Skip to content

Commit

Permalink
Standardise column like quick pick
Browse files Browse the repository at this point in the history
  • Loading branch information
mattseddon committed Jul 19, 2023
1 parent 1994749 commit c7fdf61
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 19 deletions.
6 changes: 2 additions & 4 deletions extension/src/experiments/columns/quickPick.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -49,13 +49,11 @@ describe('pickFromColumnLikes', () => {
expect(mockedQuickPickValue).toHaveBeenCalledWith(
[
{
description: epochsParamPath,
label: 'epochs',
label: epochsParamPath,
value: epochsParam
},
{
description: paramsYamlPath,
label: paramsYaml,
label: paramsYamlPath,
value: paramsYamlParam
}
],
Expand Down
24 changes: 17 additions & 7 deletions extension/src/experiments/columns/quickPick.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,22 @@ export const pickFromColumnLikes = (
if (!definedAndNonEmpty(columnLikes)) {
return Toast.showError('There are no columns to select from.')
}
return quickPickValue<ColumnLike>(
columnLikes.map(columnLike => ({
description: columnLike.path,
label: columnLike.label,

const items = []
for (const columnLike of columnLikes) {
if (columnLike.path === 'starred') {
items.push({
description: columnLike.path,
label: columnLike.label,
value: columnLike
})
continue
}
items.push({
label: columnLike.path,
value: columnLike
})),
quickPickOptions
)
})
}

return quickPickValue<ColumnLike>(items, quickPickOptions)
}
12 changes: 4 additions & 8 deletions extension/src/plots/model/quickPick.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -231,18 +231,15 @@ describe('pickMetricAndParam', () => {
1,
[
{
description: 'metrics:summary.json:loss',
label: 'loss',
label: 'metrics:summary.json:loss',
value: { label: 'loss', path: 'metrics:summary.json:loss' }
},
{
description: 'metrics:summary.json:accuracy',
label: 'accuracy',
label: 'metrics:summary.json:accuracy',
value: { label: 'accuracy', path: 'metrics:summary.json:accuracy' }
},
{
description: 'metrics:summary.json:val_loss',
label: 'val_loss',
label: 'metrics:summary.json:val_loss',
value: { label: 'val_loss', path: 'metrics:summary.json:val_loss' }
}
],
Expand All @@ -254,8 +251,7 @@ describe('pickMetricAndParam', () => {
2,
[
{
description: 'params:params.yaml:epochs',
label: 'epochs',
label: 'params:params.yaml:epochs',
value: { label: 'epochs', path: 'params:params.yaml:epochs' }
}
],
Expand Down

0 comments on commit c7fdf61

Please sign in to comment.