2020-04-30 17:09:47 -04:00
|
|
|
<script>
|
2020-05-12 08:09:47 -04:00
|
|
|
import {
|
|
|
|
GlLoadingIcon,
|
|
|
|
GlNewDropdown,
|
|
|
|
GlNewDropdownItem,
|
|
|
|
GlTabs,
|
|
|
|
GlTab,
|
|
|
|
GlButton,
|
|
|
|
} from '@gitlab/ui';
|
2020-04-30 17:09:47 -04:00
|
|
|
import { s__ } from '~/locale';
|
2020-05-06 11:09:42 -04:00
|
|
|
import query from '../graphql/queries/details.query.graphql';
|
|
|
|
import { fetchPolicies } from '~/lib/graphql';
|
2020-05-08 14:09:55 -04:00
|
|
|
import glFeatureFlagsMixin from '~/vue_shared/mixins/gl_feature_flags_mixin';
|
2020-04-30 17:09:47 -04:00
|
|
|
|
|
|
|
export default {
|
2020-05-05 14:09:43 -04:00
|
|
|
statuses: {
|
|
|
|
triggered: s__('AlertManagement|Triggered'),
|
|
|
|
acknowledged: s__('AlertManagement|Acknowledged'),
|
|
|
|
resolved: s__('AlertManagement|Resolved'),
|
|
|
|
},
|
2020-04-30 17:09:47 -04:00
|
|
|
i18n: {
|
|
|
|
fullAlertDetailsTitle: s__('AlertManagement|Full Alert Details'),
|
|
|
|
overviewTitle: s__('AlertManagement|Overview'),
|
|
|
|
},
|
|
|
|
components: {
|
2020-05-12 08:09:47 -04:00
|
|
|
GlLoadingIcon,
|
2020-05-05 14:09:43 -04:00
|
|
|
GlNewDropdown,
|
|
|
|
GlNewDropdownItem,
|
2020-04-30 17:09:47 -04:00
|
|
|
GlTab,
|
|
|
|
GlTabs,
|
2020-05-08 14:09:55 -04:00
|
|
|
GlButton,
|
2020-04-30 17:09:47 -04:00
|
|
|
},
|
2020-05-08 14:09:55 -04:00
|
|
|
mixins: [glFeatureFlagsMixin()],
|
2020-05-06 11:09:42 -04:00
|
|
|
props: {
|
|
|
|
alertId: {
|
|
|
|
type: String,
|
|
|
|
required: true,
|
|
|
|
},
|
|
|
|
projectPath: {
|
|
|
|
type: String,
|
|
|
|
required: true,
|
|
|
|
},
|
2020-05-08 14:09:55 -04:00
|
|
|
newIssuePath: {
|
|
|
|
type: String,
|
|
|
|
required: true,
|
|
|
|
},
|
2020-05-06 11:09:42 -04:00
|
|
|
},
|
|
|
|
apollo: {
|
|
|
|
alert: {
|
|
|
|
fetchPolicy: fetchPolicies.CACHE_AND_NETWORK,
|
|
|
|
query,
|
|
|
|
variables() {
|
|
|
|
return {
|
|
|
|
fullPath: this.projectPath,
|
|
|
|
alertId: this.alertId,
|
|
|
|
};
|
|
|
|
},
|
|
|
|
update(data) {
|
|
|
|
return data?.project?.alertManagementAlerts?.nodes?.[0] ?? null;
|
|
|
|
},
|
|
|
|
},
|
|
|
|
},
|
|
|
|
data() {
|
|
|
|
return { alert: null };
|
|
|
|
},
|
2020-05-12 08:09:47 -04:00
|
|
|
computed: {
|
|
|
|
loading() {
|
|
|
|
return this.$apollo.queries.alert.loading;
|
|
|
|
},
|
|
|
|
},
|
2020-04-30 17:09:47 -04:00
|
|
|
};
|
|
|
|
</script>
|
|
|
|
<template>
|
|
|
|
<div>
|
2020-05-12 08:09:47 -04:00
|
|
|
<div v-if="loading"><gl-loading-icon size="lg" class="mt-3" /></div>
|
2020-05-08 14:09:55 -04:00
|
|
|
<div
|
|
|
|
v-if="alert"
|
|
|
|
class="gl-display-flex justify-content-end gl-border-b-1 gl-border-b-gray-200 gl-border-b-solid gl-p-4"
|
|
|
|
>
|
|
|
|
<gl-button
|
|
|
|
v-if="glFeatures.createIssueFromAlertEnabled"
|
|
|
|
data-testid="createIssueBtn"
|
|
|
|
:href="newIssuePath"
|
|
|
|
category="primary"
|
|
|
|
variant="success"
|
|
|
|
>
|
|
|
|
{{ s__('AlertManagement|Create issue') }}
|
|
|
|
</gl-button>
|
|
|
|
</div>
|
2020-05-12 08:09:47 -04:00
|
|
|
<div v-if="alert" class="gl-display-flex justify-content-end">
|
2020-05-08 14:09:55 -04:00
|
|
|
<gl-new-dropdown right>
|
2020-05-05 14:09:43 -04:00
|
|
|
<gl-new-dropdown-item
|
|
|
|
v-for="(label, field) in $options.statuses"
|
|
|
|
:key="field"
|
|
|
|
data-testid="statusDropdownItem"
|
|
|
|
class="align-middle"
|
|
|
|
>{{ label }}
|
|
|
|
</gl-new-dropdown-item>
|
|
|
|
</gl-new-dropdown>
|
|
|
|
</div>
|
2020-05-06 11:09:42 -04:00
|
|
|
<gl-tabs v-if="alert" data-testid="alertDetailsTabs">
|
|
|
|
<gl-tab data-testid="overviewTab" :title="$options.i18n.overviewTitle">
|
|
|
|
<ul class="pl-3">
|
|
|
|
<li data-testid="startTimeItem" class="font-weight-bold mb-3 mt-2">
|
|
|
|
{{ s__('AlertManagement|Start time:') }}
|
|
|
|
</li>
|
|
|
|
<li class="font-weight-bold my-3">
|
|
|
|
{{ s__('AlertManagement|End time:') }}
|
|
|
|
</li>
|
|
|
|
<li class="font-weight-bold my-3">
|
|
|
|
{{ s__('AlertManagement|Events:') }}
|
|
|
|
</li>
|
|
|
|
</ul>
|
|
|
|
</gl-tab>
|
|
|
|
<gl-tab data-testid="fullDetailsTab" :title="$options.i18n.fullAlertDetailsTitle" />
|
|
|
|
</gl-tabs>
|
2020-04-30 17:09:47 -04:00
|
|
|
</div>
|
|
|
|
</template>
|