Skip to content

Commit b1131fb

Browse files
author
utchoang
committed
change position of clear notification button
1 parent e74168c commit b1131fb

6 files changed

Lines changed: 52 additions & 22 deletions

File tree

ui/public/locales/en.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -570,7 +570,7 @@
570570
"label.cks.cluster.size": "Cluster size (Worker nodes)",
571571
"label.cleanup": "Clean up",
572572
"label.clear": "Clear",
573-
"label.clear.all.notify": "Clear all notification",
573+
"label.clear.notification": "Clear notification",
574574
"label.clear.list": "Clear list",
575575
"label.close": "Close",
576576
"label.cloud.console": "Cloud Management Console",

ui/src/components/header/UserMenu.vue

Lines changed: 0 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -18,10 +18,6 @@
1818
<template>
1919
<div class="user-menu">
2020

21-
<a-tooltip v-if="countNotify > 0" :title="$t('label.clear.all.notify')" class="action button-clear-notification" @click="clearAllNotify">
22-
<a-icon type="bell" class="bell-icon" />
23-
<a-icon type="stop" class="clear-icon" />
24-
</a-tooltip>
2521
<translation-menu class="action"/>
2622
<header-notice class="action"/>
2723
<label class="user-menu-server-info action" v-if="$config.multipleServer">
@@ -183,19 +179,4 @@ export default {
183179
}
184180
}
185181
}
186-
187-
.button-clear-notification {
188-
position: relative;
189-
190-
.bell-icon {
191-
position: absolute;
192-
left: 18px;
193-
font-size: 12px;
194-
}
195-
196-
.clear-icon {
197-
font-size: 20px;
198-
padding: 4px;
199-
}
200-
}
201182
</style>

ui/src/components/page/GlobalLayout.vue

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -91,6 +91,13 @@
9191
/>
9292
</a-affix>
9393

94+
<a-button
95+
v-if="showClear"
96+
type="default"
97+
size="small"
98+
class="button-clear-notification"
99+
@click="onClearNotification">{{ $t('label.clear.notification') }}</a-button>
100+
94101
<!-- layout content -->
95102
<a-layout-content class="layout-content" :class="{'is-header-fixed': fixedHeader}">
96103
<slot></slot>
@@ -128,7 +135,8 @@ export default {
128135
return {
129136
collapsed: false,
130137
menus: [],
131-
showSetting: false
138+
showSetting: false,
139+
showClear: false
132140
}
133141
},
134142
computed: {
@@ -161,6 +169,12 @@ export default {
161169
} else {
162170
document.body.classList.remove('dark-mode')
163171
}
172+
},
173+
'$store.getters.countNotify' (countNotify) {
174+
this.showClear = false
175+
if (countNotify && countNotify > 0) {
176+
this.showClear = true
177+
}
164178
}
165179
},
166180
provide: function () {
@@ -212,6 +226,10 @@ export default {
212226
},
213227
toggleSetting (showSetting) {
214228
this.showSetting = showSetting
229+
},
230+
onClearNotification () {
231+
this.$notification.destroy()
232+
this.$store.commit('SET_COUNT_NOTIFY', 0)
215233
}
216234
}
217235
}

ui/src/layouts/UserLayout.vue

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,12 @@
1717

1818
<template>
1919
<div id="userLayout" :class="['user-layout', device]">
20+
<a-button
21+
v-if="showClear"
22+
type="default"
23+
size="small"
24+
class="button-clear-notification"
25+
@click="onClearNotification">{{ $t('label.clear.notification') }}</a-button>
2026
<div class="user-layout-container">
2127
<div class="user-layout-header">
2228
<img
@@ -45,7 +51,9 @@ export default {
4551
components: { RouteView },
4652
mixins: [mixinDevice],
4753
data () {
48-
return {}
54+
return {
55+
showClear: false
56+
}
4957
},
5058
watch: {
5159
'$store.getters.darkMode' (darkMode) {
@@ -54,6 +62,12 @@ export default {
5462
} else {
5563
document.body.classList.remove('dark-mode')
5664
}
65+
},
66+
'$store.getters.countNotify' (countNotify) {
67+
this.showClear = false
68+
if (countNotify && countNotify > 0) {
69+
this.showClear = true
70+
}
5771
}
5872
},
5973
mounted () {
@@ -66,6 +80,12 @@ export default {
6680
beforeDestroy () {
6781
document.body.classList.remove('userLayout')
6882
document.body.classList.remove('dark-mode')
83+
},
84+
methods: {
85+
onClearNotification () {
86+
this.$notification.destroy()
87+
this.$store.commit('SET_COUNT_NOTIFY', 0)
88+
}
6989
}
7090
}
7191
</script>

ui/src/style/dark-mode.less

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -901,4 +901,8 @@
901901
.ant-empty-normal {
902902
color: @dark-text-color-3;
903903
}
904+
905+
.button-clear-notification {
906+
background-color: @dark-secondary-bgColor;
907+
}
904908
}

ui/src/style/vars.less

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -344,3 +344,10 @@ a {
344344
border-color: @primary-color;
345345
}
346346
}
347+
348+
.button-clear-notification {
349+
position: fixed;
350+
right: 287px;
351+
top: 35px;
352+
z-index: 1001;
353+
}

0 commit comments

Comments
 (0)