Skip to content

Commit 479f9c4

Browse files
committed
Remove banner related changes
1 parent ca2207d commit 479f9c4

5 files changed

Lines changed: 22 additions & 57 deletions

File tree

ui/public/config.json

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,6 @@
88
}
99
],
1010
"docBase": "http://docs.cloudstack.apache.org/en/latest",
11-
"alertMessage": "",
12-
"alertMessageType": "info",
1311
"appTitle": "CloudStack",
1412
"footer": "Licensed under the <a href='http://www.apache.org/licenses/' target='_blank'>Apache License</a>, Version 2.0.",
1513
"loginTitle": "CloudStack",

ui/src/components/page/GlobalLayout.vue

Lines changed: 6 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -17,31 +17,11 @@
1717

1818
<template>
1919
<div>
20-
<a-affix v-if="alertCount > 0" >
21-
<a-alert
22-
v-if="this.$config.alertMessage && this.$config.alertMessage !== ''"
23-
:type="this.$config.alertMessageType ? this.$config.alertMessageType : 'info'"
24-
:showIcon="false"
25-
banner
26-
class="alertHeader"
27-
closable
28-
@close="closeCustomAlert()">
29-
<template #message>
30-
<span v-html="$config.alertMessage"></span>
31-
</template>
32-
</a-alert>
33-
34-
<a-alert
35-
v-if="this.$store.getters.shutdownTriggered"
36-
:message="$t('message.shutdown.triggered')"
37-
type="error"
38-
banner
39-
:showIcon="false"
40-
class="alertHeader" />
41-
20+
<a-affix v-if="this.$store.getters.shutdownTriggered" >
21+
<a-alert :message="$t('message.shutdown.triggered')" type="error" banner :showIcon="false" class="shutdownHeader" />
4222
</a-affix>
4323
<a-layout class="layout" :class="[device]">
44-
<a-affix style="z-index: 200" :offsetTop="alertCount * 25">
24+
<a-affix style="z-index: 200" :offsetTop="this.$store.getters.shutdownTriggered ? 25 : 0">
4525
<template v-if="isSideMenu()">
4626
<a-drawer
4727
v-if="isMobile()"
@@ -104,7 +84,7 @@
10484
<!-- layout header -->
10585
<a-affix style="z-index: 100">
10686
<global-header
107-
:style="'margin-top: ' + alertCount * 25 + 'px;'"
87+
:style="this.$store.getters.shutdownTriggered ? 'margin-top: 25px;' : null"
10888
:mode="layoutMode"
10989
:menus="menus"
11090
:theme="navTheme"
@@ -164,8 +144,7 @@ export default {
164144
collapsed: false,
165145
menus: [],
166146
showSetting: false,
167-
showClear: false,
168-
alertCount: 0
147+
showClear: false
169148
}
170149
},
171150
computed: {
@@ -224,7 +203,6 @@ export default {
224203
const readyForShutdownPollingJob = setInterval(this.checkShutdown, 5000)
225204
this.$store.commit('SET_READY_FOR_SHUTDOWN_POLLING_JOB', readyForShutdownPollingJob)
226205
}
227-
this.getNumberOfAlerts()
228206
},
229207
mounted () {
230208
const layoutMode = this.$config.theme['@layout-mode'] || 'light'
@@ -282,20 +260,6 @@ export default {
282260
api('readyForShutdown', {}).then(json => {
283261
this.$store.dispatch('SetShutdownTriggered', json.readyforshutdownresponse.readyforshutdown.shutdowntriggered || false)
284262
})
285-
},
286-
getNumberOfAlerts () {
287-
this.alertCount = 0
288-
if (this.$store.getters.shutdownTriggered) {
289-
this.alertCount++
290-
}
291-
if (this.$config.alertMessage && this.$config.alertMessage !== '') {
292-
this.alertCount++
293-
}
294-
return this.alertCount
295-
},
296-
closeCustomAlert () {
297-
this.$config.alertMessage = ''
298-
this.alertCount--
299263
}
300264
}
301265
}
@@ -343,7 +307,7 @@ export default {
343307
}
344308
}
345309
346-
.alertHeader {
310+
.shutdownHeader {
347311
font-weight: bold;
348312
height: 25px;
349313
text-align: center;

ui/src/store/getters.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,8 @@ const getters = {
3232
addRouters: state => state.permission.addRouters,
3333
multiTab: state => state.app.multiTab,
3434
listAllProjects: state => state.app.listAllProjects,
35+
bannerCount: state => state.user.bannerCount,
36+
customBanner: state => state.user.customBanner,
3537
headerNotices: state => state.user.headerNotices,
3638
isLdapEnabled: state => state.user.isLdapEnabled,
3739
cloudian: state => state.user.cloudian,

ui/src/store/modules/user.js

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,12 @@ const user = {
7272
twoFaProvider: '',
7373
twoFaIssuer: '',
7474
customHypervisorName: 'Custom',
75-
readyForShutdownPollingJob: ''
75+
readyForShutdownPollingJob: '',
76+
customBanner: {
77+
message: '',
78+
type: 'info',
79+
closed: false
80+
}
7681
},
7782

7883
mutations: {
@@ -224,6 +229,7 @@ const user = {
224229
commit('SET_LOGIN_FLAG', false)
225230
const latestVersion = vueProps.$localStorage.get(LATEST_CS_VERSION, { version: '', fetchedTs: 0 })
226231
commit('SET_LATEST_VERSION', latestVersion)
232+
console.log(vueProps.$config.alertMessage)
227233
notification.destroy()
228234

229235
resolve()
@@ -271,6 +277,8 @@ const user = {
271277
commit('SET_2FA_PROVIDER', result.providerfor2fa)
272278
commit('SET_2FA_ISSUER', result.issuerfor2fa)
273279
commit('SET_LOGIN_FLAG', false)
280+
const latestVersion = vueProps.$localStorage.get(LATEST_CS_VERSION, { version: '', fetchedTs: 0 })
281+
commit('SET_LATEST_VERSION', latestVersion)
274282
notification.destroy()
275283

276284
resolve()
@@ -411,6 +419,8 @@ const user = {
411419
commit('SET_CLOUDIAN', cloudian)
412420
}).catch(ignored => {
413421
})
422+
}).catch(error => {
423+
console.error(error)
414424
})
415425
},
416426

ui/src/views/AutogenView.vue

Lines changed: 3 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717

1818
<template>
1919
<div>
20-
<a-affix :offsetTop="78 + (getNumberOfAlerts() * 25)">
20+
<a-affix :offsetTop="this.$store.getters.shutdownTriggered ? 103 : 78">
2121
<a-card class="breadcrumb-card" style="z-index: 10">
2222
<a-row>
2323
<a-col :span="device === 'mobile' ? 24 : 12" style="padding-left: 12px; margin-top: 10px">
@@ -396,7 +396,8 @@
396396
<br />
397397
</a-modal>
398398
</div>
399-
<div :style="getNumberOfAlerts() > 0 ? 'margin-top: ' + getNumberOfAlerts() * 25 + 'px; margin-bottom: 12px' : null">
399+
400+
<div :style="this.$store.getters.shutdownTriggered ? 'margin-top: 24px; margin-bottom: 12px' : null">
400401
<div v-if="dataView">
401402
<slot name="resource" v-if="$route.path.startsWith('/quotasummary') || $route.path.startsWith('/publicip')"></slot>
402403
<resource-view
@@ -700,16 +701,6 @@ export default {
700701
}
701702
},
702703
methods: {
703-
getNumberOfAlerts () {
704-
let count = 0
705-
if (this.$store.getters.shutdownTriggered) {
706-
count++
707-
}
708-
if (this.$config.alertMessage && this.$config.alertMessage !== '') {
709-
count++
710-
}
711-
return count
712-
},
713704
getStyle () {
714705
if (['snapshot', 'vmsnapshot', 'publicip'].includes(this.$route.name)) {
715706
return 'table-cell'

0 commit comments

Comments
 (0)