forked from platypush/platypush
[UI] Show the connected/disconnected status in the Nav
icon.
This commit is contained in:
parent
f3c5c2fdfa
commit
38c5172316
4 changed files with 41 additions and 1 deletions
|
@ -181,6 +181,11 @@ export default {
|
||||||
created() {
|
created() {
|
||||||
bus.on('subscribe', this.subscribe)
|
bus.on('subscribe', this.subscribe)
|
||||||
bus.on('unsubscribe', this.unsubscribe)
|
bus.on('unsubscribe', this.unsubscribe)
|
||||||
|
|
||||||
|
this.$watch('opened', (open) => {
|
||||||
|
bus.emit(open ? 'connect' : 'disconnect')
|
||||||
|
})
|
||||||
|
|
||||||
this.init()
|
this.init()
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
|
@ -3,6 +3,9 @@
|
||||||
<div class="toggler" @click="collapsed = !collapsed">
|
<div class="toggler" @click="collapsed = !collapsed">
|
||||||
<i class="fas fa-bars" />
|
<i class="fas fa-bars" />
|
||||||
<span class="hostname" v-if="hostname" v-text="hostname" />
|
<span class="hostname" v-if="hostname" v-text="hostname" />
|
||||||
|
<i class="icon status fas fa-circle"
|
||||||
|
:class="{ok: connected, error: !connected}"
|
||||||
|
:title="connected ? 'Connected' : 'Disconnected'" />
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<ul class="plugins" v-if="selectedPanel === 'settings'">
|
<ul class="plugins" v-if="selectedPanel === 'settings'">
|
||||||
|
@ -76,6 +79,7 @@
|
||||||
import icons from '@/assets/icons.json'
|
import icons from '@/assets/icons.json'
|
||||||
import Utils from "@/Utils";
|
import Utils from "@/Utils";
|
||||||
import configSections from '@/components/panels/Settings/sections.json';
|
import configSections from '@/components/panels/Settings/sections.json';
|
||||||
|
import { bus } from "@/bus";
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: "Nav",
|
name: "Nav",
|
||||||
|
@ -137,11 +141,18 @@ export default {
|
||||||
|
|
||||||
return name
|
return name
|
||||||
},
|
},
|
||||||
|
|
||||||
|
setConnected(connected) {
|
||||||
|
return () => {
|
||||||
|
this.connected = connected
|
||||||
|
}
|
||||||
|
},
|
||||||
},
|
},
|
||||||
|
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
collapsed: true,
|
collapsed: true,
|
||||||
|
connected: false,
|
||||||
icons: icons,
|
icons: icons,
|
||||||
host: null,
|
host: null,
|
||||||
configSections: configSections,
|
configSections: configSections,
|
||||||
|
@ -150,6 +161,8 @@ export default {
|
||||||
|
|
||||||
mounted() {
|
mounted() {
|
||||||
this.collapsed = this.collapsedDefault
|
this.collapsed = this.collapsedDefault
|
||||||
|
bus.on('connect', this.setConnected(true))
|
||||||
|
bus.on('disconnect', this.setConnected(false))
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
@ -239,10 +252,26 @@ nav {
|
||||||
background: $nav-toggler-bg;
|
background: $nav-toggler-bg;
|
||||||
display: flex;
|
display: flex;
|
||||||
font-size: 1.5em;
|
font-size: 1.5em;
|
||||||
|
position: relative;
|
||||||
cursor: pointer;
|
cursor: pointer;
|
||||||
padding: 0.4em;
|
padding: 0.4em;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
box-shadow: $nav-toggler-shadow;
|
box-shadow: $nav-toggler-shadow;
|
||||||
|
|
||||||
|
.icon.status {
|
||||||
|
position: absolute;
|
||||||
|
top: calc($toggler-height / 2 + 0.3em);
|
||||||
|
right: 0.5em;
|
||||||
|
font-size: 0.5em;
|
||||||
|
|
||||||
|
&.ok {
|
||||||
|
color: $ok-fg;
|
||||||
|
}
|
||||||
|
|
||||||
|
&.error {
|
||||||
|
color: $error-fg;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
.hostname {
|
.hostname {
|
||||||
|
@ -328,6 +357,11 @@ nav {
|
||||||
background: $nav-toggler-collapsed-mobile-bg;
|
background: $nav-toggler-collapsed-mobile-bg;
|
||||||
color: $nav-toggler-collapsed-mobile-fg;
|
color: $nav-toggler-collapsed-mobile-fg;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.icon.status {
|
||||||
|
top: 0.75em;
|
||||||
|
left: 2em;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
.footer {
|
.footer {
|
||||||
|
|
|
@ -39,7 +39,7 @@
|
||||||
</span>
|
</span>
|
||||||
|
|
||||||
<span class="section center">
|
<span class="section center">
|
||||||
<div class="title" v-text="pluginDisplayName(group.name)" />
|
<div class="title" v-text="group.name" />
|
||||||
</span>
|
</span>
|
||||||
|
|
||||||
<span class="section right">
|
<span class="section right">
|
||||||
|
|
|
@ -6,6 +6,7 @@ $default-bg-4: #f1f3f2 !default;
|
||||||
$default-bg-5: #edf0ee !default;
|
$default-bg-5: #edf0ee !default;
|
||||||
$default-bg-6: #e4eae8 !default;
|
$default-bg-6: #e4eae8 !default;
|
||||||
$default-bg-7: #e4e4e4 !default;
|
$default-bg-7: #e4e4e4 !default;
|
||||||
|
$ok-fg: #17ad17 !default;
|
||||||
$error-fg: #ad1717 !default;
|
$error-fg: #ad1717 !default;
|
||||||
|
|
||||||
$default-fg: black !default;
|
$default-fg: black !default;
|
||||||
|
|
Loading…
Reference in a new issue