YAML comes back as JSON now

This commit is contained in:
Vincent Fiduccia 2016-02-19 10:10:51 -07:00
parent c9b36feace
commit 42be7b2595
6 changed files with 23 additions and 12 deletions

View File

@ -14,10 +14,6 @@ export function hasThings(stacks, project, tgt)
{ {
keys.hasSystem = true; keys.hasSystem = true;
} }
else if ( info.kind === C.EXTERNALID.KIND_CATALOG && info.id.match(/:kubernetes:/) )
{
keys.hasKubernetes = true;
}
}); });
tgt.setProperties(keys); tgt.setProperties(keys);

View File

@ -40,4 +40,8 @@ export default Ember.Component.extend(FasterLinksAndMenus, {
stateBackground: function() { stateBackground: function() {
return this.get('model.stateColor').replace("text-","bg-"); return this.get('model.stateColor').replace("text-","bg-");
}.property('model.stateColor'), }.property('model.stateColor'),
isKubernetes: function() {
return !!this.get('model.labels')[C.LABEL.K8S_POD_NAME];
}.property('model.labels'),
}); });

View File

@ -18,7 +18,7 @@
</div> </div>
{{#if children}} {{#if children}}
<div class="subpod-children clearfix"> <div class="subpod-children clearfix">
<h6 class="pull-left">Sidekicks</h6> <h6 class="pull-left">{{if isKubernetes 'Containers' 'Sidekicks'}}</h6>
{{#each children as |child|}} {{#each children as |child|}}
{{container-dot model=child type='tooltip-action-menu' template='tooltip-select-dot'}} {{container-dot model=child type='tooltip-action-menu' template='tooltip-select-dot'}}
{{else}} {{else}}

View File

@ -5,6 +5,7 @@ const NONE = 'none',
LOADING = 'loading', LOADING = 'loading',
CURRENT = 'current', CURRENT = 'current',
AVAILABLE = 'available', AVAILABLE = 'available',
NOTFOUND = 'notfound',
ERROR = 'error'; ERROR = 'error';
var queue = async.queue(getUpgradeInfo, 2); var queue = async.queue(getUpgradeInfo, 2);
@ -26,8 +27,15 @@ function getUpgradeInfo(task, cb) {
obj.set('upgradeStatus', CURRENT); obj.set('upgradeStatus', CURRENT);
} }
} }
}).catch((/*err*/) => { }).catch((err) => {
if ( err.status === 404 )
{
obj.set('upgradeStatus', NOTFOUND);
}
else
{
obj.set('upgradeStatus', ERROR); obj.set('upgradeStatus', ERROR);
}
}).finally(() => { }).finally(() => {
cb(); cb();
}); });
@ -73,6 +81,7 @@ export default Ember.Component.extend({
return 'hide'; return 'hide';
case LOADING: case LOADING:
case CURRENT: case CURRENT:
case NOTFOUND:
case ERROR: case ERROR:
return 'btn-disabled'; return 'btn-disabled';
case AVAILABLE: case AVAILABLE:
@ -90,13 +99,15 @@ export default Ember.Component.extend({
case NONE: case NONE:
return ''; return '';
case LOADING: case LOADING:
return 'Checking Upgrades...'; return 'Checking upgrades...';
case CURRENT: case CURRENT:
return 'Up to date'; return 'Up to date';
case AVAILABLE: case AVAILABLE:
return 'Upgrade Available'; return 'Upgrade available';
case NOTFOUND:
return 'Template version not found';
default: default:
return 'Error checking upgrades'; return 'Error checking for upgrade';
} }
}.property('upgradeStatus','isUpgradeState'), }.property('upgradeStatus','isUpgradeState'),

View File

@ -181,7 +181,7 @@ export default Ember.Service.extend({
} }
var output = store.createRecord(obj, type); var output = store.createRecord(obj, type);
if (output.metadata.uid) if (output && output.metadata && output.metadata.uid)
{ {
var cacheEntry = self.getByUid(type, output.metadata.uid); var cacheEntry = self.getByUid(type, output.metadata.uid);
if ( cacheEntry ) if ( cacheEntry )
@ -458,7 +458,6 @@ export default Ember.Service.extend({
return this.request({ return this.request({
url: `${this.get('app.kubectlEndpoint')}/${encodeURIComponent(type)}/${encodeURIComponent(parts.name)}?namespace=${encodeURIComponent(parts.namespace)}`, url: `${this.get('app.kubectlEndpoint')}/${encodeURIComponent(type)}/${encodeURIComponent(parts.name)}?namespace=${encodeURIComponent(parts.namespace)}`,
}).then((body) => { }).then((body) => {
body = JSON.parse(body);
return body.stdOut.trim(); return body.stdOut.trim();
}).catch((err) => { }).catch((err) => {
return Ember.RSVP.reject(this.parseKubectlError(err)); return Ember.RSVP.reject(this.parseKubectlError(err));

View File

@ -97,6 +97,7 @@ var C = {
PULL_IMAGE: 'io.rancher.container.pull_image', PULL_IMAGE: 'io.rancher.container.pull_image',
PULL_IMAGE_VALUE: 'always', PULL_IMAGE_VALUE: 'always',
KVM: 'io.rancher.host.kvm', KVM: 'io.rancher.host.kvm',
K8S_POD_NAME: 'io.kubernetes.pod.name',
}, },
PREFS: { PREFS: {