@5minds/node-red-dashboard-2-processcube-ui-page-navigation 1.1.0-develop-98e32b-m61y7jog → 1.1.0-develop-d0ba19-m623rryu
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@5minds/node-red-dashboard-2-processcube-ui-page-navigation",
|
|
3
|
-
"version": "1.1.0-develop-
|
|
3
|
+
"version": "1.1.0-develop-d0ba19-m623rryu",
|
|
4
4
|
"description": "A node to handle the navigation between pages in the Node-RED Dashboard",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"node-red",
|
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(t,
|
|
1
|
+
(function(t,a){typeof exports=="object"&&typeof module<"u"?a(exports,require("vuex")):typeof define=="function"&&define.amd?define(["exports","vuex"],a):(t=typeof globalThis<"u"?globalThis:t||self,a(t["ui-page-navigation"]={},t.vuex))})(this,function(t,a){"use strict";const s={name:"DBUIEvent",inject:["$socket","$dataTracker"],props:{id:{type:String,required:!0},props:{type:Object,default:()=>({})}},data(){return{page:null}},computed:{...a.mapState("ui",["pages"])},watch:{"$route.meta.id":{handler(i,e){console.log(`route changed old: ${e} new:${i}`);const o=this.createPayload(this.pages[e]);this.$socket.emit("ui-event",this.id,{topic:"$pageleave",payload:o});const r=this.createPayload(this.pages[i]);this.$socket.emit("ui-event",this.id,{topic:"$pageview",payload:r})}}},created(){this.$dataTracker(this.id),this.props.page===this.pages[this.$route.meta.id]&&(console.log("created page "),this.pageview())},unmounted(){this.pageleave()},methods:{pageview(){this.trigger("$pageview")},pageleave(){this.trigger("$pageleave")},trigger(i){const e=this.createPayload(this.props.page);this.$socket.emit("ui-event",this.id,{topic:i,payload:e})},createPayload(i){let e={...i};return e._groups=e._users,delete e._users,{pageForPayload:e,query:this.$route.query}}}};t.UIPageNavigation=s,Object.defineProperty(t,Symbol.toStringTag,{value:"Module"})});
|
|
@@ -38,11 +38,14 @@ export default {
|
|
|
38
38
|
},
|
|
39
39
|
},
|
|
40
40
|
created() {
|
|
41
|
-
|
|
41
|
+
|
|
42
42
|
// can't do this in setup as we have custom onInput function
|
|
43
43
|
this.$dataTracker(this.id);
|
|
44
|
-
|
|
45
|
-
this.
|
|
44
|
+
|
|
45
|
+
if (this.props.page === this.pages[this.$route.meta.id]) {
|
|
46
|
+
console.log(`created page `);
|
|
47
|
+
this.pageview();
|
|
48
|
+
}
|
|
46
49
|
},
|
|
47
50
|
unmounted() {
|
|
48
51
|
this.pageleave();
|
|
@@ -55,20 +58,20 @@ export default {
|
|
|
55
58
|
this.trigger('$pageleave');
|
|
56
59
|
},
|
|
57
60
|
trigger(evt) {
|
|
58
|
-
const payload = this.createPayload(this.page);
|
|
61
|
+
const payload = this.createPayload(this.props.page);
|
|
59
62
|
this.$socket.emit('ui-event', this.id, {
|
|
60
63
|
topic: evt,
|
|
61
64
|
payload,
|
|
62
65
|
});
|
|
63
66
|
},
|
|
64
67
|
createPayload(page) {
|
|
65
|
-
|
|
68
|
+
let pageForPayload = { ...page };
|
|
66
69
|
// re-map _users > _groups for better data readability
|
|
67
|
-
|
|
68
|
-
delete
|
|
70
|
+
pageForPayload._groups = pageForPayload._users;
|
|
71
|
+
delete pageForPayload._users;
|
|
69
72
|
// form event data object
|
|
70
73
|
return {
|
|
71
|
-
|
|
74
|
+
pageForPayload,
|
|
72
75
|
query: this.$route.query,
|
|
73
76
|
};
|
|
74
77
|
},
|