diff --git a/app/authenticated/apikeys/controller.js b/app/authenticated/apikeys/controller.js index e1ffdf727..e58940ac1 100644 --- a/app/authenticated/apikeys/controller.js +++ b/app/authenticated/apikeys/controller.js @@ -22,13 +22,12 @@ export default Controller.extend({ name: 'state', sort: ['sortState','name','id'], translationKey: 'apiPage.table.state', - width: 125, + width: 80, }, { name: 'name', sort: ['name','id'], translationKey: 'apiPage.table.name', - width: 150, }, { name: 'description', @@ -39,13 +38,13 @@ export default Controller.extend({ name: 'created', sort: ['created','name','id'], translationKey: 'apiPage.table.created', - width: 200, + width: 150, }, { name: 'expires', sort: ['expiresAt','name','id'], translationKey: 'apiPage.table.expires.label', - width: 200, + width: 150, }, ], diff --git a/lib/global-admin/addon/clusters/index/controller.js b/lib/global-admin/addon/clusters/index/controller.js index 93a1e48ed..3e4efbcc9 100644 --- a/lib/global-admin/addon/clusters/index/controller.js +++ b/lib/global-admin/addon/clusters/index/controller.js @@ -18,13 +18,7 @@ const headers = [ name: 'provider', sort: ['displayProvider','name','id'], translationKey: 'clustersPage.provider.label', - width: 125, - }, - { - name: 'version', - sort: ['displayProvider','name','id'], - translationKey: 'clustersPage.provider.label', - width: 125, + width: 150, }, { name: 'nodes', @@ -57,6 +51,7 @@ export default Controller.extend({ application: controller(), headers: headers, + extraSearchFields: ['version.gitVersion'], sortBy: 'name', searchText: null, bulkActions: true, diff --git a/lib/global-admin/addon/clusters/index/template.hbs b/lib/global-admin/addon/clusters/index/template.hbs index 262de49ce..d597fd5b4 100644 --- a/lib/global-admin/addon/clusters/index/template.hbs +++ b/lib/global-admin/addon/clusters/index/template.hbs @@ -15,6 +15,7 @@ searchText=searchText sortBy=sortBy bulkActions=true + extraSearchFields=extraSearchFields pagingLabel="pagination.cluster" headers=headers as |sortable kind inst dt| }} diff --git a/lib/shared/addon/components/apikey-row/template.hbs b/lib/shared/addon/components/apikey-row/template.hbs index 9463bc45b..aa809eec3 100644 --- a/lib/shared/addon/components/apikey-row/template.hbs +++ b/lib/shared/addon/components/apikey-row/template.hbs @@ -4,12 +4,8 @@ {{badge-state model=model}} - - {{#copy-to-clipboard clipboardText=model.displayName size="small"}} - - {{model.displayName}} - - {{/copy-to-clipboard}} + + {{model.displayName}} {{#if model.description}} @@ -19,13 +15,13 @@ {{/if}} - {{date-calendar model.created}} + {{date-from-now model.created}} {{#if model.expiresAt}} - {{date-calendar model.expiresAt}} + {{date-from-now model.expiresAt}} {{else}} - {{t 'generic.none'}} + {{t 'generic.never'}} {{/if}} diff --git a/lib/shared/addon/components/cluster-row/template.hbs b/lib/shared/addon/components/cluster-row/template.hbs index 1c8c8ff3b..1db86e836 100644 --- a/lib/shared/addon/components/cluster-row/template.hbs +++ b/lib/shared/addon/components/cluster-row/template.hbs @@ -9,7 +9,12 @@ {{#link-to-external 'authenticated.cluster' model.id}}{{model.displayName}}{{/link-to-external}} - {{model.displayProvider}} + {{#if model.version.gitVersion}} + {{model.displayProvider}} +

{{model.version.gitVersion}}

+ {{else}} + {{model.displayProvider}} + {{/if}} {{#if (eq model.state "inactive")}} @@ -21,7 +26,8 @@ {{#if model.cpuUsage}} - {{model.cpuUsage}} + {{model.cpuUsage}} +

{{model.cpuPercent}}

{{else}} {{t 'generic.na'}} @@ -31,7 +37,8 @@ {{#if model.memoryUsage}} - {{model.memoryUsage}} + {{model.memoryUsage}} +

{{model.memoryPercent}}

{{else}} {{t 'generic.na'}} diff --git a/lib/shared/addon/mixins/resource-usage.js b/lib/shared/addon/mixins/resource-usage.js index 7499461df..98d85b0c6 100644 --- a/lib/shared/addon/mixins/resource-usage.js +++ b/lib/shared/addon/mixins/resource-usage.js @@ -12,10 +12,10 @@ export default Mixin.create({ const total = parseSi(get(this,'allocatable.cpu')); if ( total ) { const minExp = exponentNeeded(total); - const usedStr = formatSi(used, 1000, '', '', 0, minExp).replace(/\s.*$/,''); - const totalStr = formatSi(total, 1000, '', '', 0, minExp); + const usedStr = formatSi(used, 1000, '', '', 0, minExp, 1).replace(/\s.*$/,''); + const totalStr = formatSi(total, 1000, '', '', 0, minExp, 1); - return `${usedStr}/${totalStr}` + return `${usedStr}/${totalStr} Core` + (totalStr === '1' ? '' : 's'); } else { return null; } @@ -25,7 +25,7 @@ export default Mixin.create({ const used = parseSi(get(this,'requested.cpu'))||0; const total = parseSi(get(this,'allocatable.cpu')); if ( total ) { - return formatPercent(100*used/total); + return formatPercent(100*used/total, 0); } else { return null; } @@ -36,8 +36,8 @@ export default Mixin.create({ const total = parseSi(get(this,'allocatable.memory')); if ( total ) { const minExp = exponentNeeded(total); - const usedStr = formatSi(used, 1024, '', '', 0, minExp).replace(/\s.*/,''); - const totalStr = formatSi(total, 1024, 'iB', 'B', 0, minExp); + const usedStr = formatSi(used, 1024, '', '', 0, minExp, 1).replace(/\s.*/,''); + const totalStr = formatSi(total, 1024, 'iB', 'B', 0, minExp, 1); return `${usedStr}/${totalStr}` } else { @@ -49,7 +49,7 @@ export default Mixin.create({ const used = parseSi(get(this,'requested.memory'))||0; const total = parseSi(get(this,'allocatable.memory')); if ( total ) { - return formatPercent(100*used/total); + return formatPercent(100*used/total, 0); } else { return null; } @@ -60,8 +60,8 @@ export default Mixin.create({ const total = parseSi(get(this,'allocatable.pods')); if ( total ) { const minExp = exponentNeeded(total); - const usedStr = formatSi(used, 1000, '', '', 0, minExp).replace(/\s.*$/,''); - const totalStr = formatSi(total, 1000, '', '', 0, minExp); + const usedStr = formatSi(used, 1000, '', '', 0, minExp, 1).replace(/\s.*$/,''); + const totalStr = formatSi(total, 1000, '', '', 0, minExp, 1); return `${usedStr}/${totalStr}` } else { @@ -73,7 +73,7 @@ export default Mixin.create({ const used = parseSi(get(this,'requested.pods'))||0; const total = parseSi(get(this,'allocatable.pods')); if ( total ) { - return formatPercent(100*used/total); + return formatPercent(100*used/total, 0); } else { return null; } diff --git a/lib/shared/addon/utils/parse-unit.js b/lib/shared/addon/utils/parse-unit.js index 81f1f3f5a..af75c3ec4 100644 --- a/lib/shared/addon/utils/parse-unit.js +++ b/lib/shared/addon/utils/parse-unit.js @@ -1,7 +1,7 @@ const UNITS = ['','K','M','G','T','P']; const FRACTIONAL = ['','m','u','n','p','f']; // milli micro nano pico femto -export function formatSi(inValue, increment=1000, suffix=null, firstSuffix=null, startingExponent=0, minExponent=0) +export function formatSi(inValue, increment=1000, suffix=null, firstSuffix=null, startingExponent=0, minExponent=0, maxPrecision=2) { var val = inValue; var exp = startingExponent; @@ -11,9 +11,9 @@ export function formatSi(inValue, increment=1000, suffix=null, firstSuffix=null, } var out = ''; - if ( (val < 1) || ( val < 10 ) ) { + if ( val < 10 && maxPrecision >= 2 ) { out = Math.round(val*100)/100; - } else if ( val < 100 ) { + } else if ( val < 100 && maxPrecision >= 1) { out = Math.round(val*10)/10; } else { out = Math.round(val); diff --git a/lib/shared/addon/utils/util.js b/lib/shared/addon/utils/util.js index 05739954a..28f99a54e 100644 --- a/lib/shared/addon/utils/util.js +++ b/lib/shared/addon/utils/util.js @@ -232,12 +232,12 @@ export function randomStr(length=16, charset='alphanum') }).join(''); } -export function formatPercent(value) { - if ( value < 1 ) +export function formatPercent(value, maxPrecision=2) { + if ( value < 1 && maxPrecision >= 2 ) { return Math.round(value*100)/100 + '%'; } - else if ( value < 10 ) + else if ( value < 10 && maxPrecision >= 1 ) { return Math.round(value*10)/10 + '%'; } diff --git a/translations/en-us.yaml b/translations/en-us.yaml index e7bc8e241..c69a1ff0e 100644 --- a/translations/en-us.yaml +++ b/translations/en-us.yaml @@ -635,6 +635,8 @@ clustersPage: label: Cluster Name provider: label: Provider + version: + label: Version nodes: label: Nodes cpu: