mirror of https://github.com/rancher/ui.git
commit
d559ccb02a
|
|
@ -41,7 +41,9 @@ export default Ember.Component.extend(ManageLabels, GroupedInstances, {
|
||||||
|
|
||||||
isActive: Ember.computed.equal('model.state','active'),
|
isActive: Ember.computed.equal('model.state','active'),
|
||||||
isProvisioning: Ember.computed.equal('model.state','provisioning'),
|
isProvisioning: Ember.computed.equal('model.state','provisioning'),
|
||||||
|
isError: Ember.computed.equal('model.state','error'),
|
||||||
showAdd: Ember.computed.alias('isActive'),
|
showAdd: Ember.computed.alias('isActive'),
|
||||||
|
showOnlyMessage: Ember.computed.or('isProvisioning','isError'),
|
||||||
|
|
||||||
stateBackground: function() {
|
stateBackground: function() {
|
||||||
return this.get('model.stateColor').replace("text-","bg-");
|
return this.get('model.stateColor').replace("text-","bg-");
|
||||||
|
|
|
||||||
|
|
@ -5,21 +5,24 @@
|
||||||
</div>
|
</div>
|
||||||
<div class="pod-name">
|
<div class="pod-name">
|
||||||
<a href="{{href-to 'host' model.id}}">{{model.displayName}}</a>
|
<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'}}">
|
<div class="pod-message {{if model.isError 'text-danger' 'text-muted'}}">
|
||||||
{{model.transitioningMessage}}
|
{{model.transitioningMessage}}
|
||||||
</div>
|
</div>
|
||||||
{{/if}}
|
{{/if}}
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
{{#if isProvisioning}}
|
{{#if showOnlyMessage}}
|
||||||
<div class="machine-info text-center force-wrap">
|
<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>
|
</div>
|
||||||
{{else}}
|
{{else}}
|
||||||
<div class="pod-info">
|
<div class="pod-info">
|
||||||
<div class="pod-info-container">
|
<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}}
|
{{#if model.dockerBlurb}}
|
||||||
<div class="pod-info-item"><i class="icon icon-docker"></i> {{model.dockerBlurb}}</div>
|
<div class="pod-info-item"><i class="icon icon-docker"></i> {{model.dockerBlurb}}</div>
|
||||||
{{/if}}
|
{{/if}}
|
||||||
|
|
|
||||||
|
|
@ -6,7 +6,7 @@ import Util from 'ui/utils/util';
|
||||||
const DIGITALOCEAN_API = 'api.digitalocean.com/v2';
|
const DIGITALOCEAN_API = 'api.digitalocean.com/v2';
|
||||||
const VALID_IMAGES = [
|
const VALID_IMAGES = [
|
||||||
// 'centos-6-x64',
|
// 'centos-6-x64',
|
||||||
// 'centos-7-0-x64',
|
'centos-7-0-x64',
|
||||||
// 'coreos-alpha',
|
// 'coreos-alpha',
|
||||||
// 'coreos-beta',
|
// 'coreos-beta',
|
||||||
// 'coreos-stable',
|
// 'coreos-stable',
|
||||||
|
|
@ -17,7 +17,8 @@ const VALID_IMAGES = [
|
||||||
// 'freebsd-10-1-x64',
|
// 'freebsd-10-1-x64',
|
||||||
// 'freebsd-10-2-x64',
|
// 'freebsd-10-2-x64',
|
||||||
'ubuntu-14-04-x64',
|
'ubuntu-14-04-x64',
|
||||||
// 'ubuntu-16-04-x64'
|
'ubuntu-16-04-x64'
|
||||||
|
// 'ubuntu-16-10-x64'
|
||||||
];
|
];
|
||||||
|
|
||||||
export default Ember.Component.extend(Driver, {
|
export default Ember.Component.extend(Driver, {
|
||||||
|
|
@ -61,6 +62,7 @@ export default Ember.Component.extend(Driver, {
|
||||||
});
|
});
|
||||||
|
|
||||||
let filteredImages = hash.images.images.filter(function(image) {
|
let filteredImages = hash.images.images.filter(function(image) {
|
||||||
|
// 64-bit only
|
||||||
return !((image.name||'').match(/x32$/));
|
return !((image.name||'').match(/x32$/));
|
||||||
}).map(function(image) {
|
}).map(function(image) {
|
||||||
image.disabled = VALID_IMAGES.indexOf(image.slug) === -1;
|
image.disabled = VALID_IMAGES.indexOf(image.slug) === -1;
|
||||||
|
|
@ -99,7 +101,7 @@ export default Ember.Component.extend(Driver, {
|
||||||
accessToken : '',
|
accessToken : '',
|
||||||
size : '1gb',
|
size : '1gb',
|
||||||
region : 'nyc3',
|
region : 'nyc3',
|
||||||
image : 'ubuntu-14-04-x64'
|
image : 'ubuntu-16-04-x64'
|
||||||
});
|
});
|
||||||
|
|
||||||
this.set('model', this.get('store').createRecord({
|
this.set('model', this.get('store').createRecord({
|
||||||
|
|
|
||||||
|
|
@ -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}}
|
||||||
|
|
|
||||||
|
|
@ -5,6 +5,12 @@ import C from 'ui/utils/constants';
|
||||||
|
|
||||||
let DEADTOME = ['removed','purging','purged'];
|
let DEADTOME = ['removed','purging','purged'];
|
||||||
|
|
||||||
|
const ORCHESTRATION_STACKS = [
|
||||||
|
'infra*k8s',
|
||||||
|
'infra*swarm',
|
||||||
|
'infra*mesos'
|
||||||
|
];
|
||||||
|
|
||||||
export default Ember.Mixin.create({
|
export default Ember.Mixin.create({
|
||||||
k8s : Ember.inject.service(),
|
k8s : Ember.inject.service(),
|
||||||
projects : Ember.inject.service(),
|
projects : Ember.inject.service(),
|
||||||
|
|
@ -156,32 +162,16 @@ export default Ember.Mixin.create({
|
||||||
console.log('Subscribe ping ' + this.forStr());
|
console.log('Subscribe ping ' + this.forStr());
|
||||||
},
|
},
|
||||||
|
|
||||||
loadBalancerTargetChanged: function(change) {
|
stackChanged: function(change) {
|
||||||
this._includeChanged('loadBalancer', 'loadBalancerTargets', 'loadBalancerId', change.data.resource);
|
let stack = change.data.resource;
|
||||||
},
|
|
||||||
|
|
||||||
loadBalancerChanged: function(change) {
|
if ( ORCHESTRATION_STACKS.indexOf(stack.get('externalIdInfo.name')) >= 0 ) {
|
||||||
var balancer = change.data.resource;
|
Ember.run.once(this, function() {
|
||||||
var config = balancer.get('loadBalancerConfig');
|
this.get('projects.current').reload().then(() => {
|
||||||
var balancers = config.get('loadBalancers');
|
this.get('projects').updateOrchestrationState();
|
||||||
if ( !balancers )
|
});
|
||||||
{
|
});
|
||||||
balancers = [];
|
|
||||||
config.set('loadBalancers',balancers);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
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) {
|
k8sResourceChanged: function(changeType, obj) {
|
||||||
|
|
@ -200,96 +190,4 @@ export default Ember.Mixin.create({
|
||||||
this.get('store')._remove(resource.get('type'), resource);
|
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);
|
|
||||||
},
|
|
||||||
});
|
});
|
||||||
|
|
|
||||||
|
|
@ -5,12 +5,6 @@ import C from 'ui/utils/constants';
|
||||||
import Util from 'ui/utils/util';
|
import Util from 'ui/utils/util';
|
||||||
import { denormalizeServiceArray } from 'ui/utils/denormalize-snowflakes';
|
import { denormalizeServiceArray } from 'ui/utils/denormalize-snowflakes';
|
||||||
|
|
||||||
const ORCHESTRATION_STACKS = [
|
|
||||||
'infra*k8s',
|
|
||||||
'infra*swarm',
|
|
||||||
'infra*mesos'
|
|
||||||
];
|
|
||||||
|
|
||||||
export function activeIcon(stack)
|
export function activeIcon(stack)
|
||||||
{
|
{
|
||||||
if ( stack.get('system') )
|
if ( stack.get('system') )
|
||||||
|
|
@ -253,17 +247,6 @@ var Stack = Resource.extend({
|
||||||
|
|
||||||
return true;
|
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({
|
Stack.reopenClass({
|
||||||
|
|
|
||||||
|
|
@ -118,8 +118,8 @@ export default Ember.Controller.extend(Sortable, {
|
||||||
|
|
||||||
return out;
|
return out;
|
||||||
|
|
||||||
// stateSort isn't really a dependency here, but sortable won't recompute when it changes otherwise
|
// state isn't really a dependency here, but sortable won't recompute when it changes otherwise
|
||||||
}.property('model.[]','model.@each.{stateSort,grouping}','which','tags'),
|
}.property('model.stacks.[]','model.stacks.@each.{state,grouping}','which','tags'),
|
||||||
|
|
||||||
sortableContent: Ember.computed.alias('filteredStacks'),
|
sortableContent: Ember.computed.alias('filteredStacks'),
|
||||||
sortBy: 'name',
|
sortBy: 'name',
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
{
|
{
|
||||||
"name": "ui",
|
"name": "ui",
|
||||||
"version": "1.2.15",
|
"version": "1.2.17",
|
||||||
"private": true,
|
"private": true,
|
||||||
"directories": {
|
"directories": {
|
||||||
"doc": "doc",
|
"doc": "doc",
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue