@drax/identity-vue 0.11.5 → 0.12.7

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/package.json CHANGED
@@ -3,7 +3,7 @@
3
3
  "publishConfig": {
4
4
  "access": "public"
5
5
  },
6
- "version": "0.11.5",
6
+ "version": "0.12.7",
7
7
  "type": "module",
8
8
  "main": "./src/index.ts",
9
9
  "module": "./src/index.ts",
@@ -24,12 +24,12 @@
24
24
  "format": "prettier --write src/"
25
25
  },
26
26
  "dependencies": {
27
- "@drax/common-front": "^0.11.5",
28
- "@drax/common-vue": "^0.11.5",
29
- "@drax/crud-front": "^0.11.3",
30
- "@drax/crud-share": "^0.11.5",
31
- "@drax/crud-vue": "^0.11.5",
32
- "@drax/identity-share": "^0.11.5"
27
+ "@drax/common-front": "^0.12.1",
28
+ "@drax/common-vue": "^0.12.1",
29
+ "@drax/crud-front": "^0.12.1",
30
+ "@drax/crud-share": "^0.12.1",
31
+ "@drax/crud-vue": "^0.12.1",
32
+ "@drax/identity-share": "^0.12.1"
33
33
  },
34
34
  "peerDependencies": {
35
35
  "pinia": "^2.2.2",
@@ -66,5 +66,5 @@
66
66
  "vue-tsc": "^2.1.6",
67
67
  "vuetify": "^3.7.1"
68
68
  },
69
- "gitHead": "e67f10f0af29468c9d30f16135cfdbdff166d916"
69
+ "gitHead": "2a0174e7fff0e4778ff45b5e1f3752b06164e93a"
70
70
  }
@@ -14,6 +14,8 @@ defineProps({
14
14
  rules: {type: Array as PropType<any[]>, default: () => []},
15
15
  multiple: {type: Boolean, default: false},
16
16
  clearable: {type: Boolean, default: false},
17
+ itemTitle: {type: String, default: "name"},
18
+ itemValue: {type: String, default: "_id"},
17
19
  readonly: {type: Boolean, default: false},
18
20
  label: {type: String, default: 'role.entity'},
19
21
  density: {type: String as PropType<'comfortable' | 'compact' | 'default'>, default: 'default'},
@@ -35,8 +37,8 @@ onMounted(async () => {
35
37
  v-model="model"
36
38
  :label="te(label) ? t(label) : label"
37
39
  :items="items"
38
- item-title="name"
39
- item-value="id"
40
+ :item-title="itemTitle"
41
+ :item-value="itemValue"
40
42
  :variant="variant"
41
43
  :error-messages="errorMessages"
42
44
  :multiple="multiple"
@@ -8,6 +8,8 @@ defineProps({
8
8
  errorMessages: {type: String as PropType<string | string[] | undefined>,},
9
9
  clearable: {type: Boolean, default: false},
10
10
  readonly: {type: Boolean, default: false},
11
+ itemTitle: {type: String, default: "name"},
12
+ itemValue: {type: String, default: "_id"},
11
13
  rules: {type: Array as PropType<any[]>, default: () => []},
12
14
  label: {type: String, default: 'tenant.entity'},
13
15
  density: {type: String as PropType<'comfortable' | 'compact' | 'default'>, default: 'default'},
@@ -31,8 +33,8 @@ onMounted(async () => {
31
33
  v-model="model"
32
34
  :label="te(label) ? t(label) : label"
33
35
  :items="items"
34
- item-title="name"
35
- item-value="id"
36
+ :item-title="itemTitle"
37
+ :item-value="itemValue"
36
38
  :variant="variant"
37
39
  :error-messages="errorMessages"
38
40
  :clearable="clearable"
@@ -26,12 +26,24 @@ const valueModel = defineModel<boolean>()
26
26
  <identity-profile-view></identity-profile-view>
27
27
  <v-divider></v-divider>
28
28
  <v-list>
29
+
30
+ <slot name="menu"></slot>
31
+
29
32
  <v-list-item
30
33
  @click="router.push({name:'Profile'})"
31
34
  prepend-icon="mdi-account-cog"
32
35
  :title="t('user.profile')"
33
36
  >
34
37
  </v-list-item>
38
+
39
+ <v-list-item
40
+ v-if="auth.hasPermission('userApiKey:manage')"
41
+ @click="router.push({name:'CrudUserApiKey'})"
42
+ prepend-icon="mdi-table-key"
43
+ :title="t('userapikey.menu')"
44
+ >
45
+ </v-list-item>
46
+
35
47
  <v-list-item
36
48
  @click="auth.logout()"
37
49
  prepend-icon="mdi-logout"
@@ -44,8 +44,8 @@ function confirmPasswordRule(value: string) {
44
44
  async function submitRegistration() {
45
45
  try {
46
46
  loading.value = true
47
- await register(form.value)
48
- success.value = true
47
+ const result = await register(form.value)
48
+ success.value = result.success
49
49
  } catch (err) {
50
50
  if (err instanceof ClientError) {
51
51
  inputErrors.value = err.inputErrors
@@ -69,7 +69,7 @@ async function submitRegistration() {
69
69
  <v-card>
70
70
  <v-card-text>
71
71
  <v-alert type="success">
72
- {{ t('user.event.registrationComplete') }}
72
+ {{ t('user.events.registrationComplete') }}
73
73
  </v-alert>
74
74
  </v-card-text>
75
75
  <v-card-text class="text-center">
@@ -4,6 +4,7 @@ import {RoleSystemFactory} from "@drax/identity-front";
4
4
  import type {IRole, IRoleBase} from "@drax/identity-share";
5
5
  import {ClientError} from "@drax/common-front";
6
6
  import type {IClientInputError} from "@drax/common-front";
7
+ import type {IDraxPaginateOptions} from "@drax/crud-share";
7
8
 
8
9
 
9
10
  export function useRole() {
@@ -28,7 +29,7 @@ export function useRole() {
28
29
  return roles
29
30
  }
30
31
 
31
- async function paginateRole({page = 1, limit = 5, orderBy = "", order = false, search = ""}) {
32
+ async function paginateRole({page = 1, limit = 5, orderBy = "", order = "asc", search = ""}: IDraxPaginateOptions) {
32
33
  loading.value = true
33
34
  let paginatedrole = roleSystem.paginate({page, limit, orderBy, order, search})
34
35
  loading.value = false
@@ -4,6 +4,7 @@ import type { TenantSystem} from "@drax/identity-front";
4
4
  import { TenantSystemFactory} from "@drax/identity-front";
5
5
  import {ClientError} from "@drax/common-front";
6
6
  import type { IClientInputError} from "@drax/common-front";
7
+ import type {IDraxPaginateOptions} from "@drax/crud-share";
7
8
 
8
9
 
9
10
  export function useTenant() {
@@ -21,7 +22,7 @@ export function useTenant() {
21
22
  return tenants
22
23
  }
23
24
 
24
- async function paginateTenant({page= 1, limit= 5, orderBy="", order=false, search = ""}) {
25
+ async function paginateTenant({page= 1, limit= 5, orderBy="", order="asc", search = ""}: IDraxPaginateOptions) {
25
26
  loading.value = true
26
27
  let paginatedtenant = tenantSystem.paginate({page, limit, orderBy, order, search})
27
28
  loading.value = false
@@ -4,6 +4,7 @@ import {UserSystemFactory} from "@drax/identity-front";
4
4
  import type {IClientInputError} from "@drax/common-front";
5
5
  import {ClientError} from "@drax/common-front";
6
6
  import type {IUser, IUserCreate, IUserUpdate} from "@drax/identity-share";
7
+ import type {IDraxPaginateOptions} from "@drax/crud-share";
7
8
 
8
9
 
9
10
  export function useUser() {
@@ -14,7 +15,7 @@ export function useUser() {
14
15
  let inputErrors = ref<IClientInputError>()
15
16
  let loading = ref(false);
16
17
 
17
- async function paginateUser({page= 1, limit= 5, orderBy="", order=false, search = ""}) {
18
+ async function paginateUser({page= 1, limit= 5, orderBy="", order = "asc", search = ""}:IDraxPaginateOptions) {
18
19
  loading.value = true
19
20
  let paginatedUser = userSystem.paginate({page, limit, orderBy, order, search})
20
21
  loading.value = false
@@ -3,6 +3,7 @@ import type {IUserApiKey, IUserApiKeyBase} from "@drax/identity-share";
3
3
  import { UserApiKeySystemFactory} from "@drax/identity-front";
4
4
  import {ClientError} from "@drax/common-front";
5
5
  import type { IClientInputError} from "@drax/common-front";
6
+ import type {IDraxPaginateOptions} from "@drax/crud-share";
6
7
 
7
8
 
8
9
  export function useUserApiKey() {
@@ -14,7 +15,7 @@ export function useUserApiKey() {
14
15
  let loading = ref(false);
15
16
 
16
17
 
17
- async function paginateUserApiKey({page= 1, limit= 5, orderBy="", order=false, search = ""}) {
18
+ async function paginateUserApiKey({page= 1, limit= 5, orderBy="", order="asc", search = ""}: IDraxPaginateOptions) {
18
19
  loading.value = true
19
20
  let paginateduserApiKey = userApiKeySystem.paginate({page, limit, orderBy, order, search})
20
21
  loading.value = false
@@ -58,7 +58,9 @@ class RoleCrud extends EntityCrud implements IEntityCrud {
58
58
 
59
59
  get fields(): IEntityCrudField[]{
60
60
  return [
61
- {name: 'name', type: 'string', label: 'name', default:'', prependInnerIcon:'mdi-text-short' }
61
+ {name: 'name', type: 'string', label: 'name', default:'', prependInnerIcon:'mdi-text-short' },
62
+ {name: 'childRoles', type: 'array.ref', ref:'Role', refDisplay: 'name', label: 'childRoles', default:[], prependInnerIcon:'mdi-text-short' },
63
+ {name: 'permissions', type: 'array.string', label: 'childRoles', default:[], prependInnerIcon:'mdi-text-short' }
62
64
  ]
63
65
  }
64
66
 
@@ -62,6 +62,8 @@ let passwordVisibility = ref(false)
62
62
  {{ t('role.readonly') }}
63
63
  </v-alert>
64
64
 
65
+ <v-card-subtitle v-if="valueModel.id">ID: {{ valueModel.id }}</v-card-subtitle>
66
+
65
67
  <v-card-text v-if="store.error">
66
68
  <v-alert color="error">{{ te(store.error) ? t(store.error) : store.error }}</v-alert>
67
69
  </v-card-text>
@@ -25,10 +25,8 @@ let userError = ref<string>('')
25
25
 
26
26
  async function savePassword() {
27
27
  if (passwordForm.value.newPassword === passwordForm.value.confirmPassword) {
28
- passwordChanged.value = await changeUserPassword(user.id, passwordForm.value.newPassword)
29
- return
30
- } else {
31
- return
28
+ await changeUserPassword(user._id, passwordForm.value.newPassword)
29
+ passwordChanged.value = true
32
30
  }
33
31
  }
34
32
 
@@ -54,8 +52,8 @@ async function changeUserPassword(id: string, newPassword: string) {
54
52
  <template>
55
53
  <v-dialog v-model="valueModel" max-width="800">
56
54
  <v-card>
57
- <v-card-title>{{t('user.operation.changePassword')}}</v-card-title>
58
- <v-card-subtitle>{{t('user.field.username')}}: {{user.username}}</v-card-subtitle>
55
+ <v-card-title>{{ t('user.operation.changePassword') }}</v-card-title>
56
+ <v-card-subtitle>{{ t('user.field.username') }}: {{ user.username }}</v-card-subtitle>
59
57
  <v-card-text>
60
58
  <user-password-form
61
59
  v-model="passwordForm"
@@ -80,7 +78,7 @@ async function changeUserPassword(id: string, newPassword: string) {
80
78
  @click="savePassword"
81
79
  :loading="loading"
82
80
  >
83
- {{ t('action.change') }}
81
+ {{ t('action.change') }}
84
82
  </v-btn>
85
83
  </v-card-actions>
86
84
 
@@ -23,7 +23,6 @@ async function submit() {
23
23
  }
24
24
 
25
25
  function onCreated(item:IUserApiKey) {
26
- console.log("User API Key created:", item);
27
26
  userApiKeyCreated.value = item;
28
27
  userApiKeyCreatedDialog.value = true;
29
28
  }