cob-cli 2.20.0 → 2.21.0
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/lib/commands/init.js +5 -1
- package/package.json +1 -1
- package/templates/dashboards/dash/dist/css/app.7b16c01a.css +11 -0
- package/templates/dashboards/dash/dist/dashboard.html +4 -4
- package/templates/dashboards/dash/dist/js/{app.8befbbc1.js → app.13b950c8.js} +3 -3
- package/templates/dashboards/dash/dist/js/app.13b950c8.js.map +1 -0
- package/templates/dashboards/dash/src/App.vue +47 -55
- package/templates/dashboards/dash/src/components/Menu.vue +1 -1
- package/templates/dashboards/dash/src/output.css +44803 -38
- package/templates/dashboards/dash/tailwind.config.js +1 -1
- package/templates/frontend/common/js/cob/_group_references.js +15 -12
- package/templates/dashboards/dash/dist/css/app.40fc4e43.css +0 -11
- package/templates/dashboards/dash/dist/js/app.8befbbc1.js.map +0 -1
|
@@ -23,59 +23,43 @@ export default {
|
|
|
23
23
|
name: 'App',
|
|
24
24
|
components: { Dashboard },
|
|
25
25
|
data: () => ({
|
|
26
|
-
userInfo: null,
|
|
27
|
-
name: null,
|
|
28
26
|
error: "",
|
|
27
|
+
userInfo: null,
|
|
28
|
+
dashboardName: null,
|
|
29
29
|
dashboardInstance: null,
|
|
30
|
-
dashboardInstanceId: Number,
|
|
31
30
|
dashboardParsed: null,
|
|
32
31
|
dashboardState: "Loading"
|
|
33
32
|
}),
|
|
34
33
|
created() {
|
|
35
34
|
// At the initial load we get the dashboard instance name from the url
|
|
36
35
|
umLoggedin().then( userInfo => {
|
|
37
|
-
|
|
38
|
-
this.
|
|
36
|
+
this.userInfo = userInfo
|
|
37
|
+
this.dashboardName = document.getElementsByClassName("custom-resource")[0].getAttribute('data-name').split(":")[0]
|
|
38
|
+
this.dashboardInstance = instancesList(DASHBOARD_DEF, this.dashboardQuery, 1 /*just get the first*/)
|
|
39
39
|
})
|
|
40
40
|
|
|
41
41
|
// Upon anchor navigation we get the dashboard instance name from the first param to the 'resume' callback.
|
|
42
42
|
$('section.custom-resource').on('resume', (e, params) => {
|
|
43
43
|
//Recheck user (the user might have changed or his groups might have changed after previous load)
|
|
44
44
|
umLoggedin().then(userInfo => {
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
45
|
+
let name = params[0].split(":")[0]
|
|
46
|
+
if( name !== this.dashboardName || this.userInfo.username !== userInfo.username ){
|
|
47
|
+
this.userInfo = userInfo
|
|
48
|
+
this.dashboardName = name
|
|
49
|
+
this.dashboardInstance.changeArgs({query: this.dashboardQuery })
|
|
50
|
+
}
|
|
49
51
|
})
|
|
50
52
|
});
|
|
51
53
|
},
|
|
54
|
+
computed: {
|
|
55
|
+
dashboardQuery() {
|
|
56
|
+
let groups = this.userInfo.groups.map(g=> "\"" + g.name + "\"").join(" OR ")
|
|
57
|
+
let nameQuery = "name.raw:\"" + this.dashboardName + "\" "
|
|
58
|
+
let accessQuery = " (groupaccess.raw:(" + groups + ") OR (-groupaccess:*) )"
|
|
59
|
+
return "(" + nameQuery + accessQuery +") OR id:" + this.dashboardName
|
|
60
|
+
}
|
|
61
|
+
},
|
|
52
62
|
watch: {
|
|
53
|
-
// Monitor changes to the id of the Dashboard instance
|
|
54
|
-
dashboardInstanceId(newInstanceId) {
|
|
55
|
-
axios
|
|
56
|
-
.get("/recordm/recordm/instances/" + newInstanceId)
|
|
57
|
-
.then(resp => {
|
|
58
|
-
try {
|
|
59
|
-
this.dashboardParsed = parseDashboard(resp.data, this.userInfo)
|
|
60
|
-
this.dashboardState = "Ready"
|
|
61
|
-
}
|
|
62
|
-
catch(e) {
|
|
63
|
-
this.error = "Error: error parsing dashboard " + newInstanceId + " (" + e + ")"
|
|
64
|
-
this.dashboardState = "Error"
|
|
65
|
-
console.error(e)
|
|
66
|
-
}
|
|
67
|
-
})
|
|
68
|
-
.catch( (e) => {
|
|
69
|
-
if( e.response && e.response.status && e.response.status === 403) {
|
|
70
|
-
this.error = "New authorization required..."
|
|
71
|
-
} else {
|
|
72
|
-
this.error = "Error: error getting dashboard " + newInstanceId
|
|
73
|
-
}
|
|
74
|
-
this.dashboardState = "Error"
|
|
75
|
-
console.error(e)
|
|
76
|
-
})
|
|
77
|
-
},
|
|
78
|
-
|
|
79
63
|
// Monitor state changes to the searching of the Dashboard instance
|
|
80
64
|
'dashboardInstance.state'(instanceInfoState) {
|
|
81
65
|
if(instanceInfoState === "loading" || instanceInfoState === "updating") {
|
|
@@ -103,30 +87,38 @@ export default {
|
|
|
103
87
|
},
|
|
104
88
|
|
|
105
89
|
// Monitor value changes to the values of the Dashboard instance
|
|
106
|
-
'dashboardInstance.value'(
|
|
107
|
-
if(
|
|
90
|
+
'dashboardInstance.value'(newDashboard) {
|
|
91
|
+
if(newDashboard.length === 0) {
|
|
108
92
|
this.dashboardState = "Error"
|
|
109
|
-
this.error = "Error: dashboard '" + this.
|
|
93
|
+
this.error = "Error: dashboard '" + this.dashboardName + "' was not found for your user"
|
|
110
94
|
} else {
|
|
111
|
-
//Instance
|
|
112
|
-
|
|
95
|
+
//Instance found (from ES) (we only asked for the 1st match)
|
|
96
|
+
let newInstanceId = newDashboard[0].id
|
|
97
|
+
axios.get("/recordm/recordm/instances/" + newInstanceId)
|
|
98
|
+
.then(resp => {
|
|
99
|
+
try {
|
|
100
|
+
this.dashboardParsed = parseDashboard(resp.data, this.userInfo)
|
|
101
|
+
this.dashboardState = "Ready"
|
|
102
|
+
//Set the page title
|
|
103
|
+
document.title = "Recordm[" + this.dashboardName + "]"
|
|
104
|
+
}
|
|
105
|
+
catch(e) {
|
|
106
|
+
this.error = "Error: error parsing dashboard " + newInstanceId + " (" + e + ")"
|
|
107
|
+
this.dashboardState = "Error"
|
|
108
|
+
console.error(e)
|
|
109
|
+
}
|
|
110
|
+
})
|
|
111
|
+
.catch( (e) => {
|
|
112
|
+
if( e.response && e.response.status && e.response.status === 403) {
|
|
113
|
+
this.error = "New authorization required..."
|
|
114
|
+
} else {
|
|
115
|
+
this.error = "Error: error getting dashboard " + newInstanceId
|
|
116
|
+
}
|
|
117
|
+
this.dashboardState = "Error"
|
|
118
|
+
console.error(e)
|
|
119
|
+
})
|
|
113
120
|
}
|
|
114
121
|
}
|
|
115
|
-
},
|
|
116
|
-
methods: {
|
|
117
|
-
getDashboardQuery(name, userInfo) {
|
|
118
|
-
this.userInfo = userInfo
|
|
119
|
-
this.name = name
|
|
120
|
-
|
|
121
|
-
// TODO this is wrong we should only set the dashboard name after we pull it from recordm.
|
|
122
|
-
// there is no guarantee that dashboard exists
|
|
123
|
-
document.title = "Recordm[" + name + "]"
|
|
124
|
-
let groups = userInfo.groups.map(g=> "\"" + g.name + "\"").join(" OR ")
|
|
125
|
-
|
|
126
|
-
let nameQuery = "name.raw:\"" + name + "\" "
|
|
127
|
-
let accessQuery = " (groupaccess.raw:(" + groups + ") OR (-groupaccess:*) )"
|
|
128
|
-
return "(" + nameQuery + accessQuery +") OR id:" + name
|
|
129
|
-
}
|
|
130
122
|
}
|
|
131
123
|
};
|
|
132
124
|
</script>
|