This commit is contained in:
76
ayanova/src/components/role-control.vue
Normal file
76
ayanova/src/components/role-control.vue
Normal file
@@ -0,0 +1,76 @@
|
||||
<template>
|
||||
<v-select
|
||||
:items="availableRoles"
|
||||
item-text="name"
|
||||
item-value="id"
|
||||
multiple
|
||||
chips
|
||||
hint="select roles"
|
||||
persistent-hint
|
||||
:value="rolevalue()"
|
||||
@input="handleInput"
|
||||
:readonly="readonly"
|
||||
:disabled="disabled"
|
||||
:label="label"
|
||||
:rules="rules"
|
||||
:error-messages="allErrors()"
|
||||
:data-cy="!!$ay.dev ? 'roleinput:' + testId : false"
|
||||
></v-select>
|
||||
</template>
|
||||
<script>
|
||||
/* Xeslint-disable */
|
||||
export default {
|
||||
async created() {
|
||||
//get the available roles
|
||||
//first make sure it's cached
|
||||
await window.$gz.enums.fetchEnumList("AuthorizationRoles");
|
||||
this.availableRoles = window.$gz.enums.getSelectionList(
|
||||
"AuthorizationRoles"
|
||||
);
|
||||
//window.$gz.form.addNoSelectionItem(vm.selectLists.objectTypes);
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
internalValue: null,
|
||||
availableRoles: []
|
||||
};
|
||||
},
|
||||
watch: {
|
||||
value(val) {
|
||||
this.internalValue = val;
|
||||
}
|
||||
},
|
||||
props: {
|
||||
label: String,
|
||||
rules: Array,
|
||||
"error-messages": { type: Array, default: null },
|
||||
value: { type: Number, default: 0 },
|
||||
readonly: { type: Boolean, default: false },
|
||||
disabled: { type: Boolean, default: false },
|
||||
error: {
|
||||
type: String,
|
||||
required: false
|
||||
},
|
||||
testId: String
|
||||
},
|
||||
methods: {
|
||||
allErrors() {
|
||||
let ret = "";
|
||||
if (this.error != null) {
|
||||
ret = this.error;
|
||||
}
|
||||
if (this.errorMessages != null && this.errorMessages.length > 0) {
|
||||
ret += this.errorMessages.toString();
|
||||
}
|
||||
return ret;
|
||||
},
|
||||
rolevalue() {
|
||||
//turn ineternalValue numeric bitfield role value into list of selected roles
|
||||
},
|
||||
handleInput(value) {
|
||||
//turn list of selected roles into single bitfield value
|
||||
//and emit it
|
||||
}
|
||||
}
|
||||
};
|
||||
</script>
|
||||
Reference in New Issue
Block a user