@fishawack/lab-velocity 2.0.0-beta.6 → 2.0.0-beta.60
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/README.md +467 -36
- package/_Build/js/libs/build-id.js +14 -0
- package/_Build/js/libs/filters.js +36 -0
- package/_Build/js/libs/globals.js +7 -0
- package/_Build/js/libs/router.js +22 -0
- package/_Build/js/libs/routes.js +29 -0
- package/_Build/js/libs/store.js +21 -0
- package/_Build/js/libs/utility.js +161 -0
- package/_Build/vue/components/basic/Button.vue +1 -1
- package/_Build/vue/components/form/Avatar.vue +90 -0
- package/_Build/vue/components/form/Checkbox.vue +10 -0
- package/_Build/vue/components/form/InputNumber.vue +1 -1
- package/_Build/vue/components/form/Select.vue +221 -31
- package/_Build/vue/components/form/Wysiwyg2.vue +87 -2
- package/_Build/vue/components/form/wysiwyg2-video.js +41 -0
- package/_Build/vue/components/layout/Alert.vue +5 -5
- package/_Build/vue/components/layout/Audit.vue +158 -0
- package/_Build/vue/{modules/AuthModule/components/VBreadcrumbs.vue → components/layout/Breadcrumbs.vue} +4 -4
- package/_Build/vue/{modules/AuthModule/components → components/layout}/Chips.vue +2 -2
- package/_Build/vue/components/layout/Footer.vue +11 -10
- package/_Build/vue/{modules/AuthModule/components/VFormFooter.vue → components/layout/FormFooter.vue} +2 -2
- package/_Build/vue/{modules/AuthModule/components → components/layout}/FormRole.vue +8 -8
- package/_Build/vue/components/layout/Layout.vue +94 -0
- package/_Build/vue/components/layout/Navigation.vue +83 -0
- package/_Build/vue/{modules/AuthModule/components/VPageHeader.vue → components/layout/PageHeader.vue} +14 -8
- package/_Build/vue/components/layout/SideBar.vue +26 -0
- package/_Build/vue/{modules/AuthModule/components/VTable.vue → components/layout/Table.vue} +24 -12
- package/_Build/vue/{modules/AuthModule/components/VTableSorter.vue → components/layout/TableSorter.vue} +92 -48
- package/_Build/vue/components/layout/TokenDisplay.vue +52 -0
- package/_Build/vue/components/layout/pageTitle.vue +1 -1
- package/_Build/vue/components/navigation/Menu.vue +6 -1
- package/_Build/vue/components/navigation/MenuItem.vue +7 -2
- package/_Build/vue/components/navigation/MenuItemGroup.vue +7 -2
- package/_Build/vue/modules/AuthModule/js/axios.js +21 -1
- package/_Build/vue/modules/AuthModule/js/clear-cookies.js +34 -0
- package/_Build/vue/modules/AuthModule/js/guest-request.js +32 -0
- package/_Build/vue/modules/AuthModule/js/impersonation-banner.js +102 -0
- package/_Build/vue/modules/AuthModule/js/router.js +91 -114
- package/_Build/vue/modules/AuthModule/js/store.js +23 -6
- package/_Build/vue/modules/AuthModule/routes/PCompanies/columns.js +268 -0
- package/_Build/vue/modules/AuthModule/routes/PCompanies/resource.js +213 -0
- package/_Build/vue/modules/AuthModule/routes/PIntegrations/columns.js +58 -0
- package/_Build/vue/modules/AuthModule/routes/PIntegrations/resource.js +79 -0
- package/_Build/vue/modules/AuthModule/routes/PTeams/columns.js +78 -0
- package/_Build/vue/modules/AuthModule/routes/PTeams/resource.js +251 -0
- package/_Build/vue/modules/AuthModule/routes/PUsers/SetPasswordAction.vue +51 -0
- package/_Build/vue/modules/AuthModule/routes/PUsers/SetPasswordDialog.vue +138 -0
- package/_Build/vue/modules/AuthModule/routes/PUsers/columns.js +349 -0
- package/_Build/vue/modules/AuthModule/routes/PUsers/resource.js +239 -0
- package/_Build/vue/modules/AuthModule/routes/account-exists.vue +2 -2
- package/_Build/vue/modules/AuthModule/routes/change-password.vue +28 -32
- package/_Build/vue/modules/AuthModule/routes/container.vue +2 -11
- package/_Build/vue/modules/AuthModule/routes/expired-reset.vue +4 -4
- package/_Build/vue/modules/AuthModule/routes/expired-verification.vue +10 -9
- package/_Build/vue/modules/AuthModule/routes/force-reset.vue +44 -58
- package/_Build/vue/modules/AuthModule/routes/forgot.vue +10 -5
- package/_Build/vue/modules/AuthModule/routes/login.vue +12 -19
- package/_Build/vue/modules/AuthModule/routes/logincallback.vue +1 -3
- package/_Build/vue/modules/AuthModule/routes/loginsso.vue +14 -10
- package/_Build/vue/modules/AuthModule/routes/logout.vue +14 -5
- package/_Build/vue/modules/AuthModule/routes/logoutheadless.vue +16 -5
- package/_Build/vue/modules/AuthModule/routes/register.vue +24 -28
- package/_Build/vue/modules/AuthModule/routes/reset.vue +20 -14
- package/_Build/vue/modules/AuthModule/routes/success-forgot.vue +14 -8
- package/_Build/vue/modules/AuthModule/routes/success-reset.vue +2 -2
- package/_Build/vue/modules/AuthModule/routes/success-verify.vue +1 -3
- package/_Build/vue/modules/AuthModule/routes/verify.vue +11 -14
- package/_Build/vue/modules/resource/Children/create.vue +99 -0
- package/_Build/vue/modules/resource/Children/edit.vue +124 -0
- package/_Build/vue/modules/resource/Children/index.vue +42 -0
- package/_Build/vue/modules/resource/Children/partials/form.vue +111 -0
- package/_Build/vue/modules/resource/Children/show.vue +170 -0
- package/_Build/vue/modules/resource/index.js +562 -0
- package/_Build/vue/modules/resource/parent.vue +63 -0
- package/_Build/vue/modules/resource/trashable.js +104 -0
- package/_base.scss +0 -1
- package/_defaults.scss +2 -2
- package/components/_auth.scss +19 -61
- package/components/_datepicker.scss +1 -0
- package/components/_descriptions.scss +2 -0
- package/components/_footer.scss +1 -0
- package/components/_form.scss +18 -0
- package/components/_header.scss +3 -27
- package/components/_layout.scss +56 -0
- package/components/_menu.scss +0 -5
- package/components/_sidebar.scss +12 -27
- package/components/_table.scss +3 -0
- package/components/_token-display.scss +41 -0
- package/components/_wysiwyg2.scss +10 -0
- package/general.scss +1 -0
- package/index.js +31 -1
- package/package.json +7 -4
- package/_Build/vue/components/layout/sideBar.vue +0 -25
- package/_Build/vue/modules/AuthModule/adminRoutes/PCompanies/Children/Upload/upload.vue +0 -259
- package/_Build/vue/modules/AuthModule/adminRoutes/PCompanies/Children/create.vue +0 -62
- package/_Build/vue/modules/AuthModule/adminRoutes/PCompanies/Children/edit.vue +0 -98
- package/_Build/vue/modules/AuthModule/adminRoutes/PCompanies/Children/index.vue +0 -90
- package/_Build/vue/modules/AuthModule/adminRoutes/PCompanies/Children/partials/form.vue +0 -181
- package/_Build/vue/modules/AuthModule/adminRoutes/PCompanies/Children/show.vue +0 -266
- package/_Build/vue/modules/AuthModule/adminRoutes/PCompanies/parent.vue +0 -36
- package/_Build/vue/modules/AuthModule/adminRoutes/PUsers/Children/create.vue +0 -112
- package/_Build/vue/modules/AuthModule/adminRoutes/PUsers/Children/edit.vue +0 -103
- package/_Build/vue/modules/AuthModule/adminRoutes/PUsers/Children/index.vue +0 -112
- package/_Build/vue/modules/AuthModule/adminRoutes/PUsers/Children/partials/form.vue +0 -173
- package/_Build/vue/modules/AuthModule/adminRoutes/PUsers/Children/show.vue +0 -123
- package/_Build/vue/modules/AuthModule/adminRoutes/PUsers/parent.vue +0 -36
- package/components/_input.scss +0 -0
- /package/_Build/vue/{modules/AuthModule/components → components/layout}/AuthModal.vue +0 -0
- /package/_Build/vue/{modules/AuthModule/components → components/layout}/Chip.vue +0 -0
- /package/_Build/vue/{modules/AuthModule/components/VPasswordValidation.vue → components/layout/PasswordValidation.vue} +0 -0
- /package/_Build/vue/{modules/AuthModule/components/VRoleLegend.vue → components/layout/RoleLegend.vue} +0 -0
|
@@ -0,0 +1,268 @@
|
|
|
1
|
+
import { h, resolveComponent } from "vue";
|
|
2
|
+
import { ElInput } from "element-plus";
|
|
3
|
+
|
|
4
|
+
import VelBasic from "../../../../components/form/basic.vue";
|
|
5
|
+
import VelButton from "../../../../components/basic/Button.vue";
|
|
6
|
+
import VelSelect from "../../../../components/form/Select.vue";
|
|
7
|
+
import VelFormRole from "../../../../components/layout/FormRole.vue";
|
|
8
|
+
import Chip from "../../../../components/layout/Chip.vue";
|
|
9
|
+
import Chips from "../../../../components/layout/Chips.vue";
|
|
10
|
+
|
|
11
|
+
export default [
|
|
12
|
+
{
|
|
13
|
+
key: "name",
|
|
14
|
+
sortable: true,
|
|
15
|
+
},
|
|
16
|
+
{
|
|
17
|
+
key: "primary_contact",
|
|
18
|
+
label: "Primary Contact",
|
|
19
|
+
condition: {
|
|
20
|
+
table: false,
|
|
21
|
+
form: {
|
|
22
|
+
write: ({ method }) => method === "patch",
|
|
23
|
+
},
|
|
24
|
+
},
|
|
25
|
+
preparation: ({ form }) => form.primary_contact?.id,
|
|
26
|
+
render: {
|
|
27
|
+
read: ({ model }) => h("span", model.primary_contact?.name),
|
|
28
|
+
write: ({ $route }) =>
|
|
29
|
+
h(VelSelect, {
|
|
30
|
+
endpoint: `api/users`,
|
|
31
|
+
params: {
|
|
32
|
+
"filter[company_id]": $route.params.companiesId,
|
|
33
|
+
},
|
|
34
|
+
labelKey: "name",
|
|
35
|
+
filterable: true,
|
|
36
|
+
searchParam: "name",
|
|
37
|
+
}),
|
|
38
|
+
},
|
|
39
|
+
},
|
|
40
|
+
{
|
|
41
|
+
key: "primary_contact_email",
|
|
42
|
+
label: "Primary Contact Email",
|
|
43
|
+
condition: {
|
|
44
|
+
table: false,
|
|
45
|
+
form: false,
|
|
46
|
+
},
|
|
47
|
+
render: {
|
|
48
|
+
read: ({ model }) => h("span", model.primary_contact?.email),
|
|
49
|
+
},
|
|
50
|
+
},
|
|
51
|
+
{
|
|
52
|
+
key: "primary_contact_contacted",
|
|
53
|
+
label: "Primary Contact Contacted",
|
|
54
|
+
condition: {
|
|
55
|
+
table: false,
|
|
56
|
+
form: false,
|
|
57
|
+
},
|
|
58
|
+
render: {
|
|
59
|
+
read: ({ model }) =>
|
|
60
|
+
h("span", String(!!model.primary_contact_contacted)),
|
|
61
|
+
},
|
|
62
|
+
},
|
|
63
|
+
{
|
|
64
|
+
key: "domains",
|
|
65
|
+
condition: {
|
|
66
|
+
table: false,
|
|
67
|
+
},
|
|
68
|
+
initial: ({ model }) => model?.domains || [],
|
|
69
|
+
render: {
|
|
70
|
+
read: ({ model }) => h("span", model.domains.join(", ")),
|
|
71
|
+
write: ({ form }) =>
|
|
72
|
+
h("div", { class: "form__group vel-basic" }, [
|
|
73
|
+
h("p", { class: "my-0" }, [
|
|
74
|
+
"Domain/s ",
|
|
75
|
+
h("sup", { class: "color-status-red-100" }, "*"),
|
|
76
|
+
]),
|
|
77
|
+
h(
|
|
78
|
+
"ul",
|
|
79
|
+
{ class: "list-none pl-0 mt mb-2" },
|
|
80
|
+
form.domains.map((domain, index) =>
|
|
81
|
+
h("li", { key: index, class: "mb-0.5" }, [
|
|
82
|
+
h(
|
|
83
|
+
ElInput,
|
|
84
|
+
{
|
|
85
|
+
modelValue: form.domains[index],
|
|
86
|
+
"onUpdate:modelValue": (val) => {
|
|
87
|
+
form.domains[index] = val;
|
|
88
|
+
},
|
|
89
|
+
placeholder: "avalerehealth.com",
|
|
90
|
+
},
|
|
91
|
+
{
|
|
92
|
+
prepend: () => "@",
|
|
93
|
+
append: () =>
|
|
94
|
+
h(
|
|
95
|
+
VelButton,
|
|
96
|
+
{
|
|
97
|
+
type: "danger",
|
|
98
|
+
onClick: () =>
|
|
99
|
+
form.domains.splice(
|
|
100
|
+
index,
|
|
101
|
+
1,
|
|
102
|
+
),
|
|
103
|
+
},
|
|
104
|
+
() =>
|
|
105
|
+
h(
|
|
106
|
+
resolveComponent(
|
|
107
|
+
"GSvg",
|
|
108
|
+
),
|
|
109
|
+
{
|
|
110
|
+
class: "vel-icon",
|
|
111
|
+
name: "icon-trash",
|
|
112
|
+
},
|
|
113
|
+
),
|
|
114
|
+
),
|
|
115
|
+
},
|
|
116
|
+
),
|
|
117
|
+
form.errors?.has?.(`domains.${index}`) &&
|
|
118
|
+
h(
|
|
119
|
+
"small",
|
|
120
|
+
{
|
|
121
|
+
class: "form__error vel-basic__error",
|
|
122
|
+
},
|
|
123
|
+
form.errors.first(`domains.${index}`),
|
|
124
|
+
),
|
|
125
|
+
]),
|
|
126
|
+
),
|
|
127
|
+
),
|
|
128
|
+
h("div", [
|
|
129
|
+
h(
|
|
130
|
+
VelButton,
|
|
131
|
+
{
|
|
132
|
+
onClick: () => form.domains.push(""),
|
|
133
|
+
},
|
|
134
|
+
() => [
|
|
135
|
+
"Add Domain ",
|
|
136
|
+
h(resolveComponent("GIcon"), {
|
|
137
|
+
name: "icon-plus",
|
|
138
|
+
embed: true,
|
|
139
|
+
asis: true,
|
|
140
|
+
class: "fill-0 icon--0.5 ml",
|
|
141
|
+
}),
|
|
142
|
+
],
|
|
143
|
+
),
|
|
144
|
+
]),
|
|
145
|
+
]),
|
|
146
|
+
},
|
|
147
|
+
},
|
|
148
|
+
{
|
|
149
|
+
key: "seats",
|
|
150
|
+
label: "Available Seats",
|
|
151
|
+
type: "number",
|
|
152
|
+
min: 0,
|
|
153
|
+
condition: {
|
|
154
|
+
table: false,
|
|
155
|
+
},
|
|
156
|
+
},
|
|
157
|
+
{
|
|
158
|
+
key: "user_count",
|
|
159
|
+
label: "Total Users",
|
|
160
|
+
width: "150",
|
|
161
|
+
condition: {
|
|
162
|
+
form: false,
|
|
163
|
+
},
|
|
164
|
+
},
|
|
165
|
+
{
|
|
166
|
+
key: "sso_enabled",
|
|
167
|
+
label: "SSO Enabled",
|
|
168
|
+
condition: {
|
|
169
|
+
table: false,
|
|
170
|
+
form: false,
|
|
171
|
+
},
|
|
172
|
+
},
|
|
173
|
+
{
|
|
174
|
+
key: "roles",
|
|
175
|
+
label: "Role",
|
|
176
|
+
condition: {
|
|
177
|
+
description: false,
|
|
178
|
+
form: {
|
|
179
|
+
write: ({ $store }) => $store.getters.can("edit roles"),
|
|
180
|
+
},
|
|
181
|
+
},
|
|
182
|
+
initial: ({ model }) =>
|
|
183
|
+
model?.roles.map((val) => ({
|
|
184
|
+
label: val.label,
|
|
185
|
+
value: val.id,
|
|
186
|
+
})) || [],
|
|
187
|
+
preparation: ({ form }) =>
|
|
188
|
+
form.roles.map((d) => (typeof d === "object" ? d.value : d)),
|
|
189
|
+
render: {
|
|
190
|
+
read: ({ model }) =>
|
|
191
|
+
h(
|
|
192
|
+
model.roles.length === 1 ? Chip : Chips,
|
|
193
|
+
model.roles.length === 1
|
|
194
|
+
? {
|
|
195
|
+
name: model.roles[0].name,
|
|
196
|
+
label: model.roles[0].label,
|
|
197
|
+
}
|
|
198
|
+
: { array: model.roles },
|
|
199
|
+
),
|
|
200
|
+
write: ({ model, form }) =>
|
|
201
|
+
h(VelFormRole, {
|
|
202
|
+
overrides: model?.overrides_roles_and_permissions,
|
|
203
|
+
form,
|
|
204
|
+
}),
|
|
205
|
+
},
|
|
206
|
+
},
|
|
207
|
+
{
|
|
208
|
+
key: "sso_type",
|
|
209
|
+
label: "Provider",
|
|
210
|
+
condition: {
|
|
211
|
+
table: false,
|
|
212
|
+
description: false,
|
|
213
|
+
form: {
|
|
214
|
+
write: ({ $store }) => $store.getters.can("edit sso"),
|
|
215
|
+
},
|
|
216
|
+
},
|
|
217
|
+
initial: ({ model }) => model?.sso_type || undefined,
|
|
218
|
+
preparation: ({ form }) => form.sso_type?.value,
|
|
219
|
+
render: {
|
|
220
|
+
write: () =>
|
|
221
|
+
h(VelSelect, {
|
|
222
|
+
clearable: true,
|
|
223
|
+
class: "mt-2",
|
|
224
|
+
options: [
|
|
225
|
+
{ value: "azure", label: "azure" },
|
|
226
|
+
{ value: "google", label: "google" },
|
|
227
|
+
],
|
|
228
|
+
}),
|
|
229
|
+
},
|
|
230
|
+
},
|
|
231
|
+
{
|
|
232
|
+
key: "sso_client_id",
|
|
233
|
+
label: "Key",
|
|
234
|
+
condition: {
|
|
235
|
+
table: false,
|
|
236
|
+
description: false,
|
|
237
|
+
form: {
|
|
238
|
+
write: ({ $store }) => $store.getters.can("edit sso"),
|
|
239
|
+
},
|
|
240
|
+
},
|
|
241
|
+
initial: ({ model }) => model?.sso_client_id || undefined,
|
|
242
|
+
},
|
|
243
|
+
{
|
|
244
|
+
key: "sso_tenant",
|
|
245
|
+
label: "Tenant",
|
|
246
|
+
condition: {
|
|
247
|
+
table: false,
|
|
248
|
+
description: false,
|
|
249
|
+
form: {
|
|
250
|
+
write: ({ $store }) => $store.getters.can("edit sso"),
|
|
251
|
+
},
|
|
252
|
+
},
|
|
253
|
+
initial: ({ model }) => model?.sso_tenant || undefined,
|
|
254
|
+
},
|
|
255
|
+
{
|
|
256
|
+
key: "sso_client_secret",
|
|
257
|
+
label: "Secret",
|
|
258
|
+
type: "password",
|
|
259
|
+
condition: {
|
|
260
|
+
table: false,
|
|
261
|
+
description: false,
|
|
262
|
+
form: {
|
|
263
|
+
write: ({ $store }) => $store.getters.can("edit sso"),
|
|
264
|
+
},
|
|
265
|
+
},
|
|
266
|
+
initial: ({ model }) => model?.sso_client_secret || undefined,
|
|
267
|
+
},
|
|
268
|
+
];
|
|
@@ -0,0 +1,213 @@
|
|
|
1
|
+
import { merge } from "lodash";
|
|
2
|
+
import { h, resolveComponent } from "vue";
|
|
3
|
+
import axios from "axios";
|
|
4
|
+
import { ElNotification } from "element-plus";
|
|
5
|
+
|
|
6
|
+
import { columns, defaultResource, meta } from "../../../resource/index.js";
|
|
7
|
+
import companiesColumns from "./columns.js";
|
|
8
|
+
|
|
9
|
+
import VelFormRole from "../../../../components/layout/FormRole.vue";
|
|
10
|
+
import VelButton from "../../../../components/basic/Button.vue";
|
|
11
|
+
import VelTableSorter from "../../../../components/layout/TableSorter.vue";
|
|
12
|
+
import VelRoleLegend from "../../../../components/layout/RoleLegend.vue";
|
|
13
|
+
|
|
14
|
+
import userResource from "../PUsers/resource.js";
|
|
15
|
+
import teamResource from "../PTeams/resource.js";
|
|
16
|
+
|
|
17
|
+
export default [
|
|
18
|
+
"companies",
|
|
19
|
+
{
|
|
20
|
+
api: {
|
|
21
|
+
params: {
|
|
22
|
+
index: () => ({}),
|
|
23
|
+
show: () => ({
|
|
24
|
+
include: "primary_contact",
|
|
25
|
+
}),
|
|
26
|
+
},
|
|
27
|
+
},
|
|
28
|
+
permissions: {
|
|
29
|
+
create: ({ $store }) => $store.getters.can("write companies"),
|
|
30
|
+
edit: ({ $store }) => $store.getters.can("write companies"),
|
|
31
|
+
delete: ({ $store }) => $store.getters.can("delete companies"),
|
|
32
|
+
},
|
|
33
|
+
singular: "company",
|
|
34
|
+
icon: "icon-cases",
|
|
35
|
+
auditable: true,
|
|
36
|
+
trashable: true,
|
|
37
|
+
...merge(columns(companiesColumns), {
|
|
38
|
+
index: {
|
|
39
|
+
layout: [
|
|
40
|
+
...defaultResource.index.layout,
|
|
41
|
+
() =>
|
|
42
|
+
h(VelRoleLegend, {
|
|
43
|
+
class: "mt-5",
|
|
44
|
+
}),
|
|
45
|
+
],
|
|
46
|
+
},
|
|
47
|
+
show: {
|
|
48
|
+
actions: [
|
|
49
|
+
({ model }) =>
|
|
50
|
+
model.primary_contact &&
|
|
51
|
+
h(
|
|
52
|
+
VelButton,
|
|
53
|
+
{
|
|
54
|
+
type: "primary",
|
|
55
|
+
async onClick() {
|
|
56
|
+
try {
|
|
57
|
+
const res = await axios.post(
|
|
58
|
+
`/api/companies/${model.id}/welcome`,
|
|
59
|
+
);
|
|
60
|
+
ElNotification({
|
|
61
|
+
title: "Success",
|
|
62
|
+
message: res.data.message,
|
|
63
|
+
type: "success",
|
|
64
|
+
});
|
|
65
|
+
|
|
66
|
+
model.primary_contact_contacted = true;
|
|
67
|
+
} catch (e) {
|
|
68
|
+
ElNotification({
|
|
69
|
+
title: "Warning",
|
|
70
|
+
message:
|
|
71
|
+
e.response?.data?.message ||
|
|
72
|
+
e.message,
|
|
73
|
+
type: "warning",
|
|
74
|
+
});
|
|
75
|
+
}
|
|
76
|
+
},
|
|
77
|
+
},
|
|
78
|
+
"Send welcome email",
|
|
79
|
+
),
|
|
80
|
+
...defaultResource.show.actions,
|
|
81
|
+
],
|
|
82
|
+
tabs: [
|
|
83
|
+
...defaultResource.show.tabs,
|
|
84
|
+
({ model }) => ({
|
|
85
|
+
label: "Access control",
|
|
86
|
+
component: h(VelFormRole, {
|
|
87
|
+
overrides: model.overrides_roles_and_permissions,
|
|
88
|
+
form: { roles: model.roles.map((d) => d.id) },
|
|
89
|
+
readonly: true,
|
|
90
|
+
}),
|
|
91
|
+
}),
|
|
92
|
+
({ model, $store, $router, $route, ...rest }) => {
|
|
93
|
+
const resource = meta(...teamResource);
|
|
94
|
+
|
|
95
|
+
const props = {
|
|
96
|
+
model,
|
|
97
|
+
$store,
|
|
98
|
+
$router,
|
|
99
|
+
$route,
|
|
100
|
+
...rest,
|
|
101
|
+
resource,
|
|
102
|
+
};
|
|
103
|
+
|
|
104
|
+
return {
|
|
105
|
+
label: "Teams",
|
|
106
|
+
component: h("div", [
|
|
107
|
+
h(
|
|
108
|
+
"div",
|
|
109
|
+
{ class: "flex justify-end items-end" },
|
|
110
|
+
[
|
|
111
|
+
resource.permissions.create(props) &&
|
|
112
|
+
h(
|
|
113
|
+
VelButton,
|
|
114
|
+
{
|
|
115
|
+
tag: "a",
|
|
116
|
+
type: "primary",
|
|
117
|
+
size: "large",
|
|
118
|
+
onClick: () => {
|
|
119
|
+
$router.push({
|
|
120
|
+
name: `companies.${resource.routeName}.create`,
|
|
121
|
+
});
|
|
122
|
+
},
|
|
123
|
+
},
|
|
124
|
+
() => [
|
|
125
|
+
h(
|
|
126
|
+
resolveComponent(
|
|
127
|
+
"GIcon",
|
|
128
|
+
),
|
|
129
|
+
{
|
|
130
|
+
class: "fill-0 mr-0.5 icon--0.5",
|
|
131
|
+
name: "icon-plus",
|
|
132
|
+
embed: true,
|
|
133
|
+
artboard: true,
|
|
134
|
+
},
|
|
135
|
+
),
|
|
136
|
+
`Create ${resource.singular}`,
|
|
137
|
+
],
|
|
138
|
+
),
|
|
139
|
+
],
|
|
140
|
+
),
|
|
141
|
+
h(
|
|
142
|
+
VelTableSorter,
|
|
143
|
+
resource.index.structure(props),
|
|
144
|
+
),
|
|
145
|
+
]),
|
|
146
|
+
};
|
|
147
|
+
},
|
|
148
|
+
({ model, $store, $router, $route, ...rest }) => {
|
|
149
|
+
const resource = meta(...userResource);
|
|
150
|
+
|
|
151
|
+
resource.api.params.index = ({ $route }) => ({
|
|
152
|
+
include: "company",
|
|
153
|
+
"filter[company_id]": $route.params.companiesId,
|
|
154
|
+
});
|
|
155
|
+
|
|
156
|
+
const props = {
|
|
157
|
+
model,
|
|
158
|
+
$store,
|
|
159
|
+
$router,
|
|
160
|
+
$route,
|
|
161
|
+
...rest,
|
|
162
|
+
resource,
|
|
163
|
+
};
|
|
164
|
+
|
|
165
|
+
return {
|
|
166
|
+
label: "Users",
|
|
167
|
+
component: h("div", [
|
|
168
|
+
h(
|
|
169
|
+
"div",
|
|
170
|
+
{ class: "flex justify-end items-end" },
|
|
171
|
+
[
|
|
172
|
+
resource.permissions.create(props) &&
|
|
173
|
+
h(
|
|
174
|
+
VelButton,
|
|
175
|
+
{
|
|
176
|
+
tag: "a",
|
|
177
|
+
type: "primary",
|
|
178
|
+
size: "large",
|
|
179
|
+
onClick: () => {
|
|
180
|
+
$router.push({
|
|
181
|
+
name: `${resource.slug}.create`,
|
|
182
|
+
});
|
|
183
|
+
},
|
|
184
|
+
},
|
|
185
|
+
() => [
|
|
186
|
+
h(
|
|
187
|
+
resolveComponent(
|
|
188
|
+
"GIcon",
|
|
189
|
+
),
|
|
190
|
+
{
|
|
191
|
+
class: "fill-0 mr-0.5 icon--0.5",
|
|
192
|
+
name: "icon-plus",
|
|
193
|
+
embed: true,
|
|
194
|
+
artboard: true,
|
|
195
|
+
},
|
|
196
|
+
),
|
|
197
|
+
`Create ${resource.singular}`,
|
|
198
|
+
],
|
|
199
|
+
),
|
|
200
|
+
],
|
|
201
|
+
),
|
|
202
|
+
h(
|
|
203
|
+
VelTableSorter,
|
|
204
|
+
resource.index.structure(props),
|
|
205
|
+
),
|
|
206
|
+
]),
|
|
207
|
+
};
|
|
208
|
+
},
|
|
209
|
+
],
|
|
210
|
+
},
|
|
211
|
+
}),
|
|
212
|
+
},
|
|
213
|
+
];
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
import { h } from "vue";
|
|
2
|
+
|
|
3
|
+
import VelSelect from "../../../../components/form/Select.vue";
|
|
4
|
+
|
|
5
|
+
export default [
|
|
6
|
+
{
|
|
7
|
+
key: "name",
|
|
8
|
+
sortable: true,
|
|
9
|
+
},
|
|
10
|
+
{
|
|
11
|
+
key: "scopes",
|
|
12
|
+
endpoint: "api/scopes",
|
|
13
|
+
labelKey: "description",
|
|
14
|
+
filterable: true,
|
|
15
|
+
clearable: true,
|
|
16
|
+
multiple: true,
|
|
17
|
+
initial: (props) =>
|
|
18
|
+
props.model?.client?.scopes?.map((id) => ({
|
|
19
|
+
id,
|
|
20
|
+
description: id,
|
|
21
|
+
})) ?? [],
|
|
22
|
+
preparation: ({ form }) => form.scopes.map((d) => d.id),
|
|
23
|
+
render: {
|
|
24
|
+
read: ({ model }) => h("span", model.client?.scopes.join(", ")),
|
|
25
|
+
write: () => h(VelSelect),
|
|
26
|
+
},
|
|
27
|
+
condition: {
|
|
28
|
+
table: false,
|
|
29
|
+
},
|
|
30
|
+
},
|
|
31
|
+
{
|
|
32
|
+
key: "client_id",
|
|
33
|
+
label: "Client ID",
|
|
34
|
+
condition: {
|
|
35
|
+
form: false,
|
|
36
|
+
},
|
|
37
|
+
},
|
|
38
|
+
{
|
|
39
|
+
key: "user_id",
|
|
40
|
+
label: "Created by",
|
|
41
|
+
render: {
|
|
42
|
+
read: ({ model }) => h("span", model?.user?.name ?? "System"),
|
|
43
|
+
},
|
|
44
|
+
condition: {
|
|
45
|
+
form: false,
|
|
46
|
+
},
|
|
47
|
+
},
|
|
48
|
+
{
|
|
49
|
+
key: "access_logs_count",
|
|
50
|
+
label: "API Calls",
|
|
51
|
+
render: {
|
|
52
|
+
read: ({ model }) => h("span", model?.access_logs_count ?? 0),
|
|
53
|
+
},
|
|
54
|
+
condition: {
|
|
55
|
+
form: false,
|
|
56
|
+
},
|
|
57
|
+
},
|
|
58
|
+
];
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
import { merge } from "lodash";
|
|
2
|
+
import { h, ref } from "vue";
|
|
3
|
+
|
|
4
|
+
import { columns, defaultResource } from "../../../resource/index.js";
|
|
5
|
+
import integrationsColumns from "./columns.js";
|
|
6
|
+
import TokenDisplay from "../../../../components/layout/TokenDisplay.vue";
|
|
7
|
+
|
|
8
|
+
const newToken = ref(null);
|
|
9
|
+
|
|
10
|
+
export default [
|
|
11
|
+
"integrations",
|
|
12
|
+
{
|
|
13
|
+
icon: `icon-keyboard-tab`,
|
|
14
|
+
api: {
|
|
15
|
+
params: {
|
|
16
|
+
index: () => ({ include: "user,client,accessLogsCount" }),
|
|
17
|
+
show: () => ({ include: "user,client,accessLogsCount" }),
|
|
18
|
+
},
|
|
19
|
+
},
|
|
20
|
+
searchable: {
|
|
21
|
+
value: "name",
|
|
22
|
+
},
|
|
23
|
+
permissions: {
|
|
24
|
+
create: ({ $store }) => $store.getters.can("write integrations"),
|
|
25
|
+
edit: ({ $store }) => $store.getters.can("write integrations"),
|
|
26
|
+
delete: ({ $store }) => $store.getters.can("delete integrations"),
|
|
27
|
+
},
|
|
28
|
+
...merge(columns(integrationsColumns), {
|
|
29
|
+
form: {
|
|
30
|
+
submit: async (props) => {
|
|
31
|
+
const { form, resource, $router, model } = props;
|
|
32
|
+
const hold = JSON.parse(JSON.stringify(form.data()));
|
|
33
|
+
const isEdit = !!model;
|
|
34
|
+
const endpoint = isEdit
|
|
35
|
+
? `${resource.api.endpoint(props)}/${model.id}`
|
|
36
|
+
: `${resource.api.endpoint(props)}`;
|
|
37
|
+
try {
|
|
38
|
+
form.populate(resource.form.preparation(props));
|
|
39
|
+
let res = await form.post(endpoint);
|
|
40
|
+
newToken.value = res.data.token;
|
|
41
|
+
await $router.replace({
|
|
42
|
+
name: `${resource.name}.show`,
|
|
43
|
+
params: {
|
|
44
|
+
integrationsId: res.data.id,
|
|
45
|
+
},
|
|
46
|
+
});
|
|
47
|
+
} catch (e) {
|
|
48
|
+
console.log(e);
|
|
49
|
+
} finally {
|
|
50
|
+
if (
|
|
51
|
+
!form.successful ||
|
|
52
|
+
!form.__options.resetOnSuccess
|
|
53
|
+
) {
|
|
54
|
+
form.populate(hold);
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
},
|
|
58
|
+
},
|
|
59
|
+
show: {
|
|
60
|
+
...defaultResource.show,
|
|
61
|
+
layout: [
|
|
62
|
+
...defaultResource.show.layout,
|
|
63
|
+
() =>
|
|
64
|
+
h({
|
|
65
|
+
setup: () => () => {
|
|
66
|
+
if (!newToken.value) return null;
|
|
67
|
+
return h(TokenDisplay, {
|
|
68
|
+
token: newToken.value,
|
|
69
|
+
onClose: () => {
|
|
70
|
+
newToken.value = null;
|
|
71
|
+
},
|
|
72
|
+
});
|
|
73
|
+
},
|
|
74
|
+
}),
|
|
75
|
+
],
|
|
76
|
+
},
|
|
77
|
+
}),
|
|
78
|
+
},
|
|
79
|
+
];
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
import { h } from "vue";
|
|
2
|
+
|
|
3
|
+
import VelSelect from "../../../../components/form/Select.vue";
|
|
4
|
+
import VelFormRole from "../../../../components/layout/FormRole.vue";
|
|
5
|
+
import Chip from "../../../../components/layout/Chip.vue";
|
|
6
|
+
import Chips from "../../../../components/layout/Chips.vue";
|
|
7
|
+
|
|
8
|
+
export default [
|
|
9
|
+
{
|
|
10
|
+
key: "name",
|
|
11
|
+
sortable: true,
|
|
12
|
+
},
|
|
13
|
+
{
|
|
14
|
+
key: "description",
|
|
15
|
+
},
|
|
16
|
+
{
|
|
17
|
+
key: "company_id",
|
|
18
|
+
label: "Company",
|
|
19
|
+
endpoint: "api/companies",
|
|
20
|
+
labelKey: "name",
|
|
21
|
+
filterable: true,
|
|
22
|
+
searchParam: "name",
|
|
23
|
+
condition: {
|
|
24
|
+
form: {
|
|
25
|
+
write: ({ $route, model }) =>
|
|
26
|
+
!$route.params.companiesId && !model?.company,
|
|
27
|
+
},
|
|
28
|
+
},
|
|
29
|
+
initial: ({ model, $route }) =>
|
|
30
|
+
model?.company ||
|
|
31
|
+
($route.params.companiesId && {
|
|
32
|
+
id: $route.params.companiesId,
|
|
33
|
+
}),
|
|
34
|
+
preparation: ({ form }) => form.company_id?.id,
|
|
35
|
+
render: {
|
|
36
|
+
read: ({ model }) => h("span", model.company.name),
|
|
37
|
+
write: () => h(VelSelect),
|
|
38
|
+
},
|
|
39
|
+
},
|
|
40
|
+
{
|
|
41
|
+
key: "user_count",
|
|
42
|
+
label: "Users",
|
|
43
|
+
condition: {
|
|
44
|
+
form: false,
|
|
45
|
+
},
|
|
46
|
+
},
|
|
47
|
+
{
|
|
48
|
+
key: "roles",
|
|
49
|
+
initial: ({ model }) => model?.roles.map((val) => val.id) || [],
|
|
50
|
+
preparation: ({ form }) =>
|
|
51
|
+
form.roles?.map((d) => (typeof d === "object" ? d.value : d)),
|
|
52
|
+
render: {
|
|
53
|
+
read: ({ model }) =>
|
|
54
|
+
h(
|
|
55
|
+
!model.overrides_roles_and_permissions ||
|
|
56
|
+
model.roles.length === 1
|
|
57
|
+
? Chip
|
|
58
|
+
: Chips,
|
|
59
|
+
!model.overrides_roles_and_permissions
|
|
60
|
+
? {
|
|
61
|
+
name: "inherited",
|
|
62
|
+
label: "Inherited",
|
|
63
|
+
}
|
|
64
|
+
: model.roles.length === 1
|
|
65
|
+
? {
|
|
66
|
+
name: model.roles[0].name,
|
|
67
|
+
label: model.roles[0].label,
|
|
68
|
+
}
|
|
69
|
+
: { array: model.roles },
|
|
70
|
+
),
|
|
71
|
+
write: ({ model, form }) =>
|
|
72
|
+
h(VelFormRole, {
|
|
73
|
+
overrides: model?.overrides_roles_and_permissions,
|
|
74
|
+
form,
|
|
75
|
+
}),
|
|
76
|
+
},
|
|
77
|
+
},
|
|
78
|
+
];
|