Drop our label-col width heuristic for less wasted col. space

- The label column now flexes to the available space. (Old behaviour:
  label width was a function of # of cols).
- Most columns other than the label now have a fixed width specified
  (some large ones are left to share the avaiable space w/ the label)
This commit is contained in:
Simon Howe
2016-09-26 10:48:06 +02:00
parent 090d33069d
commit 51e4fc6d74
@@ -13,7 +13,7 @@ function isNumber(data) {
const CW = {
XS: '32px',
S: '50px',
M: '80px',
M: '64px',
L: '120px',
XL: '140px',
XXL: '170px',
@@ -21,12 +21,15 @@ const CW = {
const XS_LABEL = {
count: '#'
count: '#',
// TODO: consider changing the name of this field on the BE
container: '#',
};
const COLUMN_WIDTHS = {
count: CW.XS,
container: CW.XS,
docker_container_created: CW.XL,
docker_container_restart_count: CW.M,
docker_container_state_human: CW.XXL,
@@ -34,14 +37,16 @@ const COLUMN_WIDTHS = {
docker_cpu_total_usage: CW.M,
docker_memory_usage: CW.M,
open_files_count: CW.M,
pid: CW.M,
pid: CW.S,
port: CW.S,
ppid: CW.M,
ppid: CW.S,
process_cpu_usage_percent: CW.M,
process_memory_usage_bytes: CW.M,
threads: CW.M,
// e.g. details panel > pods
kubernetes_ip: CW.L,
kubernetes_state: CW.M,
};
@@ -143,21 +148,7 @@ function getSortedNodes(nodes, sortByHeader, sortedDesc) {
}
function getColumnWidth(headers, h, i) {
//
// Beauty hack: adjust first column width if there are only few columns;
// this assumes the other columns are narrow metric columns of 20% table width
//
if (i === 0) {
if (headers.length === 2) {
return '66%';
} else if (headers.length === 3) {
return '50%';
} else if (headers.length > 3 && headers.length <= 5) {
return '33%';
}
}
function getColumnWidth(headers, h) {
//
// More beauty hacking, ports and counts can only get so big, free up WS for other longer
// fields like IPs!