Added toggle for tag visibility

This commit is contained in:
Jasper Miller-Waugh
2021-10-29 18:19:24 +13:00
parent 24664cde2c
commit b32bfb3ff1
2 changed files with 44 additions and 5 deletions

View File

@@ -77,6 +77,16 @@
<font-awesome-icon icon="save" />
{{ $t("Switch to Dark Theme") }}
</button>
<button v-if="tagsVisible == 'hidden'" class="btn btn-secondary me-2" @click="changeTagsVisibilty('visible')">
<font-awesome-icon icon="eye" />
{{ $t("Show Tags") }}
</button>
<button v-if="tagsVisible == 'visible'" class="btn btn-secondary me-2" @click="changeTagsVisibilty('hidden')">
<font-awesome-icon icon="eye-slash" />
{{ $t("Hide Tags") }}
</button>
</div>
</div>
@@ -292,6 +302,10 @@ export default {
return this.config.statusPageTheme;
},
tagsVisible() {
return this.config.statusPageTags
},
logoClass() {
if (this.editMode) {
return {
@@ -472,6 +486,23 @@ export default {
changeTheme(name) {
this.config.statusPageTheme = name;
},
changeTagsVisibilty(newState) {
this.config.statusPageTags = newState;
// On load, if the status page will not include tags if it's not enabled for security reasons
// Which means if we enable tags, it won't show in the UI until saved
// So we have this to enhance UX and load in the tags from the authenticated source instantly
this.$root.publicGroupList = this.$root.publicGroupList.map((group)=>{
return {...group,
monitorList: group.monitorList.map((monitor)=> {
// We only include the tags if visible so we can reuse the logic to hide the tags on disable
return {...monitor,
tags: newState==="visible" ? this.$root.monitorList[monitor.id].tags : []
}
})
}
});
},
/**
* Crop Success