@fishawack/lab-velocity 2.0.0-beta.28 → 2.0.0-beta.29
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.
|
@@ -91,7 +91,7 @@ export default {
|
|
|
91
91
|
|
|
92
92
|
computed: {
|
|
93
93
|
permissions() {
|
|
94
|
-
const allPermissions = this.form.roles.reduce((acc, id) => {
|
|
94
|
+
const allPermissions = (this.form.roles || []).reduce((acc, id) => {
|
|
95
95
|
return acc.concat(
|
|
96
96
|
this.roles.find((d) => d.id === id)?.permissions || [],
|
|
97
97
|
);
|
|
@@ -7,6 +7,11 @@ import { columns } from "../../../resource/index.js";
|
|
|
7
7
|
import userResource from "../PUsers/resource.js";
|
|
8
8
|
import { defaultResource, meta } from "../../../resource/index.js";
|
|
9
9
|
|
|
10
|
+
import VelFormRole from "../../../../components/layout/FormRole.vue";
|
|
11
|
+
import Chip from "../../../../components/layout/Chip.vue";
|
|
12
|
+
import Chips from "../../../../components/layout/Chips.vue";
|
|
13
|
+
import VelRoleLegend from "../../../../components/layout/RoleLegend.vue";
|
|
14
|
+
|
|
10
15
|
import VelTableSorter from "../../../../components/layout/TableSorter.vue";
|
|
11
16
|
import VelButton from "../../../../components/basic/Button.vue";
|
|
12
17
|
import VelCheckbox from "../../../../components/form/Checkbox.vue";
|
|
@@ -50,11 +55,60 @@ export default [
|
|
|
50
55
|
initial: ({ $route, model }) =>
|
|
51
56
|
model?.company_id || $route.params.companiesId || null,
|
|
52
57
|
},
|
|
58
|
+
{
|
|
59
|
+
key: "roles",
|
|
60
|
+
initial: ({ model }) =>
|
|
61
|
+
model?.roles.map((val) => val.id) || [],
|
|
62
|
+
render: {
|
|
63
|
+
read: ({ model }) =>
|
|
64
|
+
h(
|
|
65
|
+
!model.overrides_roles_and_permissions ||
|
|
66
|
+
model.roles.length === 1
|
|
67
|
+
? Chip
|
|
68
|
+
: Chips,
|
|
69
|
+
!model.overrides_roles_and_permissions
|
|
70
|
+
? {
|
|
71
|
+
name: "inherited",
|
|
72
|
+
label: "Inherited",
|
|
73
|
+
}
|
|
74
|
+
: model.roles.length === 1
|
|
75
|
+
? {
|
|
76
|
+
name: model.roles[0].name,
|
|
77
|
+
label: model.roles[0].label,
|
|
78
|
+
}
|
|
79
|
+
: { array: model.roles },
|
|
80
|
+
),
|
|
81
|
+
write: ({ model, form }) =>
|
|
82
|
+
h(VelFormRole, {
|
|
83
|
+
overrides:
|
|
84
|
+
model?.overrides_roles_and_permissions,
|
|
85
|
+
form,
|
|
86
|
+
}),
|
|
87
|
+
},
|
|
88
|
+
},
|
|
53
89
|
]),
|
|
54
90
|
{
|
|
91
|
+
index: {
|
|
92
|
+
layout: [
|
|
93
|
+
...defaultResource.index.layout,
|
|
94
|
+
() =>
|
|
95
|
+
h(VelRoleLegend, {
|
|
96
|
+
class: "mt-5",
|
|
97
|
+
}),
|
|
98
|
+
],
|
|
99
|
+
},
|
|
55
100
|
show: {
|
|
56
101
|
layout: [
|
|
57
102
|
...defaultResource.show.layout,
|
|
103
|
+
({ model }) => ({
|
|
104
|
+
label: "Access control",
|
|
105
|
+
component: h(VelFormRole, {
|
|
106
|
+
overrides:
|
|
107
|
+
model.overrides_roles_and_permissions,
|
|
108
|
+
form: { roles: model.roles.map((d) => d.id) },
|
|
109
|
+
readonly: true,
|
|
110
|
+
}),
|
|
111
|
+
}),
|
|
58
112
|
(props) => {
|
|
59
113
|
const { model, $store, $router, $route, ...rest } =
|
|
60
114
|
props;
|
|
@@ -122,8 +176,6 @@ export default [
|
|
|
122
176
|
this.emitter.emit(
|
|
123
177
|
"reload-teams",
|
|
124
178
|
);
|
|
125
|
-
|
|
126
|
-
this.loading = false;
|
|
127
179
|
},
|
|
128
180
|
},
|
|
129
181
|
"Remove",
|
|
@@ -214,8 +266,6 @@ export default [
|
|
|
214
266
|
this.emitter.emit(
|
|
215
267
|
"reload-teams",
|
|
216
268
|
);
|
|
217
|
-
|
|
218
|
-
this.loading = false;
|
|
219
269
|
},
|
|
220
270
|
},
|
|
221
271
|
"Add",
|