Skip to content

Commit

Permalink
Fix Account details Uri
Browse files Browse the repository at this point in the history
Signed-off-by: Maxime Dufour <[email protected]>
  • Loading branch information
outscale-mdr committed Jan 18, 2024
1 parent 925c8e7 commit b86b672
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/extension.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import { OscExplorer } from "./explorer";
import { ExplorerResourceNode, ResourceNodeType } from './flat/node';
import { ResourceNode } from './flat/resources/node.resources';
import { VmResourceNode } from './flat/resources/node.resources.vms';
import { OscVirtualContentProvider } from './virtual_filesystem/oscvirtualfs';
import { OscVirtualContentProvider, computeUri } from './virtual_filesystem/oscvirtualfs';
import { LogsProvider } from './virtual_filesystem/logs';
import { ProfileNode } from './flat/node.profile';
import { FolderNode } from './flat/folders/node.folder';
Expand All @@ -28,7 +28,7 @@ function getMultipleSelection<T>(mainSelectedItem: T, allSelectedItems?: any[]):
}

export async function showResourceDetails(profileName: string, resourceType: ResourceNodeType, resourceId: string) {
const uri = vscode.Uri.parse('osc:/' + profileName + "/" + resourceType + "/" + resourceId + ".json");
const uri = computeUri(profileName, `${resourceType}`, resourceId);
const doc = await vscode.workspace.openTextDocument(uri); // calls back into the provider
await vscode.window.showTextDocument(doc);
}
Expand Down Expand Up @@ -187,7 +187,7 @@ export function activate(context: vscode.ExtensionContext) {
});

vscode.commands.registerCommand('osc.showAccountInfo', async (arg: ProfileNode) => {
const uri = vscode.Uri.parse('osc:/' + arg.profile.name + "/profile/" + arg.profile.name);
const uri = computeUri(arg.profile.name, "profile", arg.profile.name);
try {
const doc = await vscode.workspace.openTextDocument(uri); // calls back into the provider
await vscode.window.showTextDocument(doc);
Expand Down
4 changes: 4 additions & 0 deletions src/virtual_filesystem/oscvirtualfs.ts
Original file line number Diff line number Diff line change
Expand Up @@ -109,4 +109,8 @@ export class OscVirtualContentProvider implements vscode.TextDocumentContentProv
}
return JSON.stringify(resourceEncoding.toString(res), null, 4);
}
}

export function computeUri(profile: string, resourceType: string, resourceId: string): vscode.Uri {
return vscode.Uri.parse(`osc:/${profile}/${resourceType}/${resourceId}.json`);
}

0 comments on commit b86b672

Please sign in to comment.