This commit is contained in:
2020-11-02 19:37:46 +00:00
parent f9a429ce5d
commit cf2607d356
4 changed files with 75 additions and 20 deletions

View File

@@ -16,17 +16,17 @@ todo: DASHBOARD
See notes there See notes there
ELEMENTS ELEMENTS
dash ui items that can self update and display properly in any form factor dash ui items that can self update and display properly in any form factor
central dash registry - collection of dash ui items, the roles they are available for, their unique ID's Xcentral dash registry - collection of dash ui items, the roles they are available for, their unique ID's
stored at *client* statically, (server prevents out of role access to data anyway) stored at *client* statically, (server prevents out of role access to data anyway)
[{id:(unique id, probably human readable 'tag-dash-format'),roles:[role array available to]}] [{id:(unique id, probably human readable 'tag-dash-format'),roles:[role array available to]}]
User dash registry - user's selected dash widgets to display and the order to display them in plus any unique settings to each one XUser dash registry - user's selected dash widgets to display and the order to display them in plus any unique settings to each one
Index in array is their display order Index in array is their display order
[{id:(unique dashitem id),settings:{refreshfrequencymaybe:22,other:'setting'}},{id:(second item id)}] [{id:(unique dashitem id),settings:{refreshfrequencymaybe:22,other:'setting'}},{id:(second item id)}]
dashboard host page dashboard host page
iterates user registry, instantiates the dash items in order desired if user is in allowed role (user may have changed roles) iterates user registry, instantiates the dash items in order desired if user is in allowed role (user may have changed roles)
handles removal, re-ordering events handles removal, re-ordering events
dashboard selection UI Xdashboard selection UI
UI accessed from dashboard menu allowing user to add widgets XUI accessed from dashboard menu allowing user to add widgets
todo: wireframe / mockup dashboard item objects todo: wireframe / mockup dashboard item objects
mockup dash items with all commonality built in, better to start mocking up now than try to design perfectly in advance and then implement mockup dash items with all commonality built in, better to start mocking up now than try to design perfectly in advance and then implement

View File

@@ -2,72 +2,97 @@ import authorizationroles from "./authorizationroles";
let role = authorizationroles.AUTHORIZATION_ROLES; let role = authorizationroles.AUTHORIZATION_ROLES;
export default { export default {
registry: { registry: {
TestWidgetsPriciest: {
roles: [
role.BizAdminFull,
role.BizAdminLimited,
role.SalesFull,
role.SalesLimited
],
title: "Priciest widgets",
type: "GzDashTestWidgetsPriciest"
},
dashBizOnlyTest: { dashBizOnlyTest: {
roles: [role.BizAdminFull, role.BizAdminLimited], roles: [role.BizAdminFull, role.BizAdminLimited],
title: "Biz only test item" title: "Biz only test item",
type: "GzDashBase"
}, },
dashTechOnlyTest: { dashTechOnlyTest: {
roles: [role.TechFull, role.TechLimited], roles: [role.TechFull, role.TechLimited],
title: "Tech only test item" title: "Tech only test item",
type: "GzDashBase"
}, },
dashSalesOnlyTest: { dashSalesOnlyTest: {
roles: [role.SalesFull, role.SalesLimited], roles: [role.SalesFull, role.SalesLimited],
title: "Sales only test item" title: "Sales only test item",
type: "GzDashBase"
}, },
dashBizOnlyTest1: { dashBizOnlyTest1: {
roles: [role.BizAdminFull, role.BizAdminLimited], roles: [role.BizAdminFull, role.BizAdminLimited],
title: "1Biz only test item" title: "1Biz only test item",
type: "GzDashBase"
}, },
dashTechOnlyTest1: { dashTechOnlyTest1: {
roles: [role.TechFull, role.TechLimited], roles: [role.TechFull, role.TechLimited],
title: "1Tech only test item" title: "1Tech only test item",
type: "GzDashBase"
}, },
dashSalesOnlyTest1: { dashSalesOnlyTest1: {
roles: [role.SalesFull, role.SalesLimited], roles: [role.SalesFull, role.SalesLimited],
title: "1Sales only test item" title: "1Sales only test item",
type: "GzDashBase"
}, },
dashBizOnlyTest2: { dashBizOnlyTest2: {
roles: [role.BizAdminFull, role.BizAdminLimited], roles: [role.BizAdminFull, role.BizAdminLimited],
title: "2Biz only test item" title: "2Biz only test item",
type: "GzDashBase"
}, },
dashTechOnlyTest2: { dashTechOnlyTest2: {
roles: [role.TechFull, role.TechLimited], roles: [role.TechFull, role.TechLimited],
title: "2Tech only test item" title: "2Tech only test item",
type: "GzDashBase"
}, },
dashSalesOnlyTest2: { dashSalesOnlyTest2: {
roles: [role.SalesFull, role.SalesLimited], roles: [role.SalesFull, role.SalesLimited],
title: "2Sales only test item" title: "2Sales only test item",
type: "GzDashBase"
}, },
dashBizOnlyTest3: { dashBizOnlyTest3: {
roles: [role.BizAdminFull, role.BizAdminLimited], roles: [role.BizAdminFull, role.BizAdminLimited],
title: "3Biz only test item" title: "3Biz only test item",
type: "GzDashBase"
}, },
dashTechOnlyTest3: { dashTechOnlyTest3: {
roles: [role.TechFull, role.TechLimited], roles: [role.TechFull, role.TechLimited],
title: "3Tech only test item" title: "3Tech only test item",
type: "GzDashBase"
}, },
dashSalesOnlyTest3: { dashSalesOnlyTest3: {
roles: [role.SalesFull, role.SalesLimited], roles: [role.SalesFull, role.SalesLimited],
title: "3Sales only test item" title: "3Sales only test item",
type: "GzDashBase"
}, },
dashBizOnlyTest4: { dashBizOnlyTest4: {
roles: [role.BizAdminFull, role.BizAdminLimited], roles: [role.BizAdminFull, role.BizAdminLimited],
title: "4Biz only test item" title: "4Biz only test item",
type: "GzDashBase"
}, },
dashTechOnlyTest4: { dashTechOnlyTest4: {
roles: [role.TechFull, role.TechLimited], roles: [role.TechFull, role.TechLimited],
title: "4Tech only test item" title: "4Tech only test item",
type: "GzDashBase"
}, },
dashSalesOnlyTest: { dashSalesOnlyTest: {
roles: [role.SalesFull, role.SalesLimited], roles: [role.SalesFull, role.SalesLimited],
title: "4Sales only test item" title: "4Sales only test item",
type: "GzDashBase"
} }
}, },
availableItems() { availableItems() {
let ret = []; let ret = [];
for (const [key, value] of Object.entries(this.registry)) { for (const [key, value] of Object.entries(this.registry)) {
if (authorizationroles.hasRole(value.roles)) { if (authorizationroles.hasRole(value.roles)) {
ret.push({ id: key, title: value.title }); ret.push({ id: key, title: value.title, type: value.type });
} }
} }
return ret; return ret;

View File

@@ -0,0 +1,27 @@
<template>
<gz-dash
:showCount="true"
:count="0"
moreUrl="/home-dashboard"
icon="$ayiSplotch"
:updateFrequency="60000"
>
MY CONTENT HERE
</gz-dash>
</template>
<script>
import GzDash from "../components/dash-base.vue";
export default {
components: {
GzDash
},
data() {
return {};
},
props: {},
created() {},
computed: {},
methods: {}
};
</script>

View File

@@ -49,6 +49,7 @@
lg="4" lg="4"
xl="3" xl="3"
> >
{{ item.type }}
<gz-dash <gz-dash
:title="item.title" :title="item.title"
:id="item.id" :id="item.id"
@@ -71,6 +72,8 @@
const FORM_KEY = "home-dashboard"; const FORM_KEY = "home-dashboard";
import DashRegistry from "../api/dash-registry"; import DashRegistry from "../api/dash-registry";
import GzDash from "../components/dash-base.vue"; import GzDash from "../components/dash-base.vue";
//---------- DASH ITEMS ----------
import GzDashTestWidgetsPriciest from "../components/dash-test-widgets-priciest.vue";
export default { export default {
components: { components: {