missing edit flag on action, ensure replace not add on edit

This commit is contained in:
Westly Wright 2017-09-21 22:04:46 -07:00
parent fdfa3f8ad3
commit 790598134c
No known key found for this signature in database
GPG Key ID: 4FAB3D8673DC54A3
2 changed files with 12 additions and 8 deletions

View File

@ -100,30 +100,34 @@ export default Ember.Controller.extend({
externalId: selectedTemplate.externalId
});
this.get('model.cluster.systemStacks').pushObject(newSystemStack);
if (!this.get('model.cluster.systemStacks').findBy('externalId', newSystemStack.get('externalId'))) {
this.get('model.cluster.systemStacks').pushObject(newSystemStack);
}
this.set('viewCatalog', false);
this.send('cancelEdit');
},
goToTemplate(templateId, edit=false) {
goToTemplate(externalId, edit=false) {
var templateInfo = {};
if (edit) {
templateInfo = parseExternalId(templateId);
templateInfo = parseExternalId(externalId);
} else {
templateInfo = {
templateId: templateId,
templateId: externalId,
templateBase: '',
};
}
this.get('catalog').fetchTemplate(templateInfo.templateId).then((template) => {
var stack = this.get('model.cluster.systemStacks').find((stack) => {
if (stack.get('externalId').indexOf(templateInfo.templateId) >= 0) {
if (stack.get('externalId').indexOf(externalId) >= 0) {
return stack;
}
});
if (!stack) {
if (stack) {
this.set('newSystemStack', stack);
} else {
stack = this.set('newSystemStack', this.get('store').createRecord({
type: 'stack',
name: template.get('defaultName'),

View File

@ -22,8 +22,8 @@ export default Ember.Component.extend(NewOrEdit, {
this.sendAction('done');
},
editStack(obj) {
this.sendAction('goToTemplate', obj.get('externalId'));
editStack(obj, edit) {
this.sendAction('goToTemplate', obj.get('externalId'), edit);
},
removeStack(obj) {