This commit is contained in:
Vincent Fiduccia 2016-03-18 17:08:17 -07:00
parent cc87384fcc
commit ccd2a840db
6 changed files with 31 additions and 5 deletions

View File

@ -0,0 +1,4 @@
import DriverView from 'ui/hosts/new/driver-view';
export default DriverView.extend({
});

View File

@ -29,6 +29,8 @@ const defaultStateMap = {
'unhealthy': {icon: 'icon icon-alert', color: 'text-danger' }, 'unhealthy': {icon: 'icon icon-alert', color: 'text-danger' },
'updating': {icon: 'icon icon-tag', color: 'text-info' }, 'updating': {icon: 'icon icon-tag', color: 'text-info' },
'updating-active': {icon: 'icon icon-tag', color: 'text-info' }, 'updating-active': {icon: 'icon icon-tag', color: 'text-info' },
'updating-healthy': {icon: 'icon icon-tag', color: 'text-info' },
'updating-unhealthy': {icon: 'icon icon-tag', color: 'text-info' },
'updating-reinitializing': {icon: 'icon icon-alert', color: 'text-info' }, 'updating-reinitializing': {icon: 'icon icon-alert', color: 'text-info' },
'updating-inactive': {icon: 'icon icon-tag', color: 'text-info' }, 'updating-inactive': {icon: 'icon icon-tag', color: 'text-info' },
}; };
@ -507,7 +509,7 @@ export default Ember.Mixin.create({
doAction: function(name, data, opt) { doAction: function(name, data, opt) {
var promise = this._super.apply(this, arguments); var promise = this._super.apply(this, arguments);
if ( opt && opt.catchGrowl !== false ) if ( !opt || opt.catchGrowl !== false )
{ {
return promise.catch((err) => { return promise.catch((err) => {
this.get('growl').fromError(Util.ucFirst(name) + ' Error', err); this.get('growl').fromError(Util.ucFirst(name) + ' Error', err);

View File

@ -1,6 +1,7 @@
import Ember from 'ember'; import Ember from 'ember';
import Resource from 'ember-api-store/models/resource'; import Resource from 'ember-api-store/models/resource';
import C from 'ui/utils/constants'; import C from 'ui/utils/constants';
import Util from 'ui/utils/util';
var Container = Resource.extend({ var Container = Resource.extend({
// Common to all instances // Common to all instances
@ -158,6 +159,18 @@ var Container = Resource.extend({
return this.get('primaryAssociatedIpAddress') || this.get('primaryIpAddress') || new Ember.Handlebars.SafeString('<span class="text-muted">None</span>'); return this.get('primaryAssociatedIpAddress') || this.get('primaryIpAddress') || new Ember.Handlebars.SafeString('<span class="text-muted">None</span>');
}.property('primaryIpAddress','primaryAssociatedIpAddress'), }.property('primaryIpAddress','primaryAssociatedIpAddress'),
sortIp: function() {
var ip = this.get('primaryAssociatedIpAddress') || this.get('primaryIpAddress');
if ( !ip ) {
return '';
}
var match = ip.match(/^(\d+)\.(\d+)\.(\d+)\.(\d+)$/);
if ( match )
{
return match.slice(1).map((octet) => { return Util.strPad(octet,3,'0',false); }).join(".");
}
}.property('primaryIpAddress','primaryAssociatedIpAddress'),
canDelete: function() { canDelete: function() {
return ['removed','removing','purging','purged'].indexOf(this.get('state')) === -1; return ['removed','removing','purging','purged'].indexOf(this.get('state')) === -1;
}.property('state'), }.property('state'),

View File

@ -10,7 +10,8 @@ export default Ember.Controller.extend(Sortable, ContainerSparkStats, {
sorts: { sorts: {
state: ['stateSort','name','id'], state: ['stateSort','name','id'],
name: ['name','id'], name: ['name','id'],
ip: ['displayIp','name','id'], ip: ['sortIp','name','id'],
host: ['primaryHost.displayName','name','id'],
image: ['imageUuid','command','name','id'], image: ['imageUuid','command','name','id'],
}, },
}); });

View File

@ -112,7 +112,12 @@ export default Ember.Service.extend({
session.setProperties(interesting); session.setProperties(interesting);
return res; return res;
}).catch((res) => { }).catch((res) => {
var err = JSON.parse(res.xhr.responseText); let err;
try {
err = JSON.parse(res.xhr.responseText);
} catch(e) {
err = {type: 'error', message: 'Error logging in'};
}
return Ember.RSVP.reject(err); return Ember.RSVP.reject(err);
}); });
}, },

View File

@ -2,9 +2,10 @@ import Ember from 'ember';
export default Ember.Service.extend({ export default Ember.Service.extend({
choices() { choices() {
var store = this.get('store');
return Ember.RSVP.hash({ return Ember.RSVP.hash({
environments: this.get('store').findAllUnremoved('environment'), environments: store.findAllUnremoved('environment'),
services: this.get('store').findAllUnremoved('service'), services: store.find('service', null, {forceReload: true}) // Need force-reload to get response with mixed types
}).then((hash) => { }).then((hash) => {
return hash.services.map((service) => { return hash.services.map((service) => {
return { return {