This commit is contained in:
Vincent Fiduccia 2016-10-17 10:26:39 -07:00
parent fa98ad2b27
commit a850f8037f
9 changed files with 34 additions and 144 deletions

View File

@ -41,7 +41,9 @@ export default Ember.Component.extend(ManageLabels, GroupedInstances, {
isActive: Ember.computed.equal('model.state','active'),
isProvisioning: Ember.computed.equal('model.state','provisioning'),
isError: Ember.computed.equal('model.state','error'),
showAdd: Ember.computed.alias('isActive'),
showOnlyMessage: Ember.computed.or('isProvisioning','isError'),
stateBackground: function() {
return this.get('model.stateColor').replace("text-","bg-");

View File

@ -5,21 +5,24 @@
</div>
<div class="pod-name">
<a href="{{href-to 'host' model.id}}">{{model.displayName}}</a>
{{#if (and (not isProvisioning) model.showTransitioningMessage)}}
{{#if (and (not showOnlyMessage) model.showTransitioningMessage)}}
<div class="pod-message {{if model.isError 'text-danger' 'text-muted'}}">
{{model.transitioningMessage}}
</div>
{{/if}}
</div>
{{#if isProvisioning}}
{{#if showOnlyMessage}}
<div class="machine-info text-center force-wrap">
<span class="{{if model.isError 'text-danger' 'text-muted'}}">{{model.transitioningMessage}}</span>
<span class="{{if isError 'text-danger' 'text-muted'}}">{{model.transitioningMessage}}</span>
</div>
{{else}}
<div class="pod-info">
<div class="pod-info-container">
<div class="pod-info-item"><i class="icon icon-link"></i> {{format-ip model.displayIp}}</div>
{{#if model.displayIp}}
<div class="pod-info-item"><i class="icon icon-link"></i> {{format-ip model.displayIp}}</div>
{{/if}}
{{#if model.dockerBlurb}}
<div class="pod-info-item"><i class="icon icon-docker"></i> {{model.dockerBlurb}}</div>
{{/if}}

View File

@ -6,7 +6,7 @@ import Util from 'ui/utils/util';
const DIGITALOCEAN_API = 'api.digitalocean.com/v2';
const VALID_IMAGES = [
// 'centos-6-x64',
// 'centos-7-0-x64',
'centos-7-0-x64',
// 'coreos-alpha',
// 'coreos-beta',
// 'coreos-stable',
@ -17,7 +17,8 @@ const VALID_IMAGES = [
// 'freebsd-10-1-x64',
// 'freebsd-10-2-x64',
'ubuntu-14-04-x64',
// 'ubuntu-16-04-x64'
'ubuntu-16-04-x64'
// 'ubuntu-16-10-x64'
];
export default Ember.Component.extend(Driver, {
@ -61,6 +62,7 @@ export default Ember.Component.extend(Driver, {
});
let filteredImages = hash.images.images.filter(function(image) {
// 64-bit only
return !((image.name||'').match(/x32$/));
}).map(function(image) {
image.disabled = VALID_IMAGES.indexOf(image.slug) === -1;
@ -99,7 +101,7 @@ export default Ember.Component.extend(Driver, {
accessToken : '',
size : '1gb',
region : 'nyc3',
image : 'ubuntu-14-04-x64'
image : 'ubuntu-16-04-x64'
});
this.set('model', this.get('store').createRecord({

View File

@ -1 +1,3 @@
{{t (concat-str 'upgradeBtn.status.' upgradeStatus character='')}}
{{#tooltip-element type="tooltip-basic" model=currentVersion tooltipTemplate='tooltip-static' aria-describedby="tooltip-base"}}
{{t (concat-str 'upgradeBtn.status.' upgradeStatus character='')}}
{{/tooltip-element}}

View File

@ -5,6 +5,12 @@ import C from 'ui/utils/constants';
let DEADTOME = ['removed','purging','purged'];
const ORCHESTRATION_STACKS = [
'infra*k8s',
'infra*swarm',
'infra*mesos'
];
export default Ember.Mixin.create({
k8s : Ember.inject.service(),
projects : Ember.inject.service(),
@ -156,32 +162,16 @@ export default Ember.Mixin.create({
console.log('Subscribe ping ' + this.forStr());
},
loadBalancerTargetChanged: function(change) {
this._includeChanged('loadBalancer', 'loadBalancerTargets', 'loadBalancerId', change.data.resource);
},
stackChanged: function(change) {
let stack = 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 ( ORCHESTRATION_STACKS.indexOf(stack.get('externalIdInfo.name')) >= 0 ) {
Ember.run.once(this, function() {
this.get('projects.current').reload().then(() => {
this.get('projects').updateOrchestrationState();
});
});
}
if ( config.get('state') === 'removed' )
{
balancers.removeObject(balancer);
}
else
{
balancers.addObject(balancer);
}
},
registryCredentialChanged: function(change) {
this._includeChanged('registry', 'credentials', 'registryId', change.data.resource);
},
k8sResourceChanged: function(changeType, obj) {
@ -200,96 +190,4 @@ export default Ember.Mixin.create({
this.get('store')._remove(resource.get('type'), resource);
}
},
// Update the `?include=`-ed arrays of a host,
// e.g. when an instance changes:
// Update the destProperty='instances' array on all models of type resourceName='hosts'.
// to match the list in the the 'changed' resource's expectedProperty='hosts'
// _includeChanged( 'host', 'hosts', 'instances', 'hosts', instance)
_includeChanged: function(resourceName, destProperty, expectedProperty, changed) {
if (!changed)
{
return;
}
let start = (new Date().getTime());
var changedId = changed.get('id');
var store = this.get('store');
//console.log('Include changed',resourceName,destProperty,expectedProperty,changedId);
// All the resources
var all = store.all(resourceName);
// IDs the resource should be on
var expectedIds = [];
var expected = changed.get(expectedProperty)||[];
if ( !Ember.isArray(expected) )
{
expected = [expected];
}
if ( changed.get('state') !== 'purged' )
{
expectedIds = expected.map(function(item) {
if ( typeof item === 'object' )
{
return item.get('id');
}
else
{
return item;
}
});
}
// IDs it is currently on
var curIds = [];
all.forEach(function(item) {
var existing = (item.get(destProperty)||[]).filterBy('id', changedId);
if ( existing.length )
{
curIds.push(item.get('id'));
}
});
// Remove from resources the changed shouldn't be on
var remove = Util.arrayDiff(curIds, expectedIds);
remove.forEach((id) => {
//console.log('Remove',id);
store.find(resourceName, id).then((item) => {
var list = item.get(destProperty);
if ( list )
{
//console.log('Removing',changedId,'from',item.get('id'));
list.removeObjects(list.filterBy('id', changedId));
}
}).catch(() => {});
});
// Add or update resources the changed should be on
expectedIds.forEach((id) => {
//console.log('Expect',id);
store.find(resourceName, id).then((item) => {
var list = item.get(destProperty);
if ( !list )
{
list = [];
//console.log('Adding empty to',item.get('id'), destProperty);
item.set(destProperty, list);
}
var existing = list.filterBy('id', changedId);
if ( existing.length === 0)
{
//console.log('Adding',changedId,'to',item.get('id'), destProperty);
list.pushObject(changed);
}
}).catch(() => {});
});
let diff = ((new Date()).getTime())-start;
console.log('includechanged:', resourceName, destProperty, expectedProperty, diff);
},
});

View File

@ -5,12 +5,6 @@ import C from 'ui/utils/constants';
import Util from 'ui/utils/util';
import { denormalizeServiceArray } from 'ui/utils/denormalize-snowflakes';
const ORCHESTRATION_STACKS = [
'infra*k8s',
'infra*swarm',
'infra*mesos'
];
export function activeIcon(stack)
{
if ( stack.get('system') )
@ -253,17 +247,6 @@ var Stack = Resource.extend({
return true;
},
updateOrchestrationState: function() {
if ( ORCHESTRATION_STACKS.indexOf(this.get('externalIdInfo.name')) >= 0 ) {
Ember.run.once(this, function() {
this.get('projectsService').updateOrchestrationState();
if ( ['updating-active','activating','active'].indexOf(this.get('state')) >= 0 ) {
this.get('projectsService.current').reload();
}
});
}
}.observes('combinedState'),
});
Stack.reopenClass({

View File

@ -118,8 +118,8 @@ export default Ember.Controller.extend(Sortable, {
return out;
// stateSort isn't really a dependency here, but sortable won't recompute when it changes otherwise
}.property('model.[]','model.@each.{stateSort,grouping}','which','tags'),
// state isn't really a dependency here, but sortable won't recompute when it changes otherwise
}.property('model.stacks.[]','model.stacks.@each.{state,grouping}','which','tags'),
sortableContent: Ember.computed.alias('filteredStacks'),
sortBy: 'name',

View File

@ -1,6 +1,6 @@
{
"name": "ui",
"version": "1.2.15",
"version": "1.2.17",
"private": true,
"directories": {
"doc": "doc",