@drax/identity-vue 0.0.22 → 0.0.25
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 +5 -3
- package/src/composables/useCopy.ts +29 -0
- package/src/composables/useRole.ts +7 -7
- package/src/composables/useTenant.ts +8 -7
- package/src/composables/useUser.ts +7 -8
- package/src/cruds/role-crud/RoleCrud.vue +1 -1
- package/src/cruds/role-crud/RoleList.vue +5 -2
- package/src/cruds/tenant-crud/TenantCrud.vue +1 -1
- package/src/cruds/tenant-crud/TenantList.vue +9 -7
- package/src/cruds/user-crud/UserCrud.vue +3 -3
- package/src/cruds/user-crud/UserList.vue +5 -2
- package/src/index.ts +8 -0
package/package.json
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
"publishConfig": {
|
|
4
4
|
"access": "public"
|
|
5
5
|
},
|
|
6
|
-
"version": "0.0.
|
|
6
|
+
"version": "0.0.25",
|
|
7
7
|
"type": "module",
|
|
8
8
|
"main": "./src/index.ts",
|
|
9
9
|
"module": "./src/index.ts",
|
|
@@ -24,7 +24,9 @@
|
|
|
24
24
|
"format": "prettier --write src/"
|
|
25
25
|
},
|
|
26
26
|
"dependencies": {
|
|
27
|
-
"@drax/common-front": "^0.0.
|
|
27
|
+
"@drax/common-front": "^0.0.25",
|
|
28
|
+
"@drax/common-share": "^0.0.25",
|
|
29
|
+
"@drax/identity-share": "^0.0.25",
|
|
28
30
|
"vue-i18n": "^9.13.1"
|
|
29
31
|
},
|
|
30
32
|
"peerDependencies": {
|
|
@@ -61,5 +63,5 @@
|
|
|
61
63
|
"vue-tsc": "^2.0.11",
|
|
62
64
|
"vuetify": "^3.6.4"
|
|
63
65
|
},
|
|
64
|
-
"gitHead": "
|
|
66
|
+
"gitHead": "606497ae64684b17c757a72ed57a4a7dda0f1f8e"
|
|
65
67
|
}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
|
|
2
|
+
export function useCopy(){
|
|
3
|
+
|
|
4
|
+
function unsecuredCopyToClipboard(text:string) {
|
|
5
|
+
const textArea = document.createElement("textarea");
|
|
6
|
+
textArea.value = text;
|
|
7
|
+
document.body.appendChild(textArea);
|
|
8
|
+
textArea.focus();
|
|
9
|
+
textArea.select();
|
|
10
|
+
try {
|
|
11
|
+
document.execCommand('copy');
|
|
12
|
+
} catch (err) {
|
|
13
|
+
console.error('Unable to copy to clipboard', err);
|
|
14
|
+
}
|
|
15
|
+
document.body.removeChild(textArea);
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
async function copy(text:string) {
|
|
19
|
+
if(navigator.clipboard){
|
|
20
|
+
await navigator.clipboard.writeText(text)
|
|
21
|
+
}else{
|
|
22
|
+
unsecuredCopyToClipboard(text)
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
return {
|
|
27
|
+
copy,
|
|
28
|
+
}
|
|
29
|
+
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import {inject, ref} from "vue";
|
|
2
2
|
import {RoleSystem} from "@drax/identity-front";
|
|
3
|
-
import type {IRole, IRoleBase} from "@drax/identity-
|
|
3
|
+
import type {IRole, IRoleBase} from "@drax/identity-share";
|
|
4
4
|
import {ClientError} from "@drax/common-front";
|
|
5
5
|
import type { IClientInputError} from "@drax/common-front";
|
|
6
6
|
|
|
@@ -27,9 +27,9 @@ export function useRole() {
|
|
|
27
27
|
return roles
|
|
28
28
|
}
|
|
29
29
|
|
|
30
|
-
async function paginateRole(page
|
|
30
|
+
async function paginateRole({page= 1, limit= 5, orderBy="", orderDesc=false, search = ""}) {
|
|
31
31
|
loading.value = true
|
|
32
|
-
let paginatedrole = roleSystem.
|
|
32
|
+
let paginatedrole = roleSystem.paginate({page, limit, orderBy, orderDesc, search})
|
|
33
33
|
loading.value = false
|
|
34
34
|
return paginatedrole
|
|
35
35
|
}
|
|
@@ -37,7 +37,7 @@ export function useRole() {
|
|
|
37
37
|
async function createRole(roleData: IRoleBase) {
|
|
38
38
|
try {
|
|
39
39
|
loading.value = true
|
|
40
|
-
let role: IRole = await roleSystem.
|
|
40
|
+
let role: IRole = await roleSystem.create(roleData)
|
|
41
41
|
return role
|
|
42
42
|
} catch (err) {
|
|
43
43
|
if (err instanceof ClientError) {
|
|
@@ -55,7 +55,7 @@ export function useRole() {
|
|
|
55
55
|
async function editRole(id: string, roleData: IRoleBase) {
|
|
56
56
|
try {
|
|
57
57
|
loading.value = true
|
|
58
|
-
let role: IRole = await roleSystem.
|
|
58
|
+
let role: IRole = await roleSystem.update(id, roleData)
|
|
59
59
|
return role
|
|
60
60
|
} catch (err) {
|
|
61
61
|
|
|
@@ -74,9 +74,9 @@ export function useRole() {
|
|
|
74
74
|
async function deleteRole(id: string) {
|
|
75
75
|
try {
|
|
76
76
|
loading.value = true
|
|
77
|
-
await roleSystem.
|
|
77
|
+
await roleSystem.delete(id)
|
|
78
78
|
} catch (err) {
|
|
79
|
-
console.log("composable
|
|
79
|
+
console.log("composable delete error: ", err, )
|
|
80
80
|
if (err instanceof ClientError) {
|
|
81
81
|
inputErrors.value = err.inputErrors
|
|
82
82
|
}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import {inject, ref} from "vue";
|
|
2
|
-
import type {ITenant, ITenantBase
|
|
2
|
+
import type {ITenant, ITenantBase} from "@drax/identity-share";
|
|
3
|
+
import type { TenantSystem} from "@drax/identity-front";
|
|
3
4
|
import {ClientError} from "@drax/common-front";
|
|
4
5
|
import type { IClientInputError} from "@drax/common-front";
|
|
5
6
|
|
|
@@ -19,9 +20,9 @@ export function useTenant() {
|
|
|
19
20
|
return tenants
|
|
20
21
|
}
|
|
21
22
|
|
|
22
|
-
async function paginateTenant(page
|
|
23
|
+
async function paginateTenant({page= 1, limit= 5, orderBy="", orderDesc=false, search = ""}) {
|
|
23
24
|
loading.value = true
|
|
24
|
-
let paginatedtenant = tenantSystem.
|
|
25
|
+
let paginatedtenant = tenantSystem.paginate({page, limit, orderBy, orderDesc, search})
|
|
25
26
|
loading.value = false
|
|
26
27
|
return paginatedtenant
|
|
27
28
|
}
|
|
@@ -29,7 +30,7 @@ export function useTenant() {
|
|
|
29
30
|
async function createTenant(tenantData: ITenantBase) {
|
|
30
31
|
try {
|
|
31
32
|
loading.value = true
|
|
32
|
-
let tenant: ITenant = await tenantSystem.
|
|
33
|
+
let tenant: ITenant = await tenantSystem.create(tenantData)
|
|
33
34
|
return tenant
|
|
34
35
|
} catch (err) {
|
|
35
36
|
if (err instanceof ClientError) {
|
|
@@ -47,7 +48,7 @@ export function useTenant() {
|
|
|
47
48
|
async function editTenant(id: string, tenantData: ITenantBase) {
|
|
48
49
|
try {
|
|
49
50
|
loading.value = true
|
|
50
|
-
let tenant: ITenant = await tenantSystem.
|
|
51
|
+
let tenant: ITenant = await tenantSystem.update(id, tenantData)
|
|
51
52
|
return tenant
|
|
52
53
|
} catch (err) {
|
|
53
54
|
|
|
@@ -66,9 +67,9 @@ export function useTenant() {
|
|
|
66
67
|
async function deleteTenant(id: string) {
|
|
67
68
|
try {
|
|
68
69
|
loading.value = true
|
|
69
|
-
await tenantSystem.
|
|
70
|
+
await tenantSystem.delete(id)
|
|
70
71
|
} catch (err) {
|
|
71
|
-
console.log("composable
|
|
72
|
+
console.log("composable delete error: ", err, )
|
|
72
73
|
if (err instanceof ClientError) {
|
|
73
74
|
inputErrors.value = err.inputErrors
|
|
74
75
|
}
|
|
@@ -1,9 +1,8 @@
|
|
|
1
1
|
import {inject, ref} from "vue";
|
|
2
2
|
import type {UserSystem} from "@drax/identity-front";
|
|
3
|
-
import type {IUser} from "@drax/identity-front";
|
|
4
3
|
import type {IClientInputError} from "@drax/common-front";
|
|
5
4
|
import {ClientError} from "@drax/common-front";
|
|
6
|
-
import type {IUserCreate, IUserUpdate} from "@drax/identity-
|
|
5
|
+
import type {IUser, IUserCreate, IUserUpdate} from "@drax/identity-share";
|
|
7
6
|
|
|
8
7
|
|
|
9
8
|
export function useUser() {
|
|
@@ -14,9 +13,9 @@ export function useUser() {
|
|
|
14
13
|
let inputErrors = ref<IClientInputError>()
|
|
15
14
|
let loading = ref(false);
|
|
16
15
|
|
|
17
|
-
async function paginateUser(page
|
|
16
|
+
async function paginateUser({page= 1, limit= 5, orderBy="", orderDesc=false, search = ""}) {
|
|
18
17
|
loading.value = true
|
|
19
|
-
let paginatedUser = userSystem.
|
|
18
|
+
let paginatedUser = userSystem.paginate({page, limit, orderBy, orderDesc, search})
|
|
20
19
|
loading.value = false
|
|
21
20
|
return paginatedUser
|
|
22
21
|
}
|
|
@@ -24,7 +23,7 @@ export function useUser() {
|
|
|
24
23
|
async function createUser(userData: IUserCreate) {
|
|
25
24
|
try {
|
|
26
25
|
loading.value = true
|
|
27
|
-
let user: IUser = await userSystem.
|
|
26
|
+
let user: IUser = await userSystem.create(userData)
|
|
28
27
|
return user
|
|
29
28
|
} catch (err) {
|
|
30
29
|
if (err instanceof ClientError) {
|
|
@@ -59,7 +58,7 @@ export function useUser() {
|
|
|
59
58
|
async function editUser(id: string, userData: IUserUpdate) {
|
|
60
59
|
try {
|
|
61
60
|
loading.value = true
|
|
62
|
-
let user: IUser = await userSystem.
|
|
61
|
+
let user: IUser = await userSystem.update(id, userData)
|
|
63
62
|
return user
|
|
64
63
|
} catch (err) {
|
|
65
64
|
if (err instanceof ClientError) {
|
|
@@ -77,9 +76,9 @@ export function useUser() {
|
|
|
77
76
|
async function deleteUser(id: string) {
|
|
78
77
|
try {
|
|
79
78
|
loading.value = true
|
|
80
|
-
await userSystem.
|
|
79
|
+
await userSystem.delete(id)
|
|
81
80
|
} catch (err) {
|
|
82
|
-
console.log("composable
|
|
81
|
+
console.log("composable delete error: ", err, )
|
|
83
82
|
if (err instanceof ClientError) {
|
|
84
83
|
inputErrors.value = err.inputErrors
|
|
85
84
|
}
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
import {computed, ref} from 'vue'
|
|
3
3
|
import RoleList from "./RoleList.vue";
|
|
4
4
|
import {useRole} from "../../composables/useRole";
|
|
5
|
-
import type {IRole, IRoleBase} from "@drax/identity-
|
|
5
|
+
import type {IRole, IRoleBase} from "@drax/identity-share";
|
|
6
6
|
import RoleForm from "../../forms/RoleForm.vue";
|
|
7
7
|
import RoleView from "../../views/RoleView.vue";
|
|
8
8
|
|
|
@@ -4,7 +4,7 @@ import {defineProps, type Ref, ref} from "vue";
|
|
|
4
4
|
import {useRole} from "../../composables/useRole";
|
|
5
5
|
import {useAuth} from "../../composables/useAuth";
|
|
6
6
|
import {useI18n} from "vue-i18n";
|
|
7
|
-
import type {IRole} from "@drax/identity-
|
|
7
|
+
import type {IRole} from "@drax/identity-share";
|
|
8
8
|
|
|
9
9
|
const {hasPermission} = useAuth()
|
|
10
10
|
const {paginateRole} = useRole()
|
|
@@ -36,7 +36,10 @@ const search = ref('')
|
|
|
36
36
|
async function loadItems(){
|
|
37
37
|
try{
|
|
38
38
|
loading.value = true
|
|
39
|
-
const r = await paginateRole(
|
|
39
|
+
const r = await paginateRole({
|
|
40
|
+
page: page.value,
|
|
41
|
+
limit: itemsPerPage.value,
|
|
42
|
+
search: search.value})
|
|
40
43
|
serverItems.value = r.items
|
|
41
44
|
totalItems.value = r.total
|
|
42
45
|
}catch (e){
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
import {computed, ref} from 'vue'
|
|
3
3
|
import TenantList from "./TenantList.vue";
|
|
4
4
|
import {useTenant} from "../../composables/useTenant";
|
|
5
|
-
import type {ITenant, ITenantBase} from "@drax/identity-
|
|
5
|
+
import type {ITenant, ITenantBase} from "@drax/identity-share";
|
|
6
6
|
import TenantForm from "../../forms/TenantForm.vue";
|
|
7
7
|
import TenantView from "../../views/TenantView.vue";
|
|
8
8
|
|
|
@@ -4,7 +4,7 @@ import {defineProps, type Ref, ref} from "vue";
|
|
|
4
4
|
import {useTenant} from "../../composables/useTenant";
|
|
5
5
|
import {useAuth} from "../../composables/useAuth";
|
|
6
6
|
import {useI18n} from "vue-i18n";
|
|
7
|
-
import type {ITenant} from "@drax/identity-
|
|
7
|
+
import type {ITenant} from "@drax/identity-share";
|
|
8
8
|
|
|
9
9
|
const {hasPermission} = useAuth()
|
|
10
10
|
const {paginateTenant} = useTenant()
|
|
@@ -19,20 +19,22 @@ defineProps({
|
|
|
19
19
|
|
|
20
20
|
const itemsPerPage = ref(5)
|
|
21
21
|
const page = ref(1)
|
|
22
|
-
const headers = ref<any>([
|
|
23
|
-
{ title: t('tenant.name') as string, key: 'name', align: 'start' },
|
|
24
|
-
{ title: '', key: 'actions', align: 'end', minWidth: '150px' },
|
|
25
|
-
])
|
|
26
|
-
|
|
27
22
|
const serverItems: Ref<ITenant[]> = ref([]);
|
|
28
23
|
const totalItems = ref(0)
|
|
29
24
|
const loading = ref(false)
|
|
30
25
|
const search = ref('')
|
|
26
|
+
const headers = ref<any>([
|
|
27
|
+
{ title: t('tenant.name') as string, key: 'name', align: 'start' },
|
|
28
|
+
{ title: '', key: 'actions', align: 'end', minWidth: '150px' },
|
|
29
|
+
])
|
|
31
30
|
|
|
32
31
|
async function loadItems(){
|
|
33
32
|
try{
|
|
34
33
|
loading.value = true
|
|
35
|
-
const r = await paginateTenant(
|
|
34
|
+
const r = await paginateTenant({
|
|
35
|
+
page: page.value,
|
|
36
|
+
limit: itemsPerPage.value,
|
|
37
|
+
search: search.value})
|
|
36
38
|
serverItems.value = r.items
|
|
37
39
|
totalItems.value = r.total
|
|
38
40
|
}catch (e){
|
|
@@ -2,8 +2,8 @@
|
|
|
2
2
|
import {computed, ref} from 'vue'
|
|
3
3
|
import UserList from "./UserList.vue";
|
|
4
4
|
import {useUser} from "../../composables/useUser";
|
|
5
|
-
import type {IUser} from "@drax/identity-
|
|
6
|
-
import type {
|
|
5
|
+
import type {IUser, IUserCreate, IUserUpdate} from "@drax/identity-share";
|
|
6
|
+
import type {IUserPassword} from "@drax/identity-front";
|
|
7
7
|
import UserCreateForm from "../../forms/UserCreateForm.vue";
|
|
8
8
|
import UserEditForm from "../../forms/UserEditForm.vue";
|
|
9
9
|
import UserPasswordForm from "../../forms/UserPasswordForm.vue";
|
|
@@ -107,7 +107,7 @@ function toEdit(item: IUser) {
|
|
|
107
107
|
email: item.email,
|
|
108
108
|
phone: item.phone,
|
|
109
109
|
role: item.role.id,
|
|
110
|
-
tenant: item
|
|
110
|
+
tenant: item?.tenant?.id,
|
|
111
111
|
active: item.active
|
|
112
112
|
};
|
|
113
113
|
dialog.value = true;
|
|
@@ -4,7 +4,7 @@ import {ref, defineProps, type Ref} from "vue";
|
|
|
4
4
|
import {useUser} from "../../composables/useUser";
|
|
5
5
|
import {useAuth} from "../../composables/useAuth";
|
|
6
6
|
import {useI18n} from "vue-i18n";
|
|
7
|
-
import type {IUser} from "@drax/identity-
|
|
7
|
+
import type {IUser} from "@drax/identity-share";
|
|
8
8
|
|
|
9
9
|
const {hasPermission} = useAuth()
|
|
10
10
|
const {paginateUser} = useUser()
|
|
@@ -38,7 +38,10 @@ const search = ref('')
|
|
|
38
38
|
async function loadItems(){
|
|
39
39
|
try{
|
|
40
40
|
loading.value = true
|
|
41
|
-
const r = await paginateUser(
|
|
41
|
+
const r = await paginateUser({
|
|
42
|
+
page: page.value,
|
|
43
|
+
limit: itemsPerPage.value,
|
|
44
|
+
search: search.value})
|
|
42
45
|
serverItems.value = r.items
|
|
43
46
|
totalItems.value = r.total
|
|
44
47
|
}catch (e){
|
package/src/index.ts
CHANGED
|
@@ -27,9 +27,17 @@ import {useAuth} from "./composables/useAuth.js";
|
|
|
27
27
|
import {useUser} from "./composables/useUser.js";
|
|
28
28
|
import {useRole} from "./composables/useRole.js";
|
|
29
29
|
import {useTenant} from "./composables/useTenant.js";
|
|
30
|
+
import {useI18nValidation} from "./composables/useI18nValidation.js";
|
|
31
|
+
import {useCopy} from "./composables/useCopy.js";
|
|
32
|
+
|
|
30
33
|
import {useAuthStore} from "./stores/auth/AuthStore.js";
|
|
31
34
|
|
|
32
35
|
export {
|
|
36
|
+
|
|
37
|
+
//General purpose composables
|
|
38
|
+
useI18nValidation,
|
|
39
|
+
useCopy,
|
|
40
|
+
|
|
33
41
|
//Vue Components
|
|
34
42
|
IdentityLogin,
|
|
35
43
|
IdentityProfileAvatar,
|