@drax/identity-vue 0.5.3 → 0.5.4
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 +6 -5
- package/src/combobox/RoleCombobox.vue +15 -18
- package/src/components/PermissionSelector/PermissionSelector.vue +4 -7
- package/src/cruds/role-crud/RoleCrud.ts +83 -0
- package/src/cruds/tenant-crud/TenantCrud.ts +9 -3
- package/src/cruds/user-crud/UserCrud.ts +101 -0
- package/src/forms/RoleForm.vue +57 -25
- package/src/forms/RoleFormOld.vue +57 -0
- package/src/pages/RoleCrudCustomPage.vue +12 -0
- package/src/pages/RoleCrudPage.vue +51 -2
- package/src/pages/UserCrudCustomPage.vue +12 -0
- package/src/pages/UserCrudPage.vue +9 -3
- package/src/routes/IdentityRoutes.ts +96 -60
- /package/src/pages/{TenantCrudPageOld.vue → TenantCrudCustomPage.vue} +0 -0
package/package.json
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
"publishConfig": {
|
|
4
4
|
"access": "public"
|
|
5
5
|
},
|
|
6
|
-
"version": "0.5.
|
|
6
|
+
"version": "0.5.4",
|
|
7
7
|
"type": "module",
|
|
8
8
|
"main": "./src/index.ts",
|
|
9
9
|
"module": "./src/index.ts",
|
|
@@ -24,9 +24,10 @@
|
|
|
24
24
|
"format": "prettier --write src/"
|
|
25
25
|
},
|
|
26
26
|
"dependencies": {
|
|
27
|
-
"@drax/common-front": "^0.5.
|
|
28
|
-
"@drax/common-vue": "^0.5.
|
|
29
|
-
"@drax/crud-
|
|
27
|
+
"@drax/common-front": "^0.5.4",
|
|
28
|
+
"@drax/common-vue": "^0.5.4",
|
|
29
|
+
"@drax/crud-front": "^0.5.3",
|
|
30
|
+
"@drax/crud-share": "^0.5.4",
|
|
30
31
|
"@drax/identity-share": "^0.5.1"
|
|
31
32
|
},
|
|
32
33
|
"peerDependencies": {
|
|
@@ -64,5 +65,5 @@
|
|
|
64
65
|
"vue-tsc": "^2.1.6",
|
|
65
66
|
"vuetify": "^3.7.1"
|
|
66
67
|
},
|
|
67
|
-
"gitHead": "
|
|
68
|
+
"gitHead": "6db0bebb2df9edecd2c3caa7288fb5c7001c4243"
|
|
68
69
|
}
|
|
@@ -1,31 +1,26 @@
|
|
|
1
1
|
<script setup lang="ts">
|
|
2
|
-
|
|
3
2
|
import {ref, onMounted, defineModel} from 'vue'
|
|
4
|
-
import type {
|
|
3
|
+
import type {PropType} from 'vue'
|
|
4
|
+
import type {IRole} from "@drax/identity-share";
|
|
5
|
+
import {useRole} from "../composables/useRole";
|
|
6
|
+
|
|
5
7
|
defineProps({
|
|
6
|
-
errorMessages: {
|
|
7
|
-
|
|
8
|
-
},
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
},
|
|
13
|
-
clearable:{
|
|
14
|
-
type: Boolean,
|
|
15
|
-
default: false,
|
|
16
|
-
}
|
|
8
|
+
errorMessages: {type: String as PropType<string | string[] | undefined>},
|
|
9
|
+
multiple: {type: Boolean, default: false},
|
|
10
|
+
clearable: {type: Boolean, default: false},
|
|
11
|
+
readonly: {type: Boolean, default: false},
|
|
12
|
+
density: {type: String as PropType<'comfortable' | 'compact' | 'default'>, default: 'default'},
|
|
13
|
+
variant: {type: String as PropType<'underlined' | 'outlined' | 'filled' | 'solo' | 'solo-inverted' | 'solo-filled' | 'plain'>, default: 'filled'},
|
|
17
14
|
})
|
|
18
15
|
|
|
19
16
|
const model = defineModel<any>()
|
|
20
|
-
|
|
17
|
+
|
|
21
18
|
const {fetchRole} = useRole()
|
|
22
|
-
let items = ref([])
|
|
19
|
+
let items = ref<IRole[]>([])
|
|
23
20
|
|
|
24
21
|
onMounted(async () => {
|
|
25
22
|
items.value = await fetchRole()
|
|
26
23
|
})
|
|
27
|
-
|
|
28
|
-
|
|
29
24
|
</script>
|
|
30
25
|
|
|
31
26
|
<template>
|
|
@@ -35,10 +30,12 @@ onMounted(async () => {
|
|
|
35
30
|
:items="items"
|
|
36
31
|
item-title="name"
|
|
37
32
|
item-value="id"
|
|
38
|
-
variant="
|
|
33
|
+
:variant="variant"
|
|
39
34
|
:error-messages="errorMessages"
|
|
40
35
|
:multiple="multiple"
|
|
41
36
|
:clearable="clearable"
|
|
37
|
+
:readonly="readonly"
|
|
38
|
+
:density="density"
|
|
42
39
|
></v-select>
|
|
43
40
|
</template>
|
|
44
41
|
|
|
@@ -6,9 +6,8 @@ import {useI18n} from "vue-i18n";
|
|
|
6
6
|
const {t,te} = useI18n()
|
|
7
7
|
|
|
8
8
|
defineProps({
|
|
9
|
-
errorMessages: {
|
|
10
|
-
|
|
11
|
-
}
|
|
9
|
+
errorMessages: {type: String as PropType<string | string[] | undefined>,},
|
|
10
|
+
readonly: {type: Boolean, default: false},
|
|
12
11
|
})
|
|
13
12
|
|
|
14
13
|
const model = defineModel()
|
|
@@ -68,17 +67,15 @@ const permissionGroups = computed(() => {
|
|
|
68
67
|
<v-item
|
|
69
68
|
v-for="permission in permissions"
|
|
70
69
|
v-slot="{ isSelected, toggle }"
|
|
71
|
-
:value="permission"
|
|
70
|
+
:value="permission" :disabled="readonly"
|
|
72
71
|
>
|
|
73
72
|
|
|
74
73
|
<v-chip
|
|
75
|
-
:color="isSelected? 'green' : 'grey-darken-3'"
|
|
74
|
+
:color="isSelected? 'green' : 'grey-darken-3'" :disabled="readonly"
|
|
76
75
|
@click="toggle" variant="flat" :rounded="false" border
|
|
77
76
|
>
|
|
78
77
|
{{ te('permission.'+permission) ? t('permission.'+permission) : permission }}
|
|
79
78
|
</v-chip>
|
|
80
|
-
|
|
81
|
-
|
|
82
79
|
</v-item>
|
|
83
80
|
</v-card-text>
|
|
84
81
|
</v-card>
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
|
|
2
|
+
import {EntityCrud} from "@drax/crud-vue";
|
|
3
|
+
import {RoleSystemFactory} from "@drax/identity-front";
|
|
4
|
+
import type {IEntityCrud, IEntityCrudField, IEntityCrudFilter, IEntityCrudHeader} from "@drax/crud-share";
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
class RoleCrud extends EntityCrud implements IEntityCrud {
|
|
8
|
+
|
|
9
|
+
static singleton: RoleCrud
|
|
10
|
+
|
|
11
|
+
constructor() {
|
|
12
|
+
super();
|
|
13
|
+
this.name = 'Role'
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
static get instance(): RoleCrud {
|
|
17
|
+
if(!RoleCrud.singleton){
|
|
18
|
+
RoleCrud.singleton = new RoleCrud()
|
|
19
|
+
}
|
|
20
|
+
return RoleCrud.singleton
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
get permissions(){
|
|
24
|
+
return {
|
|
25
|
+
manage: 'tenant:manage',
|
|
26
|
+
view: 'tenant:view',
|
|
27
|
+
create: 'tenant:create',
|
|
28
|
+
update: 'tenant:update',
|
|
29
|
+
delete: 'tenant:delete'
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
get headers():IEntityCrudHeader[] {
|
|
34
|
+
return [
|
|
35
|
+
//{title: 'id',key:'_id', align: 'start'},
|
|
36
|
+
{title: 'name',key:'name', align: 'start'},
|
|
37
|
+
{title: 'permissions',key:'permissions', align: 'start'},
|
|
38
|
+
{title: 'childRoles',key:'childRoles', align: 'start'},
|
|
39
|
+
{title: 'readonly',key:'readonly', align: 'start'},
|
|
40
|
+
]
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
get provider(){
|
|
44
|
+
return RoleSystemFactory.getInstance()
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
get refs(){
|
|
48
|
+
return {
|
|
49
|
+
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
get rules(){
|
|
54
|
+
return {
|
|
55
|
+
name: [(v: any) => !!v || 'Requerido']
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
get fields(): IEntityCrudField[]{
|
|
60
|
+
return [
|
|
61
|
+
{name: 'name', type: 'string', label: 'name', default:'', prependInnerIcon:'mdi-text-short' }
|
|
62
|
+
]
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
get filters():IEntityCrudFilter[]{
|
|
66
|
+
return [
|
|
67
|
+
|
|
68
|
+
]
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
get dialogFullscreen(){
|
|
72
|
+
return false
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
get exportHeaders(){
|
|
76
|
+
return ['_id', 'name']
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
export default RoleCrud
|
|
82
|
+
|
|
83
|
+
export {RoleCrud}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
|
|
2
2
|
import {EntityCrud} from "@drax/crud-vue";
|
|
3
3
|
import {TenantSystemFactory} from "@drax/identity-front";
|
|
4
|
-
import type {IEntityCrud, IEntityCrudField, IEntityCrudHeader} from "@drax/crud-share";
|
|
4
|
+
import type {IEntityCrud, IEntityCrudField, IEntityCrudFilter, IEntityCrudHeader} from "@drax/crud-share";
|
|
5
5
|
|
|
6
6
|
|
|
7
7
|
class TenantCrud extends EntityCrud implements IEntityCrud {
|
|
@@ -55,7 +55,13 @@ class TenantCrud extends EntityCrud implements IEntityCrud {
|
|
|
55
55
|
|
|
56
56
|
get fields(): IEntityCrudField[]{
|
|
57
57
|
return [
|
|
58
|
-
{name: 'name', type: 'string', label: 'name', default:'' }
|
|
58
|
+
{name: 'name', type: 'string', label: 'name', default:'', prependInnerIcon:'mdi-text-short' }
|
|
59
|
+
]
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
get filters():IEntityCrudFilter[]{
|
|
63
|
+
return [
|
|
64
|
+
|
|
59
65
|
]
|
|
60
66
|
}
|
|
61
67
|
|
|
@@ -70,4 +76,4 @@ class TenantCrud extends EntityCrud implements IEntityCrud {
|
|
|
70
76
|
}
|
|
71
77
|
|
|
72
78
|
export default TenantCrud
|
|
73
|
-
|
|
79
|
+
export { TenantCrud }
|
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
|
|
2
|
+
|
|
3
|
+
import {EntityCrud} from "@drax/crud-vue";
|
|
4
|
+
import {UserSystemFactory} from "@drax/identity-front";
|
|
5
|
+
import {RoleCrud} from '../role-crud/RoleCrud'
|
|
6
|
+
import {TenantCrud} from '../tenant-crud/TenantCrud'
|
|
7
|
+
import type {
|
|
8
|
+
IEntityCrud,
|
|
9
|
+
IEntityCrudField,
|
|
10
|
+
IEntityCrudFilter,
|
|
11
|
+
IEntityCrudHeader,
|
|
12
|
+
IEntityCrudRefs
|
|
13
|
+
} from "@drax/crud-share";
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
class UserCrud extends EntityCrud implements IEntityCrud {
|
|
17
|
+
|
|
18
|
+
static singleton: UserCrud
|
|
19
|
+
|
|
20
|
+
constructor() {
|
|
21
|
+
super();
|
|
22
|
+
this.name = 'User'
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
static get instance(): UserCrud {
|
|
26
|
+
if(!UserCrud.singleton){
|
|
27
|
+
UserCrud.singleton = new UserCrud()
|
|
28
|
+
}
|
|
29
|
+
return UserCrud.singleton
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
get permissions(){
|
|
33
|
+
return {
|
|
34
|
+
manage: 'tenant:manage',
|
|
35
|
+
view: 'tenant:view',
|
|
36
|
+
create: 'tenant:create',
|
|
37
|
+
update: 'tenant:update',
|
|
38
|
+
delete: 'tenant:delete'
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
get headers():IEntityCrudHeader[] {
|
|
43
|
+
return [
|
|
44
|
+
//{title: 'id',key:'_id', align: 'start'},
|
|
45
|
+
{ title: 'name', key: 'name', align: 'start' },
|
|
46
|
+
{ title: 'username', key: 'username', align: 'start' },
|
|
47
|
+
{ title: 'email', key: 'email', align: 'start' },
|
|
48
|
+
{ title: 'role', key: 'role.name', align: 'start' },
|
|
49
|
+
{ title: 'tenant', key: 'tenant.name', align: 'start' },
|
|
50
|
+
{ title: 'active', key: 'active', align: 'start' },
|
|
51
|
+
]
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
get provider(){
|
|
55
|
+
return UserSystemFactory.getInstance()
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
get refs():IEntityCrudRefs{
|
|
59
|
+
return {
|
|
60
|
+
role: RoleCrud.instance,
|
|
61
|
+
tenant: TenantCrud.instance,
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
get rules(){
|
|
66
|
+
return {
|
|
67
|
+
name: [(v: any) => !!v || 'Requerido']
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
get fields(): IEntityCrudField[]{
|
|
72
|
+
return [
|
|
73
|
+
{name: 'name', type: 'string', label: 'name', default:'' },
|
|
74
|
+
{name: 'username', type: 'string', label: 'username', default:'' },
|
|
75
|
+
{name: 'email', type: 'string', label: 'email', default:'' },
|
|
76
|
+
{name: 'phone', type: 'string', label: 'phone', default:'' },
|
|
77
|
+
{name: 'role', type: 'ref', ref: 'role', label: 'role', default:null },
|
|
78
|
+
{name: 'tenant', type: 'ref', ref: 'tenant', label: 'tenant', default:null },
|
|
79
|
+
{name: 'active', type: 'boolean', label: 'active', default:true },
|
|
80
|
+
|
|
81
|
+
]
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
get filters():IEntityCrudFilter[]{
|
|
85
|
+
return [
|
|
86
|
+
|
|
87
|
+
]
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
get dialogFullscreen(){
|
|
91
|
+
return false
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
get exportHeaders(){
|
|
95
|
+
return ['_id', 'name','username','email','phone','role.name','tenant.name','active']
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
export default UserCrud
|
|
101
|
+
|
package/src/forms/RoleForm.vue
CHANGED
|
@@ -1,55 +1,87 @@
|
|
|
1
1
|
<script setup lang="ts">
|
|
2
|
-
import {
|
|
3
|
-
import
|
|
2
|
+
import {useFormUtils, useCrudStore} from "@drax/crud-vue";
|
|
3
|
+
import {defineEmits, defineModel, defineProps, ref} from "vue";
|
|
4
4
|
import {useI18nValidation} from "@drax/common-vue";
|
|
5
|
-
import type {IClientInputError} from "@drax/common-front";
|
|
6
5
|
import PermissionSelector from "../components/PermissionSelector/PermissionSelector.vue";
|
|
7
6
|
import RoleCombobox from "../combobox/RoleCombobox.vue";
|
|
8
7
|
|
|
9
8
|
const {$ta} = useI18nValidation()
|
|
9
|
+
import {useI18n} from "vue-i18n";
|
|
10
|
+
|
|
11
|
+
const {t} = useI18n()
|
|
12
|
+
|
|
13
|
+
const valueModel = defineModel({type: [Object]})
|
|
10
14
|
|
|
11
15
|
defineProps({
|
|
12
|
-
|
|
13
|
-
type: Object as PropType<IClientInputError>,
|
|
14
|
-
default: () => ({name: "", permissions: "", readonly: ""})
|
|
15
|
-
}
|
|
16
|
+
error: {type: String, required: false},
|
|
16
17
|
})
|
|
17
18
|
|
|
18
|
-
const
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
19
|
+
const emit = defineEmits(['submit', 'cancel'])
|
|
20
|
+
|
|
21
|
+
const store = useCrudStore()
|
|
22
|
+
|
|
23
|
+
const valid = ref()
|
|
24
|
+
const formRef = ref()
|
|
22
25
|
|
|
23
|
-
|
|
26
|
+
async function submit() {
|
|
27
|
+
store.resetErrors()
|
|
28
|
+
await formRef.value.validate()
|
|
24
29
|
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
30
|
+
if(valid.value) {
|
|
31
|
+
emit('submit',valueModel.value)
|
|
32
|
+
}else{
|
|
33
|
+
console.log('Invalid form')
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
function cancel() {
|
|
38
|
+
emit('cancel')
|
|
28
39
|
}
|
|
29
40
|
|
|
41
|
+
const {
|
|
42
|
+
variant, submitColor, readonly
|
|
43
|
+
} = useFormUtils(store.operation)
|
|
44
|
+
|
|
30
45
|
</script>
|
|
31
46
|
|
|
32
47
|
<template>
|
|
33
|
-
<form @submit.prevent="
|
|
48
|
+
<v-form v-model="valid" ref="formRef" @submit.prevent="submit">
|
|
34
49
|
<v-text-field
|
|
35
|
-
variant="outlined"
|
|
36
50
|
id="name-input"
|
|
37
|
-
|
|
38
|
-
|
|
51
|
+
name="name"
|
|
52
|
+
:label="$t('role.fields.name')"
|
|
53
|
+
v-model="valueModel.name"
|
|
39
54
|
prepend-inner-icon="mdi-card-account-details"
|
|
40
|
-
|
|
41
|
-
:error-messages="$ta(inputErrors
|
|
55
|
+
:variant="variant"
|
|
56
|
+
:error-messages="$ta(store.inputErrors?.name)"
|
|
57
|
+
:rules="[v => !!v || 'validation.required']"
|
|
58
|
+
density="default"
|
|
59
|
+
:readonly="readonly"
|
|
60
|
+
:clearable="false"
|
|
42
61
|
></v-text-field>
|
|
43
62
|
|
|
44
63
|
<RoleCombobox
|
|
45
|
-
v-model="
|
|
46
|
-
:error-messages="$ta(inputErrors
|
|
64
|
+
v-model="valueModel.childRoles"
|
|
65
|
+
:error-messages="$ta(store.inputErrors?.role)"
|
|
47
66
|
multiple
|
|
67
|
+
:readonly="readonly"
|
|
68
|
+
:variant="variant"
|
|
48
69
|
></RoleCombobox>
|
|
49
70
|
|
|
50
|
-
<PermissionSelector
|
|
71
|
+
<PermissionSelector
|
|
72
|
+
v-model="valueModel.permissions"
|
|
73
|
+
:readonly="readonly"
|
|
74
|
+
></PermissionSelector>
|
|
75
|
+
|
|
76
|
+
<v-card-actions>
|
|
77
|
+
<v-spacer></v-spacer>
|
|
78
|
+
<v-btn variant="text" color="grey" @click="cancel">{{ t('action.cancel') }}</v-btn>
|
|
79
|
+
<v-btn variant="flat" v-if="store.operation != 'view'" :color="submitColor" @click="submit">
|
|
80
|
+
{{ store.operation ? t('action.' + store.operation) : t('action.sent') }}
|
|
81
|
+
</v-btn>
|
|
82
|
+
</v-card-actions>
|
|
51
83
|
|
|
52
|
-
</form>
|
|
84
|
+
</v-form>
|
|
53
85
|
</template>
|
|
54
86
|
|
|
55
87
|
<style scoped>
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
import {defineModel, type PropType} from "vue";
|
|
3
|
+
import type {IRoleBase} from "@drax/identity-share";
|
|
4
|
+
import {useI18nValidation} from "@drax/common-vue";
|
|
5
|
+
import type {IClientInputError} from "@drax/common-front";
|
|
6
|
+
import PermissionSelector from "../components/PermissionSelector/PermissionSelector.vue";
|
|
7
|
+
import RoleCombobox from "../combobox/RoleCombobox.vue";
|
|
8
|
+
|
|
9
|
+
const {$ta} = useI18nValidation()
|
|
10
|
+
|
|
11
|
+
defineProps({
|
|
12
|
+
inputErrors: {
|
|
13
|
+
type: Object as PropType<IClientInputError>,
|
|
14
|
+
default: () => ({name: "", permissions: "", readonly: ""})
|
|
15
|
+
}
|
|
16
|
+
})
|
|
17
|
+
|
|
18
|
+
const form = defineModel<IRoleBase>({
|
|
19
|
+
type: Object,
|
|
20
|
+
default: () => ({name: "", permissions: [], readonly: false})
|
|
21
|
+
})
|
|
22
|
+
|
|
23
|
+
const emits = defineEmits(['formSubmit'])
|
|
24
|
+
|
|
25
|
+
// Function to call when form is attempted to be submitted
|
|
26
|
+
const onSubmit = () => {
|
|
27
|
+
emits('formSubmit', form); // Emitting an event with the form data
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
</script>
|
|
31
|
+
|
|
32
|
+
<template>
|
|
33
|
+
<form @submit.prevent="onSubmit">
|
|
34
|
+
<v-text-field
|
|
35
|
+
variant="outlined"
|
|
36
|
+
id="name-input"
|
|
37
|
+
label="Name"
|
|
38
|
+
v-model="form.name"
|
|
39
|
+
prepend-inner-icon="mdi-card-account-details"
|
|
40
|
+
required
|
|
41
|
+
:error-messages="$ta(inputErrors.name)"
|
|
42
|
+
></v-text-field>
|
|
43
|
+
|
|
44
|
+
<RoleCombobox
|
|
45
|
+
v-model="form.childRoles"
|
|
46
|
+
:error-messages="$ta(inputErrors.role)"
|
|
47
|
+
multiple
|
|
48
|
+
></RoleCombobox>
|
|
49
|
+
|
|
50
|
+
<PermissionSelector v-model="form.permissions"></PermissionSelector>
|
|
51
|
+
|
|
52
|
+
</form>
|
|
53
|
+
</template>
|
|
54
|
+
|
|
55
|
+
<style scoped>
|
|
56
|
+
|
|
57
|
+
</style>
|
|
@@ -1,10 +1,59 @@
|
|
|
1
1
|
<script setup lang="ts">
|
|
2
|
+
import {Crud, useCrud} from "@drax/crud-vue";
|
|
3
|
+
import RoleCrud from "../cruds/role-crud/RoleCrud";
|
|
4
|
+
import RoleForm from "../forms/RoleForm.vue";
|
|
5
|
+
import {useI18n} from "vue-i18n";
|
|
6
|
+
|
|
7
|
+
const {t, te} = useI18n()
|
|
8
|
+
|
|
9
|
+
const {
|
|
10
|
+
onCancel, onSubmit,form
|
|
11
|
+
} = useCrud(RoleCrud.instance);
|
|
2
12
|
|
|
3
|
-
import RoleCrud from "../cruds/role-crud/RoleCrud.vue";
|
|
4
13
|
</script>
|
|
5
14
|
|
|
6
15
|
<template>
|
|
7
|
-
<RoleCrud
|
|
16
|
+
<crud :entity="RoleCrud.instance">
|
|
17
|
+
|
|
18
|
+
<template v-slot:form>
|
|
19
|
+
<role-form
|
|
20
|
+
v-model="form"
|
|
21
|
+
@submit="onSubmit"
|
|
22
|
+
@cancel="onCancel"
|
|
23
|
+
/>
|
|
24
|
+
</template>
|
|
25
|
+
|
|
26
|
+
<template v-slot:item.permissions="{ value }">
|
|
27
|
+
<v-chip
|
|
28
|
+
v-for="permission in value"
|
|
29
|
+
:key="permission" color="green"
|
|
30
|
+
class="ma-1"
|
|
31
|
+
>
|
|
32
|
+
{{ te(`permission.${permission}`) ? t(`permission.${permission}`) : permission }}
|
|
33
|
+
</v-chip>
|
|
34
|
+
</template>
|
|
35
|
+
|
|
36
|
+
<template v-slot:item.childRoles="{ value }">
|
|
37
|
+
<v-chip
|
|
38
|
+
v-if="value && value.length > 0"
|
|
39
|
+
v-for="role in value"
|
|
40
|
+
:key="role" color="blue"
|
|
41
|
+
class="ma-1"
|
|
42
|
+
>
|
|
43
|
+
{{ role.name }}
|
|
44
|
+
</v-chip>
|
|
45
|
+
</template>
|
|
46
|
+
|
|
47
|
+
<template v-slot:item.readonly="{ value }">
|
|
48
|
+
<v-chip v-if="value" color="red">
|
|
49
|
+
<v-icon class="mdi mdi-pencil-off-outline"></v-icon>
|
|
50
|
+
</v-chip>
|
|
51
|
+
<v-chip v-else color="green">
|
|
52
|
+
<v-icon class="mdi mdi-pencil-outline"></v-icon>
|
|
53
|
+
</v-chip>
|
|
54
|
+
</template>
|
|
55
|
+
|
|
56
|
+
</crud>
|
|
8
57
|
</template>
|
|
9
58
|
|
|
10
59
|
<style scoped>
|
|
@@ -1,10 +1,16 @@
|
|
|
1
1
|
<script setup lang="ts">
|
|
2
|
-
|
|
3
|
-
import
|
|
2
|
+
import UserCrud from "../cruds/user-crud/UserCrud";
|
|
3
|
+
import {Crud} from "@drax/crud-vue";
|
|
4
4
|
</script>
|
|
5
5
|
|
|
6
6
|
<template>
|
|
7
|
-
<UserCrud
|
|
7
|
+
<crud :entity="UserCrud.instance">
|
|
8
|
+
<template v-slot:item.active="{ value }" >
|
|
9
|
+
<v-chip :color="value ? 'green':'red'" >
|
|
10
|
+
{{ value ? 'Active' : 'Inactive' }}
|
|
11
|
+
</v-chip>
|
|
12
|
+
</template>
|
|
13
|
+
</crud>
|
|
8
14
|
</template>
|
|
9
15
|
|
|
10
16
|
<style scoped>
|
|
@@ -2,71 +2,107 @@ import LoginPage from '../pages/LoginPage.vue'
|
|
|
2
2
|
import ProfilePage from '../pages/ProfilePage.vue'
|
|
3
3
|
import PasswordPage from '../pages/PasswordPage.vue'
|
|
4
4
|
import UserCrudPage from '../pages/UserCrudPage.vue'
|
|
5
|
+
import UserCrudCustomPage from '../pages/UserCrudCustomPage.vue'
|
|
5
6
|
import RoleCrudPage from '../pages/RoleCrudPage.vue'
|
|
7
|
+
import RoleCrudCustomPage from '../pages/RoleCrudCustomPage.vue'
|
|
6
8
|
import TenantCrudPage from '../pages/TenantCrudPage.vue'
|
|
9
|
+
import TenantCrudCustomPage from '../pages/TenantCrudCustomPage.vue'
|
|
7
10
|
import UserApiKeyCrudPage from '../pages/UserApiKeyCrudPage.vue'
|
|
8
11
|
|
|
9
12
|
const routes = [
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
13
|
+
{
|
|
14
|
+
name: 'Login',
|
|
15
|
+
path: '/login',
|
|
16
|
+
component: LoginPage,
|
|
17
|
+
meta: {
|
|
18
|
+
auth: false,
|
|
19
|
+
}
|
|
20
|
+
},
|
|
21
|
+
{
|
|
22
|
+
name: 'Profile',
|
|
23
|
+
path: '/profile',
|
|
24
|
+
component: ProfilePage,
|
|
25
|
+
meta: {
|
|
26
|
+
auth: true,
|
|
27
|
+
}
|
|
28
|
+
},
|
|
29
|
+
{
|
|
30
|
+
name: 'Password',
|
|
31
|
+
path: '/password',
|
|
32
|
+
component: PasswordPage,
|
|
33
|
+
meta: {
|
|
34
|
+
auth: true,
|
|
35
|
+
}
|
|
36
|
+
},
|
|
37
|
+
//CRUDS
|
|
38
|
+
{
|
|
39
|
+
name: 'CrudRole',
|
|
40
|
+
path: '/crud/role',
|
|
41
|
+
component: RoleCrudPage,
|
|
42
|
+
meta: {
|
|
43
|
+
auth: true,
|
|
44
|
+
permission: 'role:manage'
|
|
45
|
+
}
|
|
46
|
+
},
|
|
47
|
+
|
|
48
|
+
{
|
|
49
|
+
name: 'CrudTenant',
|
|
50
|
+
path: '/crud/tenant',
|
|
51
|
+
component: TenantCrudPage,
|
|
52
|
+
meta: {
|
|
53
|
+
auth: true,
|
|
54
|
+
permission: 'tenant:manage'
|
|
55
|
+
}
|
|
56
|
+
},
|
|
57
|
+
|
|
58
|
+
{
|
|
59
|
+
name: 'CrudUser',
|
|
60
|
+
path: '/crud/user',
|
|
61
|
+
component: UserCrudPage,
|
|
62
|
+
meta: {
|
|
63
|
+
auth: true,
|
|
64
|
+
permission: 'user:manage'
|
|
65
|
+
}
|
|
66
|
+
},
|
|
67
|
+
{
|
|
68
|
+
name: 'CrudUserApiKey',
|
|
69
|
+
path: '/crud/user-api-key',
|
|
70
|
+
component: UserApiKeyCrudPage,
|
|
71
|
+
meta: {
|
|
72
|
+
auth: true,
|
|
73
|
+
permission: 'userApiKey:manage'
|
|
74
|
+
}
|
|
75
|
+
},
|
|
76
|
+
|
|
77
|
+
//CUSTOM CRUDs
|
|
78
|
+
{
|
|
79
|
+
name: 'CrudCustomTenant',
|
|
80
|
+
path: '/crud/custom/tenant',
|
|
81
|
+
component: TenantCrudCustomPage,
|
|
82
|
+
meta: {
|
|
83
|
+
auth: true,
|
|
84
|
+
permission: 'tenant:manage'
|
|
85
|
+
}
|
|
86
|
+
},
|
|
87
|
+
{
|
|
88
|
+
name: 'CrudRoleCustom',
|
|
89
|
+
path: '/crud/custom/role',
|
|
90
|
+
component: RoleCrudCustomPage,
|
|
91
|
+
meta: {
|
|
92
|
+
auth: true,
|
|
93
|
+
permission: 'role:manage'
|
|
94
|
+
}
|
|
95
|
+
},
|
|
96
|
+
{
|
|
97
|
+
name: 'CrudCustomUser',
|
|
98
|
+
path: '/crud/custom/user',
|
|
99
|
+
component: UserCrudCustomPage,
|
|
100
|
+
meta: {
|
|
101
|
+
auth: true,
|
|
102
|
+
permission: 'user:manage'
|
|
103
|
+
}
|
|
104
|
+
},
|
|
105
|
+
|
|
70
106
|
]
|
|
71
107
|
|
|
72
108
|
|
|
File without changes
|