@drax/identity-vue 0.1.9 → 0.3.0
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 +9 -9
- package/src/combobox/TenantCombobox.vue +5 -0
- package/src/composables/useRole.ts +2 -2
- package/src/composables/useTenant.ts +2 -2
- package/src/composables/useUser.ts +2 -2
- package/src/composables/useUserApiKey.ts +2 -2
- package/src/cruds/role-crud/RoleList.vue +5 -0
- package/src/cruds/tenant-crud/TenantList.vue +10 -3
- package/src/cruds/user-api-key-crud/UserApiKeyList.vue +8 -3
- package/src/cruds/user-crud/UserList.vue +5 -0
- package/src/forms/UserCreateForm.vue +1 -0
- package/src/forms/UserEditForm.vue +1 -0
package/package.json
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
"publishConfig": {
|
|
4
4
|
"access": "public"
|
|
5
5
|
},
|
|
6
|
-
"version": "0.
|
|
6
|
+
"version": "0.3.0",
|
|
7
7
|
"type": "module",
|
|
8
8
|
"main": "./src/index.ts",
|
|
9
9
|
"module": "./src/index.ts",
|
|
@@ -24,15 +24,15 @@
|
|
|
24
24
|
"format": "prettier --write src/"
|
|
25
25
|
},
|
|
26
26
|
"dependencies": {
|
|
27
|
-
"@drax/common-front": "^0.
|
|
28
|
-
"@drax/common-share": "^0.
|
|
29
|
-
"@drax/common-vue": "^0.
|
|
30
|
-
"@drax/identity-share": "^0.
|
|
31
|
-
"vue-i18n": "^9.13.1"
|
|
27
|
+
"@drax/common-front": "^0.3.0",
|
|
28
|
+
"@drax/common-share": "^0.3.0",
|
|
29
|
+
"@drax/common-vue": "^0.3.0",
|
|
30
|
+
"@drax/identity-share": "^0.3.0"
|
|
32
31
|
},
|
|
33
32
|
"peerDependencies": {
|
|
34
33
|
"pinia": "^2.2.2",
|
|
35
34
|
"vue": "^3.5.3",
|
|
35
|
+
"vue-i18n": "^9.14.0",
|
|
36
36
|
"vuetify": "^3.7.1"
|
|
37
37
|
},
|
|
38
38
|
"devDependencies": {
|
|
@@ -51,7 +51,7 @@
|
|
|
51
51
|
"eslint-plugin-vue": "^9.23.0",
|
|
52
52
|
"jsdom": "^24.0.0",
|
|
53
53
|
"npm-run-all2": "^6.1.2",
|
|
54
|
-
"pinia": "^2.
|
|
54
|
+
"pinia": "^2.2.2",
|
|
55
55
|
"pinia-plugin-persistedstate": "^3.2.1",
|
|
56
56
|
"prettier": "^3.2.5",
|
|
57
57
|
"start-server-and-test": "^2.0.3",
|
|
@@ -61,8 +61,8 @@
|
|
|
61
61
|
"vite-plugin-dts": "^3.9.1",
|
|
62
62
|
"vitest": "^1.6.0",
|
|
63
63
|
"vue": "^3.5.3",
|
|
64
|
-
"vue-tsc": "^2.
|
|
64
|
+
"vue-tsc": "^2.1.6",
|
|
65
65
|
"vuetify": "^3.7.1"
|
|
66
66
|
},
|
|
67
|
-
"gitHead": "
|
|
67
|
+
"gitHead": "5ec8cb15b649fb29c69fbb7f248346487e0e9be2"
|
|
68
68
|
}
|
|
@@ -5,6 +5,10 @@ import type { PropType } from 'vue'
|
|
|
5
5
|
defineProps({
|
|
6
6
|
errorMessages: {
|
|
7
7
|
type: String as PropType<string | string[] | undefined>,
|
|
8
|
+
},
|
|
9
|
+
clearable: {
|
|
10
|
+
type: Boolean,
|
|
11
|
+
default: false,
|
|
8
12
|
}
|
|
9
13
|
})
|
|
10
14
|
|
|
@@ -29,6 +33,7 @@ onMounted(async () => {
|
|
|
29
33
|
item-value="id"
|
|
30
34
|
variant="outlined"
|
|
31
35
|
:error-messages="errorMessages"
|
|
36
|
+
:clearable="clearable"
|
|
32
37
|
></v-select>
|
|
33
38
|
</template>
|
|
34
39
|
|
|
@@ -27,9 +27,9 @@ export function useRole() {
|
|
|
27
27
|
return roles
|
|
28
28
|
}
|
|
29
29
|
|
|
30
|
-
async function paginateRole({page= 1, limit= 5, orderBy="",
|
|
30
|
+
async function paginateRole({page= 1, limit= 5, orderBy="", order=false, search = ""}) {
|
|
31
31
|
loading.value = true
|
|
32
|
-
let paginatedrole = roleSystem.paginate({page, limit, orderBy,
|
|
32
|
+
let paginatedrole = roleSystem.paginate({page, limit, orderBy, order, search})
|
|
33
33
|
loading.value = false
|
|
34
34
|
return paginatedrole
|
|
35
35
|
}
|
|
@@ -20,9 +20,9 @@ export function useTenant() {
|
|
|
20
20
|
return tenants
|
|
21
21
|
}
|
|
22
22
|
|
|
23
|
-
async function paginateTenant({page= 1, limit= 5, orderBy="",
|
|
23
|
+
async function paginateTenant({page= 1, limit= 5, orderBy="", order=false, search = ""}) {
|
|
24
24
|
loading.value = true
|
|
25
|
-
let paginatedtenant = tenantSystem.paginate({page, limit, orderBy,
|
|
25
|
+
let paginatedtenant = tenantSystem.paginate({page, limit, orderBy, order, search})
|
|
26
26
|
loading.value = false
|
|
27
27
|
return paginatedtenant
|
|
28
28
|
}
|
|
@@ -13,9 +13,9 @@ export function useUser() {
|
|
|
13
13
|
let inputErrors = ref<IClientInputError>()
|
|
14
14
|
let loading = ref(false);
|
|
15
15
|
|
|
16
|
-
async function paginateUser({page= 1, limit= 5, orderBy="",
|
|
16
|
+
async function paginateUser({page= 1, limit= 5, orderBy="", order=false, search = ""}) {
|
|
17
17
|
loading.value = true
|
|
18
|
-
let paginatedUser = userSystem.paginate({page, limit, orderBy,
|
|
18
|
+
let paginatedUser = userSystem.paginate({page, limit, orderBy, order, search})
|
|
19
19
|
loading.value = false
|
|
20
20
|
return paginatedUser
|
|
21
21
|
}
|
|
@@ -14,9 +14,9 @@ export function useUserApiKey() {
|
|
|
14
14
|
let loading = ref(false);
|
|
15
15
|
|
|
16
16
|
|
|
17
|
-
async function paginateUserApiKey({page= 1, limit= 5, orderBy="",
|
|
17
|
+
async function paginateUserApiKey({page= 1, limit= 5, orderBy="", order=false, search = ""}) {
|
|
18
18
|
loading.value = true
|
|
19
|
-
let paginateduserApiKey = userApiKeySystem.paginate({page, limit, orderBy,
|
|
19
|
+
let paginateduserApiKey = userApiKeySystem.paginate({page, limit, orderBy, order, search})
|
|
20
20
|
loading.value = false
|
|
21
21
|
return paginateduserApiKey
|
|
22
22
|
}
|
|
@@ -32,6 +32,7 @@ const serverItems: Ref<IRole[]> = ref([]);
|
|
|
32
32
|
const totalItems = ref(0)
|
|
33
33
|
const loading = ref(false)
|
|
34
34
|
const search = ref('')
|
|
35
|
+
const sortBy : Ref<any> = ref([])
|
|
35
36
|
|
|
36
37
|
async function loadItems(){
|
|
37
38
|
try{
|
|
@@ -39,6 +40,8 @@ async function loadItems(){
|
|
|
39
40
|
const r = await paginateRole({
|
|
40
41
|
page: page.value,
|
|
41
42
|
limit: itemsPerPage.value,
|
|
43
|
+
orderBy: sortBy.value[0]?.key,
|
|
44
|
+
order: sortBy.value[0]?.order,
|
|
42
45
|
search: search.value})
|
|
43
46
|
serverItems.value = r.items
|
|
44
47
|
totalItems.value = r.total
|
|
@@ -61,7 +64,9 @@ defineExpose({
|
|
|
61
64
|
<v-data-table-server
|
|
62
65
|
v-if="hasPermission('user:manage')"
|
|
63
66
|
v-model:items-per-page="itemsPerPage"
|
|
67
|
+
:items-per-page-options="[5, 10, 20, 50]"
|
|
64
68
|
v-model:page="page"
|
|
69
|
+
v-model:sort-by="sortBy"
|
|
65
70
|
:headers="headers"
|
|
66
71
|
:items="serverItems"
|
|
67
72
|
:items-length="totalItems"
|
|
@@ -1,11 +1,10 @@
|
|
|
1
1
|
<script setup lang="ts">
|
|
2
|
-
|
|
3
2
|
import {defineProps, type Ref, ref} from "vue";
|
|
4
3
|
import {useTenant} from "../../composables/useTenant";
|
|
5
4
|
import {useAuth} from "../../composables/useAuth";
|
|
6
5
|
import {useI18n} from "vue-i18n";
|
|
7
6
|
import type {ITenant} from "@drax/identity-share";
|
|
8
|
-
import
|
|
7
|
+
import {formatDateTime} from "@drax/common-front";
|
|
9
8
|
|
|
10
9
|
const {hasPermission} = useAuth()
|
|
11
10
|
const {paginateTenant} = useTenant()
|
|
@@ -24,18 +23,23 @@ const serverItems: Ref<ITenant[]> = ref([]);
|
|
|
24
23
|
const totalItems = ref(0)
|
|
25
24
|
const loading = ref(false)
|
|
26
25
|
const search = ref('')
|
|
26
|
+
const sortBy : Ref<any> = ref([])
|
|
27
|
+
|
|
27
28
|
const headers = ref<any>([
|
|
28
29
|
{ title: t('tenant.name') as string, key: 'name', align: 'start' },
|
|
29
30
|
{ title: t('tenant.createdAt') as string, key: 'createdAt', align: 'start' },
|
|
30
31
|
{ title: '', key: 'actions', align: 'end', minWidth: '150px' },
|
|
31
32
|
])
|
|
32
33
|
|
|
34
|
+
|
|
33
35
|
async function loadItems(){
|
|
34
36
|
try{
|
|
35
37
|
loading.value = true
|
|
36
38
|
const r = await paginateTenant({
|
|
37
39
|
page: page.value,
|
|
38
40
|
limit: itemsPerPage.value,
|
|
41
|
+
orderBy: sortBy.value[0]?.key,
|
|
42
|
+
order: sortBy.value[0]?.order,
|
|
39
43
|
search: search.value})
|
|
40
44
|
serverItems.value = r.items
|
|
41
45
|
totalItems.value = r.total
|
|
@@ -59,12 +63,15 @@ defineExpose({
|
|
|
59
63
|
class="border"
|
|
60
64
|
v-if="hasPermission('user:manage')"
|
|
61
65
|
v-model:items-per-page="itemsPerPage"
|
|
66
|
+
:items-per-page-options="[5, 10, 20, 50]"
|
|
62
67
|
v-model:page="page"
|
|
68
|
+
v-model:sort-by="sortBy"
|
|
63
69
|
:headers="headers"
|
|
64
70
|
:items="serverItems"
|
|
65
71
|
:items-length="totalItems"
|
|
66
72
|
:loading="loading"
|
|
67
73
|
:search="search"
|
|
74
|
+
:multi-sort="false"
|
|
68
75
|
item-value="name"
|
|
69
76
|
@update:options="loadItems"
|
|
70
77
|
>
|
|
@@ -84,7 +91,7 @@ defineExpose({
|
|
|
84
91
|
</template>
|
|
85
92
|
|
|
86
93
|
<template v-slot:item.createdAt="{ value }" >
|
|
87
|
-
{{
|
|
94
|
+
{{formatDateTime(value)}}
|
|
88
95
|
</template>
|
|
89
96
|
|
|
90
97
|
|
|
@@ -5,7 +5,7 @@ import {useUserApiKey} from "../../composables/useUserApiKey";
|
|
|
5
5
|
import {useAuth} from "../../composables/useAuth";
|
|
6
6
|
import {useI18n} from "vue-i18n";
|
|
7
7
|
import type {IUserApiKey} from "@drax/identity-share";
|
|
8
|
-
import
|
|
8
|
+
import {formatDateTime} from "@drax/common-front";
|
|
9
9
|
|
|
10
10
|
const {hasPermission} = useAuth()
|
|
11
11
|
const {paginateUserApiKey} = useUserApiKey()
|
|
@@ -24,9 +24,10 @@ const serverItems: Ref<IUserApiKey[]> = ref([]);
|
|
|
24
24
|
const totalItems = ref(0)
|
|
25
25
|
const loading = ref(false)
|
|
26
26
|
const search = ref('')
|
|
27
|
+
const sortBy : Ref<any> = ref([])
|
|
27
28
|
|
|
28
29
|
const headers = ref<any>([
|
|
29
|
-
...( hasPermission('userApiKey:view') ? [{ title: t('userApiKey.user') as string, key: 'user.username', align: 'start' }] : []),
|
|
30
|
+
...( hasPermission('userApiKey:view') ? [{ title: t('userApiKey.user') as string, key: 'user.username', align: 'start', sortable: false }] : []),
|
|
30
31
|
{ title: t('userApiKey.name') as string, key: 'name', align: 'start' },
|
|
31
32
|
{ title: t('userApiKey.ipv4') as string, key: 'ipv4', align: 'start' },
|
|
32
33
|
{ title: t('userApiKey.ipv6') as string, key: 'ipv6', align: 'start' },
|
|
@@ -40,6 +41,8 @@ async function loadItems(){
|
|
|
40
41
|
const r = await paginateUserApiKey({
|
|
41
42
|
page: page.value,
|
|
42
43
|
limit: itemsPerPage.value,
|
|
44
|
+
orderBy: sortBy.value[0]?.key,
|
|
45
|
+
order: sortBy.value[0]?.order,
|
|
43
46
|
search: search.value})
|
|
44
47
|
serverItems.value = r.items
|
|
45
48
|
totalItems.value = r.total
|
|
@@ -63,7 +66,9 @@ defineExpose({
|
|
|
63
66
|
class="border"
|
|
64
67
|
v-if="hasPermission('userApiKey:manage')"
|
|
65
68
|
v-model:items-per-page="itemsPerPage"
|
|
69
|
+
:items-per-page-options="[5, 10, 20, 50]"
|
|
66
70
|
v-model:page="page"
|
|
71
|
+
v-model:sort-by="sortBy"
|
|
67
72
|
:headers="headers"
|
|
68
73
|
:items="serverItems"
|
|
69
74
|
:items-length="totalItems"
|
|
@@ -96,7 +101,7 @@ defineExpose({
|
|
|
96
101
|
</template>
|
|
97
102
|
|
|
98
103
|
<template v-slot:item.createdAt="{ value }" >
|
|
99
|
-
{{
|
|
104
|
+
{{formatDateTime(value)}}
|
|
100
105
|
</template>
|
|
101
106
|
|
|
102
107
|
|
|
@@ -34,6 +34,7 @@ const serverItems: Ref<IUser[]> = ref([]);
|
|
|
34
34
|
const totalItems = ref(0)
|
|
35
35
|
const loading = ref(false)
|
|
36
36
|
const search = ref('')
|
|
37
|
+
const sortBy : Ref<any> = ref([])
|
|
37
38
|
|
|
38
39
|
async function loadItems(){
|
|
39
40
|
try{
|
|
@@ -41,6 +42,8 @@ async function loadItems(){
|
|
|
41
42
|
const r = await paginateUser({
|
|
42
43
|
page: page.value,
|
|
43
44
|
limit: itemsPerPage.value,
|
|
45
|
+
orderBy: sortBy.value[0]?.key,
|
|
46
|
+
order: sortBy.value[0]?.order,
|
|
44
47
|
search: search.value})
|
|
45
48
|
serverItems.value = r.items
|
|
46
49
|
totalItems.value = r.total
|
|
@@ -64,6 +67,8 @@ defineExpose({
|
|
|
64
67
|
v-if="hasPermission('user:manage')"
|
|
65
68
|
v-model:items-per-page="itemsPerPage"
|
|
66
69
|
v-model:page="page"
|
|
70
|
+
v-model:sort-by="sortBy"
|
|
71
|
+
:items-per-page-options="[5, 10, 20, 50]"
|
|
67
72
|
:headers="headers"
|
|
68
73
|
:items="serverItems"
|
|
69
74
|
:items-length="totalItems"
|