Commit 1139a13f authored by Natalia Tepluhina's avatar Natalia Tepluhina

Merge branch 'lm-detail-pages-tweaks' into 'master'

Alert Management|Details page: update some styles and attributes

See merge request gitlab-org/gitlab!32785
parents 2c548d72 b38eacf5
...@@ -2,6 +2,7 @@ ...@@ -2,6 +2,7 @@
import * as Sentry from '@sentry/browser'; import * as Sentry from '@sentry/browser';
import { import {
GlAlert, GlAlert,
GlBadge,
GlIcon, GlIcon,
GlLoadingIcon, GlLoadingIcon,
GlSprintf, GlSprintf,
...@@ -35,6 +36,7 @@ export default { ...@@ -35,6 +36,7 @@ export default {
}, },
severityLabels: ALERTS_SEVERITY_LABELS, severityLabels: ALERTS_SEVERITY_LABELS,
components: { components: {
GlBadge,
GlAlert, GlAlert,
GlIcon, GlIcon,
GlLoadingIcon, GlLoadingIcon,
...@@ -186,21 +188,18 @@ export default { ...@@ -186,21 +188,18 @@ export default {
<div <div
class="gl-display-inline-flex gl-align-items-center gl-justify-content-space-between" class="gl-display-inline-flex gl-align-items-center gl-justify-content-space-between"
> >
<gl-icon <gl-badge class="gl-mr-3">
class="gl-mr-3 align-middle" <strong>{{ s__('AlertManagement|Alert') }}</strong>
:size="12" </gl-badge>
:name="`severity-${alert.severity.toLowerCase()}`"
:class="`icon-${alert.severity.toLowerCase()}`"
/>
<strong>{{ $options.severityLabels[alert.severity] }}</strong>
</div> </div>
<span class="mx-2">&bull;</span> <span>
<gl-sprintf :message="reportedAtMessage"> <gl-sprintf :message="reportedAtMessage">
<template #when> <template #when>
<time-ago-tooltip :time="alert.createdAt" class="gl-ml-3" /> <time-ago-tooltip :time="alert.createdAt" />
</template> </template>
<template #tool>{{ alert.monitoringTool }}</template> <template #tool>{{ alert.monitoringTool }}</template>
</gl-sprintf> </gl-sprintf>
</span>
</div> </div>
<gl-button <gl-button
v-if="alert.issueIid" v-if="alert.issueIid"
...@@ -242,24 +241,48 @@ export default { ...@@ -242,24 +241,48 @@ export default {
</div> </div>
<gl-tabs v-if="alert" data-testid="alertDetailsTabs"> <gl-tabs v-if="alert" data-testid="alertDetailsTabs">
<gl-tab data-testid="overviewTab" :title="$options.i18n.overviewTitle"> <gl-tab data-testid="overviewTab" :title="$options.i18n.overviewTitle">
<ul class="pl-4 mb-n1"> <div v-if="alert.severity" class="gl-mt-3 gl-mb-5 gl-display-flex">
<li v-if="alert.startedAt" class="my-2"> <div class="gl-font-weight-bold gl-w-13 gl-text-right gl-pr-3">
<strong class="bold">{{ s__('AlertManagement|Start time') }}:</strong> {{ s__('AlertManagement|Severity') }}:
</div>
<div class="gl-pl-2" data-testid="severity">
<span>
<gl-icon
class="gl-vertical-align-middle"
:size="12"
:name="`severity-${alert.severity.toLowerCase()}`"
:class="`icon-${alert.severity.toLowerCase()}`"
/>
</span>
{{ $options.severityLabels[alert.severity] }}
</div>
</div>
<div v-if="alert.startedAt" class="gl-my-5 gl-display-flex">
<div class="gl-font-weight-bold gl-w-13 gl-text-right gl-pr-3">
{{ s__('AlertManagement|Start time') }}:
</div>
<div class="gl-pl-2">
<time-ago-tooltip data-testid="startTimeItem" :time="alert.startedAt" /> <time-ago-tooltip data-testid="startTimeItem" :time="alert.startedAt" />
</li> </div>
<li v-if="alert.eventCount" class="my-2"> </div>
<strong class="bold">{{ s__('AlertManagement|Events') }}:</strong> <div v-if="alert.eventCount" class="gl-my-5 gl-display-flex">
<span data-testid="eventCount">{{ alert.eventCount }}</span> <div class="gl-font-weight-bold gl-w-13 gl-text-right gl-pr-3">
</li> {{ s__('AlertManagement|Events') }}:
<li v-if="alert.monitoringTool" class="my-2"> </div>
<strong class="bold">{{ s__('AlertManagement|Tool') }}:</strong> <div class="gl-pl-2" data-testid="eventCount">{{ alert.eventCount }}</div>
<span data-testid="monitoringTool">{{ alert.monitoringTool }}</span> </div>
</li> <div v-if="alert.monitoringTool" class="gl-my-5 gl-display-flex">
<li v-if="alert.service" class="my-2"> <div class="gl-font-weight-bold gl-w-13 gl-text-right gl-pr-3">
<strong class="bold">{{ s__('AlertManagement|Service') }}:</strong> {{ s__('AlertManagement|Tool') }}:
<span data-testid="service">{{ alert.service }}</span> </div>
</li> <div class="gl-pl-2" data-testid="monitoringTool">{{ alert.monitoringTool }}</div>
</ul> </div>
<div v-if="alert.service" class="gl-my-5 gl-display-flex">
<div class="bold gl-w-13 gl-text-right gl-pr-3">
{{ s__('AlertManagement|Service') }}:
</div>
<div class="gl-pl-2" data-testid="service">{{ alert.service }}</div>
</div>
</gl-tab> </gl-tab>
<gl-tab data-testid="fullDetailsTab" :title="$options.i18n.fullAlertDetailsTitle"> <gl-tab data-testid="fullDetailsTab" :title="$options.i18n.fullAlertDetailsTitle">
<gl-table <gl-table
......
...@@ -3,9 +3,11 @@ import { GlAlert, GlLoadingIcon, GlTable } from '@gitlab/ui'; ...@@ -3,9 +3,11 @@ import { GlAlert, GlLoadingIcon, GlTable } from '@gitlab/ui';
import AlertDetails from '~/alert_management/components/alert_details.vue'; import AlertDetails from '~/alert_management/components/alert_details.vue';
import createIssueQuery from '~/alert_management/graphql/mutations/create_issue_from_alert.graphql'; import createIssueQuery from '~/alert_management/graphql/mutations/create_issue_from_alert.graphql';
import { joinPaths } from '~/lib/utils/url_utility'; import { joinPaths } from '~/lib/utils/url_utility';
import { trackAlertsDetailsViewsOptions } from '~/alert_management/constants'; import {
trackAlertsDetailsViewsOptions,
ALERTS_SEVERITY_LABELS,
} from '~/alert_management/constants';
import Tracking from '~/tracking'; import Tracking from '~/tracking';
import mockAlerts from '../mocks/alerts.json'; import mockAlerts from '../mocks/alerts.json';
const mockAlert = mockAlerts[0]; const mockAlert = mockAlerts[0];
...@@ -77,6 +79,12 @@ describe('AlertDetails', () => { ...@@ -77,6 +79,12 @@ describe('AlertDetails', () => {
expect(wrapper.find('[data-testid="fullDetailsTab"]').exists()).toBe(true); expect(wrapper.find('[data-testid="fullDetailsTab"]').exists()).toBe(true);
}); });
it('renders severity', () => {
expect(wrapper.find('[data-testid="severity"]').text()).toBe(
ALERTS_SEVERITY_LABELS[mockAlert.severity],
);
});
it('renders a title', () => { it('renders a title', () => {
expect(wrapper.find('[data-testid="title"]').text()).toBe(mockAlert.title); expect(wrapper.find('[data-testid="title"]').text()).toBe(mockAlert.title);
}); });
...@@ -204,15 +212,15 @@ describe('AlertDetails', () => { ...@@ -204,15 +212,15 @@ describe('AlertDetails', () => {
describe('individual header fields', () => { describe('individual header fields', () => {
describe.each` describe.each`
severity | createdAt | monitoringTool | result createdAt | monitoringTool | result
${'MEDIUM'} | ${'2020-04-17T23:18:14.996Z'} | ${null} | ${'Medium • Reported now'} ${'2020-04-17T23:18:14.996Z'} | ${null} | ${'Alert Reported now'}
${'INFO'} | ${'2020-04-17T23:18:14.996Z'} | ${'Datadog'} | ${'Info • Reported now by Datadog'} ${'2020-04-17T23:18:14.996Z'} | ${'Datadog'} | ${'Alert Reported now by Datadog'}
`( `(
`When severity=$severity, createdAt=$createdAt, monitoringTool=$monitoringTool`, `When createdAt=$createdAt, monitoringTool=$monitoringTool`,
({ severity, createdAt, monitoringTool, result }) => { ({ createdAt, monitoringTool, result }) => {
beforeEach(() => { beforeEach(() => {
mountComponent({ mountComponent({
data: { alert: { ...mockAlert, severity, createdAt, monitoringTool } }, data: { alert: { ...mockAlert, createdAt, monitoringTool } },
mountMethod: mount, mountMethod: mount,
stubs, stubs,
}); });
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment