Remove sidekick

This commit is contained in:
Vincent Fiduccia 2015-10-15 10:08:40 -07:00
parent 348b33b8ac
commit cd87a82884
3 changed files with 51 additions and 22 deletions

View File

@ -47,6 +47,18 @@ export default Ember.Component.extend(NewOrEdit, SelectTab, {
this.send('selectLaunchConfig', ary.get('length')-1);
},
removeSidekick() {
var idx = this.get('launchConfigIndex');
var ary = this.get('service.secondaryLaunchConfigs');
ary.removeAt(idx);
if ( idx >= ary.get('length') )
{
Ember.run.next(() => {
this.send('selectLaunchConfig', ary.get('length')-1);
});
}
},
setScale(scale) {
this.set('service.scale', scale);
},

View File

@ -1,30 +1,20 @@
<section class="horizontal-form container-fluid">
{{#unless isSidekick}}
<h2>Add {{if isService 'Service' 'Container'}}</h2>
<h2>Add
{{#if isService}}
Service
{{#if hasSidekicks}}
+
{{service.secondaryLaunchConfigs.length}} Sidekick{{if (not-eq service.secondaryLaunchConfigs.length 1) 's'}}
{{/if}}
{{else}}
Container
{{/if}}
</h2>
{{top-errors errors=errors}}
{{/unless}}
{{#if (and isService (not isSidekick))}}
<div class="row form-group">
<div class="col-sm-12 col-md-2 form-label r-mt5">
<label>Sidekicks</label>
</div>
<div class="col-sm-12 col-md-8">
<nav>
<ul class="pagination pagination-sm r-m0">
{{#if hasSidekicks}}
<li class="{{if (eq launchConfigIndex -1) 'active'}}"><a href="#" {{action "selectLaunchConfig" -1}}>{{default-str service.name default="(Primary Service)"}}</a></li>
{{/if}}
{{#each service.secondaryLaunchConfigs as |slc index|}}
<li class="{{if (eq launchConfigIndex index) 'active'}}"><a href="#" {{action "selectLaunchConfig" index}}>{{default-str slc.name (concat-str '(Sidekick #' (one-louder index) ')')}}</a></li>
{{/each}}
<li><a {{action "addSidekick"}} tooltip="Add Sidekick"><i class="icon icon-plus"/></a></li>
</ul>
</nav>
</div>
</div>
{{form-scale
initialLabels=launchConfig.labels
initialScale=service.scale
@ -35,6 +25,28 @@
setScale=(action 'setScale')
}}
<div class="row form-group">
<div class="col-sm-12 col-md-2 form-label r-mt5">
<label>Sidekicks</label>
</div>
<div class="col-sm-12 col-md-8">
{{#if hasSidekicks}}
<nav>
<ul class="pagination pagination-sm r-m0">
<li class="{{if (eq launchConfigIndex -1) 'active'}}"><a href="#" {{action "selectLaunchConfig" -1}}>{{default-str service.name default="(Primary Service)"}}</a></li>
{{#each service.secondaryLaunchConfigs as |slc index|}}
<li class="{{if (eq launchConfigIndex index) 'active'}}"><a href="#" {{action "selectLaunchConfig" index}}>{{default-str slc.name (concat-str '(Sidekick #' (one-louder index) ')')}}</a></li>
{{/each}}
<li><a {{action "addSidekick"}} tooltip="Add Sidekick"><i class="icon icon-plus"/></a></li>
</ul>
</nav>
{{else}}
<button class="btn-circle-plus btn-circle-text" style="margin-right: 20px;" {{action "addSidekick"}}>Add Sidekick</button>
{{/if}}
</div>
</div>
{{form-divider}}
{{/if}}
@ -152,5 +164,9 @@
{{/if}}
{{#unless isSidekick}}
{{save-cancel save="save" cancel="cancel"}}
{{#save-cancel save="save" cancel="cancel"}}
{{#if (not-eq launchConfigIndex -1)}}
<button class="btn btn-default" {{action "removeSidekick"}}>Remove this Sidekick</button>
{{/if}}
{{/save-cancel}}
{{/unless}}

View File

@ -1,3 +1,4 @@
{{yield}}
{{#if saving}}
<button class="btn btn-primary btn-disabled"><i class="icon icon-spinner icon-spin"></i> Saving...</button>
{{else}}