This commit is contained in:
2020-07-29 19:16:58 +00:00
parent 9a3aeab8f8
commit d8e4a45e8a
2 changed files with 16 additions and 25 deletions

View File

@@ -15,10 +15,6 @@ ____________
##########################
todo: generated user names have numbers in them and are not the same as the id. Do they need numbers? Can it just keep an internal list of used names and bump
or query the db to see if it's already used because there are not that many generated users generally.
todo: User edit form role control is not working
todo: server state form is not getting dirtied when setting radio button, only on text (try going to closed then open and not change text on open)
todo: ops backup file list not in order by date, seems to be random or something, I want newest at top oldest at bottom
todo: any use of simple-table sb turned into data-table see how it's done in ops-notify-queue, pretty straightforward and you get responsiveness and sorting built in

View File

@@ -5,7 +5,8 @@
item-value="id"
multiple
chips
:value="selectedRoles"
deletable-chips
:value="selectedValue"
@input="handleInput"
:readonly="readonly"
:disabled="disabled"
@@ -27,16 +28,9 @@ export default {
data() {
return {
internalValue: null,
selectedRoles: [],
availableRoles: []
};
},
watch: {
value(val) {
this.internalValue = val;
this.setSelectedItems();
}
},
props: {
label: String,
rules: Array,
@@ -50,6 +44,20 @@ export default {
},
testId: String
},
computed: {
selectedValue() {
let ret = [];
if (this.value != null && this.value != 0) {
for (let i = 0; i < this.availableRoles.length; i++) {
let role = this.availableRoles[i];
if (!!(this.value & role.id)) {
ret.push(role.id);
}
}
}
return ret;
}
},
methods: {
allErrors() {
let ret = "";
@@ -61,19 +69,6 @@ export default {
}
return ret;
},
setSelectedItems() {
//turn internalValue numeric bitfield role value into array of selected roles
let ret = [];
if (this.internalValue != null && this.internalValue != 0) {
for (let i = 0; i < this.availableRoles.length; i++) {
let role = this.availableRoles[i];
if (!!(this.internalValue & role.id)) {
ret.push(role.id);
}
}
}
this.selectedRoles = [...ret];
},
handleInput(value) {
let newValue = 0;
if (value != null && value != [] && value.length > 0) {