Cobalt form improvements - on insert/update action & taller multiselect
This commit is contained in:
parent
c74e3b0685
commit
8701df1acc
@ -1,10 +1,6 @@
|
||||
- MFA recovery codes handling
|
||||
- Forgot password handling
|
||||
- Admin password reset mechanism -> flag users as needing PW resets
|
||||
- Cobalt form - when multiselect make selection box taller
|
||||
- Cobalt form - after action handlers
|
||||
- e.g. after insert perform action
|
||||
- e.g. after update perform action, &c.
|
||||
- OAuth2 -> support refresh tokens
|
||||
- Traps -> support session traps; convert MFA challenge to use session trap
|
||||
- Allow setting user trap from web UI
|
||||
|
@ -32,7 +32,7 @@ const template = `
|
||||
<label :for="uuid+field.field">{{ field.name }}</label>
|
||||
<select
|
||||
:id="uuid+field.field"
|
||||
class="form-control"
|
||||
:class="['form-control', (field.type.endsWith('.multiple') ? 'multi' : 'normal')]"
|
||||
v-model="data[field.field]"
|
||||
:required="Array.isArray(field.required) ? field.required.includes(mode) : field.required"
|
||||
:readonly="mode === 'view' || (Array.isArray(field.readonly) ? field.readonly.includes(mode) : field.readonly)"
|
||||
@ -238,10 +238,19 @@ export default class FormComponent extends Component {
|
||||
async on_create() {
|
||||
this.id = this.data.id
|
||||
this.mode = 'update'
|
||||
if ( this.definition.handlers && this.definition.handlers.insert ) {
|
||||
await action_service.perform(this.definition.handlers.insert)
|
||||
}
|
||||
await this.vue_on_create(true)
|
||||
location_service.set_query(`mode=update&id=${this.id}`)
|
||||
}
|
||||
|
||||
async on_update() {
|
||||
if ( this.definition.handlers && this.definition.handlers.update ) {
|
||||
await action_service.perform(this.definition.handlers.update)
|
||||
}
|
||||
}
|
||||
|
||||
data_to_save() {
|
||||
const data = Object.assign({}, this.data)
|
||||
for ( const field of this.definition.fields ) {
|
||||
@ -270,6 +279,7 @@ export default class FormComponent extends Component {
|
||||
await this.on_create()
|
||||
} else if (this.mode === 'update') {
|
||||
await this.resource_class.update(this.id, this.data_to_save())
|
||||
await this.on_update()
|
||||
}
|
||||
|
||||
this.error_message = ''
|
||||
|
@ -146,6 +146,14 @@ class PolicyResource extends CRUDBase {
|
||||
if: (form_data) => form_data.target_type === 'api_scope'
|
||||
},
|
||||
],
|
||||
/*handlers: {
|
||||
insert: {
|
||||
action: 'back',
|
||||
},
|
||||
update: {
|
||||
action: 'back',
|
||||
},
|
||||
},*/
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -82,3 +82,7 @@ body {
|
||||
opacity: 1;
|
||||
}
|
||||
}
|
||||
|
||||
select.multi {
|
||||
min-height: 200px;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user