Skip to content

Commit bd68f66

Browse files
feat: sort import modules
1 parent 62f6eb7 commit bd68f66

91 files changed

Lines changed: 223 additions & 196 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

README.md

Lines changed: 28 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ This plugin enables frontend UI based on feature flags passed to the backend. Th
77
Feature flags should be added to the Feature enum [here](pkg/server/server.go) and to the useFeatures hook [here](web/src/shared/hooks/useFeatures.ts). Whenever a feature is enabled, a set of related feature extension points is included in the plugin-manifest.json served by the backend. These feature extension points are created through the use of [json-patches](https://datatracker.ietf.org/doc/html/rfc6902), such as the `acm-alerting` patch [here](config/acm-alerting.patch.json). The server looks for a patch in the format of `{feature-flag-name}.patch.json` to apply. Some feature flags, such as `acm-alerting` require other flags to be set such as `alertmanager` and `thanos-querier` to instruct the backend how to communicate with the observability signals they utilize
88

99
| Feature | OCP Version |
10-
|-------------------|-------------|
10+
| ----------------- | ----------- |
1111
| acm-alerting | 4.14+ |
1212
| perses-dashboards | 4.14+ |
1313
| incidents | 4.17+ |
@@ -16,7 +16,6 @@ Feature flags should be added to the Feature enum [here](pkg/server/server.go) a
1616
| metrics | 5.0+ |
1717
| targets | 5.0+ |
1818

19-
2019
## monitoring-plugin
2120

2221
This section describes knowledge helpful to development of the default monitoring-plugin.
@@ -69,8 +68,8 @@ Install the [devspace](https://www.devspace.sh/docs/getting-started/installation
6968

7069
1. Install the frontend dependencies running `make install-frontend`.
7170
2. Start the frontend `make start-frontend`.
72-
4. Select the namespace the monitoring-plugin is located in `devspace use namespace openshift-monitoring`.
73-
5. In a different terminal start the devspace sync `devspace dev`.
71+
3. Select the namespace the monitoring-plugin is located in `devspace use namespace openshift-monitoring`.
72+
4. In a different terminal start the devspace sync `devspace dev`.
7473

7574
When running the `devspace dev` command, the pipeline will run the `scale_down_cmo` function to prevent CMO from fighting over control of the pod. After CMO has been scaled down, devspace will "take over" the monitoring-plugin pod, grabbing all of the certificates and backend binary and configuration to run in the devspace pod. The backend will stay the same as what is built in the Dockerfile.devspace file, only the frontend changes will be reflected live in cluster.
7675

@@ -82,6 +81,18 @@ After development you can run `devspace purge` which will cleanup and then call
8281

8382
### Local Development
8483

84+
#### Editor configuration
85+
86+
Some of the lint rules for typescript which we have enabled in our codebase are not supported by prettier and need to be solved by running `eslint --fix` You can configure your code editor to perform this on save/format although some setup is needed:
87+
88+
- zed: https://zed.dev/docs/languages/javascript#eslint
89+
- vscode: https://marketplace.visualstudio.com/items?itemName=dbaeumer.vscode-eslint
90+
91+
We recommend running the following eslint rules when formatting:
92+
93+
- `import/order`
94+
- `sort-imports`
95+
8596
#### Dependencies
8697

8798
1. [Node.js 22+](https://nodejs.org/en/) and [npm](https://www.npmjs.com/) are required
@@ -121,12 +132,13 @@ The application will be running at [localhost:9000](http://localhost:9000/).
121132
## monitoring-console-plugin (mcp)
122133

123134
### Dependencies
135+
124136
1. [Local Development Dependencies](README#Dependencies)
125137
2. [yq](https://github.com/mikefarah/yq) for acm deployment
126138
3. sed ([gnu-sed](https://formulae.brew.sh/formula/gnu-sed) for mac, with sed being aliased to that gnu-sed)
127139

128-
129140
### Building an image
141+
130142
Images for the mcp can be built by running the following command. Due to the limitation of linux/amd64 image builds on Apple Silicon Macs's, some of the changes are run locally and not just in the Dockerfiles. If you are on a Mac, it is not suggested to cancel the exection of this scipt part way through
131143

132144
```bash
@@ -153,7 +165,7 @@ Since the store for the `monitoring-plugin` is stored in the `openshift/console`
153165
# Login to an OpenShift cluster
154166
$ oc login <clusterAddress> -u <username> -p <password>
155167
156-
# Start podman (or Docker) - Linux machines can skip this part
168+
# Start podman (or Docker) - Linux machines can skip this part
157169
$ podman machine init
158170
$ podman machine start
159171
@@ -173,6 +185,7 @@ $ make start-coo-backend
173185
`make start-coo-backend` will inject the `alerting,targets,legacy-dashboards,metrics,incidents,perses-dashboards` features.
174186

175187
#### Local Development with Perses Proxy
188+
176189
The bridge script `start-console.sh` is configured to proxy to a local Perses instance running at port `:8080`. To run the local Perses instance you will need to clone the [perses/perses](https://github.com/perses/perses) repository and follow the start up instructions in [ui/README.md](https://github.com/perses/perses/blob/63601751674403f626d1dea3dec168bdad0ef1c7/ui/README.md) :
177190

178191
```
@@ -189,16 +202,18 @@ $ ./scripts/api_backend_dev.sh
189202
# Lastly navigate to http://localhost:8080/ to see Perses app running
190203
```
191204

192-
##### Install COO && Perses Datasource && Perses Sample Dashboard
193-
1. Install COO through the OpenShift UI > OperatorHub > Cluster Observability Operator
194-
2. Install UIPlugin > monitoring
205+
##### Install COO && Perses Datasource && Perses Sample Dashboard
206+
207+
1. Install COO through the OpenShift UI > OperatorHub > Cluster Observability Operator
208+
2. Install UIPlugin > monitoring
195209
3. oc apply -f <PERSES_DATASOURCE_YAML>
196-
- See sample yaml [here](https://github.com/observability-ui/development-tools/blob/main/monitoring-plugin/monitoring-console-plugin/perses/thanos-querier-datasource.yaml)
210+
- See sample yaml [here](https://github.com/observability-ui/development-tools/blob/main/monitoring-plugin/monitoring-console-plugin/perses/thanos-querier-datasource.yaml)
197211
4. oc apply -f <PERSES_DASHBOARD_YAML>
198-
- See sample yaml [here](https://github.com/observability-ui/development-tools/blob/main/monitoring-plugin/monitoring-console-plugin/perses/perses-dashboard.yaml)
212+
- See sample yaml [here](https://github.com/observability-ui/development-tools/blob/main/monitoring-plugin/monitoring-console-plugin/perses/perses-dashboard.yaml)
213+
214+
##### Port forward Perses Datasource
199215

200-
##### Port forward Perses Datasource
201-
To use the PERSES_DATASOURCE you deployed above, you'll need to forward it to your local machine then proxy it using the local Perses Instance.
216+
To use the PERSES_DATASOURCE you deployed above, you'll need to forward it to your local machine then proxy it using the local Perses Instance.
202217

203218
```
204219
# Forward cluster Prometheus Instance to localhost:9090

web/cypress.config.ts

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,10 @@ import * as console from 'console';
44
import * as path from 'path';
55
import registerCypressGrep from '@cypress/grep/src/plugin';
66
import { DefinePlugin, NormalModuleReplacementPlugin } from 'webpack';
7-
import { writeBenchmarkReport, injectBenchmarksIntoMochawesome } from './cypress/plugins/benchmark-reporter';
7+
import {
8+
writeBenchmarkReport,
9+
injectBenchmarksIntoMochawesome,
10+
} from './cypress/plugins/benchmark-reporter';
811

912
const getLoginCredentials = (index: number): { username: string; password: string } => {
1013
const users = (process.env.CYPRESS_LOGIN_USERS || '').split(',').filter(Boolean);
@@ -161,7 +164,6 @@ export default defineConfig({
161164
},
162165

163166
writeBenchmarkReport,
164-
165167
});
166168
on('after:spec', (spec: Cypress.Spec, results: CypressCommandLine.RunResult) => {
167169
if (results && results.video) {
@@ -199,6 +201,7 @@ export default defineConfig({
199201
resolve: {
200202
extensions: ['.ts', '.tsx', '.js', '.jsx'],
201203
alias: {
204+
'@': path.resolve(__dirname, 'src'),
202205
'@perses-dev/plugin-system': path.resolve(
203206
__dirname,
204207
'cypress/component/mocks/perses-plugin-system.tsx',

web/cypress/support/incidents_prometheus_query_mocks/mock-generators.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
// Mock data generators for Prometheus mocking system
22
import { IncidentDefinition, PrometheusResult } from './types';
3-
import { severityToValue, parseQueryLabels } from './utils';
3+
import { parseQueryLabels, severityToValue } from './utils';
44
import { nowInClusterTimezone } from './utils';
55
import { NEW_METRIC_NAME, OLD_METRIC_NAME } from './prometheus-mocks';
66

web/cypress/support/incidents_prometheus_query_mocks/prometheus-mocks.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
import { IncidentDefinition, PrometheusResponse, IncidentScenarioFixture } from './types';
2-
import { createIncidentMock, createAlertDetailsMock } from './mock-generators';
1+
import { IncidentDefinition, IncidentScenarioFixture, PrometheusResponse } from './types';
2+
import { createAlertDetailsMock, createIncidentMock } from './mock-generators';
33
import { convertFixtureToIncidents, parseYamlFixture } from './schema/fixture-converter';
44
import { incidentsPage } from '../../views/incidents-page';
55

web/cypress/support/incidents_prometheus_query_mocks/schema/fixture-converter.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
import {
22
IncidentDefinition,
3-
IncidentTimeline,
4-
IncidentScenarioFixture,
53
IncidentFixture,
4+
IncidentScenarioFixture,
5+
IncidentTimeline,
66
} from '../types';
7-
import { parseDuration, nowInClusterTimezone } from '../utils';
7+
import { nowInClusterTimezone, parseDuration } from '../utils';
88
import { validateAndParseYamlFixture } from './schema-validator';
99

1010
/**

web/cypress/support/monitoring/01.reg_alerts.cy.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,9 @@ import {
1111
AlertingRulesAlertState,
1212
MainTagState,
1313
Severity,
14+
SilenceComment,
1415
SilenceState,
1516
Source,
16-
SilenceComment,
1717
WatchdogAlert,
1818
} from '../../fixtures/monitoring/constants';
1919
import { FilterOUIAIDs } from '@/shared/constants/data-test';

web/cypress/support/monitoring/03.reg_legacy_dashboards.cy.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import {
55
MetricsPageQueryInput,
66
WatchdogAlert,
77
} from '../../fixtures/monitoring/constants';
8-
import { Classes, LegacyDashboardPageTestIDs, DataTestIDs } from '@/shared/constants/data-test';
8+
import { Classes, DataTestIDs, LegacyDashboardPageTestIDs } from '@/shared/constants/data-test';
99
import { metricsPage } from '../../views/metrics';
1010
import { alertingRuleDetailsPage } from '../../views/alerting-rule-details-page';
1111
import { alerts } from '../../fixtures/monitoring/alert';

web/cypress/support/monitoring/04.reg_alerts_namespace.cy.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,9 @@ import {
1111
AlertingRulesAlertState,
1212
MainTagState,
1313
Severity,
14+
SilenceComment,
1415
SilenceState,
1516
Source,
16-
SilenceComment,
1717
WatchdogAlert,
1818
} from '../../fixtures/monitoring/constants';
1919
import { FilterOUIAIDs } from '@/shared/constants/data-test';

web/cypress/support/monitoring/05.reg_metrics_namespace_1.cy.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
import { metricsPage } from '../../views/metrics';
22
import { Classes, DataTestIDs } from '@/shared/constants/data-test';
33
import {
4-
MetricsPageUnits,
54
GraphTimespan,
65
MetricsPagePredefinedQueries,
76
MetricsPageQueryInput,
7+
MetricsPageUnits,
88
} from '../../fixtures/monitoring/constants';
99

1010
export interface PerspectiveConfig {

web/cypress/support/monitoring/05.reg_metrics_namespace_2.cy.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@ import { Classes, DataTestIDs } from '@/shared/constants/data-test';
33
import {
44
MetricsPagePredefinedQueries,
55
MetricsPageQueryInput,
6-
MetricsPageQueryKebabDropdown,
76
MetricsPageQueryInputByNamespace,
7+
MetricsPageQueryKebabDropdown,
88
} from '../../fixtures/monitoring/constants';
99

1010
export interface PerspectiveConfig {

0 commit comments

Comments
 (0)