mirror of https://github.com/rancher/ui.git
Ember 1.13: Service edit
This commit is contained in:
parent
79ef757e66
commit
1f6897b930
|
|
@ -2,7 +2,7 @@ import Ember from 'ember';
|
||||||
|
|
||||||
export default Ember.Route.extend({
|
export default Ember.Route.extend({
|
||||||
beforeModel: function() {
|
beforeModel: function() {
|
||||||
var main = this.modelFor('stacks-tab');
|
var main = this.modelFor('applications-tab');
|
||||||
if ( main.get('services.length') )
|
if ( main.get('services.length') )
|
||||||
{
|
{
|
||||||
this.transitionTo('environments');
|
this.transitionTo('environments');
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,4 @@
|
||||||
import Ember from 'ember';
|
import Ember from 'ember';
|
||||||
import C from 'ui/utils/constants';
|
|
||||||
|
|
||||||
export default Ember.Controller.extend({
|
export default Ember.Controller.extend({
|
||||||
needs: ['application'],
|
needs: ['application'],
|
||||||
|
|
|
||||||
|
|
@ -2,6 +2,6 @@ import Ember from 'ember';
|
||||||
|
|
||||||
export default Ember.Route.extend({
|
export default Ember.Route.extend({
|
||||||
beforeModel: function() {
|
beforeModel: function() {
|
||||||
this.replaceWith('stacks-tab');
|
this.replaceWith('applications-tab');
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
|
||||||
|
|
@ -31,7 +31,7 @@ export default Ember.Component.extend(EditContainer, {
|
||||||
this.get('store').findAll('host'), // Need inactive ones in case a link points to an inactive host
|
this.get('store').findAll('host'), // Need inactive ones in case a link points to an inactive host
|
||||||
]).then((results) => {
|
]).then((results) => {
|
||||||
var model = Ember.Object.create({
|
var model = Ember.Object.create({
|
||||||
instance: instance,
|
instance: instance.clone(),
|
||||||
ports: results[0],
|
ports: results[0],
|
||||||
instanceLinks: results[1],
|
instanceLinks: results[1],
|
||||||
allHosts: results[2],
|
allHosts: results[2],
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,72 @@
|
||||||
|
import Ember from 'ember';
|
||||||
|
import NewOrEdit from 'ui/mixins/new-or-edit';
|
||||||
|
import EditService from 'ui/mixins/edit-service';
|
||||||
|
import EditTargetIp from 'ui/mixins/edit-targetip';
|
||||||
|
import C from 'ui/utils/constants';
|
||||||
|
import { addAction } from 'ui/utils/add-view-action';
|
||||||
|
|
||||||
|
export default Ember.Component.extend(NewOrEdit, EditService, EditTargetIp, {
|
||||||
|
editing: true,
|
||||||
|
loading: true,
|
||||||
|
|
||||||
|
actions: {
|
||||||
|
addServiceLink: addAction('addServiceLink', '.service-link'),
|
||||||
|
addTargetIp: addAction('addTargetIp', '.target-ip'),
|
||||||
|
|
||||||
|
outsideClick: function() {},
|
||||||
|
|
||||||
|
cancel: function() {
|
||||||
|
this.sendAction('dismiss');
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
|
didInsertElement: function() {
|
||||||
|
Ember.run.next(this, 'loadDependencies');
|
||||||
|
},
|
||||||
|
|
||||||
|
loadDependencies: function() {
|
||||||
|
var service = this.get('originalModel');
|
||||||
|
|
||||||
|
this.get('store').find('environment', service.get('environmentId')).then((env) => {
|
||||||
|
env.importLink('services').then(() => {
|
||||||
|
var model = Ember.Object.create({
|
||||||
|
service: service.clone(),
|
||||||
|
selectedEnvironment: env
|
||||||
|
});
|
||||||
|
|
||||||
|
this.setProperties({
|
||||||
|
originalModel: service,
|
||||||
|
model: model,
|
||||||
|
service: model.service,
|
||||||
|
environment: model.selectedEnvironment,
|
||||||
|
});
|
||||||
|
|
||||||
|
this.initFields();
|
||||||
|
this.set('loading', false);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
},
|
||||||
|
|
||||||
|
canScale: function() {
|
||||||
|
if ( ['service','loadbalancerservice'].indexOf(this.get('service.type').toLowerCase()) >= 0 )
|
||||||
|
{
|
||||||
|
return !this.getLabel(C.LABEL.SCHED_GLOBAL);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}.property('service.type'),
|
||||||
|
|
||||||
|
hasServiceLinks: function() {
|
||||||
|
return this.get('service.type').toLowerCase() !== 'externalservice';
|
||||||
|
}.property('service.type'),
|
||||||
|
|
||||||
|
hasTargetIp: function() {
|
||||||
|
return this.get('service.type').toLowerCase() === 'externalservice';
|
||||||
|
}.property('service.type'),
|
||||||
|
|
||||||
|
doneSaving: function() {
|
||||||
|
this.sendAction('dismiss');
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
@ -0,0 +1,47 @@
|
||||||
|
{{#liquid-if loading}}
|
||||||
|
<div class="text-center">
|
||||||
|
<p>
|
||||||
|
<i class="fa fa-circle-o-notch fa-spin"></i> Loading...
|
||||||
|
</p>
|
||||||
|
</div>
|
||||||
|
{{else}}
|
||||||
|
<section class="horizontal-form container-fluid">
|
||||||
|
<h2>{{#if editing}}Edit{{else}}Add{{/if}} Service</h2>
|
||||||
|
{{top-errors errors=errors}}
|
||||||
|
|
||||||
|
{{partial "container/edit-name"}}
|
||||||
|
|
||||||
|
{{#if canScale}}
|
||||||
|
{{partial "form-divider"}}
|
||||||
|
|
||||||
|
<div class="row">
|
||||||
|
<div class="col-sm-12 col-md-2 form-label">
|
||||||
|
<label>Scale</label>
|
||||||
|
</div>
|
||||||
|
{{#if isGlobal}}
|
||||||
|
<div class="col-sm-10 col-md-8">
|
||||||
|
<span class="text-muted">Always run one instance of this container on every host</span>
|
||||||
|
</div>
|
||||||
|
{{else}}
|
||||||
|
<div class="col-sm-2 col-md-1">
|
||||||
|
{{service.scale}}
|
||||||
|
</div>
|
||||||
|
<div class="col-sm-10 col-md-7">
|
||||||
|
{{input-slider value=service.scale valueMin=1 valueMax=11 scaleMin=0 scaleMax=12}}
|
||||||
|
</div>
|
||||||
|
{{/if}}
|
||||||
|
</div>
|
||||||
|
{{/if}}
|
||||||
|
|
||||||
|
{{partial "form-divider"}}
|
||||||
|
|
||||||
|
{{#if hasServiceLinks}}
|
||||||
|
{{partial "container/edit-services"}}
|
||||||
|
{{/if}}
|
||||||
|
{{#if hasTargetIp}}
|
||||||
|
{{partial "container/edit-targetip"}}
|
||||||
|
{{/if}}
|
||||||
|
</section>
|
||||||
|
|
||||||
|
{{partial "save-cancel"}}
|
||||||
|
{{/liquid-if}}
|
||||||
|
|
@ -9,7 +9,7 @@ export default Ember.Component.extend(ReadLabels,{
|
||||||
|
|
||||||
actions: {
|
actions: {
|
||||||
newContainer: function() {
|
newContainer: function() {
|
||||||
this.sendAction('newContainer', this.get('model.id'))
|
this.sendAction('newContainer', this.get('model.id'));
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -28,11 +28,11 @@ export default Ember.Component.extend({
|
||||||
}.property('project.id','projectChoices.@each.id'),
|
}.property('project.id','projectChoices.@each.id'),
|
||||||
|
|
||||||
isInfrastructure: function() {
|
isInfrastructure: function() {
|
||||||
return this.get('currentPath').indexOf('authenticated.infrastructure') === 0;
|
return this.get('currentPath').indexOf('authenticated.infrastructure-tab') === 0;
|
||||||
}.property('currentPath'),
|
}.property('currentPath'),
|
||||||
|
|
||||||
isStacks: function() {
|
isApplications: function() {
|
||||||
return this.get('currentPath').indexOf('authenticated.stacks') === 0;
|
return this.get('currentPath').indexOf('authenticated.applications-tab') === 0;
|
||||||
}.property('currentPath'),
|
}.property('currentPath'),
|
||||||
|
|
||||||
actions: {
|
actions: {
|
||||||
|
|
|
||||||
|
|
@ -2,7 +2,7 @@
|
||||||
<div class="logo" {{action "showAbout"}}></div>
|
<div class="logo" {{action "showAbout"}}></div>
|
||||||
<nav>
|
<nav>
|
||||||
{{#if project}}
|
{{#if project}}
|
||||||
{{#link-to "stacks-tab"}}Stacks{{/link-to}}
|
{{#link-to "applications-tab"}}Applications{{/link-to}}
|
||||||
{{#link-to "infrastructure-tab"}}Infrastructure{{/link-to}}
|
{{#link-to "infrastructure-tab"}}Infrastructure{{/link-to}}
|
||||||
{{/if}}
|
{{/if}}
|
||||||
</nav>
|
</nav>
|
||||||
|
|
@ -129,7 +129,7 @@
|
||||||
{{#link-to "hosts"}}<i class="ss-database"></i> Hosts{{/link-to}}
|
{{#link-to "hosts"}}<i class="ss-database"></i> Hosts{{/link-to}}
|
||||||
{{#link-to "containers"}}<i class="ss-box"></i> Containers{{/link-to}}
|
{{#link-to "containers"}}<i class="ss-box"></i> Containers{{/link-to}}
|
||||||
{{/if}}
|
{{/if}}
|
||||||
{{#if isStacks}}
|
{{#if isApplications}}
|
||||||
{{#link-to "environments"}}<i class="ss-globe"></i> Stacks{{/link-to}}
|
{{#link-to "environments"}}<i class="ss-globe"></i> Stacks{{/link-to}}
|
||||||
|
|
||||||
<div class="btn-group pull-right">
|
<div class="btn-group pull-right">
|
||||||
|
|
|
||||||
|
|
@ -19,18 +19,16 @@
|
||||||
<div class="pod-info clearfix">
|
<div class="pod-info clearfix">
|
||||||
<div class="pod-info-line">
|
<div class="pod-info-line">
|
||||||
{{#each model.consumedServicesWithNames as |map|}}
|
{{#each model.consumedServicesWithNames as |map|}}
|
||||||
{{#with map.service controller="service" as |service|}}
|
|
||||||
<div class="pod-info-item">
|
<div class="pod-info-item">
|
||||||
{{#link-to "service" service.environmentId service.id}}
|
{{#link-to "service" map.service.environmentId map.service.id}}
|
||||||
<i class="{{service.activeIcon}}"></i>
|
<i class="{{map.service.activeIcon}}"></i>
|
||||||
{{#if (eq map.name service.displayName)}}
|
{{#if (eq map.name map.service.displayName)}}
|
||||||
{{map.name}}
|
{{map.name}}
|
||||||
{{else}}
|
{{else}}
|
||||||
{{service.displayName}}{{#if map.name}} <span class="text-muted">(as {{map.name}})</span>{{/if}}
|
{{map.service.displayName}}{{#if map.name}} <span class="text-muted">(as {{map.name}})</span>{{/if}}
|
||||||
{{/if}}
|
{{/if}}
|
||||||
{{/link-to}}
|
{{/link-to}}
|
||||||
</div>
|
</div>
|
||||||
{{/with}}
|
|
||||||
{{/each}}
|
{{/each}}
|
||||||
</div>
|
</div>
|
||||||
{{#if model.externalIpAddresses.length}}
|
{{#if model.externalIpAddresses.length}}
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,9 @@
|
||||||
<div class="pod-state {{model.stateBackground}}"><span>{{model.displayState}}</span></div>
|
<div class="pod-state {{model.stateBackground}}"><span>{{model.displayState}}</span></div>
|
||||||
|
|
||||||
<div class="right">
|
<div class="right">
|
||||||
{{resource-actions-menu model=model choices=model.availableActions}}
|
{{#with model controller="environment" as |ctrl|}}
|
||||||
|
{{resource-actions-menu model=ctrl choices=ctrl.availableActions parentController=this}}
|
||||||
|
{{/with}}
|
||||||
|
|
||||||
<a href="{{dom-id model pound=true}}" data-toggle="collapse" class="btn btn-link collapser" aria-expanded="true"></a>
|
<a href="{{dom-id model pound=true}}" data-toggle="collapse" class="btn btn-link collapser" aria-expanded="true"></a>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
||||||
|
|
@ -16,7 +16,7 @@ export default Ember.Controller.extend(CattleTransitioningController, {
|
||||||
},
|
},
|
||||||
|
|
||||||
addService: function() {
|
addService: function() {
|
||||||
this.transitionToRoute('service.new', {
|
this.get('controllers.application').transitionToRoute('service.new', {
|
||||||
queryParams: {
|
queryParams: {
|
||||||
environmentId: this.get('model.id'),
|
environmentId: this.get('model.id'),
|
||||||
},
|
},
|
||||||
|
|
@ -24,7 +24,7 @@ export default Ember.Controller.extend(CattleTransitioningController, {
|
||||||
},
|
},
|
||||||
|
|
||||||
addBalancer: function() {
|
addBalancer: function() {
|
||||||
this.transitionToRoute('service.new-balancer', {
|
this.get('controllers.application').transitionToRoute('service.new-balancer', {
|
||||||
queryParams: {
|
queryParams: {
|
||||||
environmentId: this.get('model.id'),
|
environmentId: this.get('model.id'),
|
||||||
},
|
},
|
||||||
|
|
@ -44,11 +44,11 @@ export default Ember.Controller.extend(CattleTransitioningController, {
|
||||||
},
|
},
|
||||||
|
|
||||||
viewCode: function() {
|
viewCode: function() {
|
||||||
this.transitionToRoute('environment.code', this.get('model.id'));
|
this.get('controllers.application').transitionToRoute('environment.code', this.get('model.id'));
|
||||||
},
|
},
|
||||||
|
|
||||||
viewGraph: function() {
|
viewGraph: function() {
|
||||||
this.transitionToRoute('environment.graph', this.get('model.id'));
|
this.get('controllers.application').transitionToRoute('environment.graph', this.get('model.id'));
|
||||||
},
|
},
|
||||||
|
|
||||||
delete: function() {
|
delete: function() {
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,3 @@
|
||||||
import Ember from 'ember';
|
|
||||||
import Resource from 'ember-api-store/models/resource';
|
import Resource from 'ember-api-store/models/resource';
|
||||||
|
|
||||||
var Host = Resource.extend({
|
var Host = Resource.extend({
|
||||||
|
|
|
||||||
|
|
@ -8,7 +8,7 @@ export default Ember.Mixin.create(EditLabels, {
|
||||||
|
|
||||||
actions: {
|
actions: {
|
||||||
addServiceLink: function() {
|
addServiceLink: function() {
|
||||||
this.get('serviceLinksArray').pushObject(Ember.Object.create({serviceId: null, linkName: null}));
|
this.get('serviceLinksArray').pushObject(Ember.Object.create({name: '', serviceId: null}));
|
||||||
},
|
},
|
||||||
removeServiceLink: function(obj) {
|
removeServiceLink: function(obj) {
|
||||||
this.get('serviceLinksArray').removeObject(obj);
|
this.get('serviceLinksArray').removeObject(obj);
|
||||||
|
|
@ -25,7 +25,7 @@ export default Ember.Mixin.create(EditLabels, {
|
||||||
// Services
|
// Services
|
||||||
// ----------------------------------
|
// ----------------------------------
|
||||||
serviceChoices: function() {
|
serviceChoices: function() {
|
||||||
var env = this.get('selectedEnvironment');
|
var env = this.get('model.selectedEnvironment');
|
||||||
var group = 'Stack: ' + (env.get('name') || '('+env.get('id')+')');
|
var group = 'Stack: ' + (env.get('name') || '('+env.get('id')+')');
|
||||||
|
|
||||||
var list = (env.get('services')||[]).map((service) => {
|
var list = (env.get('services')||[]).map((service) => {
|
||||||
|
|
@ -47,7 +47,6 @@ export default Ember.Mixin.create(EditLabels, {
|
||||||
}.property('environment.services.@each.{id,name,state}'),
|
}.property('environment.services.@each.{id,name,state}'),
|
||||||
|
|
||||||
serviceLinksArray: null,
|
serviceLinksArray: null,
|
||||||
serviceLinksAsMap: null,
|
|
||||||
initServiceLinks: function() {
|
initServiceLinks: function() {
|
||||||
var out = [];
|
var out = [];
|
||||||
var links;
|
var links;
|
||||||
|
|
@ -63,11 +62,11 @@ export default Ember.Mixin.create(EditLabels, {
|
||||||
}
|
}
|
||||||
|
|
||||||
links.forEach(function(obj) {
|
links.forEach(function(obj) {
|
||||||
var linkName = obj.get('name');
|
var name = obj.get('name');
|
||||||
var service = obj.get('service');
|
var service = obj.get('service');
|
||||||
|
|
||||||
out.push(Ember.Object.create({
|
out.push(Ember.Object.create({
|
||||||
linkName: (linkName === service.get('name') ? '' : linkName),
|
name: (name === service.get('name') ? '' : name),
|
||||||
obj: service,
|
obj: service,
|
||||||
serviceId: service.get('id'),
|
serviceId: service.get('id'),
|
||||||
}));
|
}));
|
||||||
|
|
@ -77,31 +76,7 @@ export default Ember.Mixin.create(EditLabels, {
|
||||||
},
|
},
|
||||||
|
|
||||||
serviceLinksDidChange: function() {
|
serviceLinksDidChange: function() {
|
||||||
// Sync with the actual environment
|
}.observes('serviceLinksArray.@each.{name,serviceId}'),
|
||||||
var out = {};
|
|
||||||
this.get('serviceLinksArray').forEach((row) => {
|
|
||||||
if ( row.serviceId )
|
|
||||||
{
|
|
||||||
var name = row.linkName;
|
|
||||||
if ( !name )
|
|
||||||
{
|
|
||||||
// If no name is given, use the name of the service
|
|
||||||
var service = this.get('serviceChoices').filterProperty('id', row.serviceId)[0];
|
|
||||||
if ( service )
|
|
||||||
{
|
|
||||||
name = service.get('obj.name');
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if ( name )
|
|
||||||
{
|
|
||||||
out[name] = row.serviceId;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
this.set('serviceLinksAsMap', out);
|
|
||||||
}.observes('serviceLinksArray.@each.{linkName,serviceId}'),
|
|
||||||
|
|
||||||
// ----------------------------------
|
// ----------------------------------
|
||||||
// Scheduling
|
// Scheduling
|
||||||
|
|
@ -144,7 +119,15 @@ export default Ember.Mixin.create(EditLabels, {
|
||||||
var type = service.get('type').toLowerCase();
|
var type = service.get('type').toLowerCase();
|
||||||
if ( type === 'service' )
|
if ( type === 'service' )
|
||||||
{
|
{
|
||||||
return service.doAction('setservicelinks', {serviceLinks: this.get('serviceLinksAsMap')});
|
var ary = []
|
||||||
|
this.get('serviceLinksArray').forEach((row) => {
|
||||||
|
if ( row.serviceId )
|
||||||
|
{
|
||||||
|
ary.push({name: row.name, serviceId: row.serviceId});
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
return service.doAction('setservicelinks', {serviceLinks: ary});
|
||||||
}
|
}
|
||||||
else if ( ['dnsservice','loadbalancerservice'].indexOf(type) >= 0 )
|
else if ( ['dnsservice','loadbalancerservice'].indexOf(type) >= 0 )
|
||||||
{
|
{
|
||||||
|
|
@ -152,5 +135,4 @@ export default Ember.Mixin.create(EditLabels, {
|
||||||
return service.doAction('setservicelinks', {serviceIds: ids});
|
return service.doAction('setservicelinks', {serviceIds: ids});
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
|
||||||
|
|
@ -35,7 +35,7 @@ export default Ember.Mixin.create({
|
||||||
}.property('sortBy','sorts.@each.{name}'),
|
}.property('sortBy','sorts.@each.{name}'),
|
||||||
|
|
||||||
arranged: function(){
|
arranged: function(){
|
||||||
var content = this.get('sortableContent');
|
var content = this.get('sortableContent')||[];
|
||||||
var currentSort = this.get('currentSort');
|
var currentSort = this.get('currentSort');
|
||||||
var out;
|
var out;
|
||||||
if ( currentSort )
|
if ( currentSort )
|
||||||
|
|
|
||||||
|
|
@ -85,7 +85,7 @@ Router.map(function() {
|
||||||
});
|
});
|
||||||
|
|
||||||
// Applications
|
// Applications
|
||||||
this.resource('stacks-tab', {path: '/stacks'}, function() {
|
this.resource('applications-tab', {path: '/apps'}, function() {
|
||||||
this.resource('splash', {path: '/welcome'});
|
this.resource('splash', {path: '/welcome'});
|
||||||
this.resource('service.new', {path: '/add-service'});
|
this.resource('service.new', {path: '/add-service'});
|
||||||
this.resource('service.new-balancer', {path: '/add-balancer'});
|
this.resource('service.new-balancer', {path: '/add-balancer'});
|
||||||
|
|
|
||||||
|
|
@ -2,7 +2,7 @@ import Ember from 'ember';
|
||||||
import CattleTransitioningController from 'ui/mixins/cattle-transitioning-controller';
|
import CattleTransitioningController from 'ui/mixins/cattle-transitioning-controller';
|
||||||
|
|
||||||
var ServiceController = Ember.Controller.extend(CattleTransitioningController, {
|
var ServiceController = Ember.Controller.extend(CattleTransitioningController, {
|
||||||
needs: ['environment'],
|
needs: ['environment','application'],
|
||||||
environment: Ember.computed.alias('controllers.environment.model'),
|
environment: Ember.computed.alias('controllers.environment.model'),
|
||||||
|
|
||||||
actions: {
|
actions: {
|
||||||
|
|
@ -15,7 +15,10 @@ var ServiceController = Ember.Controller.extend(CattleTransitioningController, {
|
||||||
},
|
},
|
||||||
|
|
||||||
edit: function() {
|
edit: function() {
|
||||||
this.transitionToRoute('service.edit', this.get('environmentId'), this.get('model.id'));
|
this.get('controllers.application').setProperties({
|
||||||
|
editService: true,
|
||||||
|
originalModel: this.get('model'),
|
||||||
|
});
|
||||||
},
|
},
|
||||||
|
|
||||||
scaleUp: function() {
|
scaleUp: function() {
|
||||||
|
|
|
||||||
|
|
@ -1,32 +0,0 @@
|
||||||
import Ember from 'ember';
|
|
||||||
import Cattle from 'ui/utils/cattle';
|
|
||||||
import EditService from 'ui/mixins/edit-service';
|
|
||||||
import EditTargetIp from 'ui/mixins/edit-targetip';
|
|
||||||
import C from 'ui/utils/constants';
|
|
||||||
|
|
||||||
export default Ember.ObjectController.extend(Cattle.LegacyNewOrEditMixin, EditService, EditTargetIp, {
|
|
||||||
editing: true,
|
|
||||||
|
|
||||||
canScale: function() {
|
|
||||||
if ( ['service','loadbalancerservice'].indexOf(this.get('service.type').toLowerCase()) >= 0 )
|
|
||||||
{
|
|
||||||
return !this.getLabel(C.LABEL.SCHED_GLOBAL);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}.property('service.type'),
|
|
||||||
|
|
||||||
hasServiceLinks: function() {
|
|
||||||
return this.get('service.type').toLowerCase() !== 'externalservice';
|
|
||||||
}.property('service.type'),
|
|
||||||
|
|
||||||
hasTargetIp: function() {
|
|
||||||
return this.get('service.type').toLowerCase() === 'externalservice';
|
|
||||||
}.property('service.type'),
|
|
||||||
|
|
||||||
doneSaving: function() {
|
|
||||||
this.send('goToPrevious');
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
@ -1,39 +0,0 @@
|
||||||
import Ember from 'ember';
|
|
||||||
|
|
||||||
export default Ember.Route.extend({
|
|
||||||
model: function(/*params, transition*/) {
|
|
||||||
var store = this.get('store');
|
|
||||||
var service = this.modelFor('service');
|
|
||||||
|
|
||||||
var dependencies = [
|
|
||||||
store.find('environment', service.get('environmentId')).then(function(env) {
|
|
||||||
return env.importLink('services');
|
|
||||||
})
|
|
||||||
];
|
|
||||||
|
|
||||||
return Ember.RSVP.all(dependencies, 'Load service dependencies').then((results) => {
|
|
||||||
return Ember.Object.create({
|
|
||||||
service: service,
|
|
||||||
selectedEnvironment: results[0],
|
|
||||||
});
|
|
||||||
});
|
|
||||||
},
|
|
||||||
|
|
||||||
setupController: function(controller, model) {
|
|
||||||
var service = model.get('service');
|
|
||||||
model.set('service', service.clone());
|
|
||||||
controller.set('originalModel', service);
|
|
||||||
controller.set('model', model);
|
|
||||||
controller.initFields();
|
|
||||||
},
|
|
||||||
|
|
||||||
renderTemplate: function() {
|
|
||||||
this.render('service/edit', {into: 'application', outlet: 'overlay'});
|
|
||||||
},
|
|
||||||
|
|
||||||
actions: {
|
|
||||||
cancel: function() {
|
|
||||||
this.goToPrevious();
|
|
||||||
},
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
@ -1,39 +0,0 @@
|
||||||
<section class="horizontal-form container-fluid">
|
|
||||||
<h2>{{#if editing}}Edit{{else}}Add{{/if}} Service</h2>
|
|
||||||
{{top-errors errors=errors}}
|
|
||||||
|
|
||||||
{{partial "container/edit-name"}}
|
|
||||||
|
|
||||||
{{#if canScale}}
|
|
||||||
{{partial "form-divider"}}
|
|
||||||
|
|
||||||
<div class="row">
|
|
||||||
<div class="col-sm-12 col-md-2 form-label">
|
|
||||||
<label>Scale</label>
|
|
||||||
</div>
|
|
||||||
{{#if isGlobal}}
|
|
||||||
<div class="col-sm-10 col-md-8">
|
|
||||||
<span class="text-muted">Always run one instance of this container on every host</span>
|
|
||||||
</div>
|
|
||||||
{{else}}
|
|
||||||
<div class="col-sm-2 col-md-1">
|
|
||||||
{{service.scale}}
|
|
||||||
</div>
|
|
||||||
<div class="col-sm-10 col-md-7">
|
|
||||||
{{input-slider value=service.scale valueMin=1 valueMax=11 scaleMin=0 scaleMax=12}}
|
|
||||||
</div>
|
|
||||||
{{/if}}
|
|
||||||
</div>
|
|
||||||
{{/if}}
|
|
||||||
|
|
||||||
{{partial "form-divider"}}
|
|
||||||
|
|
||||||
{{#if hasServiceLinks}}
|
|
||||||
{{partial "container/edit-services"}}
|
|
||||||
{{/if}}
|
|
||||||
{{#if hasTargetIp}}
|
|
||||||
{{partial "container/edit-targetip"}}
|
|
||||||
{{/if}}
|
|
||||||
</section>
|
|
||||||
|
|
||||||
{{partial "save-cancel"}}
|
|
||||||
|
|
@ -1,17 +0,0 @@
|
||||||
import Overlay from "ui/overlay/view";
|
|
||||||
import { addAction } from 'ui/utils/add-view-action';
|
|
||||||
|
|
||||||
export default Overlay.extend({
|
|
||||||
actions: {
|
|
||||||
addServiceLink: addAction('addServiceLink', '.service-link'),
|
|
||||||
addTargetIp: addAction('addTargetIp', '.target-ip'),
|
|
||||||
|
|
||||||
overlayClose: function() {
|
|
||||||
this.get('controller').send('cancel');
|
|
||||||
},
|
|
||||||
|
|
||||||
overlayEnter: function() {
|
|
||||||
this.get('controller').send('save');
|
|
||||||
},
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
@ -16,7 +16,7 @@ var Service = Resource.extend(ReadLabels, {
|
||||||
consumedServicesUpdated: 0,
|
consumedServicesUpdated: 0,
|
||||||
serviceLinks: null, // Used for clone
|
serviceLinks: null, // Used for clone
|
||||||
reservedKeys: ['_allMaps','consumedServicesUpdated','serviceLinks'],
|
reservedKeys: ['_allMaps','consumedServicesUpdated','serviceLinks'],
|
||||||
labelResource: Ember.computed.alias('model.launchConfig'),
|
labelResource: Ember.computed.alias('launchConfig'),
|
||||||
|
|
||||||
init: function() {
|
init: function() {
|
||||||
this._super();
|
this._super();
|
||||||
|
|
@ -163,7 +163,7 @@ var Service = Resource.extend(ReadLabels, {
|
||||||
}.property('type'),
|
}.property('type'),
|
||||||
|
|
||||||
activeIcon: function() {
|
activeIcon: function() {
|
||||||
return activeIcon(this.get('model'));
|
return activeIcon(this);
|
||||||
}.property('type'),
|
}.property('type'),
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,6 @@
|
||||||
import Ember from 'ember';
|
import Ember from 'ember';
|
||||||
import Util from 'ui/utils/util';
|
import Util from 'ui/utils/util';
|
||||||
|
import C from 'ui/utils/constants';
|
||||||
|
|
||||||
export default Ember.Service.extend({
|
export default Ember.Service.extend({
|
||||||
cookies: Ember.inject.service(),
|
cookies: Ember.inject.service(),
|
||||||
|
|
|
||||||
|
|
@ -7,7 +7,7 @@
|
||||||
{{#unless editing}}
|
{{#unless editing}}
|
||||||
<div>
|
<div>
|
||||||
{{#if containersOnRequestedHostIfUnmanaged.length}}
|
{{#if containersOnRequestedHostIfUnmanaged.length}}
|
||||||
<button class="btn-circle-plus" {{action "addLink" target="view"}}></button>
|
<button class="btn-circle-plus" {{action "addLink"}}></button>
|
||||||
{{else}}
|
{{else}}
|
||||||
<span class="text-muted">There are no other containers to link to.</span>
|
<span class="text-muted">There are no other containers to link to.</span>
|
||||||
{{/if}}
|
{{/if}}
|
||||||
|
|
@ -39,9 +39,9 @@
|
||||||
</td>
|
</td>
|
||||||
<td>
|
<td>
|
||||||
{{#if link.existing}}
|
{{#if link.existing}}
|
||||||
<p class="form-control-static input-sm text-muted">{{link.linkName}}</p>
|
<p class="form-control-static input-sm text-muted">{{link.name}}</p>
|
||||||
{{else}}
|
{{else}}
|
||||||
{{input class="form-control input-sm" type="text" value=link.linkName placeholder="e.g. database"}}
|
{{input class="form-control input-sm" type="text" value=link.name placeholder="e.g. database"}}
|
||||||
{{/if}}
|
{{/if}}
|
||||||
</td>
|
</td>
|
||||||
<td class="text-right">
|
<td class="text-right">
|
||||||
|
|
|
||||||
|
|
@ -39,7 +39,7 @@
|
||||||
<p class="form-control-static"><i class="ss-right"></i></p>
|
<p class="form-control-static"><i class="ss-right"></i></p>
|
||||||
</td>
|
</td>
|
||||||
<td>
|
<td>
|
||||||
{{input class="form-control input-sm" type="text" value=link.linkName placeholder="e.g. database"}}
|
{{input class="form-control input-sm" type="text" value=link.name placeholder="e.g. database"}}
|
||||||
</td>
|
</td>
|
||||||
{{/if}}
|
{{/if}}
|
||||||
<td class="text-right">
|
<td class="text-right">
|
||||||
|
|
|
||||||
|
|
@ -2,7 +2,7 @@ import Ember from 'ember';
|
||||||
|
|
||||||
export function addAction(action, selector) {
|
export function addAction(action, selector) {
|
||||||
return function() {
|
return function() {
|
||||||
this.get('controller').send(action);
|
this._super();
|
||||||
Ember.run.next(this, function() {
|
Ember.run.next(this, function() {
|
||||||
this.$(selector).last().focus();
|
this.$(selector).last().focus();
|
||||||
});
|
});
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue