Skip to content

Commit d30d69b

Browse files
authored
Adjustments to IRM unified plugin (#4727)
# What this PR does - TypeScript version bump 5.1 - Other minor tweaks that are required to successfully build and lint IRM plugin with oncall code imported ## Which issue(s) this PR closes Related to grafana/irm#3 <!-- *Note*: If you want the issue to be auto-closed once the PR is merged, change "Related to" to "Closes" in the line above. If you have more than one GitHub issue that this PR closes, be sure to preface each issue link with a [closing keyword](https://docs.github.com/en/get-started/writing-on-github/working-with-advanced-formatting/using-keywords-in-issues-and-pull-requests#linking-a-pull-request-to-an-issue). This ensures that the issue(s) are auto-closed once the PR has been merged. --> ## Checklist - [ ] Unit, integration, and e2e (if applicable) tests updated - [x] Documentation added (or `pr:no public docs` PR label added if not required) - [x] Added the relevant release notes label (see labels prefixed w/ `release:`). These labels dictate how your PR will show up in the autogenerated release notes.
1 parent 845940d commit d30d69b

File tree

14 files changed

+144
-373
lines changed

14 files changed

+144
-373
lines changed

Tiltfile

+15-13
Original file line numberDiff line numberDiff line change
@@ -16,11 +16,18 @@ DOCKER_REGISTRY = "localhost:63628/"
1616

1717
load("ext://docker_build_sub", "docker_build_sub")
1818

19+
def get_profiles():
20+
profiles = os.getenv('ONCALL_PROFILES', 'grafana,plugin,backend,tests')
21+
return profiles.split(',')
22+
profiles = get_profiles()
23+
1924
# Tell ops-devenv/Tiltifle where our plugin.json file lives
2025
plugin_file = os.path.abspath("grafana-plugin/src/plugin.json")
2126

2227
def plugin_json():
23-
return plugin_file
28+
if 'plugin' in profiles:
29+
return plugin_file
30+
return 'NOT_A_PLUGIN'
2431

2532

2633
allow_k8s_contexts(["kind-kind"])
@@ -78,12 +85,13 @@ def load_grafana():
7885
grafana_version = os.getenv("GRAFANA_VERSION", "latest")
7986

8087

81-
k8s_resource(
82-
objects=["grafana-oncall-app-provisioning:configmap"],
83-
new_name="grafana-oncall-app-provisioning-configmap",
84-
resource_deps=["build-ui"],
85-
labels=["Grafana"],
86-
)
88+
if 'plugin' in profiles:
89+
k8s_resource(
90+
objects=["grafana-oncall-app-provisioning:configmap"],
91+
new_name="grafana-oncall-app-provisioning-configmap",
92+
resource_deps=["build-ui"],
93+
labels=["Grafana"],
94+
)
8795

8896
# Use separate grafana helm chart
8997
if not running_under_parent_tiltfile:
@@ -101,12 +109,6 @@ def load_grafana():
101109
)
102110
# --- GRAFANA END ----
103111

104-
105-
def get_profiles():
106-
profiles = os.getenv('ONCALL_PROFILES', 'grafana,plugin,backend,tests')
107-
return profiles.split(',')
108-
profiles = get_profiles()
109-
110112
if 'grafana' in profiles:
111113
load_grafana()
112114
if 'plugin' in profiles:

grafana-plugin/.eslintrc.js

+14-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
const rulesDirPlugin = require('eslint-plugin-rulesdir');
2-
rulesDirPlugin.RULES_DIR = 'tools/eslint-rules';
2+
rulesDirPlugin.RULES_DIR = __dirname + '/tools/eslint-rules';
33

44
module.exports = {
55
extends: ['./.config/.eslintrc'],
@@ -8,6 +8,19 @@ module.exports = {
88
'import/internal-regex':
99
'^assets|^components|^containers|^contexts|^icons|^models|^network|^pages|^services|^state|^utils|^plugin',
1010
},
11+
overrides: [
12+
{
13+
files: ['src/**/*.{ts,tsx}'],
14+
rules: {
15+
'deprecation/deprecation': 'off',
16+
},
17+
parserOptions: {
18+
project: './tsconfig.json',
19+
tsconfigRootDir: __dirname,
20+
},
21+
},
22+
],
23+
1124
rules: {
1225
eqeqeq: 'warn',
1326
'import/order': [

grafana-plugin/package.json

+5-6
Original file line numberDiff line numberDiff line change
@@ -59,8 +59,9 @@
5959
"@swc/core": "^1.3.90",
6060
"@swc/helpers": "^0.5.0",
6161
"@swc/jest": "^0.2.26",
62-
"@testing-library/jest-dom": "6.1.4",
63-
"@testing-library/react": "14.0.0",
62+
"@testing-library/dom": "latest",
63+
"@testing-library/jest-dom": "^6.4.2",
64+
"@testing-library/react": "^14.1.2",
6465
"@testing-library/user-event": "^14.4.3",
6566
"@types/dompurify": "^2.3.4",
6667
"@types/express": "^4.17.21",
@@ -107,8 +108,6 @@
107108
"plop": "^2.7.4",
108109
"postcss-loader": "^7.0.1",
109110
"prettier": "^2.8.7",
110-
"react": "18.2.0",
111-
"react-dom": "18.2.0",
112111
"react-test-renderer": "^18.0.2",
113112
"replace-in-file-webpack-plugin": "^1.0.6",
114113
"sass": "1.63.2",
@@ -121,7 +120,7 @@
121120
"ts-jest": "29.0.3",
122121
"ts-node": "^10.9.1",
123122
"tsconfig-paths": "^4.2.0",
124-
"typescript": "4.8.4",
123+
"typescript": "5.1",
125124
"webpack": "^5.86.0",
126125
"webpack-bundle-analyzer": "^4.6.1",
127126
"webpack-cli": "^5.1.4",
@@ -143,7 +142,7 @@
143142
"@grafana/runtime": "^10.2.2",
144143
"@grafana/scenes": "^1.28.0",
145144
"@grafana/schema": "^10.2.2",
146-
"@grafana/ui": "^10.2.0",
145+
"@grafana/ui": "10.2.0",
147146
"@lifeomic/attempt": "^3.0.3",
148147
"array-move": "^4.0.0",
149148
"axios": "^1.6.7",

grafana-plugin/src/components/CardButton/CardButton.test.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import 'jest/matchMedia.ts';
1+
import 'jest/matchMedia';
22
import React from 'react';
33

44
import { fireEvent, render, screen } from '@testing-library/react';

grafana-plugin/src/components/Collapse/Collapse.test.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import 'jest/matchMedia.ts';
1+
import 'jest/matchMedia';
22
import React from 'react';
33

44
import { render, fireEvent, screen } from '@testing-library/react';

grafana-plugin/src/components/ScheduleQualityDetails/ScheduleQualityProgressBar.test.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import 'jest/matchMedia.ts';
1+
import 'jest/matchMedia';
22
import React from 'react';
33

44
import { render, screen } from '@testing-library/react';

grafana-plugin/src/components/SourceCode/SourceCode.test.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import 'jest/matchMedia.ts';
1+
import 'jest/matchMedia';
22
import React from 'react';
33

44
import { render, screen } from '@testing-library/react';

grafana-plugin/src/pages/incident/Incident.tsx

+1
Original file line numberDiff line numberDiff line change
@@ -647,6 +647,7 @@ class _IncidentPage extends React.Component<IncidentPageProps, IncidentPageState
647647
};
648648

649649
getPlaceholderReplaceFn = (entity: TimeLineItem) => {
650+
// eslint-disable-next-line react/display-name
650651
return (match: string) => {
651652
switch (match) {
652653
case 'author':

grafana-plugin/src/plugin/PluginSetup/PluginSetup.test.tsx

-112
This file was deleted.

0 commit comments

Comments
 (0)