Skip to content

Commit 822f238

Browse files
authored
Standardise column like quick pick (#4307)
1 parent 1994749 commit 822f238

File tree

3 files changed

+23
-19
lines changed

3 files changed

+23
-19
lines changed

extension/src/experiments/columns/quickPick.test.ts

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -49,13 +49,11 @@ describe('pickFromColumnLikes', () => {
4949
expect(mockedQuickPickValue).toHaveBeenCalledWith(
5050
[
5151
{
52-
description: epochsParamPath,
53-
label: 'epochs',
52+
label: epochsParamPath,
5453
value: epochsParam
5554
},
5655
{
57-
description: paramsYamlPath,
58-
label: paramsYaml,
56+
label: paramsYamlPath,
5957
value: paramsYamlParam
6058
}
6159
],

extension/src/experiments/columns/quickPick.ts

Lines changed: 17 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -13,12 +13,22 @@ export const pickFromColumnLikes = (
1313
if (!definedAndNonEmpty(columnLikes)) {
1414
return Toast.showError('There are no columns to select from.')
1515
}
16-
return quickPickValue<ColumnLike>(
17-
columnLikes.map(columnLike => ({
18-
description: columnLike.path,
19-
label: columnLike.label,
16+
17+
const items = []
18+
for (const columnLike of columnLikes) {
19+
if (columnLike.path === 'starred') {
20+
items.push({
21+
description: columnLike.path,
22+
label: columnLike.label,
23+
value: columnLike
24+
})
25+
continue
26+
}
27+
items.push({
28+
label: columnLike.path,
2029
value: columnLike
21-
})),
22-
quickPickOptions
23-
)
30+
})
31+
}
32+
33+
return quickPickValue<ColumnLike>(items, quickPickOptions)
2434
}

extension/src/plots/model/quickPick.test.ts

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -231,18 +231,15 @@ describe('pickMetricAndParam', () => {
231231
1,
232232
[
233233
{
234-
description: 'metrics:summary.json:loss',
235-
label: 'loss',
234+
label: 'metrics:summary.json:loss',
236235
value: { label: 'loss', path: 'metrics:summary.json:loss' }
237236
},
238237
{
239-
description: 'metrics:summary.json:accuracy',
240-
label: 'accuracy',
238+
label: 'metrics:summary.json:accuracy',
241239
value: { label: 'accuracy', path: 'metrics:summary.json:accuracy' }
242240
},
243241
{
244-
description: 'metrics:summary.json:val_loss',
245-
label: 'val_loss',
242+
label: 'metrics:summary.json:val_loss',
246243
value: { label: 'val_loss', path: 'metrics:summary.json:val_loss' }
247244
}
248245
],
@@ -254,8 +251,7 @@ describe('pickMetricAndParam', () => {
254251
2,
255252
[
256253
{
257-
description: 'params:params.yaml:epochs',
258-
label: 'epochs',
254+
label: 'params:params.yaml:epochs',
259255
value: { label: 'epochs', path: 'params:params.yaml:epochs' }
260256
}
261257
],

0 commit comments

Comments
 (0)