From d8e4a45e8a9e952504c00dc2e4756c0853d1c989 Mon Sep 17 00:00:00 2001 From: John Cardinal Date: Wed, 29 Jul 2020 19:16:58 +0000 Subject: [PATCH] --- ayanova/devdocs/todo.txt | 4 --- ayanova/src/components/role-control.vue | 37 +++++++++++-------------- 2 files changed, 16 insertions(+), 25 deletions(-) diff --git a/ayanova/devdocs/todo.txt b/ayanova/devdocs/todo.txt index f2679c1a..3f062715 100644 --- a/ayanova/devdocs/todo.txt +++ b/ayanova/devdocs/todo.txt @@ -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 diff --git a/ayanova/src/components/role-control.vue b/ayanova/src/components/role-control.vue index 3591debe..87ab1dab 100644 --- a/ayanova/src/components/role-control.vue +++ b/ayanova/src/components/role-control.vue @@ -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) {