💄 Show no-access cursor when rebuild is disallowed by admin

This commit is contained in:
Alicia Sykes 2021-06-22 23:06:59 +01:00
parent 23e14662e5
commit e94ff4b952
3 changed files with 29 additions and 4 deletions

View File

@ -39,7 +39,7 @@
<p class="app-version">Dashy version {{ appVersion }}</p> <p class="app-version">Dashy version {{ appVersion }}</p>
<div class="config-note"> <div class="config-note">
<span> <span>
It is recommend to make a backup of your conf.yml file, before making any changes. It is recommend to make a backup of your conf.yml file before making changes.
</span> </span>
</div> </div>
</div> </div>
@ -129,7 +129,7 @@ export default {
this.$refs.tabView.activeTabItem({ tabItem: itemToSelect, byUser: true }); this.$refs.tabView.activeTabItem({ tabItem: itemToSelect, byUser: true });
}, },
goToCustomCss() { goToCustomCss() {
const itemToSelect = this.$refs.tabView.navItems[4]; const itemToSelect = this.$refs.tabView.navItems[3];
this.$refs.tabView.activeTabItem({ tabItem: itemToSelect, byUser: true }); this.$refs.tabView.activeTabItem({ tabItem: itemToSelect, byUser: true });
}, },
openRebuildAppModal() { openRebuildAppModal() {

View File

@ -8,10 +8,13 @@
This should happen automatically, but if it hasn't, you can manually trigger it here.<br> This should happen automatically, but if it hasn't, you can manually trigger it here.<br>
This is not required for modifications stored locally. This is not required for modifications stored locally.
</p> </p>
<Button :click="startBuild" :disabled="loading"> <Button :click="startBuild" :disabled="loading || !allowRebuild" :disallow="!allowRebuild">
<template v-slot:text>{{ loading ? 'Building...' : 'Start Build' }}</template> <template v-slot:text>{{ loading ? 'Building...' : 'Start Build' }}</template>
<template v-slot:icon><RebuildIcon /></template> <template v-slot:icon><RebuildIcon /></template>
</Button> </Button>
<div v-if="!allowRebuild">
<p class="disallow-rebuild-msg">You do no have permission to trigger this action</p>
</div>
<!-- Loading animation and text (shown while build is happening) --> <!-- Loading animation and text (shown while build is happening) -->
<div v-if="loading" class="loader-info"> <div v-if="loading" class="loader-info">
<LoadingAnimation class="loader" /> <LoadingAnimation class="loader" />
@ -45,6 +48,7 @@ import LoadingAnimation from '@/assets/interface-icons/loader.svg';
export default { export default {
name: 'RebuildApp', name: 'RebuildApp',
inject: ['config'],
components: { components: {
Button, Button,
RebuildIcon, RebuildIcon,
@ -58,6 +62,7 @@ export default {
error: '', error: '',
output: '', output: '',
message: '', message: '',
allowRebuild: true,
}), }),
methods: { methods: {
startBuild() { startBuild() {
@ -92,6 +97,15 @@ export default {
location.reload(); // eslint-disable-line no-restricted-globals location.reload(); // eslint-disable-line no-restricted-globals
}, },
}, },
mounted() {
if (this.config) {
if (this.config.appConfig) {
if (this.config.appConfig.allowConfigEdit === false) {
this.allowRebuild = false;
}
}
}
},
}; };
</script> </script>
@ -110,6 +124,13 @@ export default {
color: var(--config-settings-color); color: var(--config-settings-color);
} }
p.disallow-rebuild-msg {
color: var(--danger);
font-size: 1.2rem;
margin: 0.2rem auto;
text-align: center;
}
h3.rebuild-app-title { h3.rebuild-app-title {
text-align: center; text-align: center;
font-size: 2rem; font-size: 2rem;

View File

@ -1,5 +1,5 @@
<template> <template>
<button @click="click()" :disabled="disabled"> <button @click="click()" :disabled="disabled" :class="disallow ? 'disallowed': ''">
<slot></slot> <slot></slot>
<slot name="text"></slot> <slot name="text"></slot>
<slot name="icon"></slot> <slot name="icon"></slot>
@ -14,6 +14,7 @@ export default {
text: String, text: String,
click: Function, click: Function,
disabled: Boolean, disabled: Boolean,
disallow: Boolean,
}, },
}; };
</script> </script>
@ -38,6 +39,9 @@ button {
fill: currentColor; fill: currentColor;
} }
} }
&.disallowed {
cursor: not-allowed !important;
}
} }
/* Default visual settings, can be overridden when needed */ /* Default visual settings, can be overridden when needed */