Skip to content

Commit

Permalink
More fully qualified kinds
Browse files Browse the repository at this point in the history
  • Loading branch information
Kingdon Barrett committed Sep 5, 2023
1 parent f8763dc commit 15feef4
Showing 1 changed file with 19 additions and 2 deletions.
21 changes: 19 additions & 2 deletions src/ui/treeviews/nodes/treeNode.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { Command, MarkdownString, ThemeColor, ThemeIcon, TreeItem, TreeItemColla

import { CommandId } from 'types/extensionIds';
import { FileTypes } from 'types/fileTypes';
import { KubernetesObject } from 'types/kubernetes/kubernetesTypes';
import { Kind, FullyQualifiedKinds, KubernetesObject } from 'types/kubernetes/kubernetesTypes';
import { asAbsolutePath } from 'utils/asAbsolutePath';
import { getResourceUri } from 'utils/getResourceUri';
import { KnownTreeNodeResources, createMarkdownTable } from 'utils/markdownUtils';
Expand Down Expand Up @@ -141,6 +141,22 @@ export class TreeNode extends TreeItem {
.join('');
}

fullyQualifyKind(): string {
let stringKind = '';
if(this.resource) {
stringKind = this.resource.kind as string;
}
if (stringKind) {
let typedKind : Kind = stringKind as Kind;
let fqKind = FullyQualifiedKinds[typedKind];

if(fqKind !== '') {
stringKind = fqKind as string;
}
}
return stringKind;
}

// @ts-ignore
get tooltip(): string | MarkdownString {
if (this.resource) {
Expand All @@ -152,9 +168,10 @@ export class TreeNode extends TreeItem {
get command(): Command | undefined {
// Set click event handler to load kubernetes resource as yaml file in editor.
if (this.resource) {
let stringKind = this.fullyQualifyKind();
const resourceUri = getResourceUri(
this.resource.metadata?.namespace,
`${this.resource.kind}/${this.resource.metadata?.name}`,
`${stringKind}/${this.resource.metadata?.name}`,
FileTypes.Yaml,
);

Expand Down

0 comments on commit 15feef4

Please sign in to comment.