mirror of https://github.com/rancher/ui.git
parent
6eda0f7b2b
commit
6329d214fa
|
|
@ -70,31 +70,11 @@ export default Component.extend(NewOrEdit,{
|
|||
return get(this, 'globalStore').createRecord(role);
|
||||
},
|
||||
|
||||
validate: function () {
|
||||
var errors = [];
|
||||
if ((get(this, 'primaryResource.subjectName') || '').trim().length === 0) {
|
||||
errors.push(get(this, 'intl').findTranslationByKey('formScopedRoles.errors.userRequired'));
|
||||
}
|
||||
if (errors.length) {
|
||||
set(this, 'errors', errors.uniq());
|
||||
return false;
|
||||
} else {
|
||||
set(this, 'errors', null);
|
||||
}
|
||||
return true;
|
||||
},
|
||||
|
||||
actions: {
|
||||
cancel() {
|
||||
this.sendAction('cancel');
|
||||
},
|
||||
save(cb) {
|
||||
if(!this.validate()) {
|
||||
if ( cb ) {
|
||||
cb();
|
||||
}
|
||||
return;
|
||||
}
|
||||
let mode = get(this, 'mode');
|
||||
let add = [];
|
||||
let remove = [];
|
||||
|
|
@ -118,6 +98,13 @@ export default Component.extend(NewOrEdit,{
|
|||
}
|
||||
|
||||
|
||||
if(!this.validate()) {
|
||||
if ( cb ) {
|
||||
cb();
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
return PromiseAll(add.map(x => x.save())).then(() => {
|
||||
return PromiseAll(remove.map(x => x.delete())).then(() => {
|
||||
return this.doneSaving();
|
||||
|
|
|
|||
|
|
@ -2262,8 +2262,6 @@ formGlobalRoles:
|
|||
formScopedRoles:
|
||||
title: '{type} Permissions'
|
||||
description: 'Controls what access users have to the {type}.'
|
||||
errors:
|
||||
userRequired: Please select a user.
|
||||
|
||||
mode:
|
||||
admin:
|
||||
|
|
|
|||
Loading…
Reference in New Issue