Fix a member issue

https://github.com/rancher/rancher/issues/11259
This commit is contained in:
loganhz 2018-02-01 14:06:53 +08:00
parent 6eda0f7b2b
commit 6329d214fa
2 changed files with 7 additions and 22 deletions

View File

@ -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();

View File

@ -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: