diff --git a/app/authenticated/route.js b/app/authenticated/route.js
index abff25039..406260b29 100644
--- a/app/authenticated/route.js
+++ b/app/authenticated/route.js
@@ -204,6 +204,26 @@ export default Ember.Route.extend(AuthenticatedRouteMixin, {
this._includeChanged('loadBalancer', 'loadBalancerListeners', 'loadBalancerListeners', change.data.resource);
},
+ loadBalancerChanged: function(change) {
+ var balancer = change.data.resource;
+ var config = balancer.get('loadBalancerConfig');
+ var balancers = config.get('loadBalancers');
+ if ( !balancers )
+ {
+ balancers = [];
+ config.set('loadBalancers',balancers);
+ }
+
+ if ( config.get('state') === 'removed' )
+ {
+ balancers.removeObject(balancer);
+ }
+ else
+ {
+ balancers.addObject(balancer);
+ }
+ },
+
mountChanged: function(change) {
var mount = change.data.resource;
var volume = this.get('store').getById('volume', mount.get('volumeId'));
diff --git a/app/loadbalancer/controller.js b/app/loadbalancer/controller.js
index 09b966129..28e7e2ec1 100644
--- a/app/loadbalancer/controller.js
+++ b/app/loadbalancer/controller.js
@@ -2,6 +2,12 @@ import Ember from 'ember';
import Cattle from 'ui/utils/cattle';
var LoadBalancerController = Cattle.TransitioningResourceController.extend({
+ actions: {
+ newTarget: function() {
+ this.transitionToRoute('loadbalancer.targets.new', this.get('id'));
+ },
+ },
+
availableActions: function() {
var a = this.get('actions');
diff --git a/app/loadbalancerconfigs/index/template.hbs b/app/loadbalancerconfigs/index/template.hbs
index 235405b17..e982263eb 100644
--- a/app/loadbalancerconfigs/index/template.hbs
+++ b/app/loadbalancerconfigs/index/template.hbs
@@ -28,10 +28,10 @@
{{#if config.appCookieStickinessPolicy}}
- Create Cookie
+ Use existing cookie
{{else}}
{{#if config.lbCookieStickinessPolicy}}
- Use existing cookie
+ Create cookie
{{else}}
None
{{/if}}
diff --git a/app/loadbalancerlistener/model.js b/app/loadbalancerlistener/model.js
index f358637ce..08b86cb83 100644
--- a/app/loadbalancerlistener/model.js
+++ b/app/loadbalancerlistener/model.js
@@ -5,6 +5,8 @@ var LoadBalancerListener = Cattle.TransitioningResource.extend({
});
LoadBalancerListener.reopenClass({
+ pollTransitioningDelay: 1000,
+ pollTransitioningInterval: 5000,
});
export default LoadBalancerListener;
diff --git a/app/loadbalancers/new/controller.js b/app/loadbalancers/new/controller.js
index 4db3f8d3a..f400ca5f9 100644
--- a/app/loadbalancers/new/controller.js
+++ b/app/loadbalancers/new/controller.js
@@ -97,6 +97,12 @@ export default Ember.ObjectController.extend(Cattle.NewOrEditMixin, EditLoadBala
});
}.property('targetsArray.@each.{isIp,isContainer,value}'),
+ activeConfigs: function() {
+ return this.get('allConfigs').filter((config) => {
+ return config.get('state') === 'active';
+ });
+ }.property('allConfigs.@each.state'),
+
willSave: function() {
if ( !this._super() )
{
diff --git a/app/loadbalancers/new/template.hbs b/app/loadbalancers/new/template.hbs
index 5bc6232ba..95c377078 100644
--- a/app/loadbalancers/new/template.hbs
+++ b/app/loadbalancers/new/template.hbs
@@ -88,7 +88,7 @@
{{view "select"
class="form-control"
- content=allConfigs
+ content=activeConfigs
optionLabelPath="content.name"
optionValuePath="content.id"
value=existingConfigId
diff --git a/app/loadbalancertarget/model.js b/app/loadbalancertarget/model.js
index e260f1ed3..0b2902bd1 100644
--- a/app/loadbalancertarget/model.js
+++ b/app/loadbalancertarget/model.js
@@ -23,6 +23,8 @@ var LoadBalancerTarget = Cattle.TransitioningResource.extend({
});
LoadBalancerTarget.reopenClass({
+ pollTransitioningDelay: 1000,
+ pollTransitioningInterval: 5000,
});
export default LoadBalancerTarget;
diff --git a/app/utils/cattle.js b/app/utils/cattle.js
index 96813e562..4c46e04cb 100644
--- a/app/utils/cattle.js
+++ b/app/utils/cattle.js
@@ -148,40 +148,66 @@ var TransitioningResource = Resource.extend({
isError: Ember.computed.equal('transitioning','error'),
replaceWith: function() {
+ //console.log('1 replaceWith', this.get('id'));
this._super.apply(this,arguments);
this.transitioningChanged();
},
+ wasAdded: function() {
+ this.transitioningChanged();
+ },
+
+ wasRemoved: function() {
+ this.transitioningChanged();
+ },
+
pollDelayTimer: null,
pollTimer: null,
reservedKeys: ['pollDelayTimer','pollTimer','waitInterval','waitTimeout'],
transitioningChanged: function() {
- //console.log('Transitioning changed', this.toString(), this.get('transitioning'), this.get('pollDelayTimer'),this.get('pollTimer'));
+ //console.log('Transitioning changed', this.toString(), this.get('transitioning'), this.get('pollDelayTimer'), this.get('pollTimer'));
- clearTimeout(this.get('pollDelayTimer'));
- clearTimeout(this.get('pollTimer'));
-
- if ( !this.isInStore() )
+ if ( this.get('transitioning') !== 'yes' || !this.isInStore() )
{
- //console.log('This resource is not in the store');
+ clearTimeout(this.get('pollDelayTimer'));
+ clearTimeout(this.get('pollTimer'));
return;
}
+ if ( this.get('pollDelayTimer') )
+ {
+ // Already polling or waiting, just let that one finish
+ return;
+ }
+
+
var delay = this.constructor.pollTransitioningDelay;
var interval = this.constructor.pollTransitioningInterval;
if ( delay > 0 && interval > 0 && this.get('transitioning') === 'yes' )
{
//console.log('Starting poll timer', this.toString());
this.set('pollDelayTimer', setTimeout(function() {
- //console.log('1 expired');
+ //console.log('1 expired', this.toString());
this.transitioningPoll();
}.bind(this), delay));
}
+ else
+ {
+ //console.log('Not polling', this.toString());
+ clearTimeout(this.get('pollDelayTimer'));
+ this.set('pollDelayTimer', null);
+ }
}.observes('transitioning'),
transitioningPoll: function() {
- clearTimeout(this.get('pollTimer'));
+ var self = this;
+ function reset() {
+ clearTimeout(self.get('pollDelayTimer'));
+ self.set('pollDelayTimer',null);
+ }
+ clearTimeout(this.get('pollTimer'));
+ this.set('pollTimer',null);
//console.log('Checking', this.toString());
if ( this.get('transitioning') !== 'yes' || !this.isInStore() )
@@ -196,10 +222,16 @@ var TransitioningResource = Resource.extend({
{
//console.log('Rescheduling', this.toString());
this.set('pollTimer', setTimeout(function() {
- //console.log('2 expired');
+ //console.log('2 expired', this.toString());
this.transitioningPoll();
}.bind(this), this.constructor.pollTransitioningInterval));
}
+ else
+ {
+ reset();
+ }
+ }).catch(() => {
+ reset();
});
},
@@ -241,7 +273,7 @@ var TransitioningResource = Resource.extend({
waitForAction: function(name) {
return this._waitForTestFn(function() {
- console.log('waitForAction('+name+'):', this.hasAction(name));
+ //console.log('waitForAction('+name+'):', this.hasAction(name));
return this.hasAction(name);
}, 'Wait for action='+name);
},
diff --git a/app/views/confirm-delete.js b/app/views/confirm-delete.js
index c2688ca1b..7509ef0b6 100644
--- a/app/views/confirm-delete.js
+++ b/app/views/confirm-delete.js
@@ -9,11 +9,11 @@ export default Overlay.extend({
actions: {
overlayClose: function() {
- this.get('controller').send('cancel');
+ this.get('controller').send('cancelDelete');
},
overlayEnter: function() {
- this.get('controller').send('confirm');
+ this.get('controller').send('confirmDelete');
}
}
});
diff --git a/package.json b/package.json
index 9757fb5b6..5e2309d3b 100644
--- a/package.json
+++ b/package.json
@@ -24,7 +24,7 @@
"broccoli-asset-rev": "^2.0.0",
"broccoli-sass": "0.6.2",
"connect-restreamer": "^1.0.1",
- "ember-api-store": "1.0.14",
+ "ember-api-store": "1.0.15",
"ember-browserify": "^0.6.4",
"ember-cli": "0.2.0",
"ember-cli-app-version": "0.3.3",
|