This commit is contained in:
@@ -44,8 +44,8 @@
|
||||
</v-row>
|
||||
<v-row>
|
||||
<v-col
|
||||
v-for="(item, i) in effectiveView"
|
||||
:key="i"
|
||||
v-for="item in effectiveView"
|
||||
:key="item.id"
|
||||
class="d-flex child-flex"
|
||||
cols="12"
|
||||
sm="6"
|
||||
@@ -54,7 +54,6 @@
|
||||
>
|
||||
<component
|
||||
:is="item.type"
|
||||
:ref="item.ref"
|
||||
v-bind="item"
|
||||
:max-list-items="10"
|
||||
@dash-remove="dashRemove"
|
||||
@@ -214,16 +213,31 @@ export default {
|
||||
},
|
||||
addItem: function(item) {
|
||||
this.showSelector = false;
|
||||
item.ref = "db" + Date.now();
|
||||
this.effectiveView.push(item);
|
||||
const newItem = JSON.parse(JSON.stringify(item));
|
||||
newItem.id = Date.now();
|
||||
this.effectiveView.push(newItem);
|
||||
this.saveView();
|
||||
},
|
||||
availableItems: function() {
|
||||
const allItems = DashRegistry.availableItems();
|
||||
const newItems = allItems.filter(
|
||||
z => !this.effectiveView.find(m => m.id == z.id && z.singleOnly)
|
||||
);
|
||||
return newItems;
|
||||
// console.log("availableItems:allItems", JSON.stringify(allItems));
|
||||
// console.log(
|
||||
// "availableItems:effectiveView",
|
||||
// JSON.stringify(this.effectiveView)
|
||||
// );
|
||||
const ret = [];
|
||||
allItems.forEach(z => {
|
||||
if (!z.singleOnly) {
|
||||
ret.push(z);
|
||||
} else {
|
||||
if (this.effectiveView.findIndex(m => m.type == z.type) == -1) {
|
||||
ret.push(z);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
// console.log("availableItems:ret", JSON.stringify(ret));
|
||||
return ret;
|
||||
},
|
||||
async getDataFromApi() {
|
||||
const vm = this;
|
||||
@@ -246,7 +260,7 @@ export default {
|
||||
const availableItems = DashRegistry.availableItems();
|
||||
//filter out any that are deprecated or no longer accessible due to role change
|
||||
const allowedView = savedView.filter(z =>
|
||||
availableItems.find(m => m.id == z.id)
|
||||
availableItems.find(m => m.type == z.type)
|
||||
);
|
||||
vm.effectiveView = allowedView;
|
||||
generateMenu(vm);
|
||||
|
||||
Reference in New Issue
Block a user