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;
}
else if ( info.kind === C.EXTERNALID.KIND_CATALOG && info.id.match(/:kubernetes:/) )
{
keys.hasKubernetes = true;
}
});
tgt.setProperties(keys);

View File

@ -40,4 +40,8 @@ export default Ember.Component.extend(FasterLinksAndMenus, {
stateBackground: function() {
return this.get('model.stateColor').replace("text-","bg-");
}.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>
{{#if children}}
<div class="subpod-children clearfix">
<h6 class="pull-left">Sidekicks</h6>
<h6 class="pull-left">{{if isKubernetes 'Containers' 'Sidekicks'}}</h6>
{{#each children as |child|}}
{{container-dot model=child type='tooltip-action-menu' template='tooltip-select-dot'}}
{{else}}

View File

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

View File

@ -181,7 +181,7 @@ export default Ember.Service.extend({
}
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);
if ( cacheEntry )
@ -458,7 +458,6 @@ export default Ember.Service.extend({
return this.request({
url: `${this.get('app.kubectlEndpoint')}/${encodeURIComponent(type)}/${encodeURIComponent(parts.name)}?namespace=${encodeURIComponent(parts.namespace)}`,
}).then((body) => {
body = JSON.parse(body);
return body.stdOut.trim();
}).catch((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_VALUE: 'always',
KVM: 'io.rancher.host.kvm',
K8S_POD_NAME: 'io.kubernetes.pod.name',
},
PREFS: {