oceanhelm 0.0.7 → 0.0.8
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/dist/oceanhelm.es.js +12 -7
- package/dist/oceanhelm.es.js.map +1 -1
- package/dist/oceanhelm.umd.js +1 -1
- package/dist/oceanhelm.umd.js.map +1 -1
- package/package.json +1 -1
- package/src/components/ConfigurableSidebar.vue +208 -216
- package/src/components/CrewManagement.vue +82 -120
- package/src/components/VesselList.vue +9 -5
package/dist/oceanhelm.es.js
CHANGED
|
@@ -52,13 +52,17 @@ const S = (s, t) => {
|
|
|
52
52
|
return this.customClasses;
|
|
53
53
|
},
|
|
54
54
|
filteredMenuItems() {
|
|
55
|
-
return this.menuItems.filter((s) => this.hasPermission(s));
|
|
55
|
+
return this.menuItems.filter((s) => this.hasPermission(s) ? s.type === "dropdown" && s.children ? s.children.some((t) => this.hasPermission(t)) : !0 : !1);
|
|
56
56
|
}
|
|
57
57
|
},
|
|
58
58
|
mounted() {
|
|
59
59
|
this.responsive && this.initializeResponsiveBehavior();
|
|
60
60
|
},
|
|
61
61
|
methods: {
|
|
62
|
+
// Get filtered children for dropdown items
|
|
63
|
+
getFilteredChildren(s) {
|
|
64
|
+
return s.children ? s.children.filter((t) => this.hasPermission(t)) : [];
|
|
65
|
+
},
|
|
62
66
|
// Permission checking
|
|
63
67
|
hasPermission(s) {
|
|
64
68
|
return this.permissionChecker ? this.permissionChecker(s, this.userProfile) : !s.roles || s.roles.length === 0 ? !0 : s.roles.includes(this.userProfile.role);
|
|
@@ -149,7 +153,7 @@ function Y(s, t, u, b, n, a) {
|
|
|
149
153
|
_(" " + r(i.label), 1)
|
|
150
154
|
]),
|
|
151
155
|
e("div", J, [
|
|
152
|
-
(o(!0), l(p, null, h(i
|
|
156
|
+
(o(!0), l(p, null, h(a.getFilteredChildren(i), (y, A) => (o(), l("a", {
|
|
153
157
|
key: A,
|
|
154
158
|
class: "dropdown-item black",
|
|
155
159
|
onClick: D((q) => a.handleAction(y), ["prevent"]),
|
|
@@ -236,7 +240,7 @@ const X = {
|
|
|
236
240
|
id: s.registrationNumber,
|
|
237
241
|
name: s.name
|
|
238
242
|
};
|
|
239
|
-
this.currentRoute === "dashboard" ? this.$emit("vessel-click", s) : this.$emit("vessel-navigate", t);
|
|
243
|
+
this.grantAccess(s) ? this.currentRoute === "dashboard" ? this.$emit("vessel-click", s) : this.$emit("vessel-navigate", t) : this.handleAccessDenied("this protected route");
|
|
240
244
|
},
|
|
241
245
|
handleDeleteVessel(s) {
|
|
242
246
|
if (!this.grantAccess(s)) {
|
|
@@ -1682,14 +1686,15 @@ const ti = {
|
|
|
1682
1686
|
methods: {
|
|
1683
1687
|
// Permission checking
|
|
1684
1688
|
hasPermission(s) {
|
|
1685
|
-
|
|
1686
|
-
|
|
1687
|
-
return ((b = {
|
|
1689
|
+
const { role: t, vessel: u } = this.userProfile, b = u === this.vesselName;
|
|
1690
|
+
let a = {
|
|
1688
1691
|
owner: ["add", "edit", "delete", "assign", "view"],
|
|
1689
1692
|
staff: ["add", "edit", "assign", "view"],
|
|
1690
1693
|
captain: ["assign", "view"],
|
|
1694
|
+
// default for captain
|
|
1691
1695
|
viewer: ["view"]
|
|
1692
|
-
}[t]
|
|
1696
|
+
}[t] || [];
|
|
1697
|
+
return t === "captain" && b && (a = [...a, "add"]), a.includes(s);
|
|
1693
1698
|
},
|
|
1694
1699
|
// Event handlers
|
|
1695
1700
|
handleToggleAddForm() {
|