Add "No instances available" node for empty arc controllers (#12374)

This commit is contained in:
Charles Gagnon
2020-09-16 16:25:41 -07:00
committed by GitHub
parent 8b9103208d
commit 0cd242cd0c
4 changed files with 22 additions and 2 deletions

View File

@@ -96,7 +96,7 @@
"view/item/context": [
{
"command": "arc.openDashboard",
"when": "view == azureArc && viewItem != postgresInstances",
"when": "view == azureArc && viewItem == sqlManagedInstances",
"group": "navigation@1"
},
{

View File

@@ -72,6 +72,7 @@ export const direct = localize('arc.direct', "Direct");
export const indirect = localize('arc.indirect', "Indirect");
export const loading = localize('arc.loading', "Loading...");
export const refreshToEnterCredentials = localize('arc.refreshToEnterCredentials', "Refresh node to enter credentials");
export const noInstancesAvailable = localize('arc.noInstancesAvailable', "No instances available");
export const connectToController = localize('arc.connectToController', "Connect to Existing Controller");
export function connectToSql(name: string): string { return localize('arc.connectToSql', "Connect to SQL instance - Azure Arc ({0})", name); }
export const passwordToController = localize('arc.passwordToController', "Provide Password to Controller");

View File

@@ -13,6 +13,7 @@ import { PostgresModel } from '../../models/postgresModel';
import { ControllerDashboard } from '../dashboards/controller/controllerDashboard';
import { AzureArcTreeDataProvider } from './azureArcTreeDataProvider';
import { MiaaTreeNode } from './miaaTreeNode';
import { NoInstancesTreeNode } from './noInstancesTreeNode';
import { PostgresTreeNode } from './postgresTreeNode';
import { RefreshTreeNode } from './refreshTreeNode';
import { ResourceTreeNode } from './resourceTreeNode';
@@ -55,7 +56,7 @@ export class ControllerTreeNode extends TreeNode {
}
}
return this._children;
return this._children.length > 0 ? this._children : [new NoInstancesTreeNode()];
}
public async openDashboard(): Promise<void> {

View File

@@ -0,0 +1,18 @@
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the Source EULA. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
import * as vscode from 'vscode';
import * as loc from '../../localizedConstants';
import { TreeNode } from './treeNode';
/**
* A placeholder TreeNode to display when there aren't any child instances available
*/
export class NoInstancesTreeNode extends TreeNode {
constructor() {
super(loc.noInstancesAvailable, vscode.TreeItemCollapsibleState.None, 'noInstances');
}
}