From d30d69ba66ab60c60f4766817413e34fcb301b96 Mon Sep 17 00:00:00 2001 From: Dominik Broj Date: Thu, 25 Jul 2024 14:19:49 +0200 Subject: [PATCH 1/2] 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 https://github.com/grafana/irm/issues/3 ## 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. --- Tiltfile | 28 +-- grafana-plugin/.eslintrc.js | 15 +- grafana-plugin/package.json | 11 +- .../components/CardButton/CardButton.test.tsx | 2 +- .../src/components/Collapse/Collapse.test.tsx | 2 +- .../ScheduleQualityProgressBar.test.tsx | 2 +- .../components/SourceCode/SourceCode.test.tsx | 2 +- .../src/pages/incident/Incident.tsx | 1 + .../plugin/PluginSetup/PluginSetup.test.tsx | 112 ------------ .../__snapshots__/PluginSetup.test.tsx.snap | 163 ----------------- .../src/state/rootBaseStore/RootBaseStore.ts | 1 + grafana-plugin/src/types.ts | 10 +- grafana-plugin/src/utils/faro.test.tsx | 2 +- grafana-plugin/yarn.lock | 166 +++++++++++------- 14 files changed, 144 insertions(+), 373 deletions(-) delete mode 100644 grafana-plugin/src/plugin/PluginSetup/PluginSetup.test.tsx delete mode 100644 grafana-plugin/src/plugin/PluginSetup/__snapshots__/PluginSetup.test.tsx.snap diff --git a/Tiltfile b/Tiltfile index ab4a1f64f8..fc65ce0590 100644 --- a/Tiltfile +++ b/Tiltfile @@ -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"]) @@ -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: @@ -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: diff --git a/grafana-plugin/.eslintrc.js b/grafana-plugin/.eslintrc.js index dd9ffe5cf7..7d13aa6b98 100644 --- a/grafana-plugin/.eslintrc.js +++ b/grafana-plugin/.eslintrc.js @@ -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'], @@ -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': [ diff --git a/grafana-plugin/package.json b/grafana-plugin/package.json index a6b3bcdf98..b61a748976 100644 --- a/grafana-plugin/package.json +++ b/grafana-plugin/package.json @@ -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", @@ -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", @@ -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", @@ -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", diff --git a/grafana-plugin/src/components/CardButton/CardButton.test.tsx b/grafana-plugin/src/components/CardButton/CardButton.test.tsx index aec948b2d3..9a89f2fa5e 100644 --- a/grafana-plugin/src/components/CardButton/CardButton.test.tsx +++ b/grafana-plugin/src/components/CardButton/CardButton.test.tsx @@ -1,4 +1,4 @@ -import 'jest/matchMedia.ts'; +import 'jest/matchMedia'; import React from 'react'; import { fireEvent, render, screen } from '@testing-library/react'; diff --git a/grafana-plugin/src/components/Collapse/Collapse.test.tsx b/grafana-plugin/src/components/Collapse/Collapse.test.tsx index d55af72148..0c4f3ee26b 100644 --- a/grafana-plugin/src/components/Collapse/Collapse.test.tsx +++ b/grafana-plugin/src/components/Collapse/Collapse.test.tsx @@ -1,4 +1,4 @@ -import 'jest/matchMedia.ts'; +import 'jest/matchMedia'; import React from 'react'; import { render, fireEvent, screen } from '@testing-library/react'; diff --git a/grafana-plugin/src/components/ScheduleQualityDetails/ScheduleQualityProgressBar.test.tsx b/grafana-plugin/src/components/ScheduleQualityDetails/ScheduleQualityProgressBar.test.tsx index 0f348afaf1..764edb70b5 100644 --- a/grafana-plugin/src/components/ScheduleQualityDetails/ScheduleQualityProgressBar.test.tsx +++ b/grafana-plugin/src/components/ScheduleQualityDetails/ScheduleQualityProgressBar.test.tsx @@ -1,4 +1,4 @@ -import 'jest/matchMedia.ts'; +import 'jest/matchMedia'; import React from 'react'; import { render, screen } from '@testing-library/react'; diff --git a/grafana-plugin/src/components/SourceCode/SourceCode.test.tsx b/grafana-plugin/src/components/SourceCode/SourceCode.test.tsx index 142abc3b32..c894760052 100644 --- a/grafana-plugin/src/components/SourceCode/SourceCode.test.tsx +++ b/grafana-plugin/src/components/SourceCode/SourceCode.test.tsx @@ -1,4 +1,4 @@ -import 'jest/matchMedia.ts'; +import 'jest/matchMedia'; import React from 'react'; import { render, screen } from '@testing-library/react'; diff --git a/grafana-plugin/src/pages/incident/Incident.tsx b/grafana-plugin/src/pages/incident/Incident.tsx index 3176ca45c2..5b8ec56463 100644 --- a/grafana-plugin/src/pages/incident/Incident.tsx +++ b/grafana-plugin/src/pages/incident/Incident.tsx @@ -647,6 +647,7 @@ class _IncidentPage extends React.Component { + // eslint-disable-next-line react/display-name return (match: string) => { switch (match) { case 'author': diff --git a/grafana-plugin/src/plugin/PluginSetup/PluginSetup.test.tsx b/grafana-plugin/src/plugin/PluginSetup/PluginSetup.test.tsx deleted file mode 100644 index 543dd6bc72..0000000000 --- a/grafana-plugin/src/plugin/PluginSetup/PluginSetup.test.tsx +++ /dev/null @@ -1,112 +0,0 @@ -import React from 'react'; - -import * as runtime from '@grafana/runtime'; -import { render, screen } from '@testing-library/react'; -import userEvent from '@testing-library/user-event'; - -import { RootBaseStore } from 'state/rootBaseStore/RootBaseStore'; -import { useStore as useStoreOriginal } from 'state/useStore'; - -import { PluginSetup, PluginSetupProps } from './PluginSetup'; - -jest.mock('state/useStore'); - -jest.mock('@grafana/runtime', () => ({ - __esModule: true, - - config: { - featureToggles: { - topnav: undefined, - }, - }, - - getBackendSrv: () => ({ - get: jest.fn(), - post: jest.fn(), - }), - - PluginPage: (props: any) => <>{props.children}, -})); - -jest.mock('grafana/app/core/core', () => ({ - contextSrv: { - user: { - orgRole: null, - }, - hasAccess: (_action, _fallback): boolean => null, - }, -})); - -const createComponentAndMakeAssertions = async (rootBaseStore: RootBaseStore) => { - // mocks - const mockedSetupPlugin = jest.fn(); - rootBaseStore.setupPlugin = mockedSetupPlugin; - (useStoreOriginal as jest.Mock>).mockReturnValue(rootBaseStore); - - // test setup - const MockedInitializedComponent = jest.fn().mockReturnValue(
hello
); - - const props = { - meta: { - jsonData: 'hello', - }, - InitializedComponent: MockedInitializedComponent, - } as unknown as PluginSetupProps; - - const component = render(); - - // assertions - expect(mockedSetupPlugin).toHaveBeenCalledTimes(1); - expect(mockedSetupPlugin).toHaveBeenCalledWith(props.meta); - expect(component.container).toMatchSnapshot(); - - return mockedSetupPlugin; -}; - -describe('PluginSetup', () => { - afterEach(() => { - jest.resetAllMocks(); - }); - - test('app is loading', async () => { - const rootBaseStore = new RootBaseStore(); - await createComponentAndMakeAssertions(rootBaseStore); - }); - - test('there is an error message', async () => { - const rootBaseStore = new RootBaseStore(); - rootBaseStore.initializationError = 'ohhhh noo'; - await createComponentAndMakeAssertions(rootBaseStore); - }); - - test('there is an error message - retry setup', async () => { - const rootBaseStore = new RootBaseStore(); - rootBaseStore.initializationError = 'ohhhh noo'; - - const mockedSetupPlugin = await createComponentAndMakeAssertions(rootBaseStore); - - await userEvent.click(screen.getByText('Retry')); - - expect(mockedSetupPlugin).toHaveBeenCalledTimes(2); - }); - - test('currently undergoing maintenance', async () => { - const rootBaseStore = new RootBaseStore(); - rootBaseStore.currentlyUndergoingMaintenance = true; - rootBaseStore.initializationError = 'there is some sort of maintenance'; - await createComponentAndMakeAssertions(rootBaseStore); - }); - - test('app successfully initialized', async () => { - const rootBaseStore = new RootBaseStore(); - rootBaseStore.initializationError = null; - await createComponentAndMakeAssertions(rootBaseStore); - }); - - test.each([true, false])('app initialized with topnavbar = %s', async (isTopNavBar: boolean) => { - runtime.config.featureToggles.topnav = isTopNavBar; - - const rootBaseStore = new RootBaseStore(); - await createComponentAndMakeAssertions(rootBaseStore); - }); -}); diff --git a/grafana-plugin/src/plugin/PluginSetup/__snapshots__/PluginSetup.test.tsx.snap b/grafana-plugin/src/plugin/PluginSetup/__snapshots__/PluginSetup.test.tsx.snap deleted file mode 100644 index 0e6e8207db..0000000000 --- a/grafana-plugin/src/plugin/PluginSetup/__snapshots__/PluginSetup.test.tsx.snap +++ /dev/null @@ -1,163 +0,0 @@ -// Jest Snapshot v1, https://goo.gl/fbAQLP - -exports[`PluginSetup app initialized with topnavbar = false 1`] = ` -
-
- hello -
-
-`; - -exports[`PluginSetup app initialized with topnavbar = true 1`] = ` -
-
- hello -
-
-`; - -exports[`PluginSetup app is loading 1`] = ` -
-
- hello -
-
-`; - -exports[`PluginSetup app successfully initialized 1`] = ` -
-
- hello -
-
-`; - -exports[`PluginSetup currently undergoing maintenance 1`] = ` -
-
- Grafana OnCall Logo -
- there is some sort of maintenance -
-
-
-`; - -exports[`PluginSetup there is an error message - retry setup 1`] = ` -
-
- Grafana OnCall Logo -
- ohhhh noo -
-
-
-
- -
- -
-
-
-
-`; - -exports[`PluginSetup there is an error message 1`] = ` -
-
- Grafana OnCall Logo -
- ohhhh noo -
-
-
-
- -
- -
-
-
-
-`; diff --git a/grafana-plugin/src/state/rootBaseStore/RootBaseStore.ts b/grafana-plugin/src/state/rootBaseStore/RootBaseStore.ts index 7481e8d7c9..2b75ad88d3 100644 --- a/grafana-plugin/src/state/rootBaseStore/RootBaseStore.ts +++ b/grafana-plugin/src/state/rootBaseStore/RootBaseStore.ts @@ -172,6 +172,7 @@ export class RootBaseStore { * - the user must have an Admin role and necessary permissions * Finally, try to load the current user from the OnCall backend */ + @action.bound async setupPlugin(meta: OnCallAppPluginMeta) { this.setupPluginError(null); this.onCallApiUrl = getOnCallApiUrl(meta); diff --git a/grafana-plugin/src/types.ts b/grafana-plugin/src/types.ts index 576c1cac84..1f88430a1b 100644 --- a/grafana-plugin/src/types.ts +++ b/grafana-plugin/src/types.ts @@ -1,4 +1,4 @@ -import { AppRootProps as BaseAppRootProps, AppPluginMeta, PluginConfigPageProps, CurrentUserDTO } from '@grafana/data'; +import { AppRootProps as BaseAppRootProps, AppPluginMeta, PluginConfigPageProps, BootData } from '@grafana/data'; export type OnCallPluginMetaJSONData = { stackId: number; @@ -28,13 +28,7 @@ export enum OnCallPluginExtensionPoints { declare global { export interface Window { // https://github.com/grafana/grafana/blob/78bef7a26a799209b5307d6bde8e25fcb4fbde7d/public/views/index-template.html#L251-L258 - grafanaBootData: { - user: CurrentUserDTO; - settings: { - unifiedAlertingEnabled: boolean; - unifiedAlerting: { minInterval: string }; - }; - }; + grafanaBootData?: BootData; RECAPTCHA_SITE_KEY: string; grecaptcha: any; dataLayer: any; diff --git a/grafana-plugin/src/utils/faro.test.tsx b/grafana-plugin/src/utils/faro.test.tsx index 26cd24345b..bf0f697699 100644 --- a/grafana-plugin/src/utils/faro.test.tsx +++ b/grafana-plugin/src/utils/faro.test.tsx @@ -1,4 +1,4 @@ -import 'jest/matchMedia.ts'; +import 'jest/matchMedia'; import { describe, test } from '@jest/globals'; import { FaroHelper } from 'utils/faro'; diff --git a/grafana-plugin/yarn.lock b/grafana-plugin/yarn.lock index 01e8bcbaa5..f6c6070def 100644 --- a/grafana-plugin/yarn.lock +++ b/grafana-plugin/yarn.lock @@ -2,10 +2,10 @@ # yarn lockfile v1 -"@adobe/css-tools@^4.3.1": - version "4.3.3" - resolved "https://registry.yarnpkg.com/@adobe/css-tools/-/css-tools-4.3.3.tgz#90749bde8b89cd41764224f5aac29cd4138f75ff" - integrity sha512-rE0Pygv0sEZ4vBWHlAgJLGDU7Pm8xoO6p3wsEceb7GYAjScrOHpEo8KK/eVkAcnSM+slAEtXjA2JpdjLp4fJQQ== +"@adobe/css-tools@^4.4.0": + version "4.4.0" + resolved "https://registry.yarnpkg.com/@adobe/css-tools/-/css-tools-4.4.0.tgz#728c484f4e10df03d5a3acd0d8adcbbebff8ad63" + integrity sha512-Ff9+ksdQQB3rMncgqDK78uLznstjyfIf2Arnh22pW8kBpLs6rpKDwgnZT46hin5Hl1WzazzK64DOrhSwYpS7bQ== "@ampproject/remapping@^2.1.0": version "2.2.0" @@ -1293,17 +1293,17 @@ resolved "https://registry.yarnpkg.com/@grafana/tsconfig/-/tsconfig-1.2.0-rc1.tgz#10973c978ec95b0ea637511254b5f478bce04de7" integrity sha512-+SgQeBQ1pT6D/E3/dEdADqTrlgdIGuexUZ8EU+8KxQFKUeFeU7/3z/ayI2q/wpJ/Kr6WxBBNlrST6aOKia19Ag== -"@grafana/ui@10.2.2": - version "10.2.2" - resolved "https://registry.yarnpkg.com/@grafana/ui/-/ui-10.2.2.tgz#3f3f2f20c29c301aa492398892081fcaa123c48f" - integrity sha512-45aZ9PL0lQeTSRfW916VWyTAm2u3a5bKihgiT8GX5a5Dm9+++xGwcOXVOwlIRIuLpWMJXqgg9MIrslZwfzCzhQ== +"@grafana/ui@10.2.0": + version "10.2.0" + resolved "https://registry.yarnpkg.com/@grafana/ui/-/ui-10.2.0.tgz#99920ee490d52c014b28d61ca0d9d86294a15f41" + integrity sha512-RzvR053LVV8qYRrfFPMjzEeABwahVOeyQPXmU5vmYccPolQYXbc8wp149wjTf5xdUygqQunRADI6sAqgRpVrdA== dependencies: "@emotion/css" "11.11.2" "@emotion/react" "11.11.1" - "@grafana/data" "10.2.2" - "@grafana/e2e-selectors" "10.2.2" + "@grafana/data" "10.2.0" + "@grafana/e2e-selectors" "10.2.0" "@grafana/faro-web-sdk" "1.2.1" - "@grafana/schema" "10.2.2" + "@grafana/schema" "10.2.0" "@leeoniya/ufuzzy" "1.0.8" "@monaco-editor/react" "4.6.0" "@popperjs/core" "2.11.8" @@ -1362,23 +1362,23 @@ slate-react "0.22.10" tinycolor2 "1.6.0" tslib "2.6.0" - uplot "1.6.27" + uplot "1.6.26" uuid "9.0.0" -"@grafana/ui@^10.0.0": - version "10.1.4" - resolved "https://registry.yarnpkg.com/@grafana/ui/-/ui-10.1.4.tgz#11b3cf09ed61812c27878344e868ab444aa98403" - integrity sha512-KlV7h65ZyxomPomva9illPBnpUEGa4bZRBlN7/4Yk9EE/YKjI090oAOvM0bDOiRDGeWAXoNpvyrhSpYZr4AW8A== +"@grafana/ui@10.2.2": + version "10.2.2" + resolved "https://registry.yarnpkg.com/@grafana/ui/-/ui-10.2.2.tgz#3f3f2f20c29c301aa492398892081fcaa123c48f" + integrity sha512-45aZ9PL0lQeTSRfW916VWyTAm2u3a5bKihgiT8GX5a5Dm9+++xGwcOXVOwlIRIuLpWMJXqgg9MIrslZwfzCzhQ== dependencies: "@emotion/css" "11.11.2" "@emotion/react" "11.11.1" - "@grafana/data" "10.1.4" - "@grafana/e2e-selectors" "10.1.4" - "@grafana/faro-web-sdk" "1.1.0" - "@grafana/schema" "10.1.4" + "@grafana/data" "10.2.2" + "@grafana/e2e-selectors" "10.2.2" + "@grafana/faro-web-sdk" "1.2.1" + "@grafana/schema" "10.2.2" "@leeoniya/ufuzzy" "1.0.8" - "@monaco-editor/react" "4.5.1" - "@popperjs/core" "2.11.6" + "@monaco-editor/react" "4.6.0" + "@popperjs/core" "2.11.8" "@react-aria/button" "3.8.0" "@react-aria/dialog" "3.5.3" "@react-aria/focus" "3.13.0" @@ -1389,24 +1389,24 @@ ansicolor "1.1.100" calculate-size "1.1.1" classnames "2.3.2" - core-js "3.31.0" + core-js "3.33.0" d3 "7.8.5" date-fns "2.30.0" hoist-non-react-statics "3.3.2" i18next "^22.0.0" i18next-browser-languagedetector "^7.0.2" - immutable "4.3.0" + immutable "4.3.1" is-hotkey "0.2.0" jquery "3.7.0" lodash "4.17.21" - memoize-one "6.0.0" + micro-memoize "^4.1.2" moment "2.29.4" monaco-editor "0.34.0" ol "7.4.0" prismjs "1.29.0" - rc-cascader "3.12.1" - rc-drawer "6.3.0" - rc-slider "10.2.1" + rc-cascader "3.18.1" + rc-drawer "6.5.2" + rc-slider "10.3.1" rc-time-picker "^3.7.3" rc-tooltip "6.0.1" react-beautiful-dnd "13.1.1" @@ -1422,35 +1422,35 @@ react-popper "2.3.0" react-popper-tooltip "4.4.2" react-router-dom "5.3.3" - react-select "5.7.0" + react-select "5.7.4" react-select-event "^5.1.0" react-table "7.8.0" react-transition-group "4.4.5" react-use "17.4.0" - react-window "1.8.8" - rxjs "7.8.0" + react-window "1.8.9" + rxjs "7.8.1" slate "0.47.9" slate-plain-serializer "0.7.13" slate-react "0.22.10" tinycolor2 "1.6.0" tslib "2.6.0" - uplot "1.6.24" + uplot "1.6.27" uuid "9.0.0" -"@grafana/ui@^10.2.0": - version "10.2.0" - resolved "https://registry.yarnpkg.com/@grafana/ui/-/ui-10.2.0.tgz#99920ee490d52c014b28d61ca0d9d86294a15f41" - integrity sha512-RzvR053LVV8qYRrfFPMjzEeABwahVOeyQPXmU5vmYccPolQYXbc8wp149wjTf5xdUygqQunRADI6sAqgRpVrdA== +"@grafana/ui@^10.0.0": + version "10.1.4" + resolved "https://registry.yarnpkg.com/@grafana/ui/-/ui-10.1.4.tgz#11b3cf09ed61812c27878344e868ab444aa98403" + integrity sha512-KlV7h65ZyxomPomva9illPBnpUEGa4bZRBlN7/4Yk9EE/YKjI090oAOvM0bDOiRDGeWAXoNpvyrhSpYZr4AW8A== dependencies: "@emotion/css" "11.11.2" "@emotion/react" "11.11.1" - "@grafana/data" "10.2.0" - "@grafana/e2e-selectors" "10.2.0" - "@grafana/faro-web-sdk" "1.2.1" - "@grafana/schema" "10.2.0" + "@grafana/data" "10.1.4" + "@grafana/e2e-selectors" "10.1.4" + "@grafana/faro-web-sdk" "1.1.0" + "@grafana/schema" "10.1.4" "@leeoniya/ufuzzy" "1.0.8" - "@monaco-editor/react" "4.6.0" - "@popperjs/core" "2.11.8" + "@monaco-editor/react" "4.5.1" + "@popperjs/core" "2.11.6" "@react-aria/button" "3.8.0" "@react-aria/dialog" "3.5.3" "@react-aria/focus" "3.13.0" @@ -1461,24 +1461,24 @@ ansicolor "1.1.100" calculate-size "1.1.1" classnames "2.3.2" - core-js "3.33.0" + core-js "3.31.0" d3 "7.8.5" date-fns "2.30.0" hoist-non-react-statics "3.3.2" i18next "^22.0.0" i18next-browser-languagedetector "^7.0.2" - immutable "4.3.1" + immutable "4.3.0" is-hotkey "0.2.0" jquery "3.7.0" lodash "4.17.21" - micro-memoize "^4.1.2" + memoize-one "6.0.0" moment "2.29.4" monaco-editor "0.34.0" ol "7.4.0" prismjs "1.29.0" - rc-cascader "3.18.1" - rc-drawer "6.5.2" - rc-slider "10.3.1" + rc-cascader "3.12.1" + rc-drawer "6.3.0" + rc-slider "10.2.1" rc-time-picker "^3.7.3" rc-tooltip "6.0.1" react-beautiful-dnd "13.1.1" @@ -1494,19 +1494,19 @@ react-popper "2.3.0" react-popper-tooltip "4.4.2" react-router-dom "5.3.3" - react-select "5.7.4" + react-select "5.7.0" react-select-event "^5.1.0" react-table "7.8.0" react-transition-group "4.4.5" react-use "17.4.0" - react-window "1.8.9" - rxjs "7.8.1" + react-window "1.8.8" + rxjs "7.8.0" slate "0.47.9" slate-plain-serializer "0.7.13" slate-react "0.22.10" tinycolor2 "1.6.0" tslib "2.6.0" - uplot "1.6.26" + uplot "1.6.24" uuid "9.0.0" "@humanwhocodes/config-array@^0.11.10": @@ -3025,24 +3025,38 @@ lz-string "^1.5.0" pretty-format "^27.0.2" -"@testing-library/jest-dom@6.1.4": - version "6.1.4" - resolved "https://registry.yarnpkg.com/@testing-library/jest-dom/-/jest-dom-6.1.4.tgz#cf0835c33bc5ef00befb9e672b1e3e6a710e30e3" - integrity sha512-wpoYrCYwSZ5/AxcrjLxJmCU6I5QAJXslEeSiMQqaWmP2Kzpd1LvF/qxmAIW2qposULGWq2gw30GgVNFLSc2Jnw== +"@testing-library/dom@latest": + version "10.4.0" + resolved "https://registry.yarnpkg.com/@testing-library/dom/-/dom-10.4.0.tgz#82a9d9462f11d240ecadbf406607c6ceeeff43a8" + integrity sha512-pemlzrSESWbdAloYml3bAJMEfNh1Z7EduzqPKprCH5S341frlpYnUEW0H72dLxa6IsYr+mPno20GiSm+h9dEdQ== + dependencies: + "@babel/code-frame" "^7.10.4" + "@babel/runtime" "^7.12.5" + "@types/aria-query" "^5.0.1" + aria-query "5.3.0" + chalk "^4.1.0" + dom-accessibility-api "^0.5.9" + lz-string "^1.5.0" + pretty-format "^27.0.2" + +"@testing-library/jest-dom@^6.4.2": + version "6.4.8" + resolved "https://registry.yarnpkg.com/@testing-library/jest-dom/-/jest-dom-6.4.8.tgz#9c435742b20c6183d4e7034f2b329d562c079daa" + integrity sha512-JD0G+Zc38f5MBHA4NgxQMR5XtO5Jx9g86jqturNTt2WUfRmLDIY7iKkWHDCCTiDuFMre6nxAD5wHw9W5kI4rGw== dependencies: - "@adobe/css-tools" "^4.3.1" + "@adobe/css-tools" "^4.4.0" "@babel/runtime" "^7.9.2" aria-query "^5.0.0" chalk "^3.0.0" css.escape "^1.5.1" - dom-accessibility-api "^0.5.6" - lodash "^4.17.15" + dom-accessibility-api "^0.6.3" + lodash "^4.17.21" redent "^3.0.0" -"@testing-library/react@14.0.0": - version "14.0.0" - resolved "https://registry.yarnpkg.com/@testing-library/react/-/react-14.0.0.tgz#59030392a6792450b9ab8e67aea5f3cc18d6347c" - integrity sha512-S04gSNJbYE30TlIMLTzv6QCTzt9AqIF5y6s6SzVFILNcNvbV/jU96GeiTPillGQo+Ny64M/5PV7klNYYgv5Dfg== +"@testing-library/react@^14.1.2": + version "14.3.1" + resolved "https://registry.yarnpkg.com/@testing-library/react/-/react-14.3.1.tgz#29513fc3770d6fb75245c4e1245c470e4ffdd830" + integrity sha512-H99XjUhWQw0lTgyMN05W3xQG1Nh4lq574D8keFf1dDoNTJgp66VbJozRaczoF+wsiaPJNt/TcnfpLGufGxSrZQ== dependencies: "@babel/runtime" "^7.12.5" "@testing-library/dom" "^9.0.0" @@ -4231,6 +4245,13 @@ aria-query@5.1.3, aria-query@^5.0.0: dependencies: deep-equal "^2.0.5" +aria-query@5.3.0: + version "5.3.0" + resolved "https://registry.yarnpkg.com/aria-query/-/aria-query-5.3.0.tgz#650c569e41ad90b51b3d7df5e5eed1c7549c103e" + integrity sha512-b0P0sZPKtyu8HkeRAfCq0IfURZK+SuwMjY1UXGBU27wpAiTwQAIlq56IbIO+ytk/JjS1fMR14ee5WBBfKi5J6A== + dependencies: + dequal "^2.0.3" + arity-n@^1.0.4: version "1.0.4" resolved "https://registry.yarnpkg.com/arity-n/-/arity-n-1.0.4.tgz#d9e76b11733e08569c0847ae7b39b2860b30b745" @@ -5955,6 +5976,11 @@ depd@2.0.0: resolved "https://registry.yarnpkg.com/depd/-/depd-2.0.0.tgz#b696163cc757560d09cf22cc8fad1571b79e76df" integrity sha512-g7nH6P6dyDioJogAAGprGpCtVImJhpPk/roCzdb3fIh61/s/nPsfR6onyMwkCAR/OlC3yBC0lESvUoQEAssIrw== +dequal@^2.0.3: + version "2.0.3" + resolved "https://registry.yarnpkg.com/dequal/-/dequal-2.0.3.tgz#2644214f1997d39ed0ee0ece72335490a7ac67be" + integrity sha512-0je+qPKHEMohvfRTCEo3CrPG6cAzAYgmzKyxRiYSSDkS6eGJdyVJm7WaYA5ECaAD9wLB2T4EEeymA5aFVcYXCA== + destroy@1.2.0: version "1.2.0" resolved "https://registry.yarnpkg.com/destroy/-/destroy-1.2.0.tgz#4803735509ad8be552934c67df614f94e66fa015" @@ -6011,11 +6037,16 @@ doctrine@^3.0.0: dependencies: esutils "^2.0.2" -dom-accessibility-api@^0.5.6, dom-accessibility-api@^0.5.9: +dom-accessibility-api@^0.5.9: version "0.5.14" resolved "https://registry.yarnpkg.com/dom-accessibility-api/-/dom-accessibility-api-0.5.14.tgz#56082f71b1dc7aac69d83c4285eef39c15d93f56" integrity sha512-NMt+m9zFMPZe0JcY9gN224Qvk6qLIdqex29clBvc/y75ZBX9YA9wNK3frsYvu2DI1xcCIwxwnX+TlsJ2DSOADg== +dom-accessibility-api@^0.6.3: + version "0.6.3" + resolved "https://registry.yarnpkg.com/dom-accessibility-api/-/dom-accessibility-api-0.6.3.tgz#993e925cc1d73f2c662e7d75dd5a5445259a8fd8" + integrity sha512-7ZgogeTnjuHbo+ct10G9Ffp0mif17idi0IyWNVA/wcwcm7NPOD/WEHVP3n7n3MhXqxoIYm8d6MuZohYWIZ4T3w== + dom-align@^1.7.0: version "1.12.3" resolved "https://registry.yarnpkg.com/dom-align/-/dom-align-1.12.3.tgz#a36d02531dae0eefa2abb0c4db6595250526f103" @@ -9715,7 +9746,7 @@ lodash.truncate@^4.4.2: resolved "https://registry.yarnpkg.com/lodash.truncate/-/lodash.truncate-4.4.2.tgz#5a350da0b1113b837ecfffd5812cbe58d6eae193" integrity sha512-jttmRe7bRse52OsWIMDLaXxWqRAmtIUccAQ3garviCqJjafXOfNMO0yMfNpdD6zbGaTU0P5Nz7e7gAT6cKmJRw== -lodash@4.17.21, lodash@^4.1.1, lodash@^4.17.14, lodash@^4.17.15, lodash@^4.17.19, lodash@^4.17.20, lodash@^4.17.21, lodash@^4.17.4: +lodash@4.17.21, lodash@^4.1.1, lodash@^4.17.14, lodash@^4.17.19, lodash@^4.17.20, lodash@^4.17.21, lodash@^4.17.4: version "4.17.21" resolved "https://registry.yarnpkg.com/lodash/-/lodash-4.17.21.tgz#679591c564c3bffaae8454cf0b3df370c3d6911c" integrity sha512-v2kDEe57lecTulaDIuNTPy3Ry4gLGJ6Z1O3vE1krgXZNrsQ+LFTGHVxVjcXPs17LhbZVGedAJv8XZ1tvj5FvSg== @@ -14327,6 +14358,11 @@ typescript@4.8.4: resolved "https://registry.yarnpkg.com/typescript/-/typescript-4.8.4.tgz#c464abca159669597be5f96b8943500b238e60e6" integrity sha512-QCh+85mCy+h0IGff8r5XWzOVSbBO+KfeYrMQh7NJ58QujwcE22u+NUSmUxqF+un70P9GXKxa2HCNiTTMJknyjQ== +typescript@5.1: + version "5.1.6" + resolved "https://registry.yarnpkg.com/typescript/-/typescript-5.1.6.tgz#02f8ac202b6dad2c0dd5e0913745b47a37998274" + integrity sha512-zaWCozRZ6DLEWAWFrVDz1H6FVXzUSfTy5FUMWsQlU8Ym5JP9eO4xkTIROFCQvhQf61z6O/G6ugw3SgAnvvm+HA== + typescript@^5.3.2: version "5.3.2" resolved "https://registry.yarnpkg.com/typescript/-/typescript-5.3.2.tgz#00d1c7c1c46928c5845c1ee8d0cc2791031d4c43" From 71cdf355db41517823b579e32414b4683e0e77e7 Mon Sep 17 00:00:00 2001 From: Vadim Stepanov Date: Thu, 25 Jul 2024 14:25:01 +0100 Subject: [PATCH 2/2] Force index only on list & stats (#4734) Following up on https://github.com/grafana/oncall/pull/4731 --- engine/apps/api/views/alert_group.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/engine/apps/api/views/alert_group.py b/engine/apps/api/views/alert_group.py index bd0dec3821..e59ab7aa86 100644 --- a/engine/apps/api/views/alert_group.py +++ b/engine/apps/api/views/alert_group.py @@ -332,7 +332,7 @@ def get_queryset(self, ignore_filtering_by_available_teams=False): alert_receive_channels_ids = list(alert_receive_channels_qs.values_list("id", flat=True)) queryset = AlertGroup.objects.filter(channel__in=alert_receive_channels_ids) - if settings.ALERT_GROUPS_DISABLE_PREFER_ORDERING_INDEX: + if self.action in ("list", "stats") and settings.ALERT_GROUPS_DISABLE_PREFER_ORDERING_INDEX: # workaround related to MySQL "ORDER BY LIMIT Query Optimizer Bug" # read more: https://hackmysql.com/infamous-order-by-limit-query-optimizer-bug/ from django_mysql.models import add_QuerySetMixin