This commit is contained in:
2020-11-02 17:43:08 +00:00
parent 302c9f2d48
commit d081c6cfd7
3 changed files with 26 additions and 6 deletions

View File

@@ -55,7 +55,8 @@ todo: DASHBOARD
todo: need user dashboard setup registry and route
todo: if dashboard view is empty should be a string displayed saying nothing selected to show?
// Todo: intermediate actual types (try list first), how to instantiate them from here by id (dynamic)
// todo: do we need a PLUS menu item to add one of that type to that widget, i.e. if it's showing workorders then a plus to make a new wokorder would be useful

View File

@@ -1,6 +1,5 @@
<template>
<v-sheet color="white" elevation="4" height="300" style="overflow: hidden;">
<!-- todo: need type icon and badge with count options in title bar (badge is icon?) -->
<slot name="dash-title">
<v-toolbar flat dense>
<template v-if="hasUrl">
@@ -112,7 +111,11 @@
</template>
<script>
export default {
data: () => ({}),
data() {
return {
timer: ""
};
},
props: {
id: {
type: String,
@@ -124,11 +127,27 @@ export default {
updateFrequency: { type: Number, default: 60000 },
icon: { type: String, default: "$ayiTachometer" }
},
created() {
this.refresh();
if (this.updateFrequency > 0) {
this.timer = setInterval(() => {
this.refresh();
}, this.updateFrequency);
}
},
beforeDestroy() {
clearInterval(this.timer);
},
computed: {
hasUrl: function() {
return this.moreUrl && this.moreUrl != "";
}
},
methods: {}
methods: {
refresh: function() {
console.log("dash-base:refresh()", new Date());
this.$emit("dash-refresh", this.id);
}
}
};
</script>

View File

@@ -56,6 +56,7 @@
:count="0"
moreUrl="/home-dashboard"
icon="$ayiRobot"
:updateFrequency="15000"
v-on:dash-remove="dashRemove"
v-on:dash-move-start="dashMoveStart"
v-on:dash-move-back="dashMoveBack"
@@ -66,8 +67,7 @@
</v-col>
</v-row>
</template>
Todo: intermediate actual types (try list first), how to instantiate them from here by id (dynamic)
todo: do we need a PLUS menu item to add one of that type to that widget, i.e. if it's showing workorders then a plus to make a new wokorder would be useful
<script>
const FORM_KEY = "home-dashboard";
import DashRegistry from "../api/dash-registry";