This commit is contained in:
2022-02-24 19:17:33 +00:00
parent d75f1f5592
commit 1cbdb97d22
7 changed files with 507 additions and 9 deletions

View File

@@ -35,7 +35,7 @@
<v-icon class="mr-4">{{ icon }}</v-icon>
</template>
</template>
<v-toolbar-title> {{ translatedTitle }} </v-toolbar-title>
<v-toolbar-title> {{ displayTitle }} </v-toolbar-title>
<v-spacer></v-spacer>
<v-menu bottom left>
<template v-slot:activator="{ on, attrs }">
@@ -54,6 +54,18 @@
</v-list-item-content>
</v-list-item>
<v-list-item
v-if="showContextButton"
@click="$emit('dash-context', id)"
>
<v-list-item-icon>
<v-icon>$ayiCog</v-icon>
</v-list-item-icon>
<v-list-item-content>
<v-list-item-title>{{ $ay.t("Settings") }}</v-list-item-title>
</v-list-item-content>
</v-list-item>
<v-list-item v-if="hasAddUrl" :to="addUrl">
<v-list-item-icon>
<v-icon>$ayiPlus</v-icon>
@@ -120,6 +132,11 @@
</v-menu>
</v-toolbar>
</slot>
<slot name="settings">
<div>
settings
</div>
</slot>
<div v-if="hasError" class="mx-2 mt-4 d-flex align-center">
<v-alert
data-cy="dash-error"
@@ -157,12 +174,14 @@ export default {
},
title: { type: String, default: null },
showMoreButton: { type: Boolean, default: false },
showContextButton: { type: Boolean, default: false },
addUrl: { type: String, default: null },
count: { type: Number, default: 0 },
updateFrequency: { type: Number, default: 60000 },
maxListItems: { type: Number, default: 10 },
icon: { type: String, default: "$ayiTachometer" },
errorMessage: { type: String, default: null }
errorMessage: { type: String, default: null },
settings: { type: Object, default: null }
},
data() {
return {
@@ -173,8 +192,12 @@ export default {
hasAddUrl: function() {
return this.addUrl && this.addUrl != "";
},
translatedTitle() {
return this.$ay.t(this.title);
displayTitle() {
if (this.settings && this.settings.customTitle) {
return this.settings.customTitle;
} else {
return this.$ay.t(this.title);
}
},
hasError() {
return this.errorMessage != null && this.errorMessage.length > 0;
@@ -193,6 +216,9 @@ export default {
methods: {
refresh: function() {
this.$emit("dash-refresh");
},
showContext: function() {
this.$emit("dash-context");
}
}
};