@fishawack/lab-velocity 2.0.0-beta.20 → 2.0.0-beta.22

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.
@@ -34,14 +34,14 @@
34
34
  </VelBasic>
35
35
  <slot v-if="displayActions" name="table-action">
36
36
  <VelButton
37
- v-if="displayEditAction"
37
+ v-if="displayCreateAction"
38
38
  size="large"
39
39
  type="primary"
40
40
  tag="a"
41
41
  class="ml-2"
42
42
  @click="
43
43
  $router.push({
44
- name: `${jsonData.pageLink}.create`,
44
+ name: `${jsonData.slug}.create`,
45
45
  })
46
46
  "
47
47
  >
@@ -66,13 +66,13 @@
66
66
  :fixed-height="fixedHeight"
67
67
  :target-action="
68
68
  (item) => ({
69
- name: `${jsonData.pageLink}.show`,
69
+ name: `${jsonData.slug}.show`,
70
70
  params: { id: item.id },
71
71
  })
72
72
  "
73
73
  :edit-action="
74
74
  (item) => ({
75
- name: `${jsonData.pageLink}.edit`,
75
+ name: `${jsonData.slug}.edit`,
76
76
  params: { id: item.id },
77
77
  })
78
78
  "
@@ -141,6 +141,10 @@ export default {
141
141
  type: Boolean,
142
142
  default: true,
143
143
  },
144
+ displayCreateAction: {
145
+ type: Boolean,
146
+ default: true,
147
+ },
144
148
  displayEditAction: {
145
149
  type: Boolean,
146
150
  default: true,
@@ -158,6 +158,8 @@ export default [
158
158
  },
159
159
  defaults: `include=company&filter[company_id]=${model.id}`,
160
160
  "fixed-height": false,
161
+ "display-create-action":
162
+ $store.getters.can("write users"),
161
163
  "display-edit-action":
162
164
  $store.getters.can("write users"),
163
165
  });
@@ -63,7 +63,7 @@ export default {
63
63
  let res = await this.form.post(`${this.resource.api}`);
64
64
 
65
65
  this.$router.replace({
66
- name: `${this.resource.name}.show`,
66
+ name: `${this.resource.slug}.show`,
67
67
  params: { id: res.data.id },
68
68
  });
69
69
  } catch (e) {
@@ -78,7 +78,7 @@ export default {
78
78
 
79
79
  this.addBreadcrumbs.push({
80
80
  href: {
81
- name: `${this.resource.name}.show`,
81
+ name: `${this.resource.slug}.show`,
82
82
  param: this.model.id,
83
83
  },
84
84
  text: this.model.name,
@@ -97,7 +97,7 @@ export default {
97
97
  );
98
98
 
99
99
  this.$router.replace({
100
- name: `${this.resource.name}.show`,
100
+ name: `${this.resource.slug}.show`,
101
101
  params: { id: res.data.id },
102
102
  });
103
103
  } catch (e) {
@@ -86,7 +86,7 @@ export default {
86
86
  this.model = res.data.data;
87
87
  this.addBreadcrumbs.push({
88
88
  href: {
89
- name: `${this.resource.name}.show`,
89
+ name: `${this.resource.slug}.show`,
90
90
  param: this.model.id,
91
91
  },
92
92
  text: this.model.name,
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
 
3
- import { merge } from "lodash";
3
+ import { merge, kebabCase } from "lodash";
4
4
  import axios from "axios";
5
5
  import { h, resolveComponent } from "vue";
6
6
 
@@ -20,8 +20,8 @@ export function meta(name = "default", properties = {}) {
20
20
  singular,
21
21
  label: singular,
22
22
  multiLabel: name,
23
- pageLink: name,
24
- api: `/api/${name}`,
23
+ slug: properties?.slug || kebabCase(name),
24
+ api: `/api/${properties?.slug || kebabCase(name)}`,
25
25
  permissions: {
26
26
  create: () => true,
27
27
  edit: () => true,
@@ -64,8 +64,10 @@ export function meta(name = "default", properties = {}) {
64
64
  },
65
65
  defaults: resource.defaults,
66
66
  "fixed-height": false,
67
- "display-edit-action":
67
+ "display-create-action":
68
68
  resource.permissions.create(props),
69
+ "display-edit-action":
70
+ resource.permissions.edit(props),
69
71
  });
70
72
  },
71
73
  ],
@@ -83,7 +85,7 @@ export function meta(name = "default", properties = {}) {
83
85
  type: "primary",
84
86
  onClick: () => {
85
87
  $router.push({
86
- name: `${resource.name}.edit`,
88
+ name: `${resource.slug}.edit`,
87
89
  params: { id: model.id },
88
90
  });
89
91
  },
@@ -117,7 +119,7 @@ export function meta(name = "default", properties = {}) {
117
119
  );
118
120
 
119
121
  $router.push({
120
- name: `${resource.name}.index`,
122
+ name: `${resource.slug}.index`,
121
123
  });
122
124
  },
123
125
  },
@@ -231,7 +233,7 @@ export function routes(node, name, properties = {}) {
231
233
 
232
234
  return [
233
235
  {
234
- path: `/${resource.pageLink}`,
236
+ path: `/${resource.slug}`,
235
237
  component: node ? "" : require("../resource/parent.vue").default,
236
238
  name,
237
239
  meta: {
@@ -245,28 +247,28 @@ export function routes(node, name, properties = {}) {
245
247
  component: node
246
248
  ? ""
247
249
  : require("../resource/Children/index.vue").default,
248
- name: `${name}.index`,
250
+ name: `${resource.slug}.index`,
249
251
  },
250
252
  {
251
253
  path: "create",
252
254
  component: node
253
255
  ? ""
254
256
  : require("../resource/Children/create.vue").default,
255
- name: `${name}.create`,
257
+ name: `${resource.slug}.create`,
256
258
  },
257
259
  {
258
260
  path: ":id",
259
261
  component: node
260
262
  ? ""
261
263
  : require("../resource/Children/show.vue").default,
262
- name: `${name}.show`,
264
+ name: `${resource.slug}.show`,
263
265
  },
264
266
  {
265
267
  path: ":id/edit",
266
268
  component: node
267
269
  ? ""
268
270
  : require("../resource/Children/edit.vue").default,
269
- name: `${name}.edit`,
271
+ name: `${resource.slug}.edit`,
270
272
  },
271
273
  ],
272
274
  },
@@ -30,7 +30,7 @@ export default {
30
30
  },
31
31
  {
32
32
  href: {
33
- name: `${this.resource.name}.index`,
33
+ name: `${this.resource.slug}.index`,
34
34
  },
35
35
  text: this.resource.title,
36
36
  },
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fishawack/lab-velocity",
3
- "version": "2.0.0-beta.20",
3
+ "version": "2.0.0-beta.22",
4
4
  "description": "Avalere Health branded style system",
5
5
  "scripts": {
6
6
  "setup": "npm ci || npm i && npm run content",