Commit adf7d0c8 authored by Sam Beckham's avatar Sam Beckham Committed by Phil Hughes

Resolve "Empty state shown when the group security dashboard request fails"

parent 98141f84
...@@ -22,8 +22,22 @@ export default { ...@@ -22,8 +22,22 @@ export default {
}, },
}, },
computed: { computed: {
...mapState('vulnerabilities', ['vulnerabilities', 'pageInfo', 'isLoadingVulnerabilities']), ...mapState('vulnerabilities', [
'errorLoadingVulnerabilities',
'errorLoadingVulnerabilitiesCount',
'isLoadingVulnerabilities',
'pageInfo',
'vulnerabilities',
]),
...mapGetters('vulnerabilities', ['dashboardListError']), ...mapGetters('vulnerabilities', ['dashboardListError']),
showEmptyState() {
return (
this.vulnerabilities &&
!this.vulnerabilities.length &&
!this.errorLoadingVulnerabilities &&
!this.errorLoadingVulnerabilitiesCount
);
},
showPagination() { showPagination() {
return this.pageInfo && this.pageInfo.total; return this.pageInfo && this.pageInfo.total;
}, },
...@@ -72,7 +86,7 @@ export default { ...@@ -72,7 +86,7 @@ export default {
/> />
<empty-state <empty-state
v-if="!vulnerabilities.length" v-if="showEmptyState"
:svg-path="emptyStateSvgPath" :svg-path="emptyStateSvgPath"
:link="dashboardDocumentation" :link="dashboardDocumentation"
/> />
......
---
title: Prevents the empty state from showing when the dashboard errors
merge_request: 8703
author:
type: fixed
...@@ -78,4 +78,29 @@ describe('Security Dashboard Table', () => { ...@@ -78,4 +78,29 @@ describe('Security Dashboard Table', () => {
.catch(done.fail); .catch(done.fail);
}); });
}); });
describe('on error', () => {
beforeEach(() => {
mock.onGet(vulnerabilitiesEndpoint).replyOnce(404, []);
vm = mountComponentWithStore(Component, { store, props });
});
it('should not render the empty state', done => {
waitForPromises()
.then(() => {
expect(vm.$el.querySelector('.empty-state')).toBeNull();
done();
})
.catch(done.fail);
});
it('should render the error alert', done => {
waitForPromises()
.then(() => {
expect(vm.$el.querySelector('.flash-alert')).not.toBeNull();
done();
})
.catch(done.fail);
});
});
}); });
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