Skip to content

Commit 56e530b

Browse files
Group icons, fix onCommand, remove group by menu items (#841)
1 parent 719bc98 commit 56e530b

File tree

6 files changed

+13
-80
lines changed

6 files changed

+13
-80
lines changed

explorer/models/imageGroupNode.ts

+4-3
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,8 @@ import { NodeBase } from './nodeBase';
1212
export class ImageGroupNode extends NodeBase {
1313

1414
constructor(
15-
public readonly label: string
15+
public readonly label: string,
16+
public readonly iconName: string
1617
) {
1718
super(label);
1819
}
@@ -28,8 +29,8 @@ export class ImageGroupNode extends NodeBase {
2829
collapsibleState: vscode.TreeItemCollapsibleState.Collapsed,
2930
contextValue: this.contextValue,
3031
iconPath: {
31-
light: path.join(imagesPath, 'light', 'application.svg'),
32-
dark: path.join(imagesPath, 'dark', 'application.svg')
32+
light: path.join(imagesPath, 'light', this.iconName),
33+
dark: path.join(imagesPath, 'dark', this.iconName)
3334
}
3435
}
3536
}

explorer/models/rootNode.ts

+6-1
Original file line numberDiff line numberDiff line change
@@ -177,22 +177,27 @@ export class RootNode extends NodeBase {
177177
// Determine templates to use
178178
let groupLabelTemplate: string;
179179
let leafLabelTemplate: string;
180+
let groupIconName: string;
180181
switch (ext.groupImagesBy) {
181182
case ImageGrouping.None:
182183
groupLabelTemplate = undefined; // (no group nodes)
183184
leafLabelTemplate = '{fullTag} ({createdSince})';
185+
groupIconName = '';
184186
break;
185187
case ImageGrouping.ImageId:
186188
groupLabelTemplate = '{shortImageId}';
187189
leafLabelTemplate = '{fullTag} ({createdSince})';
190+
groupIconName = 'ApplicationGroup_16x.svg';
188191
break;
189192
case ImageGrouping.Repository:
190193
groupLabelTemplate = '{repository}';
191194
leafLabelTemplate = '{tag} ({createdSince})';
195+
groupIconName = 'Repository_16x.svg';
192196
break;
193197
case ImageGrouping.RepositoryName:
194198
groupLabelTemplate = '{repositoryName}';
195199
leafLabelTemplate = '{fullTag} ({createdSince})';
200+
groupIconName = 'ApplicationGroup_16x.svg';
196201
break;
197202
default:
198203
assert(`Unexpected groupImagesBy ${ext.groupImagesBy}`);
@@ -232,7 +237,7 @@ export class RootNode extends NodeBase {
232237
let groupLabel = getImageLabel(imageNode.fullTag, imageNode.imageDesc, groupLabelTemplate);
233238
if (!groupsMap.has(groupLabel)) {
234239
// Need a new top-level group node
235-
let groupNode = new ImageGroupNode(groupLabel);
240+
let groupNode = new ImageGroupNode(groupLabel, groupIconName);
236241
groupsMap.set(groupLabel, groupNode);
237242
}
238243

extension.ts

-4
Original file line numberDiff line numberDiff line change
@@ -266,10 +266,6 @@ function registerDockerCommands(): void {
266266
);
267267

268268
registerCommand('vscode-docker.images.selectGroupBy', selectGroupImagesBy);
269-
registerCommand('vscode-docker.images.groupBy.none', () => groupImagesBy(ImageGrouping.None));
270-
registerCommand('vscode-docker.images.groupBy.repository', () => groupImagesBy(ImageGrouping.Repository));
271-
registerCommand('vscode-docker.images.groupBy.imageId', () => groupImagesBy(ImageGrouping.ImageId));
272-
registerCommand('vscode-docker.images.groupBy.repositoryName', () => groupImagesBy(ImageGrouping.RepositoryName));
273269
registerCommand('vscode-docker.acr.createRegistry', createRegistry);
274270
registerCommand('vscode-docker.acr.deleteImage', deleteAzureImage);
275271
registerCommand('vscode-docker.acr.deleteRegistry', deleteAzureRegistry);

images/dark/ApplicationGroup_16x.svg

+1
Loading

images/light/ApplicationGroup_16x.svg

+1
Loading

package.json

+1-72
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,7 @@
6666
"onCommand:vscode-docker.image.inspect",
6767
"onCommand:vscode-docker.image.push",
6868
"onCommand:vscode-docker.image.remove",
69+
"onCommand:vscode-docker.images.selectGroupBy",
6970
"onCommand:vscode-docker.image.tag",
7071
"onCommand:vscode-docker.setRegistryAsDefault",
7172
"onCommand:vscode-docker.system.prune",
@@ -94,22 +95,6 @@
9495
{
9596
"command": "vscode-docker.setRegistryAsDefault",
9697
"when": "never"
97-
},
98-
{
99-
"command": "vscode-docker.images.groupBy.none",
100-
"when": "never"
101-
},
102-
{
103-
"command": "vscode-docker.images.groupBy.imageId",
104-
"when": "never"
105-
},
106-
{
107-
"command": "vscode-docker.images.groupBy.repository",
108-
"when": "never"
109-
},
110-
{
111-
"command": "vscode-docker.images.groupBy.repositoryName",
112-
"when": "never"
11398
}
11499
],
115100
"editor/context": [
@@ -294,26 +279,6 @@
294279
"when": "view == dockerExplorer && viewItem =~ /^(runningLocalContainerNode|stoppedLocalContainerNode|containersRootNode)$/",
295280
"group": "default"
296281
},
297-
{
298-
"command": "vscode-docker.images.groupBy.none",
299-
"when": "view == dockerExplorer && viewItem =~ /^imagesRootNode$/",
300-
"group": "9_grouping@1"
301-
},
302-
{
303-
"command": "vscode-docker.images.groupBy.repository",
304-
"when": "view == dockerExplorer && viewItem =~ /^imagesRootNode$/",
305-
"group": "9_grouping@2"
306-
},
307-
{
308-
"command": "vscode-docker.images.groupBy.repositoryName",
309-
"when": "view == dockerExplorer && viewItem =~ /^imagesRootNode$/",
310-
"group": "9_grouping@3"
311-
},
312-
{
313-
"command": "vscode-docker.images.groupBy.imageId",
314-
"when": "view == dockerExplorer && viewItem =~ /^imagesRootNode$/",
315-
"group": "9_grouping@4"
316-
},
317282
{
318283
"command": "vscode-docker.container.start",
319284
"when": "view == dockerExplorer && viewItem =~ /^(localImageNode|imagesRootNode)$/",
@@ -808,42 +773,6 @@
808773
},
809774
"category": "Docker"
810775
},
811-
{
812-
"command": "vscode-docker.images.groupBy.none",
813-
"title": "No Grouping",
814-
"icon": {
815-
"light": "images/SortingGrouping_16x.svg",
816-
"dark": "images/SortingGrouping_16x.svg"
817-
},
818-
"category": "Docker"
819-
},
820-
{
821-
"command": "vscode-docker.images.groupBy.imageId",
822-
"title": "Group by Image ID",
823-
"icon": {
824-
"light": "images/SortingGrouping_16x.svg",
825-
"dark": "images/SortingGrouping_16x.svg"
826-
},
827-
"category": "Docker"
828-
},
829-
{
830-
"command": "vscode-docker.images.groupBy.repository",
831-
"title": "Group by Repository",
832-
"icon": {
833-
"light": "images/SortingGrouping_16x.svg",
834-
"dark": "images/SortingGrouping_16x.svg"
835-
},
836-
"category": "Docker"
837-
},
838-
{
839-
"command": "vscode-docker.images.groupBy.repositoryName",
840-
"title": "Group by Repository Name",
841-
"icon": {
842-
"light": "images/SortingGrouping_16x.svg",
843-
"dark": "images/SortingGrouping_16x.svg"
844-
},
845-
"category": "Docker"
846-
},
847776
{
848777
"command": "vscode-docker.acr.createRegistry",
849778
"title": "Create Azure Registry",

0 commit comments

Comments
 (0)