Commit 40175854 authored by Mike Greiling's avatar Mike Greiling

Merge branch '353431' into 'master'

Update GlAlert in security dashboard table

See merge request gitlab-org/gitlab!82014
parents a1c99ac6 f9211802
<script> <script>
import { GlCollapse, GlEmptyState, GlFormCheckbox } from '@gitlab/ui'; import { GlAlert, GlCollapse, GlEmptyState, GlFormCheckbox } from '@gitlab/ui';
import { mapActions, mapState, mapGetters } from 'vuex'; import { mapActions, mapState, mapGetters } from 'vuex';
import Pagination from '~/vue_shared/components/pagination_links.vue'; import Pagination from '~/vue_shared/components/pagination_links.vue';
import SecurityDashboardTableRow from './security_dashboard_table_row.vue'; import SecurityDashboardTableRow from './security_dashboard_table_row.vue';
...@@ -8,6 +8,7 @@ import SelectionSummary from './selection_summary_vuex.vue'; ...@@ -8,6 +8,7 @@ import SelectionSummary from './selection_summary_vuex.vue';
export default { export default {
name: 'SecurityDashboardTable', name: 'SecurityDashboardTable',
components: { components: {
GlAlert,
GlCollapse, GlCollapse,
GlEmptyState, GlEmptyState,
GlFormCheckbox, GlFormCheckbox,
...@@ -88,17 +89,13 @@ export default { ...@@ -88,17 +89,13 @@ export default {
<div class="table-section section-20" role="rowheader"></div> <div class="table-section section-20" role="rowheader"></div>
</div> </div>
<div class="flash-container"> <gl-alert v-if="dashboardListError" variant="danger" :dismissible="false" class="gl-mt-3">
<div v-if="dashboardListError" class="flash-alert">
<div class="flash-text container-fluid container-limited limit-container-width">
{{ {{
s__( s__(
'SecurityReports|Error fetching the vulnerability list. Please check your network connection and try again.', 'SecurityReports|Error fetching the vulnerability list. Please check your network connection and try again.',
) )
}} }}
</div> </gl-alert>
</div>
</div>
<template v-if="isLoadingVulnerabilities || isDismissingVulnerabilities"> <template v-if="isLoadingVulnerabilities || isDismissingVulnerabilities">
<security-dashboard-table-row v-for="n in 10" :key="n" :is-loading="true" /> <security-dashboard-table-row v-for="n in 10" :key="n" :is-loading="true" />
......
import { GlEmptyState, GlFormCheckbox } from '@gitlab/ui'; import { GlAlert, GlEmptyState, GlFormCheckbox } from '@gitlab/ui';
import { shallowMount } from '@vue/test-utils'; import { shallowMount } from '@vue/test-utils';
import Vue from 'vue'; import Vue from 'vue';
import Vuex from 'vuex'; import Vuex from 'vuex';
...@@ -33,6 +33,8 @@ describe('Security Dashboard Table', () => { ...@@ -33,6 +33,8 @@ describe('Security Dashboard Table', () => {
}); });
const findCheckbox = () => wrapper.findComponent(GlFormCheckbox); const findCheckbox = () => wrapper.findComponent(GlFormCheckbox);
const findAlert = () => wrapper.findComponent(GlAlert);
const findEmptyState = () => wrapper.findComponent(GlEmptyState);
const findSelectionSummaryCollapse = () => wrapper.findByTestId('selection-summary-collapse'); const findSelectionSummaryCollapse = () => wrapper.findByTestId('selection-summary-collapse');
describe('while loading', () => { describe('while loading', () => {
...@@ -91,7 +93,7 @@ describe('Security Dashboard Table', () => { ...@@ -91,7 +93,7 @@ describe('Security Dashboard Table', () => {
}); });
it('should render the empty state', () => { it('should render the empty state', () => {
expect(wrapper.findComponent(GlEmptyState).exists()).toBe(true); expect(findEmptyState().exists()).toBe(true);
}); });
}); });
...@@ -101,11 +103,11 @@ describe('Security Dashboard Table', () => { ...@@ -101,11 +103,11 @@ describe('Security Dashboard Table', () => {
}); });
it('should not render the empty state', () => { it('should not render the empty state', () => {
expect(wrapper.findComponent(GlEmptyState).exists()).toBe(false); expect(findEmptyState().exists()).toBe(false);
}); });
it('should render the error alert', () => { it('should render the error alert', () => {
expect(wrapper.find('.flash-alert').exists()).toBe(true); expect(findAlert().exists()).toBe(true);
}); });
}); });
......
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