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

Feat/rework config page #990

Merged
merged 33 commits into from
Nov 25, 2024
Merged

Feat/rework config page #990

merged 33 commits into from
Nov 25, 2024

Conversation

w1kman
Copy link
Contributor

@w1kman w1kman commented Nov 14, 2024

image

What this PR does / why we need it: In order to facilitate coming features, we need to move away from using a single config page. Also, this PR creates a dedicated pluginConfig config page.

Which issue(s) this PR fixes: "Rework the ConfigPage so that it is tabbed (to prepare for "Secrets" tab)"

Part of #987

Special notes for your reviewer:
Blocked by react-router-dom-v5-compat PR.

Tabs

The app config page has been split into three tabs (General, Access tokens & Terraform).

General

image

  • Added section on "Private probes" and put "backend address" in context of private probes
  • Added synthetic-monitoring-datasource to the list of data sources
  • Added link to the synthetic-monitoring-app plugin page (not the same as the app)

Access tokens

image

  • Added section on "private probes" access tokens (relevant for the terraform tab).

Terraform

image

  • Added "Prerequisites" section
  • Removed modal and replaced it with a tab
  • Changed multi-line cli syntax (&& \) to make it look a bit cleaner but remain as functional
  • Renamed the replace vars to make them reflect what they are (also added links for clarification)
  • Added syntax highlighting to replace vars (see components/Preformatted.tsx)

<Preformatted />

A new component was added to allow for some simple highlighting of content.
It's also used by <Clipboard />
The isCode prop is used for accessibility clarification (will wrap code in a <code /> tag

Plugin config page

A notable change is that we're no longer using the same component for the plugin config page as the app config page. The plugin config page is very much made to be just a pluginConfig page. To keep it simple and somewhat detached, it shares as little as possible with the app components.

image

image

image

w1kman added 12 commits November 1, 2024 13:35
…mpat`

- update routes
- remove unused code
- add `NotFound` page (wip)
- fix type issues
- remove redundant variable
- fix tests (most of them)
- fix bug in `useSearchQueryParametersState`
- downgrade packages to match grafana `grafanaDependency` version
- create feature toggle for POC
- create tab content container
- adapt current config page to the tabbed view
- use `generateRoutePath`
- remove done TODOs
- update tests for `ProbeCard`
- update tests for `NewProbe`
- update tests for `EditProbe`
- remove debug content from `TestRouteInfo`
- update not found usage for `EditProbe`
@w1kman w1kman self-assigned this Nov 14, 2024
@w1kman w1kman mentioned this pull request Nov 14, 2024
5 tasks
…mpat`

- update routes
- remove unused code
- add `NotFound` page (wip)
- fix type issues
- remove redundant variable
- fix tests (most of them)
- fix bug in `useSearchQueryParametersState`
- downgrade packages to match grafana `grafanaDependency` version
- use `generateRoutePath`
- remove done TODOs
- update tests for `ProbeCard`
- update tests for `NewProbe`
- update tests for `EditProbe`
- remove debug content from `TestRouteInfo`
- update not found usage for `EditProbe`
- lock grafana dependencies on 11.3.0
- add 404 page instead of redirect to Home
…page

# Conflicts:
#	package.json
#	src/components/CheckEditor/FormComponents/ChooseCheckType.tsx
#	src/components/CheckForm/CheckForm.tsx
#	src/components/CheckList/CheckList.test.tsx
#	src/components/ProbeEditor/ProbeEditor.tsx
#	src/components/Routing.tsx
#	src/page/EditProbe/EditProbe.tsx
#	src/page/NewProbe/NewProbe.test.tsx
#	src/routes/test/TestRouteInfo.tsx
#	src/test/dataTestIds.ts
#	src/types.ts
#	yarn.lock
- update `yarn.lock`
# Conflicts:
#	package.json
#	src/components/Routing.tsx
#	src/test/dataTestIds.ts
#	src/types.ts
#	yarn.lock
- remove `@ts-ignore`
- remove extra padding
- remove random "Hello" element
- shorten imports
- remove unused `ROUTES`
Copy link
Contributor Author

@w1kman w1kman left a comment

Choose a reason for hiding this comment

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

self-review 🍏

src/components/Preformatted.test.tsx Outdated Show resolved Hide resolved
src/components/Routing.tsx Outdated Show resolved Hide resolved
src/components/Routing.tsx Outdated Show resolved Hide resolved
@@ -40,6 +40,7 @@ export function useCanReadSM() {

// we've rolled this back to respect org roles
// this will change when we do proper plugin RBAC in the near future
// Note: this is used by `PluginConfigPage`, which is not wrapped in any app context
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Just a friendly reminder

src/page/ConfigPageLayout/ConfigContent.tsx Show resolved Hide resolved
src/page/ConfigPageLayout/ConfigPageLayout.tsx Outdated Show resolved Hide resolved
src/page/NewProbe/NewProbe.tsx Outdated Show resolved Hide resolved
src/types.ts Outdated Show resolved Hide resolved
@w1kman w1kman requested review from VikaCep and ckbedwell November 19, 2024 14:04
@w1kman w1kman marked this pull request as ready for review November 19, 2024 14:05
@w1kman w1kman requested a review from a team as a code owner November 19, 2024 14:05
Copy link
Contributor

@ckbedwell ckbedwell left a comment

Choose a reason for hiding this comment

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

Some really minor changes, please (mostly heading a11y changes) but otherwise this is fantastic 👏 🔥

src/components/LinkedDatasourceView.tsx Show resolved Hide resolved
src/configPage/PluginConfigPage/PluginConfigPage.tsx Outdated Show resolved Hide resolved
src/configPage/PluginConfigPage/PluginConfigPage.utils.ts Outdated Show resolved Hide resolved
src/page/ConfigPageLayout/tabs/GeneralTab.tsx Outdated Show resolved Hide resolved
src/page/ConfigPageLayout/tabs/TerraformTab.test.tsx Outdated Show resolved Hide resolved
src/page/ConfigPageLayout/tabs/TerraformTab.tsx Outdated Show resolved Hide resolved
Comment on lines 108 to 112
clipboard: css`
max-height: 500px;
margin-top: 10px;
margin-bottom: 10px;
`,
Copy link
Contributor

Choose a reason for hiding this comment

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

We should add a linting rule to use the object syntax for emotion so it stays type safe.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

image

The template literals allow for CSS validation (with a Jetbrains IDE).
So if we have to decide on one, writing CSS as CSS should be the preferred way IMO.

It's also cleaner with pseudo classes
image


export function UninitializedTab() {
// For some reason the 'call-to-action' variant causes infinity loop in the test (if the image is shown)
const hideImage = process.env.NODE_ENV === 'test';
Copy link
Contributor

Choose a reason for hiding this comment

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

Madness 🤕 I think this is okay to leave even though adding test specific code to production components feels smelly.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It would be const hideImage = true in production, but I agree with the smellyness either way.

- heading order
- change h1 to h2 on plugin config page
- remove `console.log`
- move `AppInitializer`
@w1kman w1kman requested a review from ckbedwell November 22, 2024 07:37
Copy link
Contributor

@ckbedwell ckbedwell left a comment

Choose a reason for hiding this comment

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

LGTM 🌟

@VikaCep
Copy link
Contributor

VikaCep commented Nov 22, 2024

The <PROBE_ACCESS_TOKEN> link is taking me to the SM access token section. Maybe it could link to the docs instead, or the probes list.

EDIT: I just noticed the Private probes subsection there 🤓, so it makes more sense to link to that view.

Screen.Recording.2024-11-22.at.17.38.56.mov

Copy link
Contributor

@VikaCep VikaCep left a comment

Choose a reason for hiding this comment

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

Great work! 👏👏👏
Just left some small comments.

src/page/ConfigPageLayout/tabs/TerraformTab.tsx Outdated Show resolved Hide resolved
src/page/ConfigPageLayout/tabs/TerraformTab.test.tsx Outdated Show resolved Hide resolved
src/page/ConfigPageLayout/tabs/TerraformTab.tsx Outdated Show resolved Hide resolved
src/page/ConfigPageLayout/tabs/TerraformTab.tsx Outdated Show resolved Hide resolved
src/page/ConfigPageLayout/tabs/TerraformTab.tsx Outdated Show resolved Hide resolved
src/page/ConfigPageLayout/tabs/TerraformTab.tsx Outdated Show resolved Hide resolved
@w1kman w1kman requested review from VikaCep and ckbedwell November 25, 2024 08:04
Copy link
Contributor

@ckbedwell ckbedwell left a comment

Choose a reason for hiding this comment

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

LGTM ⭐

Copy link
Contributor

@VikaCep VikaCep left a comment

Choose a reason for hiding this comment

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

🚀

@w1kman w1kman merged commit 56b05c3 into main Nov 25, 2024
5 checks passed
@w1kman w1kman deleted the feat/rework-config-page branch November 25, 2024 12:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants