From 2cf83a965061c16a04aac949c560a9cac1a807b8 Mon Sep 17 00:00:00 2001 From: Yulia Shanyrova Date: Tue, 21 Feb 2023 12:47:21 +0100 Subject: [PATCH] 1305 backlink tosource (#1316) # What this PR does - Header of Incident page was reworked: clickable labels instead of just names, users section was deleted - Go to Integration button was deleted, because the functionality moved to clickable labels - Link to source was added - ## Which issue(s) this PR fixes https://github.com/grafana/oncall-private/issues/1305 ## Checklist - [ ] Tests updated - [ ] Documentation added - [ v] `CHANGELOG.md` updated --- CHANGELOG.md | 3 + .../src/models/alertgroup/alertgroup.types.ts | 1 + .../src/pages/incident/Incident.helpers.tsx | 13 ++- .../src/pages/incident/Incident.module.scss | 39 +++++++++ .../src/pages/incident/Incident.tsx | 79 +++++++++++++++---- 5 files changed, 115 insertions(+), 20 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index b9c27be4..74dc54b6 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -46,6 +46,9 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - Incidents - Removed buttons column and replaced status with toggler ([#1237](https://github.com/grafana/oncall/issues/1237)) - Responsiveness changes across multiple pages (Incidents, Integrations, Schedules) ([#1237](https://github.com/grafana/oncall/issues/1237)) +- Link to source was added +- Header of Incident page was reworked: clickable labels instead of just names, users section was deleted +- "Go to Integration" button was deleted, because the functionality was moved to clickable labels ## v1.1.23 (2023-02-06) diff --git a/grafana-plugin/src/models/alertgroup/alertgroup.types.ts b/grafana-plugin/src/models/alertgroup/alertgroup.types.ts index 5705064e..5c6d622a 100644 --- a/grafana-plugin/src/models/alertgroup/alertgroup.types.ts +++ b/grafana-plugin/src/models/alertgroup/alertgroup.types.ts @@ -87,4 +87,5 @@ interface RenderForWeb { message: any; title: any; image_url: string; + source_link: string; } diff --git a/grafana-plugin/src/pages/incident/Incident.helpers.tsx b/grafana-plugin/src/pages/incident/Incident.helpers.tsx index 461ff01c..cd3e70b1 100644 --- a/grafana-plugin/src/pages/incident/Incident.helpers.tsx +++ b/grafana-plugin/src/pages/incident/Incident.helpers.tsx @@ -1,6 +1,7 @@ import React from 'react'; import { Button, HorizontalGroup, IconButton, Tooltip, VerticalGroup } from '@grafana/ui'; +import cn from 'classnames/bind'; import Avatar from 'components/Avatar/Avatar'; import { MatchMediaTooltip } from 'components/MatchMediaTooltip/MatchMediaTooltip'; @@ -16,11 +17,15 @@ import { move } from 'state/helpers'; import { UserActions } from 'utils/authorization'; import { TABLE_COLUMN_MAX_WIDTH } from 'utils/consts'; +import styles from './Incident.module.scss'; + +const cx = cn.bind(styles); + export function getIncidentStatusTag(alert: Alert) { switch (alert.status) { case IncidentStatus.Firing: return ( - + Firing @@ -28,7 +33,7 @@ export function getIncidentStatusTag(alert: Alert) { ); case IncidentStatus.Acknowledged: return ( - + Acknowledged @@ -36,7 +41,7 @@ export function getIncidentStatusTag(alert: Alert) { ); case IncidentStatus.Resolved: return ( - + Resolved @@ -44,7 +49,7 @@ export function getIncidentStatusTag(alert: Alert) { ); case IncidentStatus.Silenced: return ( - + Silenced diff --git a/grafana-plugin/src/pages/incident/Incident.module.scss b/grafana-plugin/src/pages/incident/Incident.module.scss index 9f598e01..c790c622 100644 --- a/grafana-plugin/src/pages/incident/Incident.module.scss +++ b/grafana-plugin/src/pages/incident/Incident.module.scss @@ -122,6 +122,45 @@ margin-left: 4px; } +.integration-logo { + margin-right: 8px; +} + +.label-button { + padding: 0 8px; + font-weight: 400; +} + +.label-button:disabled { + border: var(--border-strong); +} + +.label-button-text { + max-width: 160px; + overflow: hidden; + position: relative; + display: inline-block; + text-align: center; + text-decoration: none; + text-overflow: ellipsis; + white-space: nowrap; +} + +.source-name { + display: flex; + align-items: center; +} + +.status-tag-container { + margin-right: 8px; + display: inherit; +} + +.status-tag { + height: 24px; + padding: 0 8px; + border-radius: 2px; +} .paged-users { width: 100%; } diff --git a/grafana-plugin/src/pages/incident/Incident.tsx b/grafana-plugin/src/pages/incident/Incident.tsx index 0ae0ccee..4cb11a17 100644 --- a/grafana-plugin/src/pages/incident/Incident.tsx +++ b/grafana-plugin/src/pages/incident/Incident.tsx @@ -58,11 +58,12 @@ import { UserActions } from 'utils/authorization'; import { PLUGIN_ROOT } from 'utils/consts'; import sanitize from 'utils/sanitize'; -import { getActionButtons, getIncidentStatusTag, renderRelatedUsers } from './Incident.helpers'; +import { getActionButtons, getIncidentStatusTag } from './Incident.helpers'; import styles from './Incident.module.scss'; import PagedUsers from './parts/PagedUsers'; const cx = cn.bind(styles); +const INTEGRATION_NAME_LENGTH_LIMIT = 30; interface IncidentPageProps extends WithStoreProps, PageProps, RouteComponentProps<{ id: string }> {} @@ -235,6 +236,9 @@ class IncidentPage extends React.Component const integration = store.alertReceiveChannelStore.getIntegration(incident.alert_receive_channel); const showLinkTo = !incident.dependent_alert_groups.length && !incident.root_alert_group && !incident.resolved; + + const integrationNameWithEmojies = ; + return ( @@ -269,7 +273,7 @@ class IncidentPage extends React.Component {showLinkTo && (
- {getIncidentStatusTag(incident)} | | - - {integration && {integration?.display_name}} - {integration && '|'} - {renderRelatedUsers(incident, true)} +
{getIncidentStatusTag(incident)}
+ + + + + {integration && ( + <> + + + + + + + )}
@@ -310,7 +364,7 @@ class IncidentPage extends React.Component })} - @@ -324,14 +378,7 @@ class IncidentPage extends React.Component value={prepareForEdit(incident.paged_users)} onUpdateEscalationVariants={this.handleAddResponders} /> - - - +