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

change: [M3-7785] - Improve Dev Tools #10220

Merged
merged 10 commits into from
Feb 26, 2024

Conversation

abailly-akamai
Copy link
Contributor

@abailly-akamai abailly-akamai commented Feb 22, 2024

Description 📝

This PR brings non-breaking, minor improvement to the dev tools.

Changes 🔄

  • Add a theme select to persist theme choice while using MSW
  • Add a rest button to bring the feature flags values back to their Launch Darkly defaults
  • Color the dev tools icon red when MSW is enabled
  • Add a link to the preference modal for convenience
  • Comment out banners present of EVERY page cluttering the UI. (they can be easily re-enabled in serverHandlers.ts
  • Update documentation

Preview 📷

Screenshot 2024-02-22 at 11 49 19

How to test 🧪

Verification steps

  • Pull local code locally and yarn up your application
  • Confirm behavior of dev tools menu

As an Author I have considered 🤔

Check all that apply

  • 👀 Doing a self review
  • ❔ Our contribution guidelines
  • 🤏 Splitting feature into small PRs
  • ➕ Adding a changeset
  • 🧪 Providing/Improving test coverage
  • 🔐 Removing all sensitive information from the code and PR description
  • 🚩 Using a feature flag to protect the release
  • 👣 Providing comprehensive reproduction steps
  • 📑 Providing or updating our documentation
  • 🕛 Scheduling a pair reviewing session
  • 📱 Providing mobile support
  • ♿ Providing accessibility support

@abailly-akamai abailly-akamai self-assigned this Feb 22, 2024

setMockTheme(selectedValue);
setStorage(MOCK_THEME_STORAGE_KEY, selectedValue);
window.location.reload();
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Switching theme is not going to be as common as toggling or flags. I opted to no add this to redux as there is not a lot of value there and it would increase the complexity of this feature by a lot.

#dev-tools:hover {
height: 325px;
height: 375px;
Copy link
Contributor Author

Choose a reason for hiding this comment

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

increasing the height here a bit to allow for more room and the new reset button

<div className={isMSWEnabled ? 'mswEnabled' : ''} id="dev-tools">
<div>
<Handyman />
</div>
Copy link
Contributor Author

Choose a reason for hiding this comment

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

this way we can color it with CSS

Copy link
Contributor

Choose a reason for hiding this comment

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

Can we also/or add text to indicate the MSW is "on"? For accessibility, color should not be the only indicator haha

abuseTicket,
emailBounce,
// abuseTicket,
// emailBounce,
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Those ALWAYS show up, and on EVERY page. They can now be toggled on manually as needed

Screenshot 2024-02-22 at 11 58 58

Copy link
Contributor

Choose a reason for hiding this comment

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

Agreed that these are annoying. I don't think I'll miss them, but not sure if anyone else on the team has a reason behind why they have historically been kept visible by default.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

feels to me like something that was implemented at once and never changed to no particular reason. If anyone is affected I will add them back but I doubt it

@abailly-akamai abailly-akamai marked this pull request as ready for review February 22, 2024 17:03
@abailly-akamai abailly-akamai requested a review from a team as a code owner February 22, 2024 17:03
@abailly-akamai abailly-akamai requested review from mjac0bs and hana-akamai and removed request for a team February 22, 2024 17:03
Copy link
Contributor

@mjac0bs mjac0bs left a comment

Choose a reason for hiding this comment

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

This is great, thank you for the improvements!!

Are you seeing the scrollbar to the side of the MSW icon now too?
Screenshot 2024-02-22 at 9 34 49 AM

href="/profile/settings?preferenceEditor=true"
style={{ color: '#fff' }}
>
Open preference Modal
Copy link
Contributor

Choose a reason for hiding this comment

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

I love this. ++

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This one is from @jaalah-akamai!

abuseTicket,
emailBounce,
// abuseTicket,
// emailBounce,
Copy link
Contributor

Choose a reason for hiding this comment

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

Agreed that these are annoying. I don't think I'll miss them, but not sure if anyone else on the team has a reason behind why they have historically been kept visible by default.

Copy link

github-actions bot commented Feb 22, 2024

Coverage Report:
Base Coverage: 81.29%
Current Coverage: 81.29%

@abailly-akamai
Copy link
Contributor Author

@mjac0bs yes I could see it if I turned on always show scrollbar in my OS

Screenshot 2024-02-22 at 13 29 49

I fixed it too!

Copy link
Contributor

@mjac0bs mjac0bs left a comment

Choose a reason for hiding this comment

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

🛠️ ✅ 🎉

Screenshot 2024-02-22 at 10 30 39 AM

@mjac0bs mjac0bs added the Add'tl Approval Needed Waiting on another approval! label Feb 22, 2024
Copy link
Member

@bnussman-akamai bnussman-akamai left a comment

Choose a reason for hiding this comment

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

Thanks for doing this!

I did get a bit confused at first when I tried setting a theme and nothing happened because I had the MSW off.

I wonder if we should somehow indicate that this theme selector is only for when the MSW is on. Or maybe we could make Cloud Manager respect the override even when the MSW if off.

Screenshot 2024-02-22 at 2 17 13 PM

@abailly-akamai
Copy link
Contributor Author

@bnussman-akamai fair enough - it's in the documentation but I'll add it to the label as well)

Copy link
Member

@bnussman-akamai bnussman-akamai left a comment

Choose a reason for hiding this comment

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

Only other feature I can think of would be a button that clears all local storage and reloads the page.

It's relatively easy to do this in the browser's dev tools, but I don't think it would hurt to put in our own dev tools.

@bnussman-akamai bnussman-akamai added Enhancement Approved Multiple approvals and ready to merge! and removed Add'tl Approval Needed Waiting on another approval! labels Feb 22, 2024
@abailly-akamai
Copy link
Contributor Author

abailly-akamai commented Feb 22, 2024

@bnussman-akamai I'll hold on that item cause it has implications and we'd need to pick and choose what to clear. I'd rather leave that to the developer's discretion. Besides, clearing ALL local storage will log you out (I think?)

@bnussman-akamai
Copy link
Member

@abailly-akamai Yaya, that's kind of the point. Clearing local storage is super useful for debugging things like our login redirect logic for example. It won't log you out necessarily.

I'm cool either way. I've never had a problem opening dev tools to do this

Copy link
Contributor

@hana-akamai hana-akamai left a comment

Choose a reason for hiding this comment

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

Looks great, have we also considered what support for toggling object feature flags would look like?

@@ -75,6 +84,9 @@ export const FeatureFlagTool = withFeatureFlagProvider(() => {
</div>
);
})}
<button onClick={resetFlags} style={{ marginTop: 8 }}>
Reset default flags
Copy link
Contributor

Choose a reason for hiding this comment

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

Can we reword this to Reset to LaunchDarkly default flags for more clarity?

Suggested change
Reset default flags
Reset to LaunchDarkly default flags

Copy link
Contributor

Choose a reason for hiding this comment

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

I almost made this same comment, then deleted it, and asked for a code comment, ha. I do still think it would be nice.

I was thinking of (1) more text requiring further height increase of the dev tools panel and (2) whether we'd want to specify LD if to save some trouble of updating it if we were to switch to another tool in the future - but really that's such an easy change.

Copy link
Contributor

Choose a reason for hiding this comment

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

Same brain cell 🧠 . (1) We can shorthand to LD to save some width space (2) Agreed

<div className={isMSWEnabled ? 'mswEnabled' : ''} id="dev-tools">
<div>
<Handyman />
</div>
Copy link
Contributor

Choose a reason for hiding this comment

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

Can we also/or add text to indicate the MSW is "on"? For accessibility, color should not be the only indicator haha

@abailly-akamai
Copy link
Contributor Author

Can we also/or add text to indicate the MSW is "on"? For accessibility, color should not be the only indicator haha

@hana-linode I want to avoid taking extra real estate on the page with the dev tools badge, so I made the expanded MSW enabled label color the same green which creates a relationship. I also have a line in the doc that speaks to the status icon color. I think that's good enough for now, we can revisit if the need to provide a text based status is strong. All other items have been addressed!

@abailly-akamai abailly-akamai merged commit 9c88cb1 into linode:develop Feb 26, 2024
18 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Approved Multiple approvals and ready to merge! Enhancement
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants