Skip to content
This repository was archived by the owner on Feb 19, 2025. It is now read-only.

Refactor web extension #407

Merged
merged 2 commits into from
Feb 6, 2024
Merged

Refactor web extension #407

merged 2 commits into from
Feb 6, 2024

Conversation

Jyyjy
Copy link
Contributor

@Jyyjy Jyyjy commented Feb 1, 2024

This PR refactors the web extension, most of the changes simply reduce repeated code but there are a few actual changes.

  1. Fixes a bug where extension options were not updated in tab events.
  2. Changes browser log format to be more consistent with main package logs, and include a bit more information.
  3. Adds 2 additional tab events, onAttached and onUpdated. There are other tab events that still aren't logged, but it's not immediately clear how to log them.
  4. Instruments the extension options page because why not.

@Jyyjy Jyyjy marked this pull request as draft February 2, 2024 16:46
@Jyyjy Jyyjy marked this pull request as ready for review February 2, 2024 17:39
Copy link
Contributor

@EandrewJones EandrewJones left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Very minor comments on the code itself.

Only question: Do we have any tests for the plugin? If not, why not? If yes, please add some to, at minimum, verify the code fixes the bugs and ensure the refactor doesn't break existing behavior or introduce new bugs.

The code changes appear to be a very nice simplification. But I am always hesitant to refactor without any way to validate.

<br/>

<label>Tool Name:</label>
<input id="toolName"/>
<input id="tool"/>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there a reason this differs from the javascript package naming conventions?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I changed the html id's to match the data tag names defined here:

export function getInitialSettings() {

Originally I intended to add a layer of abstraction that defines the tag names and js property names for each setting and could be imported into getInitialSettings.js and options.js. But I wanted to limit the scope of this PR to the web extension.

<br/>

<label>Tool Version:</label>
<input id="toolVersion"/>
<input id="version"/>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same as above.

<br/>

<label>Tool Name:</label>
<input id="toolName"/>
<input id="tool"/>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same as previous comment.

@Jyyjy
Copy link
Contributor Author

Jyyjy commented Feb 5, 2024

Very minor comments on the code itself.

Only question: Do we have any tests for the plugin? If not, why not? If yes, please add some to, at minimum, verify the code fixes the bugs and ensure the refactor doesn't break existing behavior or introduce new bugs.

The code changes appear to be a very nice simplification. But I am always hesitant to refactor without any way to validate.

No plug-in tests exist. I think the plug-in has historically been an experimental tool only. That said it's already in my notes to write some plug-in tests.

@EandrewJones
Copy link
Contributor

Alright. I'm hesitantly approving since this is a blocker.

@Jyyjy Jyyjy merged commit 8bd9b61 into apache:test Feb 6, 2024
2 checks passed
@Jyyjy Jyyjy deleted the background branch February 6, 2024 16:41
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants