Skip to content

Commit

Permalink
ui: remove snackbar_bar in instructions load
Browse files Browse the repository at this point in the history
  • Loading branch information
noreng-jg authored and gustavosbarreto committed Jan 22, 2021
1 parent 3e08402 commit 9ea8eb6
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 2 deletions.
4 changes: 3 additions & 1 deletion ui/src/App.vue
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,9 @@
</v-icon>
</v-chip>

<Notification />
<Notification
:in-a-namespace="hasNamespaces"
/>

<v-menu
offset-y
Expand Down
2 changes: 1 addition & 1 deletion ui/src/components/app_bar/namespace/NamespaceMenu.vue
Original file line number Diff line number Diff line change
Expand Up @@ -254,7 +254,7 @@ export default {
await this.$store.dispatch('namespaces/fetch');
} catch (e) {
switch (true) {
case (!this.inANamespace): { // dialog pops
case (!this.inANamespace && e.response.status === 403): { // dialog pops
break;
}
case (e.response.status === 403): {
Expand Down
10 changes: 10 additions & 0 deletions ui/src/components/app_bar/notification/Notification.vue
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,13 @@ export default {
DeviceActionButton,
},
props: {
inANamespace: {
type: Boolean,
required: true,
},
},
data() {
return {
listNotifications: [],
Expand Down Expand Up @@ -128,6 +135,9 @@ export default {
await this.$store.dispatch('notifications/fetch');
} catch (e) {
switch (true) {
case (!this.inANamespace && e.response.status === 403): { // dialog pops
break;
}
case (e.response.status === 403): {
this.$store.dispatch('snackbar/showSnackbarErrorAssociation');
break;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ describe('Notification', () => {
localVue.use(Vuex);

let wrapper;
const inANamespace = false;

const numberNotifications = 2;
const noNotifications = Array(0);
Expand Down Expand Up @@ -86,6 +87,7 @@ describe('Notification', () => {
store,
localVue,
stubs: ['fragment', 'router-link'],
propsData: { inANamespace },
});
});

Expand All @@ -106,8 +108,12 @@ describe('Notification', () => {
store: storeNoNotifications,
localVue,
stubs: ['fragment', 'router-link'],
propsData: { inANamespace },
});
expect(wrapper.find('[data-test="noNotifications"]').exists()).toEqual(true);
expect(wrapper.find('[data-test="noNotifications"]').text()).toEqual('You don\'t have notifications');
});
it('Receives data in props', () => {
expect(wrapper.vm.inANamespace).toEqual(inANamespace);
});
});

0 comments on commit 9ea8eb6

Please sign in to comment.