Skip to content

Commit

Permalink
init
Browse files Browse the repository at this point in the history
Signed-off-by: Weichen Xu <weichen.xu@databricks.com>
  • Loading branch information
WeichenXu123 committed Nov 8, 2021
1 parent 3cd6ac8 commit 27a17f7
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 2 deletions.
Expand Up @@ -707,7 +707,7 @@ export class ExperimentView extends Component {
ColumnSortByOrder.forEach((order) => {
sortOptions.push(
<Option
key={metricKey}
key={ExperimentViewUtil.middleTruncateKey(metricKey, 20)}
title={metricKey}
data-test-id={`sort-select-${metricKey}-${order}`}
value={`${ExperimentViewUtil.makeCanonicalKey(
Expand All @@ -732,7 +732,7 @@ export class ExperimentView extends Component {
sortOptions.push(
<Option
key={paramKey}
title={paramKey}
title={ExperimentViewUtil.middleTruncateKey(paramKey, 20)}
data-test-id={`sort-select-${paramKey}-${order}`}
value={`${ExperimentViewUtil.makeCanonicalKey(
COLUMN_TYPES.PARAMS,
Expand Down
Expand Up @@ -273,6 +273,17 @@ export default class ExperimentViewUtil {
return keyType + '.`' + keyName + '`';
}

static middleTruncateKey(keyName, maxLen) {
if (keyName.length > maxLen) {
var firstPartLen = Math.floor((maxLen - 3) / 2)
var lastPartLen = maxLen - 3 - firstPartLen
return keyName.substring(0, firstPartLen) + '...' +
keyName.substring(keyName.length - lastPartLen, keyName.length)
} else {
return keyName
}
}

static getExpanderHeader(cellType) {
const CellComponent = `${cellType}`;
return (
Expand Down

0 comments on commit 27a17f7

Please sign in to comment.