@fishawack/lab-velocity 2.0.0-beta.40 → 2.0.0-beta.42

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.
Files changed (30) hide show
  1. package/README.md +4 -2
  2. package/_Build/js/libs/build-id.js +14 -0
  3. package/_Build/js/libs/filters.js +36 -0
  4. package/_Build/js/libs/globals.js +7 -0
  5. package/_Build/js/libs/router.js +22 -0
  6. package/_Build/js/libs/routes.js +29 -0
  7. package/_Build/js/libs/store.js +21 -0
  8. package/_Build/js/libs/utility.js +161 -0
  9. package/_Build/vue/components/form/Avatar.vue +86 -0
  10. package/_Build/vue/components/layout/Audit.vue +124 -56
  11. package/_Build/vue/components/layout/Layout.vue +19 -1
  12. package/_Build/vue/components/layout/TableSorter.vue +42 -12
  13. package/_Build/vue/modules/AuthModule/js/router.js +20 -36
  14. package/_Build/vue/modules/AuthModule/routes/PCompanies/columns.js +268 -0
  15. package/_Build/vue/modules/AuthModule/routes/PCompanies/resource.js +173 -232
  16. package/_Build/vue/modules/AuthModule/routes/PIntegrations/resource.js +122 -0
  17. package/_Build/vue/modules/AuthModule/routes/PTeams/resource.js +1 -0
  18. package/_Build/vue/modules/AuthModule/routes/PUsers/columns.js +349 -0
  19. package/_Build/vue/modules/AuthModule/routes/PUsers/resource.js +142 -262
  20. package/_Build/vue/modules/resource/Children/create.vue +2 -2
  21. package/_Build/vue/modules/resource/Children/edit.vue +2 -2
  22. package/_Build/vue/modules/resource/Children/partials/form.vue +71 -21
  23. package/_Build/vue/modules/resource/Children/show.vue +24 -2
  24. package/_Build/vue/modules/resource/index.js +12 -4
  25. package/components/_form.scss +18 -0
  26. package/components/_menu.scss +0 -5
  27. package/index.js +16 -0
  28. package/package.json +3 -1
  29. package/_Build/vue/modules/AuthModule/routes/PCompanies/form.vue +0 -205
  30. package/_Build/vue/modules/AuthModule/routes/PUsers/form.vue +0 -193
@@ -104,6 +104,7 @@
104
104
 
105
105
  <script>
106
106
  import axios from "axios";
107
+ import { debounce } from "lodash";
107
108
  import { ElPagination } from "element-plus";
108
109
  import VelButton from "../basic/Button.vue";
109
110
  import VelBasic from "../form/basic.vue";
@@ -163,16 +164,28 @@ export default {
163
164
  query: {},
164
165
  table_data: [],
165
166
  table_meta: null,
167
+ _abortController: null,
166
168
  };
167
169
  },
168
170
 
171
+ created() {
172
+ this.debouncedSearch = debounce(this._executeSearch, 300);
173
+ },
174
+
175
+ beforeUnmount() {
176
+ this.debouncedSearch.cancel();
177
+ this._abortController?.abort();
178
+ },
179
+
169
180
  mounted() {
170
181
  this.sort = this.jsonData.defaultSort || "-id";
171
182
  this.fetchData({ page: 1 }).then((data) => {
172
- this.table_data = data.data;
173
- this.table_meta = data.meta;
183
+ if (data) {
184
+ this.table_data = data.data;
185
+ this.table_meta = data.meta;
174
186
 
175
- this.table_curr_page = this.table_meta.current_page;
187
+ this.table_curr_page = this.table_meta.current_page;
188
+ }
176
189
  });
177
190
  },
178
191
 
@@ -180,8 +193,10 @@ export default {
180
193
  reload() {
181
194
  this.fetchData({ page: this.table_meta.current_page }).then(
182
195
  (data) => {
183
- this.table_data = data.data;
184
- this.table_meta = data.meta;
196
+ if (data) {
197
+ this.table_data = data.data;
198
+ this.table_meta = data.meta;
199
+ }
185
200
  },
186
201
  );
187
202
  },
@@ -193,9 +208,14 @@ export default {
193
208
  [`filter[${this.$refs.search.$el.dataset.key}]`]: data,
194
209
  };
195
210
  }
211
+ this.debouncedSearch();
212
+ },
213
+ _executeSearch() {
196
214
  this.fetchData({}).then((data) => {
197
- this.table_data = data.data;
198
- this.table_meta = data.meta;
215
+ if (data) {
216
+ this.table_data = data.data;
217
+ this.table_meta = data.meta;
218
+ }
199
219
  });
200
220
  },
201
221
  handleSort(data) {
@@ -206,12 +226,17 @@ export default {
206
226
  data.order === "ascending" ? data.prop : "-" + data.prop;
207
227
  }
208
228
  this.fetchData({}).then((data) => {
209
- this.table_data = data.data;
210
- this.table_meta = data.meta;
229
+ if (data) {
230
+ this.table_data = data.data;
231
+ this.table_meta = data.meta;
232
+ }
211
233
  });
212
234
  },
213
235
 
214
236
  fetchData: function ({ page = "1" }) {
237
+ this._abortController?.abort();
238
+ this._abortController = new AbortController();
239
+
215
240
  return axios
216
241
  .get(`${this.$props.jsonData.api}`, {
217
242
  params: {
@@ -220,9 +245,12 @@ export default {
220
245
  ...this.query,
221
246
  ...this.apiParams,
222
247
  },
248
+ signal: this._abortController.signal,
223
249
  })
224
250
  .then((res) => res.data)
225
- .catch(console.log);
251
+ .catch((err) => {
252
+ if (!axios.isCancel(err)) console.log(err);
253
+ });
226
254
  },
227
255
 
228
256
  getStatusLabel(status) {
@@ -238,8 +266,10 @@ export default {
238
266
 
239
267
  handleCurrentPageChange(val) {
240
268
  this.fetchData({ page: val }).then((data) => {
241
- this.table_data = data.data;
242
- this.table_meta = data.meta;
269
+ if (data) {
270
+ this.table_data = data.data;
271
+ this.table_meta = data.meta;
272
+ }
243
273
  });
244
274
  },
245
275
 
@@ -1,22 +1,22 @@
1
1
  "use strict";
2
2
 
3
- import { merge } from "lodash";
4
-
5
3
  import { h } from "vue";
6
4
  import { RouterView } from "vue-router";
7
5
 
8
6
  import { routes as resourceRoutes } from "../../resource/index.js";
9
7
 
10
- import userResource from "../routes/PUsers/resource.js";
11
- import companyResource from "../routes/PCompanies/resource.js";
12
- import teamResource from "../routes/PTeams/resource.js";
8
+ import defaultUserResource from "../routes/PUsers/resource.js";
9
+ import defaultCompanyResource from "../routes/PCompanies/resource.js";
10
+ import defaultTeamResource from "../routes/PTeams/resource.js";
11
+ import defaultIntegrationResource from "../routes/PIntegrations/resource.js";
13
12
 
14
13
  // Admin routes export - minimal auth flow (headless login only)
15
14
  export function adminRoutes(node, overrides = {}) {
16
15
  const {
17
- userResource: overrideUserResource = {},
18
- companyResource: overrideCompanyResource = {},
19
- teamResource: overrideTeamResource = {},
16
+ userResource = defaultUserResource,
17
+ companyResource = defaultCompanyResource,
18
+ teamResource = defaultTeamResource,
19
+ integrationResource = defaultIntegrationResource,
20
20
  } = overrides;
21
21
 
22
22
  return [
@@ -53,34 +53,18 @@ export function adminRoutes(node, overrides = {}) {
53
53
  },
54
54
  ],
55
55
  },
56
- ...resourceRoutes(
57
- node,
58
- ...merge(userResource, [undefined, overrideUserResource]),
59
- ),
60
- ...resourceRoutes(
61
- node,
62
- ...merge(companyResource, [undefined, overrideCompanyResource]),
63
- [
64
- ...resourceRoutes(
65
- node,
66
- ...merge(teamResource, [
67
- undefined,
68
- merge(overrideCompanyResource, {
69
- routeName: "companies.teams",
70
- }),
71
- ]),
72
- ),
73
- ],
74
- ),
75
- ...resourceRoutes(
76
- node,
77
- ...merge(teamResource, [
78
- undefined,
79
- merge(overrideCompanyResource, {
80
- routeName: "teams",
81
- }),
82
- ]),
83
- ),
56
+ ...resourceRoutes(node, ...userResource),
57
+ ...resourceRoutes(node, ...companyResource, [
58
+ ...resourceRoutes(node, teamResource[0], {
59
+ ...teamResource[1],
60
+ routeName: "companies.teams",
61
+ }),
62
+ ]),
63
+ ...resourceRoutes(node, teamResource[0], {
64
+ ...teamResource[1],
65
+ routeName: "teams",
66
+ }),
67
+ ...resourceRoutes(node, ...integrationResource),
84
68
  ];
85
69
  }
86
70
 
@@ -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
+ ];