Commit 496c0251 authored by Ezekiel Kigbo's avatar Ezekiel Kigbo

Merge branch '290959-threat-monitoring-empty-state' into 'master'

Update empty state to match designs

See merge request gitlab-org/gitlab!50894
parents df1a1bc5 285dbf55
<script> <script>
import { mapActions } from 'vuex'; import { mapActions } from 'vuex';
import { GlAlert, GlEmptyState, GlIcon, GlLink, GlPopover, GlTabs, GlTab } from '@gitlab/ui'; import {
GlAlert,
GlEmptyState,
GlIcon,
GlLink,
GlPopover,
GlSprintf,
GlTabs,
GlTab,
} from '@gitlab/ui';
import { s__ } from '~/locale'; import { s__ } from '~/locale';
import axios from '~/lib/utils/axios_utils'; import axios from '~/lib/utils/axios_utils';
import glFeatureFlagsMixin from '~/vue_shared/mixins/gl_feature_flags_mixin'; import glFeatureFlagsMixin from '~/vue_shared/mixins/gl_feature_flags_mixin';
...@@ -17,6 +26,7 @@ export default { ...@@ -17,6 +26,7 @@ export default {
GlIcon, GlIcon,
GlLink, GlLink,
GlPopover, GlPopover,
GlSprintf,
GlTabs, GlTabs,
GlTab, GlTab,
Alerts, Alerts,
...@@ -114,7 +124,7 @@ export default { ...@@ -114,7 +124,7 @@ export default {
), ),
emptyStateDescription: s__( emptyStateDescription: s__(
`ThreatMonitoring|To view this data, ensure you have configured an environment `ThreatMonitoring|To view this data, ensure you have configured an environment
for this project and that at least one threat monitoring feature is enabled.`, for this project and that at least one threat monitoring feature is enabled. %{linkStart}More information%{linkEnd}`,
), ),
alertText: s__( alertText: s__(
`ThreatMonitoring|The graph below is an overview of traffic coming to your `ThreatMonitoring|The graph below is an overview of traffic coming to your
...@@ -132,11 +142,16 @@ export default { ...@@ -132,11 +142,16 @@ export default {
v-if="!isSetUpMaybe" v-if="!isSetUpMaybe"
ref="emptyState" ref="emptyState"
:title="s__('ThreatMonitoring|No environments detected')" :title="s__('ThreatMonitoring|No environments detected')"
:description="$options.emptyStateDescription"
:svg-path="emptyStateSvgPath" :svg-path="emptyStateSvgPath"
:primary-button-link="documentationPath" >
:primary-button-text="__('More information')" <template #description>
/> <gl-sprintf :message="$options.emptyStateDescription">
<template #link="{ content }">
<gl-link :href="documentationPath" target="_blank">{{ content }}</gl-link>
</template>
</gl-sprintf>
</template>
</gl-empty-state>
<section v-else> <section v-else>
<gl-alert <gl-alert
......
---
title: Replace button in Threat Monitoring empty state with a link
merge_request: 50894
author:
type: changed
import { GlAlert } from '@gitlab/ui'; import { GlAlert, GlSprintf } from '@gitlab/ui';
import { shallowMount } from '@vue/test-utils'; import { shallowMount } from '@vue/test-utils';
import MockAdapter from 'axios-mock-adapter'; import MockAdapter from 'axios-mock-adapter';
import ThreatMonitoringAlerts from 'ee/threat_monitoring/components/alerts/alerts.vue'; import ThreatMonitoringAlerts from 'ee/threat_monitoring/components/alerts/alerts.vue';
...@@ -65,6 +65,7 @@ describe('ThreatMonitoringApp component', () => { ...@@ -65,6 +65,7 @@ describe('ThreatMonitoringApp component', () => {
const findWafSection = () => wrapper.find({ ref: 'wafSection' }); const findWafSection = () => wrapper.find({ ref: 'wafSection' });
const findNetworkPolicySection = () => wrapper.find({ ref: 'networkPolicySection' }); const findNetworkPolicySection = () => wrapper.find({ ref: 'networkPolicySection' });
const findEmptyState = () => wrapper.find({ ref: 'emptyState' }); const findEmptyState = () => wrapper.find({ ref: 'emptyState' });
const findEmptyStateMessage = () => wrapper.find(GlSprintf);
const findNetworkPolicyTab = () => wrapper.find({ ref: 'networkPolicyTab' }); const findNetworkPolicyTab = () => wrapper.find({ ref: 'networkPolicyTab' });
const findAlertTab = () => wrapper.find('[data-testid="threat-monitoring-alerts-tab"]'); const findAlertTab = () => wrapper.find('[data-testid="threat-monitoring-alerts-tab"]');
...@@ -91,9 +92,9 @@ describe('ThreatMonitoringApp component', () => { ...@@ -91,9 +92,9 @@ describe('ThreatMonitoringApp component', () => {
it('shows only the empty state', () => { it('shows only the empty state', () => {
const emptyState = findEmptyState(); const emptyState = findEmptyState();
expect(wrapper.element).toBe(emptyState.element); expect(wrapper.element).toBe(emptyState.element);
expect(findEmptyStateMessage().exists()).toBe(true);
expect(emptyState.props()).toMatchObject({ expect(emptyState.props()).toMatchObject({
svgPath: emptyStateSvgPath, svgPath: emptyStateSvgPath,
primaryButtonLink: documentationPath,
}); });
}); });
}, },
......
...@@ -29037,7 +29037,7 @@ msgstr "" ...@@ -29037,7 +29037,7 @@ msgstr ""
msgid "ThreatMonitoring|Time" msgid "ThreatMonitoring|Time"
msgstr "" msgstr ""
msgid "ThreatMonitoring|To view this data, ensure you have configured an environment for this project and that at least one threat monitoring feature is enabled." msgid "ThreatMonitoring|To view this data, ensure you have configured an environment for this project and that at least one threat monitoring feature is enabled. %{linkStart}More information%{linkEnd}"
msgstr "" msgstr ""
msgid "ThreatMonitoring|Total Packets" msgid "ThreatMonitoring|Total Packets"
......
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