Add ability to dismiss pilot notification
This commit is contained in:
parent
b67a7215f6
commit
54b94f29e1
2 changed files with 41 additions and 8 deletions
|
@ -1,8 +1,8 @@
|
||||||
<template>
|
<template>
|
||||||
<transition name="slide" v-if="!instanceIsRegistered && isOnline">
|
<transition name="slide" v-if="!instanceIsRegistered && isOnline && !platformNotificationIsHidden">
|
||||||
<section class="app-section">
|
<section class="app-section">
|
||||||
<div class="app-section-wrap app-boxed app-boxed-xl q-pl-md q-pr-md q-pt-xl q-pb-lg">
|
<div class="app-section-wrap app-boxed app-boxed-xl q-pl-md q-pr-md q-pt-md">
|
||||||
<div class="platform-notification">
|
<div class="platform-notification q-pl-lg q-pr-lg q-pt-md q-pb-md">
|
||||||
<p>
|
<p>
|
||||||
<q-avatar color="accent" text-color="white" class="icon">
|
<q-avatar color="accent" text-color="white" class="icon">
|
||||||
<q-icon name="eva-alert-circle" />
|
<q-icon name="eva-alert-circle" />
|
||||||
|
@ -10,6 +10,7 @@
|
||||||
This Traefik Instance is not registered in your Traefik Pilot account yet.
|
This Traefik Instance is not registered in your Traefik Pilot account yet.
|
||||||
</p>
|
</p>
|
||||||
<platform-action-button label="Register Traefik instance" @click="openPlatform" />
|
<platform-action-button label="Register Traefik instance" @click="openPlatform" />
|
||||||
|
<q-btn round size="xs" color="accent" icon="close" class="btn close-btn" @click="hidePlatformNotification"></q-btn>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</section>
|
</section>
|
||||||
|
@ -25,9 +26,17 @@ export default {
|
||||||
components: { PlatformActionButton },
|
components: { PlatformActionButton },
|
||||||
created () {
|
created () {
|
||||||
this.getInstanceInfos()
|
this.getInstanceInfos()
|
||||||
|
console.log(`localStorage.getItem('platform_notification-is-hidden')`, localStorage.getItem('platform_notification-is-hidden'))
|
||||||
|
try {
|
||||||
|
if (localStorage.getItem('platform_notification-is-hidden') === 'true') {
|
||||||
|
this.hidePlatformNotification()
|
||||||
|
}
|
||||||
|
} catch (e) {
|
||||||
|
console.error('error reading localStorage', e)
|
||||||
|
}
|
||||||
},
|
},
|
||||||
computed: {
|
computed: {
|
||||||
...mapGetters('platform', { isPlatformOpen: 'isOpen' }),
|
...mapGetters('platform', { isPlatformOpen: 'isOpen', platformNotificationIsHidden: 'notificationIsHidden' }),
|
||||||
...mapGetters('core', { instanceInfos: 'version' }),
|
...mapGetters('core', { instanceInfos: 'version' }),
|
||||||
instanceIsRegistered () {
|
instanceIsRegistered () {
|
||||||
return !!(this.instanceInfos && this.instanceInfos.uuid && this.instanceInfos.uuid.length > 0)
|
return !!(this.instanceInfos && this.instanceInfos.uuid && this.instanceInfos.uuid.length > 0)
|
||||||
|
@ -37,7 +46,7 @@ export default {
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
...mapActions('platform', { openPlatform: 'open' }),
|
...mapActions('platform', { openPlatform: 'open', hidePlatformNotification: 'hideNotification' }),
|
||||||
...mapActions('core', { getInstanceInfos: 'getVersion' })
|
...mapActions('core', { getInstanceInfos: 'getVersion' })
|
||||||
},
|
},
|
||||||
watch: {
|
watch: {
|
||||||
|
@ -46,6 +55,15 @@ export default {
|
||||||
if (isClosed) {
|
if (isClosed) {
|
||||||
this.getInstanceInfos()
|
this.getInstanceInfos()
|
||||||
}
|
}
|
||||||
|
},
|
||||||
|
platformNotificationIsHidden (newValue, oldValue) {
|
||||||
|
if (newValue !== oldValue) {
|
||||||
|
try {
|
||||||
|
localStorage.setItem('platform_notification-is-hidden', newValue ? 'true' : 'false')
|
||||||
|
} catch (e) {
|
||||||
|
console.error('error writing localStorage', e)
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -55,8 +73,7 @@ export default {
|
||||||
@import "../../css/sass/variables";
|
@import "../../css/sass/variables";
|
||||||
|
|
||||||
.platform-notification {
|
.platform-notification {
|
||||||
min-height: 100px;
|
position: relative;
|
||||||
padding: 40px 36px;
|
|
||||||
display: flex;
|
display: flex;
|
||||||
justify-content: space-between;
|
justify-content: space-between;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
|
@ -66,6 +83,12 @@ export default {
|
||||||
font-size: 16px;
|
font-size: 16px;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.close-btn {
|
||||||
|
position: absolute;
|
||||||
|
top: -8px;
|
||||||
|
right: -8px;
|
||||||
|
}
|
||||||
|
|
||||||
p {
|
p {
|
||||||
margin: 0;
|
margin: 0;
|
||||||
}
|
}
|
||||||
|
|
|
@ -3,11 +3,17 @@ export default {
|
||||||
getters: {
|
getters: {
|
||||||
isOpen (state) {
|
isOpen (state) {
|
||||||
return state.isOpen
|
return state.isOpen
|
||||||
|
},
|
||||||
|
notificationIsHidden (state) {
|
||||||
|
return state.notificationIsHidden
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
mutations: {
|
mutations: {
|
||||||
toggle (state, isOpen) {
|
toggle (state, isOpen) {
|
||||||
state.isOpen = isOpen || !state.isOpen
|
state.isOpen = isOpen || !state.isOpen
|
||||||
|
},
|
||||||
|
toggleNotifVisibility (state, isHidden) {
|
||||||
|
state.notificationIsHidden = isHidden || !state.isHidden
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
actions: {
|
actions: {
|
||||||
|
@ -19,9 +25,13 @@ export default {
|
||||||
},
|
},
|
||||||
close ({ commit }) {
|
close ({ commit }) {
|
||||||
commit('toggle', false)
|
commit('toggle', false)
|
||||||
|
},
|
||||||
|
hideNotification ({ commit }) {
|
||||||
|
commit('toggleNotifVisibility', true)
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
state: {
|
state: {
|
||||||
isOpen: false
|
isOpen: false,
|
||||||
|
notificationIsHidden: false
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue