Skip to content

Commit

Permalink
Adjustments to IRM unified plugin (#4727)
Browse files Browse the repository at this point in the history
# 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.
  • Loading branch information
brojd authored Jul 25, 2024
1 parent 845940d commit d30d69b
Show file tree
Hide file tree
Showing 14 changed files with 144 additions and 373 deletions.
28 changes: 15 additions & 13 deletions Tiltfile
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,18 @@ DOCKER_REGISTRY = "localhost:63628/"

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

def get_profiles():
profiles = os.getenv('ONCALL_PROFILES', 'grafana,plugin,backend,tests')
return profiles.split(',')
profiles = get_profiles()

# Tell ops-devenv/Tiltifle where our plugin.json file lives
plugin_file = os.path.abspath("grafana-plugin/src/plugin.json")

def plugin_json():
return plugin_file
if 'plugin' in profiles:
return plugin_file
return 'NOT_A_PLUGIN'


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


k8s_resource(
objects=["grafana-oncall-app-provisioning:configmap"],
new_name="grafana-oncall-app-provisioning-configmap",
resource_deps=["build-ui"],
labels=["Grafana"],
)
if 'plugin' in profiles:
k8s_resource(
objects=["grafana-oncall-app-provisioning:configmap"],
new_name="grafana-oncall-app-provisioning-configmap",
resource_deps=["build-ui"],
labels=["Grafana"],
)

# Use separate grafana helm chart
if not running_under_parent_tiltfile:
Expand All @@ -101,12 +109,6 @@ def load_grafana():
)
# --- GRAFANA END ----


def get_profiles():
profiles = os.getenv('ONCALL_PROFILES', 'grafana,plugin,backend,tests')
return profiles.split(',')
profiles = get_profiles()

if 'grafana' in profiles:
load_grafana()
if 'plugin' in profiles:
Expand Down
15 changes: 14 additions & 1 deletion grafana-plugin/.eslintrc.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
const rulesDirPlugin = require('eslint-plugin-rulesdir');
rulesDirPlugin.RULES_DIR = 'tools/eslint-rules';
rulesDirPlugin.RULES_DIR = __dirname + '/tools/eslint-rules';

module.exports = {
extends: ['./.config/.eslintrc'],
Expand All @@ -8,6 +8,19 @@ module.exports = {
'import/internal-regex':
'^assets|^components|^containers|^contexts|^icons|^models|^network|^pages|^services|^state|^utils|^plugin',
},
overrides: [
{
files: ['src/**/*.{ts,tsx}'],
rules: {
'deprecation/deprecation': 'off',
},
parserOptions: {
project: './tsconfig.json',
tsconfigRootDir: __dirname,
},
},
],

rules: {
eqeqeq: 'warn',
'import/order': [
Expand Down
11 changes: 5 additions & 6 deletions grafana-plugin/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -59,8 +59,9 @@
"@swc/core": "^1.3.90",
"@swc/helpers": "^0.5.0",
"@swc/jest": "^0.2.26",
"@testing-library/jest-dom": "6.1.4",
"@testing-library/react": "14.0.0",
"@testing-library/dom": "latest",
"@testing-library/jest-dom": "^6.4.2",
"@testing-library/react": "^14.1.2",
"@testing-library/user-event": "^14.4.3",
"@types/dompurify": "^2.3.4",
"@types/express": "^4.17.21",
Expand Down Expand Up @@ -107,8 +108,6 @@
"plop": "^2.7.4",
"postcss-loader": "^7.0.1",
"prettier": "^2.8.7",
"react": "18.2.0",
"react-dom": "18.2.0",
"react-test-renderer": "^18.0.2",
"replace-in-file-webpack-plugin": "^1.0.6",
"sass": "1.63.2",
Expand All @@ -121,7 +120,7 @@
"ts-jest": "29.0.3",
"ts-node": "^10.9.1",
"tsconfig-paths": "^4.2.0",
"typescript": "4.8.4",
"typescript": "5.1",
"webpack": "^5.86.0",
"webpack-bundle-analyzer": "^4.6.1",
"webpack-cli": "^5.1.4",
Expand All @@ -143,7 +142,7 @@
"@grafana/runtime": "^10.2.2",
"@grafana/scenes": "^1.28.0",
"@grafana/schema": "^10.2.2",
"@grafana/ui": "^10.2.0",
"@grafana/ui": "10.2.0",
"@lifeomic/attempt": "^3.0.3",
"array-move": "^4.0.0",
"axios": "^1.6.7",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import 'jest/matchMedia.ts';
import 'jest/matchMedia';
import React from 'react';

import { fireEvent, render, screen } from '@testing-library/react';
Expand Down
2 changes: 1 addition & 1 deletion grafana-plugin/src/components/Collapse/Collapse.test.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import 'jest/matchMedia.ts';
import 'jest/matchMedia';
import React from 'react';

import { render, fireEvent, screen } from '@testing-library/react';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import 'jest/matchMedia.ts';
import 'jest/matchMedia';
import React from 'react';

import { render, screen } from '@testing-library/react';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import 'jest/matchMedia.ts';
import 'jest/matchMedia';
import React from 'react';

import { render, screen } from '@testing-library/react';
Expand Down
1 change: 1 addition & 0 deletions grafana-plugin/src/pages/incident/Incident.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -647,6 +647,7 @@ class _IncidentPage extends React.Component<IncidentPageProps, IncidentPageState
};

getPlaceholderReplaceFn = (entity: TimeLineItem) => {
// eslint-disable-next-line react/display-name
return (match: string) => {
switch (match) {
case 'author':
Expand Down
112 changes: 0 additions & 112 deletions grafana-plugin/src/plugin/PluginSetup/PluginSetup.test.tsx

This file was deleted.

Loading

0 comments on commit d30d69b

Please sign in to comment.