diff --git a/app/components/info-multi-stats/component.js b/app/components/info-multi-stats/component.js index ba332925f..ff5ab7d95 100644 --- a/app/components/info-multi-stats/component.js +++ b/app/components/info-multi-stats/component.js @@ -4,6 +4,8 @@ import { formatPercent, formatMib, formatKbps } from 'ui/utils/util'; const MAX_POINTS = 60; const TICK_COUNT = 6; +const COLORS = ["#1f77b4", "#ff7f0e", "#2ca02c", "#d62728", "#9467bd", "#8c564b", "#e377c2", "#7f7f7f", "#bcbd22", "#17becf"]; +const ALT_COLORS = ["#ff7f0e", "#1f77b4", "#2ca02c", "#d62728", "#9467bd", "#8c564b", "#e377c2", "#7f7f7f", "#bcbd22", "#17becf"]; export default Ember.Component.extend({ model: null, @@ -119,10 +121,10 @@ export default Ember.Component.extend({ { if ( this.get('single') ) { - row = getOrCreateDataRow(graph, data, 'User'); - row.push(point.cpu_user); row = getOrCreateDataRow(graph, data, 'System'); row.push(point.cpu_system); + row = getOrCreateDataRow(graph, data, 'User'); + row.push(point.cpu_user); } else { @@ -166,10 +168,10 @@ export default Ember.Component.extend({ { if ( this.get('single') ) { - row = getOrCreateDataRow(graph, data, 'Receive'); - row.push(point.net_rx_kb); row = getOrCreateDataRow(graph, data, 'Transmit'); row.push(point.net_tx_kb); + row = getOrCreateDataRow(graph, data, 'Receive'); + row.push(point.net_rx_kb); } else { @@ -185,10 +187,10 @@ export default Ember.Component.extend({ { if ( this.get('single') ) { - row = getOrCreateDataRow(graph, data, 'Read'); - row.push(point.disk_read_kb); row = getOrCreateDataRow(graph, data, 'Write'); row.push(point.disk_write_kb); + row = getOrCreateDataRow(graph, data, 'Read'); + row.push(point.disk_read_kb); } else { @@ -222,11 +224,13 @@ export default Ember.Component.extend({ size: { height: 110, }, + color: { pattern: ALT_COLORS.slice() }, data: { type: 'area-step', x: 'x', columns: this.get('cpuData'), groups: [[]], // Stacked graph, populated by getOrCreateDataRow... + order: null, }, transition: { duration: 0 }, legend: { show: false }, @@ -280,6 +284,7 @@ export default Ember.Component.extend({ size: { height: 110, }, + color: { pattern: COLORS.slice() }, data: { type: 'area-step', x: 'x', @@ -337,11 +342,13 @@ export default Ember.Component.extend({ size: { height: 110, }, + color: { pattern: ALT_COLORS.slice() }, data: { type: 'area-step', x: 'x', columns: this.get('storageData'), groups: [[]], // Stacked graph, populated by getOrCreateDataRow... + order: null, }, transition: { duration: 0 }, legend: { show: false }, @@ -393,11 +400,13 @@ export default Ember.Component.extend({ size: { height: 110, }, + color: { pattern: ALT_COLORS.slice() }, data: { type: 'area-step', x: 'x', columns: this.get('networkData'), groups: [[]], // Stacked graph, populated by getOrCreateDataRow... + order: null, }, transition: { duration: 0 }, legend: { show: false }, diff --git a/app/components/spark-line/component.js b/app/components/spark-line/component.js index 1769c22e4..3241fbdbb 100644 --- a/app/components/spark-line/component.js +++ b/app/components/spark-line/component.js @@ -95,7 +95,7 @@ export default Ember.Component.extend({ update: function() { var svg = this.get('svg'); - var data = this.get('data').slice(); + var data = (this.get('data')||[]).slice(); var x = this.get('x'); var y = this.get('y'); var line = this.get('line'); diff --git a/app/host/containers/controller.js b/app/host/containers/controller.js index 8b06d3cb6..142d5b37b 100644 --- a/app/host/containers/controller.js +++ b/app/host/containers/controller.js @@ -3,6 +3,8 @@ import Sortable from 'ui/mixins/sortable'; import ContainerSparkStats from 'ui/mixins/container-spark-stats'; export default Ember.Controller.extend(Sortable, ContainerSparkStats, { + statsSocket: null, + sortableContent: Ember.computed.alias('model.instances'), sortBy: 'name', sorts: { diff --git a/app/host/model.js b/app/host/model.js index 81cd8bf15..8b3b20ce3 100644 --- a/app/host/model.js +++ b/app/host/model.js @@ -1,4 +1,6 @@ +import Ember from 'ember'; import Resource from 'ember-api-store/models/resource'; +import { formatMib } from 'ui/utils/util'; var Host = Resource.extend({ type: 'host', @@ -53,12 +55,13 @@ var Host = Resource.extend({ }.property('physicalHostId'), osBlurb: function() { - // @TODO this always sends back Ubuntu - if ( false && this.get('info.osInfo') ) + if ( this.get('info.osInfo.operatingSystem') ) { - return this.get('info.osInfo.distribution') + ' ' + this.get('info.osInfo.version'); + return this.get('info.osInfo.operatingSystem').replace(/\s+\(.*?\)/,''); } - }.property('info.osInfo.{distribution,version}'), + }.property('info.osInfo.operatingSystem'), + + osDetail: Ember.computed.alias('info.osInfo.operatingSystem'), dockerBlurb: function() { // @TODO this always sends back Ubuntu @@ -84,28 +87,53 @@ var Host = Resource.extend({ } }.property('info.cpuInfo.{count,mhz}'), + cpuTooltip: Ember.computed.alias('info.cpuInfo.modelName'), + memoryBlurb: function() { if ( this.get('info.memoryInfo') ) { - var gb = Math.round((this.get('info.memoryInfo.memTotal')/1024)*100)/100; - - return gb + ' GiB'; + return formatMib(this.get('info.memoryInfo.memTotal')); } }.property('info.memoryInfo.memTotal'), diskBlurb: function() { - if ( this.get('info.diskInfo.mountPoints') ) + var totalMb = 0; + + // New hotness + if ( this.get('info.diskInfo.fileSystems') ) { - var totalMb = 0; + var fses = this.get('info.diskInfo.fileSystems')||[]; + Object.keys(fses).forEach((fs) => { + totalMb += fses[fs].capacity; + }); + + return formatMib(totalMb); + } + else if ( this.get('info.diskInfo.mountPoints') ) + { + // Old & busted var mounts = this.get('info.diskInfo.mountPoints')||[]; Object.keys(mounts).forEach((mountPoint) => { totalMb += mounts[mountPoint].total; }); - var gb = Math.round((totalMb/1024)*10)/10; - return gb + ' GiB'; + return formatMib(totalMb); } - }.property('info.diskInfo.mountPoints.@each.total'), + }.property('info.diskInfo.mountPoints.@each.total','info.diskInfo.fileSystems.@each.capacity'), + + diskDetail: function() { + // New hotness + if ( this.get('info.diskInfo.fileSystems') ) + { + var out = []; + var fses = this.get('info.diskInfo.fileSystems')||[]; + Object.keys(fses).forEach((fs) => { + out.pushObject(Ember.Object.create({label: fs, value: formatMib(fses[fs].capacity)})); + }); + + return out; + } + }.property('info.diskInfo.fileSystems.@each.capacity'), }); Host.reopenClass({ diff --git a/app/host/template.hbs b/app/host/template.hbs index 5bb5d562f..581291e86 100644 --- a/app/host/template.hbs +++ b/app/host/template.hbs @@ -39,7 +39,7 @@ {{#if model.cpuBlurb}}