From 854dfd56a08d30c8cbf8c7831fe37a694e885738 Mon Sep 17 00:00:00 2001 From: Dominik Broj Date: Wed, 14 Aug 2024 14:52:55 +0200 Subject: [PATCH 1/3] Polish unified slack ui (#4819) # What this PR does polish ui of unified slack: - [x] New deprecation banner - [x] Move install/uninstall button to the top right corner - [x] New texts in migrate modal - [x] New text and layout in uninstall modal. ## Which issue(s) this PR closes Related to https://github.com/grafana/oncall-gateway/issues/299 ## 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. --- grafana-plugin/src/assets/style/utils.css | 8 + .../components/WithConfirm/WithConfirm.tsx | 2 + .../SlackSettings/SlackSettings.module.css | 17 +- .../tabs/SlackSettings/SlackSettings.tsx | 240 ++++++++++-------- 4 files changed, 150 insertions(+), 117 deletions(-) diff --git a/grafana-plugin/src/assets/style/utils.css b/grafana-plugin/src/assets/style/utils.css index 76d404c01b..23d3a18f45 100644 --- a/grafana-plugin/src/assets/style/utils.css +++ b/grafana-plugin/src/assets/style/utils.css @@ -36,6 +36,10 @@ margin-right: 4px; } +.u-margin-left-xs { + margin-left: 4px; +} + .u-margin-bottom-none { margin-bottom: 0; } @@ -44,6 +48,10 @@ margin-bottom: 12px; } +.u-margin-bottom-xxs { + margin-bottom: 2px; +} + .u-margin-top-xs { margin-top: 4px; } diff --git a/grafana-plugin/src/components/WithConfirm/WithConfirm.tsx b/grafana-plugin/src/components/WithConfirm/WithConfirm.tsx index 51a92e7c3c..fc724528f7 100644 --- a/grafana-plugin/src/components/WithConfirm/WithConfirm.tsx +++ b/grafana-plugin/src/components/WithConfirm/WithConfirm.tsx @@ -17,6 +17,7 @@ export const WithConfirm: React.FC = ({ children, disabled, skip = false, + modalClass, }) => { const [showConfirmation, setShowConfirmation] = useState(false); @@ -57,6 +58,7 @@ export const WithConfirm: React.FC = ({ onDismiss={() => { setShowConfirmation(false); }} + modalClass={modalClass} /> )} {React.cloneElement(children, { diff --git a/grafana-plugin/src/pages/settings/tabs/ChatOps/tabs/SlackSettings/SlackSettings.module.css b/grafana-plugin/src/pages/settings/tabs/ChatOps/tabs/SlackSettings/SlackSettings.module.css index ab38f543e3..20256d7752 100644 --- a/grafana-plugin/src/pages/settings/tabs/ChatOps/tabs/SlackSettings/SlackSettings.module.css +++ b/grafana-plugin/src/pages/settings/tabs/ChatOps/tabs/SlackSettings/SlackSettings.module.css @@ -18,7 +18,7 @@ .slack-infoblock { text-align: center; - width: 725px; + width: 100%; } .external-link-style { @@ -33,10 +33,9 @@ .infoblock-text { margin-left: 48px; margin-right: 48px; - margin-top: 24px; } -.infoblock-icon { +.marginTop { margin-top: 24px; } @@ -47,10 +46,18 @@ transform: translateY(-50%); } -.upgradeSlackAlert svg { - display: none; +.upgradeSlackAlertText { + margin-right: 110px; + + a { + font-weight: 600; + } } .linkToIncidentWrapper { margin-top: 16px; } + +.confirmUninstallModal input { + min-width: 300px; +} diff --git a/grafana-plugin/src/pages/settings/tabs/ChatOps/tabs/SlackSettings/SlackSettings.tsx b/grafana-plugin/src/pages/settings/tabs/ChatOps/tabs/SlackSettings/SlackSettings.tsx index 213f3b6bc7..112fa050d8 100644 --- a/grafana-plugin/src/pages/settings/tabs/ChatOps/tabs/SlackSettings/SlackSettings.tsx +++ b/grafana-plugin/src/pages/settings/tabs/ChatOps/tabs/SlackSettings/SlackSettings.tsx @@ -4,13 +4,13 @@ import { Alert, HorizontalGroup, LoadingPlaceholder, - VerticalGroup, Icon, Button, InlineField, Input, Legend, ConfirmModal, + Stack, } from '@grafana/ui'; import cn from 'classnames/bind'; import { observer } from 'mobx-react'; @@ -31,7 +31,7 @@ import { WithStoreProps } from 'state/types'; import { useStore } from 'state/useStore'; import { withMobXProviderContext } from 'state/withStore'; import { UserActions } from 'utils/authorization/authorization'; -import { DOCS_SLACK_SETUP, getPluginId } from 'utils/consts'; +import { DOCS_ROOT, DOCS_SLACK_SETUP, getPluginId } from 'utils/consts'; import { useConfirmModal } from 'utils/hooks'; import { showApiError } from 'utils/utils'; @@ -122,9 +122,74 @@ class _SlackSettings extends Component { const isUnifiedSlackInstalled = !currentOrganization.slack_team_identity.needs_reinstall; + const uninstallSlackButton = ( + + {isUnifiedSlackInstalled ? ( + + + Are you sure you want to remove this integration from OnCall and Incident? + +

+ This action will uninstall the IRM Slack integration from OnCall and Incident. The following IRM data + will be permanently deleted: +

+
    +
  • OnCall default Slack channel
  • +
  • Slack channels for OnCall escalation policies
  • +
  • Slack channels and user groups for OnCall schedules
  • +
  • Linked Slack profiles for OnCall users
  • +
  • Incident announcement and automatic Slack channel creation
  • +
+
+ + } + confirmationText="UNINSTALL" + confirmText="Uninstall" + > + +
+ ) : ( + +

Are you sure to delete this Slack Integration?

+

Removing the integration will also irreverisbly remove the following data for your OnCall plugin:

+
    +
  • default organization Slack channel
  • +
  • default Slack channels for OnCall Integrations
  • +
  • Slack channels & Slack user groups for OnCall Schedules
  • +
  • linked Slack usernames for OnCall Users
  • +
+
+

+ If you would like to instead remove your linked Slack username, please head{' '} + here. +

+ + } + confirmationText="DELETE" + > + +
+ )} +
+ ); + return (
- Slack App settings + + Slack OnCall settings + {uninstallSlackButton} + {currentOrganization.slack_team_identity.needs_reinstall && } @@ -152,62 +217,6 @@ class _SlackSettings extends Component { severity="info" title="Tip: Create a separate channel for OnCall Slack App notifications (catch-all). Avoid using #general, etc." /> - - - {isUnifiedSlackInstalled ? ( - -

Are you sure to delete this Slack Integration? It will affect both OnCall & Incident.

-

Removing the integration will irreverisbly remove the following data for IRM;

-
    -
  • OnCall default Slack channel
  • -
  • Slack channels for OnCall escalation policies
  • -
  • Slack channels & Slack user groups for OnCall Schedules
  • -
  • linked Slack usernames for OnCall Users
  • -
  • Incident hooks
  • -
-
- - } - confirmationText="DELETE" - > - -
- ) : ( - -

Are you sure to delete this Slack Integration?

-

- Removing the integration will also irreverisbly remove the following data for your OnCall plugin: -

-
    -
  • default organization Slack channel
  • -
  • default Slack channels for OnCall Integrations
  • -
  • Slack channels & Slack user groups for OnCall Schedules
  • -
  • linked Slack usernames for OnCall Users
  • -
-
-

- If you would like to instead remove your linked Slack username, please head{' '} - here. -

- - } - confirmationText="DELETE" - > - -
- )} -
-
Additional settings { const isUnifiedSlackEnabled = store.hasFeature(AppFeature.UnifiedSlack); return ( - - Connect Slack workspace + + + Slack + {isLiveSettingAvailable ? ( + + + + ) : ( + + + {store.hasFeature(AppFeature.LiveSettings) && ( + + + + )} + + )} + - -
+ +
- + {isUnifiedSlackEnabled ? 'Connecting Slack App will allow you to manage alert groups and incidents in your team Slack workspace.' : 'Connecting Slack App will allow you to manage alert groups in your team Slack workspace.'} - After a basic workspace connection your team members need to connect their personal Slack accounts in - order to be allowed to manage alert groups. + Once the workspace is connected, team members need to link their Slack accounts to their IRM users to + start using the app. {isLiveSettingAvailable && ( - + For bot creating instructions and additional information please read{' '} our documentation )} - - +
- {isLiveSettingAvailable ? ( - - - - ) : ( - - - {store.hasFeature(AppFeature.LiveSettings) && ( - - - - )} - - )} - + ); }; } @@ -350,48 +356,58 @@ const UpgradeToUnifiedSlackBanner = observer(() => { return ( <> - Upgrade
} - > - We've rebranded the OnCall Slack app as the Grafana IRM Slack app, now with incident management features. -

Click "Upgrade" to reviewn and approve the new permissions and complete the process.

-

For more details, check our documentation.

+ +
+ The OnCall Slack app is now a Grafana IRM app with new incident management features. Migrate now to access the + enhanced capabilities.{' '} + + {/* TODO: update link to docs */} + Learn more + +
From f5c87196baa1a45e85f83c1cc64d9bb3c6db1254 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Wed, 14 Aug 2024 08:59:33 -0400 Subject: [PATCH 2/3] Bump axios from 1.6.7 to 1.7.4 in /grafana-plugin (#4816) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Bumps [axios](https://github.com/axios/axios) from 1.6.7 to 1.7.4.
Release notes

Sourced from axios's releases.

Release v1.7.4

Release notes:

Bug Fixes

Contributors to this release

Release v1.7.3

Release notes:

Bug Fixes

  • adapter: fix progress event emitting; (#6518) (e3c76fc)
  • fetch: fix withCredentials request config (#6505) (85d4d0e)
  • xhr: return original config on errors from XHR adapter (#6515) (8966ee7)

Contributors to this release

Release v1.7.2

Release notes:

Bug Fixes

Contributors to this release

Release v1.7.1

Release notes:

Bug Fixes

  • fetch: fixed ReferenceError issue when TextEncoder is not available in the environment; (#6410) (733f15f)

Contributors to this release

Release v1.7.0

Release notes:

Features

... (truncated)

Changelog

Sourced from axios's changelog.

1.7.4 (2024-08-13)

Bug Fixes

Contributors to this release

1.7.3 (2024-08-01)

Bug Fixes

  • adapter: fix progress event emitting; (#6518) (e3c76fc)
  • fetch: fix withCredentials request config (#6505) (85d4d0e)
  • xhr: return original config on errors from XHR adapter (#6515) (8966ee7)

Contributors to this release

1.7.2 (2024-05-21)

Bug Fixes

Contributors to this release

1.7.1 (2024-05-20)

Bug Fixes

  • fetch: fixed ReferenceError issue when TextEncoder is not available in the environment; (#6410) (733f15f)

Contributors to this release

... (truncated)

Commits

[![Dependabot compatibility score](https://dependabot-badges.githubapp.com/badges/compatibility_score?dependency-name=axios&package-manager=npm_and_yarn&previous-version=1.6.7&new-version=1.7.4)](https://docs.github.com/en/github/managing-security-vulnerabilities/about-dependabot-security-updates#about-compatibility-scores) Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting `@dependabot rebase`. [//]: # (dependabot-automerge-start) [//]: # (dependabot-automerge-end) ---
Dependabot commands and options
You can trigger Dependabot actions by commenting on this PR: - `@dependabot rebase` will rebase this PR - `@dependabot recreate` will recreate this PR, overwriting any edits that have been made to it - `@dependabot merge` will merge this PR after your CI passes on it - `@dependabot squash and merge` will squash and merge this PR after your CI passes on it - `@dependabot cancel merge` will cancel a previously requested merge and block automerging - `@dependabot reopen` will reopen this PR if it is closed - `@dependabot close` will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually - `@dependabot show ignore conditions` will show all of the ignore conditions of the specified dependency - `@dependabot ignore this major version` will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself) - `@dependabot ignore this minor version` will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself) - `@dependabot ignore this dependency` will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself) You can disable automated security fix PRs for this repo from the [Security Alerts page](https://github.com/grafana/oncall/network/alerts).
Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- grafana-plugin/package.json | 2 +- grafana-plugin/yarn.lock | 44 ++++++++++++++++++++++++++++--------- 2 files changed, 35 insertions(+), 11 deletions(-) diff --git a/grafana-plugin/package.json b/grafana-plugin/package.json index 178cf3924e..84cbf8e352 100644 --- a/grafana-plugin/package.json +++ b/grafana-plugin/package.json @@ -145,7 +145,7 @@ "@grafana/ui": "^11.1.3", "@lifeomic/attempt": "^3.0.3", "array-move": "^4.0.0", - "axios": "^1.6.7", + "axios": "^1.7.4", "change-case": "^4.1.1", "circular-dependency-plugin": "^5.2.2", "classnames": "^2.3.2", diff --git a/grafana-plugin/yarn.lock b/grafana-plugin/yarn.lock index bb45bde5d7..551fae5921 100644 --- a/grafana-plugin/yarn.lock +++ b/grafana-plugin/yarn.lock @@ -4780,12 +4780,12 @@ available-typed-arrays@^1.0.7: dependencies: possible-typed-array-names "^1.0.0" -axios@^1.6.7: - version "1.6.7" - resolved "https://registry.yarnpkg.com/axios/-/axios-1.6.7.tgz#7b48c2e27c96f9c68a2f8f31e2ab19f59b06b0a7" - integrity sha512-/hDJGff6/c7u0hDkvkGxR/oy6CbCs8ziCsC7SqmhjfozqiJGc8Z11wrv9z9lYfY4K8l+H9TpjcMDX0xOZmx+RA== +axios@^1.7.4: + version "1.7.4" + resolved "https://registry.yarnpkg.com/axios/-/axios-1.7.4.tgz#4c8ded1b43683c8dd362973c393f3ede24052aa2" + integrity sha512-DukmaFRnY6AzAALSH4J2M3k6PkaC+MfaAGdEERRWcC9q3/TWQwLpHR8ZRLKTdQ3aBDL64EdluRDjJqKw+BPZEw== dependencies: - follow-redirects "^1.15.4" + follow-redirects "^1.15.6" form-data "^4.0.0" proxy-from-env "^1.1.0" @@ -7626,7 +7626,7 @@ flatted@^3.1.0: resolved "https://registry.yarnpkg.com/flatted/-/flatted-3.2.7.tgz#609f39207cb614b89d0765b477cb2d437fbf9787" integrity sha512-5nqDSxl8nn5BSNxyR3n4I6eDmbolI6WT+QqR547RwxQapgjQBmtktdP+HTBb/a/zLsbzERTONyUB5pefh5TtjQ== -follow-redirects@^1.15.4: +follow-redirects@^1.15.6: version "1.15.6" resolved "https://registry.yarnpkg.com/follow-redirects/-/follow-redirects-1.15.6.tgz#7f815c0cda4249c74ff09e95ef97c23b5fd0399b" integrity sha512-wWN62YITEaOpSK584EZXJafH1AGpO8RVgElfkuXbTOrPX4fIfOyEpW/CsiNd8JdYrAoOvafRTOEnvsO++qCqFA== @@ -13967,7 +13967,16 @@ string-template@~0.2.1: resolved "https://registry.yarnpkg.com/string-template/-/string-template-0.2.1.tgz#42932e598a352d01fc22ec3367d9d84eec6c9add" integrity sha512-Yptehjogou2xm4UJbxJ4CxgZx12HBfeystp0y3x7s4Dj32ltVVG1Gg8YhKjHZkHicuKpZX/ffilA8505VbUbpw== -"string-width-cjs@npm:string-width@^4.2.0", string-width@^4.1.0, string-width@^4.2.0, string-width@^4.2.2, string-width@^4.2.3: +"string-width-cjs@npm:string-width@^4.2.0": + version "4.2.3" + resolved "https://registry.yarnpkg.com/string-width/-/string-width-4.2.3.tgz#269c7117d27b05ad2e536830a8ec895ef9c6d010" + integrity sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g== + dependencies: + emoji-regex "^8.0.0" + is-fullwidth-code-point "^3.0.0" + strip-ansi "^6.0.1" + +string-width@^4.1.0, string-width@^4.2.0, string-width@^4.2.2, string-width@^4.2.3: version "4.2.3" resolved "https://registry.yarnpkg.com/string-width/-/string-width-4.2.3.tgz#269c7117d27b05ad2e536830a8ec895ef9c6d010" integrity sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g== @@ -14085,7 +14094,7 @@ stringify-object@^3.3.0: is-obj "^1.0.1" is-regexp "^1.0.0" -"strip-ansi-cjs@npm:strip-ansi@^6.0.1", strip-ansi@^6.0.0, strip-ansi@^6.0.1: +"strip-ansi-cjs@npm:strip-ansi@^6.0.1": version "6.0.1" resolved "https://registry.yarnpkg.com/strip-ansi/-/strip-ansi-6.0.1.tgz#9e26c63d30f53443e9489495b2105d37b67a85d9" integrity sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A== @@ -14106,6 +14115,13 @@ strip-ansi@^5.2.0: dependencies: ansi-regex "^4.1.0" +strip-ansi@^6.0.0, strip-ansi@^6.0.1: + version "6.0.1" + resolved "https://registry.yarnpkg.com/strip-ansi/-/strip-ansi-6.0.1.tgz#9e26c63d30f53443e9489495b2105d37b67a85d9" + integrity sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A== + dependencies: + ansi-regex "^5.0.1" + strip-ansi@^7.0.1: version "7.1.0" resolved "https://registry.yarnpkg.com/strip-ansi/-/strip-ansi-7.1.0.tgz#d5b6568ca689d8561370b0707685d22434faff45" @@ -15461,8 +15477,7 @@ wordwrap@^1.0.0: resolved "https://registry.yarnpkg.com/wordwrap/-/wordwrap-1.0.0.tgz#27584810891456a4171c8d0226441ade90cbcaeb" integrity sha512-gvVzJFlPycKc5dZN4yPkP8w7Dc37BtP1yczEneOb4uq34pXZcvrtRTmWV8W+Ume+XCxKgbjM+nevkyFPMybd4Q== -"wrap-ansi-cjs@npm:wrap-ansi@^7.0.0", wrap-ansi@^7.0.0: - name wrap-ansi-cjs +"wrap-ansi-cjs@npm:wrap-ansi@^7.0.0": version "7.0.0" resolved "https://registry.yarnpkg.com/wrap-ansi/-/wrap-ansi-7.0.0.tgz#67e145cff510a6a6984bdf1152911d69d2eb9e43" integrity sha512-YVGIj2kamLSTxw6NsZjoBxfSwsn0ycdesmc4p+Q21c5zPuZ1pl+NfxVdxPtdHvmNVOQ6XSYG4AUtyt/Fi7D16Q== @@ -15480,6 +15495,15 @@ wrap-ansi@^6.2.0: string-width "^4.1.0" strip-ansi "^6.0.0" +wrap-ansi@^7.0.0: + version "7.0.0" + resolved "https://registry.yarnpkg.com/wrap-ansi/-/wrap-ansi-7.0.0.tgz#67e145cff510a6a6984bdf1152911d69d2eb9e43" + integrity sha512-YVGIj2kamLSTxw6NsZjoBxfSwsn0ycdesmc4p+Q21c5zPuZ1pl+NfxVdxPtdHvmNVOQ6XSYG4AUtyt/Fi7D16Q== + dependencies: + ansi-styles "^4.0.0" + string-width "^4.1.0" + strip-ansi "^6.0.0" + wrap-ansi@^8.1.0: version "8.1.0" resolved "https://registry.yarnpkg.com/wrap-ansi/-/wrap-ansi-8.1.0.tgz#56dc22368ee570face1b49819975d9b9a5ead214" From 29bd42c0b1c3bafcc34beeeeda750d25a1c52960 Mon Sep 17 00:00:00 2001 From: Yulya Artyukhina Date: Wed, 14 Aug 2024 15:53:43 +0200 Subject: [PATCH 3/3] Fix collecting metrics (#4822) # What this PR does Reverts the accidental removal of the ApplicationMetricsCollector from the metric register ## Which issue(s) this PR closes Related to [issue link here] ## 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. --- engine/apps/metrics_exporter/metrics_collectors.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/engine/apps/metrics_exporter/metrics_collectors.py b/engine/apps/metrics_exporter/metrics_collectors.py index db1ecc1464..87fb15c839 100644 --- a/engine/apps/metrics_exporter/metrics_collectors.py +++ b/engine/apps/metrics_exporter/metrics_collectors.py @@ -232,3 +232,6 @@ def recalculate_cache_for_missing_org_ids(self, org_ids: set[int], missing_org_i recalculate_orgs.append({"organization_id": org_id, "force": force_task}) if recalculate_orgs: start_calculate_and_cache_metrics.apply_async((recalculate_orgs,)) + + +application_metrics_registry.register(ApplicationMetricsCollector())