Bug fixes

This commit is contained in:
Vincent Fiduccia 2015-04-08 00:28:46 -07:00
parent 969a0a4ff6
commit fd170519ed
10 changed files with 84 additions and 16 deletions

View File

@ -204,6 +204,26 @@ export default Ember.Route.extend(AuthenticatedRouteMixin, {
this._includeChanged('loadBalancer', 'loadBalancerListeners', 'loadBalancerListeners', change.data.resource); 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) { mountChanged: function(change) {
var mount = change.data.resource; var mount = change.data.resource;
var volume = this.get('store').getById('volume', mount.get('volumeId')); var volume = this.get('store').getById('volume', mount.get('volumeId'));

View File

@ -2,6 +2,12 @@ import Ember from 'ember';
import Cattle from 'ui/utils/cattle'; import Cattle from 'ui/utils/cattle';
var LoadBalancerController = Cattle.TransitioningResourceController.extend({ var LoadBalancerController = Cattle.TransitioningResourceController.extend({
actions: {
newTarget: function() {
this.transitionToRoute('loadbalancer.targets.new', this.get('id'));
},
},
availableActions: function() { availableActions: function() {
var a = this.get('actions'); var a = this.get('actions');

View File

@ -28,10 +28,10 @@
</td> </td>
<td> <td>
{{#if config.appCookieStickinessPolicy}} {{#if config.appCookieStickinessPolicy}}
Create Cookie Use existing cookie
{{else}} {{else}}
{{#if config.lbCookieStickinessPolicy}} {{#if config.lbCookieStickinessPolicy}}
Use existing cookie Create cookie
{{else}} {{else}}
None None
{{/if}} {{/if}}

View File

@ -5,6 +5,8 @@ var LoadBalancerListener = Cattle.TransitioningResource.extend({
}); });
LoadBalancerListener.reopenClass({ LoadBalancerListener.reopenClass({
pollTransitioningDelay: 1000,
pollTransitioningInterval: 5000,
}); });
export default LoadBalancerListener; export default LoadBalancerListener;

View File

@ -97,6 +97,12 @@ export default Ember.ObjectController.extend(Cattle.NewOrEditMixin, EditLoadBala
}); });
}.property('targetsArray.@each.{isIp,isContainer,value}'), }.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() { willSave: function() {
if ( !this._super() ) if ( !this._super() )
{ {

View File

@ -88,7 +88,7 @@
<label>Choose an existing Balancer Configuration</label> <label>Choose an existing Balancer Configuration</label>
{{view "select" {{view "select"
class="form-control" class="form-control"
content=allConfigs content=activeConfigs
optionLabelPath="content.name" optionLabelPath="content.name"
optionValuePath="content.id" optionValuePath="content.id"
value=existingConfigId value=existingConfigId

View File

@ -23,6 +23,8 @@ var LoadBalancerTarget = Cattle.TransitioningResource.extend({
}); });
LoadBalancerTarget.reopenClass({ LoadBalancerTarget.reopenClass({
pollTransitioningDelay: 1000,
pollTransitioningInterval: 5000,
}); });
export default LoadBalancerTarget; export default LoadBalancerTarget;

View File

@ -148,40 +148,66 @@ var TransitioningResource = Resource.extend({
isError: Ember.computed.equal('transitioning','error'), isError: Ember.computed.equal('transitioning','error'),
replaceWith: function() { replaceWith: function() {
//console.log('1 replaceWith', this.get('id'));
this._super.apply(this,arguments); this._super.apply(this,arguments);
this.transitioningChanged(); this.transitioningChanged();
}, },
wasAdded: function() {
this.transitioningChanged();
},
wasRemoved: function() {
this.transitioningChanged();
},
pollDelayTimer: null, pollDelayTimer: null,
pollTimer: null, pollTimer: null,
reservedKeys: ['pollDelayTimer','pollTimer','waitInterval','waitTimeout'], reservedKeys: ['pollDelayTimer','pollTimer','waitInterval','waitTimeout'],
transitioningChanged: function() { 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')); if ( this.get('transitioning') !== 'yes' || !this.isInStore() )
clearTimeout(this.get('pollTimer'));
if ( !this.isInStore() )
{ {
//console.log('This resource is not in the store'); clearTimeout(this.get('pollDelayTimer'));
clearTimeout(this.get('pollTimer'));
return; return;
} }
if ( this.get('pollDelayTimer') )
{
// Already polling or waiting, just let that one finish
return;
}
var delay = this.constructor.pollTransitioningDelay; var delay = this.constructor.pollTransitioningDelay;
var interval = this.constructor.pollTransitioningInterval; var interval = this.constructor.pollTransitioningInterval;
if ( delay > 0 && interval > 0 && this.get('transitioning') === 'yes' ) if ( delay > 0 && interval > 0 && this.get('transitioning') === 'yes' )
{ {
//console.log('Starting poll timer', this.toString()); //console.log('Starting poll timer', this.toString());
this.set('pollDelayTimer', setTimeout(function() { this.set('pollDelayTimer', setTimeout(function() {
//console.log('1 expired'); //console.log('1 expired', this.toString());
this.transitioningPoll(); this.transitioningPoll();
}.bind(this), delay)); }.bind(this), delay));
} }
else
{
//console.log('Not polling', this.toString());
clearTimeout(this.get('pollDelayTimer'));
this.set('pollDelayTimer', null);
}
}.observes('transitioning'), }.observes('transitioning'),
transitioningPoll: function() { 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()); //console.log('Checking', this.toString());
if ( this.get('transitioning') !== 'yes' || !this.isInStore() ) if ( this.get('transitioning') !== 'yes' || !this.isInStore() )
@ -196,10 +222,16 @@ var TransitioningResource = Resource.extend({
{ {
//console.log('Rescheduling', this.toString()); //console.log('Rescheduling', this.toString());
this.set('pollTimer', setTimeout(function() { this.set('pollTimer', setTimeout(function() {
//console.log('2 expired'); //console.log('2 expired', this.toString());
this.transitioningPoll(); this.transitioningPoll();
}.bind(this), this.constructor.pollTransitioningInterval)); }.bind(this), this.constructor.pollTransitioningInterval));
} }
else
{
reset();
}
}).catch(() => {
reset();
}); });
}, },
@ -241,7 +273,7 @@ var TransitioningResource = Resource.extend({
waitForAction: function(name) { waitForAction: function(name) {
return this._waitForTestFn(function() { return this._waitForTestFn(function() {
console.log('waitForAction('+name+'):', this.hasAction(name)); //console.log('waitForAction('+name+'):', this.hasAction(name));
return this.hasAction(name); return this.hasAction(name);
}, 'Wait for action='+name); }, 'Wait for action='+name);
}, },

View File

@ -9,11 +9,11 @@ export default Overlay.extend({
actions: { actions: {
overlayClose: function() { overlayClose: function() {
this.get('controller').send('cancel'); this.get('controller').send('cancelDelete');
}, },
overlayEnter: function() { overlayEnter: function() {
this.get('controller').send('confirm'); this.get('controller').send('confirmDelete');
} }
} }
}); });

View File

@ -24,7 +24,7 @@
"broccoli-asset-rev": "^2.0.0", "broccoli-asset-rev": "^2.0.0",
"broccoli-sass": "0.6.2", "broccoli-sass": "0.6.2",
"connect-restreamer": "^1.0.1", "connect-restreamer": "^1.0.1",
"ember-api-store": "1.0.14", "ember-api-store": "1.0.15",
"ember-browserify": "^0.6.4", "ember-browserify": "^0.6.4",
"ember-cli": "0.2.0", "ember-cli": "0.2.0",
"ember-cli-app-version": "0.3.3", "ember-cli-app-version": "0.3.3",