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()) 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/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 + +
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"