mirror of
https://github.com/ckaczor/azuredatastudio.git
synced 2026-02-10 18:22:34 -05:00
Add dashboard links to arc controller dashboard (#11076)
* Add dashboard links to arc controller dashboard * Fix compile error
This commit is contained in:
@@ -110,6 +110,28 @@ export class AzureArcTreeDataProvider implements vscode.TreeDataProvider<TreeNod
|
||||
const controllerInfo = this._controllerNodes.map(node => node.model.info);
|
||||
await this._context.globalState.update(mementoToken, controllerInfo);
|
||||
}
|
||||
|
||||
/**
|
||||
* Opens the dashboard for the specified resource
|
||||
* @param controllerModel The model for the controller containing the resource we want to open the dashboard for
|
||||
* @param resourceType The resourceType for the resource
|
||||
* @param namespace The namespace of the resource
|
||||
* @param name The name of the resource
|
||||
*/
|
||||
public async openResourceDashboard(controllerModel: ControllerModel, resourceType: string, namespace: string, name: string): Promise<void> {
|
||||
const controllerNode = this._controllerNodes.find(n => n.model === controllerModel);
|
||||
if (controllerNode) {
|
||||
const resourceNode = controllerNode.getResourceNode(resourceType, namespace, name);
|
||||
if (resourceNode) {
|
||||
|
||||
} else {
|
||||
console.log(`Couldn't find resource node for ${namespace}.${name} (${resourceType})`);
|
||||
}
|
||||
await resourceNode?.openDashboard();
|
||||
} else {
|
||||
console.log('Couldn\'t find controller node for opening dashboard');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function getCredentialId(info: ControllerInfo): string {
|
||||
|
||||
@@ -52,6 +52,19 @@ export class ControllerTreeNode extends TreeNode {
|
||||
await controllerDashboard.showDashboard();
|
||||
}
|
||||
|
||||
/**
|
||||
* Finds and returns the ResourceTreeNode specified if it exists, otherwise undefined
|
||||
* @param resourceType The resourceType of the node
|
||||
* @param namespace The namespace of the node
|
||||
* @param name The name of the node
|
||||
*/
|
||||
public getResourceNode(resourceType: string, namespace: string, name: string): ResourceTreeNode | undefined {
|
||||
return this._children.find(c =>
|
||||
c.model?.info.resourceType === resourceType &&
|
||||
c.model?.info.namespace === namespace &&
|
||||
c.model.info.name === name);
|
||||
}
|
||||
|
||||
private refreshChildren(registrations: Registration[]): void {
|
||||
const newChildren: ResourceTreeNode[] = [];
|
||||
registrations.forEach(registration => {
|
||||
|
||||
Reference in New Issue
Block a user