Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove report an issue from options_ui #487

Merged
merged 1 commit into from
Aug 19, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions build/UserALEWebExtension/manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,9 @@
}
],
"options_ui": {
"page": "optionsPage.html"
"page": "options.html"
},
"browser_action": {
"default_popup": "optionsPage.html"
"default_popup": "browserAction.html"
}
}
57 changes: 57 additions & 0 deletions build/UserALEWebExtension/options.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
<!--
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
-->

<!doctype html>
<html>
<head>
<title>User ALE Web Extension - Options</title>
<script src="options.js"></script>
<meta charset="utf-8" />
</head>
<body>
<h1>Logging Options</h1>
<form name="optionsForm" id="optionsForm">
<label>Logging Endpoint URL:</label>
<input name="url" id="url" />
<br />

<label>User:</label>
<input name="userId" id="user" />
<br />

<label>Password:</label>
<input name="password" type="password" id="password" />
<br />

<label>Tool Name:</label>
<input name="toolName" id="tool" />
<br />

<label>Tool Version:</label>
<input name="toolVersion" id="toolVersion" />
<br />

<label>URL whitelist regex:</label>
<input name="filter" id="filter" />
<br />

<div align="right">
<button type="submit" id="submitOptions">Save Changes</button>
</div>
</form>
</body>
</html>
5 changes: 4 additions & 1 deletion build/UserALEWebExtension/options.js
Original file line number Diff line number Diff line change
Expand Up @@ -1247,7 +1247,10 @@ function getConfig() {
payload.pluginConfig.urlWhitelist;
});
document.getElementById("optionsForm").addEventListener("submit", setConfig);
document.getElementById("issueForm").addEventListener("submit", reportIssue);
const issueForm = document.getElementById("issueForm");
if (issueForm instanceof HTMLElement) {
issueForm.addEventListener("submit", reportIssue);
}
}
function reportIssue() {
browser.runtime.sendMessage({
Expand Down
3 changes: 2 additions & 1 deletion rollup.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,8 @@ export default [
targets: [
{src: srcWebExtensionDir + 'icons/**/*.*', dest: buildWebExtensionDir + 'icons'},
{src: srcWebExtensionDir + 'manifest.json', dest: buildWebExtensionDir},
{src: srcWebExtensionDir + 'optionsPage.html', dest: buildWebExtensionDir}
{src: srcWebExtensionDir + 'options.html', dest: buildWebExtensionDir},
{src: srcWebExtensionDir + 'browserAction.html', dest: buildWebExtensionDir}
],
copyOnce: true
}),
Expand Down
4 changes: 2 additions & 2 deletions src/UserALEWebExtension/manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,9 @@
}
],
"options_ui": {
"page": "optionsPage.html"
"page": "options.html"
},
"browser_action": {
"default_popup": "optionsPage.html"
"default_popup": "browserAction.html"
}
}
57 changes: 57 additions & 0 deletions src/UserALEWebExtension/options.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
<!--
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
-->

<!doctype html>
<html>
<head>
<title>User ALE Web Extension - Options</title>
<script src="options.js"></script>
<meta charset="utf-8" />
</head>
<body>
<h1>Logging Options</h1>
<form name="optionsForm" id="optionsForm">
<label>Logging Endpoint URL:</label>
<input name="url" id="url" />
<br />

<label>User:</label>
<input name="userId" id="user" />
<br />

<label>Password:</label>
<input name="password" type="password" id="password" />
<br />

<label>Tool Name:</label>
<input name="toolName" id="tool" />
<br />

<label>Tool Version:</label>
<input name="toolVersion" id="toolVersion" />
<br />

<label>URL whitelist regex:</label>
<input name="filter" id="filter" />
<br />

<div align="right">
<button type="submit" id="submitOptions">Save Changes</button>
</div>
</form>
</body>
</html>
8 changes: 4 additions & 4 deletions src/UserALEWebExtension/options.ts
Original file line number Diff line number Diff line change
Expand Up @@ -80,10 +80,10 @@ function getConfig() {
"submit",
setConfig,
);
(document.getElementById("issueForm") as HTMLFormElement).addEventListener(
"submit",
reportIssue,
);
const issueForm = document.getElementById("issueForm");
if (issueForm instanceof HTMLElement) {
issueForm.addEventListener("submit", reportIssue);
}
}

function reportIssue() {
Expand Down
6 changes: 3 additions & 3 deletions test/e2e/spec/01-extension.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ test.describe("Userale extension", () => {
const requestPromise = sender.waitForRequest(
(request) => request.method() === "POST",
);
await page.goto(`chrome-extension://${extensionId}/optionsPage.html`);
await page.goto(`chrome-extension://${extensionId}/options.html`);
// Sleep so options.js can update the html with values from local storage.
await new Promise((r) => setTimeout(r, 1000));
await page.fill("#filter", ".*");
Expand All @@ -60,7 +60,7 @@ test.describe("Userale extension", () => {
const postData = request.postData();
return Boolean(postData && postData.includes("testUser"));
});
await page.goto(`chrome-extension://${extensionId}/optionsPage.html`);
await page.goto(`chrome-extension://${extensionId}/options.html`);
await page.waitForLoadState("load");
await page.fill("#user", id);
await page.click("#submitOptions");
Expand All @@ -87,7 +87,7 @@ test.describe("Userale extension", () => {
const postData = request.postData();
return Boolean(postData && postData.includes(description));
});
await page.goto(`chrome-extension://${extensionId}/optionsPage.html`);
await page.goto(`chrome-extension://${extensionId}/browserAction.html`);
await page.waitForLoadState("load");
await page.fill("#issueDescription", description);
await page.click("#submitIssue");
Expand Down
Loading