@fishawack/lab-velocity 2.0.0-beta.25 → 2.0.0-beta.27
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/_Build/vue/components/layout/Table.vue +13 -4
- package/_Build/vue/modules/AuthModule/routes/PCompanies/form.vue +15 -0
- package/_Build/vue/modules/AuthModule/routes/PCompanies/resource.js +6 -1
- package/_Build/vue/modules/resource/Children/index.vue +6 -0
- package/_Build/vue/modules/resource/index.js +70 -47
- package/package.json +1 -1
|
@@ -24,10 +24,13 @@
|
|
|
24
24
|
<template v-if="item.render" #default="scope">
|
|
25
25
|
<component
|
|
26
26
|
:is="
|
|
27
|
-
item.render(
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
27
|
+
item.render(
|
|
28
|
+
{
|
|
29
|
+
model: scope.row,
|
|
30
|
+
...additionalInfo,
|
|
31
|
+
},
|
|
32
|
+
this,
|
|
33
|
+
)
|
|
31
34
|
"
|
|
32
35
|
/>
|
|
33
36
|
</template>
|
|
@@ -77,6 +80,12 @@ export default {
|
|
|
77
80
|
VelButton,
|
|
78
81
|
},
|
|
79
82
|
|
|
83
|
+
inject: {
|
|
84
|
+
additionalInfo: {
|
|
85
|
+
default: () => ({}),
|
|
86
|
+
},
|
|
87
|
+
},
|
|
88
|
+
|
|
80
89
|
props: {
|
|
81
90
|
data: {
|
|
82
91
|
type: [Array, Object],
|
|
@@ -75,6 +75,21 @@
|
|
|
75
75
|
</VelButton>
|
|
76
76
|
</div>
|
|
77
77
|
|
|
78
|
+
<VelBasic
|
|
79
|
+
v-model="form.seats"
|
|
80
|
+
name="seats"
|
|
81
|
+
:error="form.errors"
|
|
82
|
+
type="number"
|
|
83
|
+
placeholder="Company seats"
|
|
84
|
+
label="Company seats"
|
|
85
|
+
min="0"
|
|
86
|
+
class="mb-0 mt-2"
|
|
87
|
+
>
|
|
88
|
+
<template #label>
|
|
89
|
+
Company seats <sup class="color-status-red-100">*</sup>
|
|
90
|
+
</template>
|
|
91
|
+
</VelBasic>
|
|
92
|
+
|
|
78
93
|
<hr class="my-5 hr-muted" />
|
|
79
94
|
|
|
80
95
|
<template v-if="$store.getters.can('edit roles')">
|
|
@@ -33,6 +33,7 @@ export default [
|
|
|
33
33
|
name: model?.name || null,
|
|
34
34
|
primary_contact: model?.primary_contact?.id || null,
|
|
35
35
|
domains: model?.domains || [],
|
|
36
|
+
seats: model?.seats != null ? model.seats : null,
|
|
36
37
|
roles: model?.roles.map((val) => val.id) || [],
|
|
37
38
|
sso_client_id: model?.sso_client_id || undefined,
|
|
38
39
|
sso_tenant: model?.sso_tenant || undefined,
|
|
@@ -95,9 +96,13 @@ export default [
|
|
|
95
96
|
h("span", !!model.primary_contact_contacted),
|
|
96
97
|
},
|
|
97
98
|
{
|
|
98
|
-
label: "Total
|
|
99
|
+
label: "Total Users",
|
|
99
100
|
key: "user_count",
|
|
100
101
|
},
|
|
102
|
+
{
|
|
103
|
+
label: "Available Seats",
|
|
104
|
+
key: "seats",
|
|
105
|
+
},
|
|
101
106
|
],
|
|
102
107
|
},
|
|
103
108
|
index: {
|
|
@@ -5,7 +5,12 @@ import axios from "axios";
|
|
|
5
5
|
import { h, resolveComponent } from "vue";
|
|
6
6
|
|
|
7
7
|
import VelTableSorter from "../../components/layout/TableSorter.vue";
|
|
8
|
-
import {
|
|
8
|
+
import {
|
|
9
|
+
ElDescriptions,
|
|
10
|
+
ElDescriptionsItem,
|
|
11
|
+
ElPopconfirm,
|
|
12
|
+
ElNotification,
|
|
13
|
+
} from "element-plus";
|
|
9
14
|
import VelButton from "../../components/basic/Button.vue";
|
|
10
15
|
|
|
11
16
|
export const defaultResource = meta();
|
|
@@ -19,6 +24,9 @@ export function meta(name = "default", properties = {}) {
|
|
|
19
24
|
name,
|
|
20
25
|
title: properties.title || name[0].toUpperCase() + name.slice(1),
|
|
21
26
|
singular,
|
|
27
|
+
singularTitle:
|
|
28
|
+
properties.singularTitle ||
|
|
29
|
+
singular[0].toUpperCase() + singular.slice(1),
|
|
22
30
|
label: singular,
|
|
23
31
|
multiLabel: name,
|
|
24
32
|
slug,
|
|
@@ -47,7 +55,7 @@ export function meta(name = "default", properties = {}) {
|
|
|
47
55
|
},
|
|
48
56
|
table: {
|
|
49
57
|
actions: [
|
|
50
|
-
({
|
|
58
|
+
({ model, resource }, { $router }) =>
|
|
51
59
|
h(
|
|
52
60
|
VelButton,
|
|
53
61
|
{
|
|
@@ -65,10 +73,10 @@ export function meta(name = "default", properties = {}) {
|
|
|
65
73
|
},
|
|
66
74
|
() => "View",
|
|
67
75
|
),
|
|
68
|
-
(props) => {
|
|
69
|
-
const { $router
|
|
76
|
+
({ model, resource }, props) => {
|
|
77
|
+
const { $router } = props;
|
|
70
78
|
|
|
71
|
-
if (resource.permissions.edit(props)) {
|
|
79
|
+
if (resource.permissions.edit(props, { model })) {
|
|
72
80
|
return h(
|
|
73
81
|
VelButton,
|
|
74
82
|
{
|
|
@@ -87,38 +95,56 @@ export function meta(name = "default", properties = {}) {
|
|
|
87
95
|
);
|
|
88
96
|
}
|
|
89
97
|
},
|
|
90
|
-
(props) => {
|
|
91
|
-
const {
|
|
98
|
+
({ model, resource }, props) => {
|
|
99
|
+
const { $emit } = props;
|
|
92
100
|
|
|
93
|
-
if (resource.permissions.delete(props)) {
|
|
94
|
-
return h(
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
101
|
+
if (resource.permissions.delete(props, { model })) {
|
|
102
|
+
return h({
|
|
103
|
+
data: () => ({
|
|
104
|
+
loading: false,
|
|
105
|
+
}),
|
|
106
|
+
render() {
|
|
107
|
+
return h(
|
|
108
|
+
ElPopconfirm,
|
|
109
|
+
{
|
|
110
|
+
title: `Are you sure you want to delete this ${resource.singular}?`,
|
|
111
|
+
confirmButtonText: "Delete",
|
|
112
|
+
cancelButtonText: "Cancel",
|
|
113
|
+
confirmButtonType: "danger",
|
|
114
|
+
onConfirm: async () => {
|
|
115
|
+
this.loading = true;
|
|
105
116
|
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
+
await axios.delete(
|
|
118
|
+
`${resource.api.endpoint(props)}/${model.id}`,
|
|
119
|
+
);
|
|
120
|
+
|
|
121
|
+
$emit("reload");
|
|
122
|
+
|
|
123
|
+
ElNotification({
|
|
124
|
+
title: "Success",
|
|
125
|
+
message: `${resource.singularTitle} with id ${model.id} deleted.`,
|
|
126
|
+
type: "success",
|
|
127
|
+
});
|
|
128
|
+
|
|
129
|
+
this.loading = false;
|
|
117
130
|
},
|
|
118
|
-
|
|
119
|
-
|
|
131
|
+
},
|
|
132
|
+
{
|
|
133
|
+
reference: () =>
|
|
134
|
+
h(
|
|
135
|
+
VelButton,
|
|
136
|
+
{
|
|
137
|
+
tag: "a",
|
|
138
|
+
type: "danger",
|
|
139
|
+
size: "small",
|
|
140
|
+
loading: this.loading,
|
|
141
|
+
},
|
|
142
|
+
() => `Delete`,
|
|
143
|
+
),
|
|
144
|
+
},
|
|
145
|
+
);
|
|
120
146
|
},
|
|
121
|
-
);
|
|
147
|
+
});
|
|
122
148
|
}
|
|
123
149
|
},
|
|
124
150
|
],
|
|
@@ -137,8 +163,7 @@ export function meta(name = "default", properties = {}) {
|
|
|
137
163
|
},
|
|
138
164
|
index: {
|
|
139
165
|
structure: (props) => {
|
|
140
|
-
const { resource
|
|
141
|
-
props;
|
|
166
|
+
const { resource } = props;
|
|
142
167
|
|
|
143
168
|
return {
|
|
144
169
|
key: "PIndex",
|
|
@@ -149,7 +174,7 @@ export function meta(name = "default", properties = {}) {
|
|
|
149
174
|
? [
|
|
150
175
|
{
|
|
151
176
|
key: "actions",
|
|
152
|
-
render: ({ model,
|
|
177
|
+
render: ({ model }, props) =>
|
|
153
178
|
h(
|
|
154
179
|
"div",
|
|
155
180
|
{
|
|
@@ -157,15 +182,13 @@ export function meta(name = "default", properties = {}) {
|
|
|
157
182
|
},
|
|
158
183
|
resource.table.actions.map(
|
|
159
184
|
(d) =>
|
|
160
|
-
d(
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
$emit,
|
|
168
|
-
}),
|
|
185
|
+
d(
|
|
186
|
+
{
|
|
187
|
+
model,
|
|
188
|
+
resource,
|
|
189
|
+
},
|
|
190
|
+
props,
|
|
191
|
+
),
|
|
169
192
|
),
|
|
170
193
|
),
|
|
171
194
|
},
|
|
@@ -226,7 +249,7 @@ export function meta(name = "default", properties = {}) {
|
|
|
226
249
|
(props) => {
|
|
227
250
|
const { resource, model, $router } = props;
|
|
228
251
|
|
|
229
|
-
if (resource.permissions.edit(props)) {
|
|
252
|
+
if (resource.permissions.edit(props, { model })) {
|
|
230
253
|
return h(
|
|
231
254
|
VelButton,
|
|
232
255
|
{
|
|
@@ -256,7 +279,7 @@ export function meta(name = "default", properties = {}) {
|
|
|
256
279
|
(props) => {
|
|
257
280
|
const { resource, model, $router } = props;
|
|
258
281
|
|
|
259
|
-
if (resource.permissions.delete(props)) {
|
|
282
|
+
if (resource.permissions.delete(props, { model })) {
|
|
260
283
|
return h(
|
|
261
284
|
ElPopconfirm,
|
|
262
285
|
{
|