Add BDC/Arc welcome views (#11020)

* add BDC/Arc welcome views

* remove en-us
This commit is contained in:
Charles Gagnon
2020-06-20 17:18:25 -07:00
committed by GitHub
parent 47f91b8efb
commit 87a7c659f2
10 changed files with 36 additions and 79 deletions

View File

@@ -134,7 +134,13 @@
"description": "%arc.ignoreSslVerification.desc%" "description": "%arc.ignoreSslVerification.desc%"
} }
} }
} },
"viewsWelcome": [
{
"view": "azureArc",
"contents": "%arc.view.welcome%"
}
]
}, },
"dependencies": { "dependencies": {
"request": "^2.88.0", "request": "^2.88.0",

View File

@@ -7,6 +7,7 @@
"arc.managePostgres": "Manage Postgres", "arc.managePostgres": "Manage Postgres",
"arc.manageArcController": "Manage Arc Controller", "arc.manageArcController": "Manage Arc Controller",
"arc.view.title" : "Azure Arc Controllers", "arc.view.title" : "Azure Arc Controllers",
"arc.view.welcome" : "No Azure Arc controllers registered. [Learn More](https://azure.microsoft.com/services/azure-arc/)\n[Connect Controller](command:arc.connectToController)",
"command.createController.title" : "Create New Controller", "command.createController.title" : "Create New Controller",
"command.connectToController.title": "Connect to Existing Controller", "command.connectToController.title": "Connect to Existing Controller",
"command.removeController.title": "Remove Controller", "command.removeController.title": "Remove Controller",

View File

@@ -17,7 +17,7 @@
"onCommand:bigDataClusters.command.deletemount", "onCommand:bigDataClusters.command.deletemount",
"onCommand:bigDataClusters.command.createController", "onCommand:bigDataClusters.command.createController",
"onCommand:bigDataClusters.command.connectController", "onCommand:bigDataClusters.command.connectController",
"onCommand:bigDataClusters.command.deleteController", "onCommand:bigDataClusters.command.removeController",
"onCommand:bigDataClusters.command.manageController", "onCommand:bigDataClusters.command.manageController",
"onCommand:bigDataClusters.command.refreshController", "onCommand:bigDataClusters.command.refreshController",
"onView:sqlBigDataCluster" "onView:sqlBigDataCluster"
@@ -47,7 +47,7 @@
"when": "false" "when": "false"
}, },
{ {
"command": "bigDataClusters.command.deleteController", "command": "bigDataClusters.command.removeController",
"when": "false" "when": "false"
}, },
{ {
@@ -95,7 +95,7 @@
"group": "navigation@2" "group": "navigation@2"
}, },
{ {
"command": "bigDataClusters.command.deleteController", "command": "bigDataClusters.command.removeController",
"when": "view == sqlBigDataCluster && viewItem == bigDataClusters.itemType.controllerNode", "when": "view == sqlBigDataCluster && viewItem == bigDataClusters.itemType.controllerNode",
"group": "navigation@3" "group": "navigation@3"
} }
@@ -130,8 +130,8 @@
"icon": "$(disconnect)" "icon": "$(disconnect)"
}, },
{ {
"command": "bigDataClusters.command.deleteController", "command": "bigDataClusters.command.removeController",
"title": "%command.deleteController.title%", "title": "%command.removeController.title%",
"when": "viewItem == bigDataClusters.itemType.controllerNode" "when": "viewItem == bigDataClusters.itemType.controllerNode"
}, },
{ {
@@ -166,7 +166,13 @@
"description": "%bdc.ignoreSslVerification.desc%" "description": "%bdc.ignoreSslVerification.desc%"
} }
} }
} },
"viewsWelcome": [
{
"view": "sqlBigDataCluster",
"contents": "%bdc.view.welcome%"
}
]
}, },
"dependencies": { "dependencies": {
"ads-kerberos": "^1.1.3", "ads-kerberos": "^1.1.3",

View File

@@ -3,12 +3,13 @@
"text.sqlServerBigDataClusters": "SQL Server Big Data Clusters", "text.sqlServerBigDataClusters": "SQL Server Big Data Clusters",
"command.connectController.title": "Connect to Existing Controller", "command.connectController.title": "Connect to Existing Controller",
"command.createController.title": "Create New Controller", "command.createController.title": "Create New Controller",
"command.deleteController.title" : "Delete", "command.removeController.title" : "Remove Controller",
"command.refreshController.title" : "Refresh", "command.refreshController.title" : "Refresh",
"command.manageController.title" : "Manage", "command.manageController.title" : "Manage",
"command.mount.title" : "Mount HDFS", "command.mount.title" : "Mount HDFS",
"command.refreshmount.title" : "Refresh Mount", "command.refreshmount.title" : "Refresh Mount",
"command.deletemount.title" : "Delete Mount", "command.deletemount.title" : "Delete Mount",
"bdc.configuration.title" : "Big Data Cluster", "bdc.configuration.title" : "Big Data Cluster",
"bdc.view.welcome" : "No SQL Big Data Cluster controllers registered. [Learn More](https://docs.microsoft.com/sql/big-data-cluster/big-data-cluster-overview)\n[Connect Controller](command:bigDataClusters.command.connectController)",
"bdc.ignoreSslVerification.desc" : "Ignore SSL verification errors against SQL Server Big Data Cluster endpoints such as HDFS, Spark, and Controller if true" "bdc.ignoreSslVerification.desc" : "Ignore SSL verification errors against SQL Server Big Data Cluster endpoints such as HDFS, Spark, and Controller if true"
} }

View File

@@ -8,7 +8,6 @@ import * as vscode from 'vscode';
export enum BdcItemType { export enum BdcItemType {
controllerRoot = 'bigDataClusters.itemType.controllerRootNode', controllerRoot = 'bigDataClusters.itemType.controllerRootNode',
controller = 'bigDataClusters.itemType.controllerNode', controller = 'bigDataClusters.itemType.controllerNode',
connectController = 'bigDataClusters.itemType.connectControllerNode',
loadingController = 'bigDataClusters.itemType.loadingControllerNode' loadingController = 'bigDataClusters.itemType.loadingControllerNode'
} }

View File

@@ -1,50 +0,0 @@
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the Source EULA. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
import * as nls from 'vscode-nls';
import * as azdata from 'azdata';
import * as vscode from 'vscode';
import { TreeNode } from './treeNode';
import { BdcItemType } from '../constants';
const localize = nls.loadMessageBundle();
export class ConnectControllerNode extends TreeNode {
private readonly nodeType: string;
constructor() {
super(localize('textBigDataClusterControllerWithDots', "Connect to SQL Server Big Data Cluster controller..."));
this.nodeType = BdcItemType.connectController;
}
public async getChildren(): Promise<TreeNode[]> {
return [];
}
public getTreeItem(): vscode.TreeItem {
let item = new vscode.TreeItem(this.label, vscode.TreeItemCollapsibleState.None);
item.command = {
title: localize('textConnectToController', "Connect to Controller"),
command: 'bigDataClusters.command.connectController',
arguments: [this]
};
item.contextValue = this.nodeType;
return item;
}
public getNodeInfo(): azdata.NodeInfo {
return {
label: this.label,
isLeaf: this.isLeaf,
errorMessage: undefined,
metadata: undefined,
nodePath: this.nodePath,
nodeStatus: undefined,
nodeType: this.nodeType,
iconType: this.nodeType,
nodeSubType: undefined
};
}
}

View File

@@ -8,7 +8,6 @@ import * as azdata from 'azdata';
import * as nls from 'vscode-nls'; import * as nls from 'vscode-nls';
import { TreeNode } from './treeNode'; import { TreeNode } from './treeNode';
import { IControllerTreeChangeHandler } from './controllerTreeChangeHandler'; import { IControllerTreeChangeHandler } from './controllerTreeChangeHandler';
import { ConnectControllerNode } from './connectControllerNode';
import { ControllerRootNode, ControllerNode } from './controllerTreeNode'; import { ControllerRootNode, ControllerNode } from './controllerTreeNode';
import { showErrorMessage } from '../utils'; import { showErrorMessage } from '../utils';
import { LoadingControllerNode } from './loadingControllerNode'; import { LoadingControllerNode } from './loadingControllerNode';
@@ -79,12 +78,12 @@ export class ControllerTreeDataProvider implements vscode.TreeDataProvider<TreeN
this.notifyNodeChanged(); this.notifyNodeChanged();
} }
public deleteController(url: string, auth: AuthType, username: string): ControllerNode[] { public removeController(url: string, auth: AuthType, username: string): ControllerNode[] {
let deleted = this.root.deleteControllerNode(url, auth, username); let removed = this.root.removeControllerNode(url, auth, username);
if (deleted) { if (removed) {
this.notifyNodeChanged(); this.notifyNodeChanged();
} }
return deleted; return removed;
} }
private removeNonControllerNodes(): void { private removeNonControllerNodes(): void {
@@ -95,8 +94,7 @@ export class ControllerTreeDataProvider implements vscode.TreeDataProvider<TreeN
private removePlaceholderNodes(nodes: TreeNode[]): void { private removePlaceholderNodes(nodes: TreeNode[]): void {
if (nodes.length > 0) { if (nodes.length > 0) {
for (let i = 0; i < nodes.length; ++i) { for (let i = 0; i < nodes.length; ++i) {
if (nodes[i] instanceof ConnectControllerNode || if (nodes[i] instanceof LoadingControllerNode
nodes[i] instanceof LoadingControllerNode
) { ) {
nodes.splice(i--, 1); nodes.splice(i--, 1);
} }
@@ -142,11 +140,7 @@ export class ControllerTreeDataProvider implements vscode.TreeDataProvider<TreeN
} }
this.root.clearChildren(); this.root.clearChildren();
if (treeNodes.length === 0) { treeNodes.forEach(node => this.root.addChild(node));
this.root.addChild(new ConnectControllerNode());
} else {
treeNodes.forEach(node => this.root.addChild(node));
}
this.notifyNodeChanged(); this.notifyNodeChanged();
} catch (err) { } catch (err) {
// Reset so we can try again if the tree refreshes // Reset so we can try again if the tree refreshes

View File

@@ -128,7 +128,7 @@ export class ControllerRootNode extends ControllerTreeNode {
} }
} }
public deleteControllerNode(url: string, auth: AuthType, username: string): ControllerNode[] | undefined { public removeControllerNode(url: string, auth: AuthType, username: string): ControllerNode[] | undefined {
if (!url || (auth === 'basic' && !username)) { if (!url || (auth === 'basic' && !username)) {
return undefined; return undefined;
} }

View File

@@ -6,7 +6,7 @@
export const ManageControllerCommand = 'bigDataClusters.command.manageController'; export const ManageControllerCommand = 'bigDataClusters.command.manageController';
export const CreateControllerCommand = 'bigDataClusters.command.createController'; export const CreateControllerCommand = 'bigDataClusters.command.createController';
export const ConnectControllerCommand = 'bigDataClusters.command.connectController'; export const ConnectControllerCommand = 'bigDataClusters.command.connectController';
export const DeleteControllerCommand = 'bigDataClusters.command.deleteController'; export const RemoveControllerCommand = 'bigDataClusters.command.removeController';
export const RefreshControllerCommand = 'bigDataClusters.command.refreshController'; export const RefreshControllerCommand = 'bigDataClusters.command.refreshController';
export const MountHdfsCommand = 'bigDataClusters.command.mount'; export const MountHdfsCommand = 'bigDataClusters.command.mount';
export const RefreshMountCommand = 'bigDataClusters.command.refreshmount'; export const RefreshMountCommand = 'bigDataClusters.command.refreshmount';

View File

@@ -50,7 +50,7 @@ function registerCommands(context: vscode.ExtensionContext, treeDataProvider: Co
runThrottledAction(commands.CreateControllerCommand, () => vscode.commands.executeCommand('azdata.resource.deploy')); runThrottledAction(commands.CreateControllerCommand, () => vscode.commands.executeCommand('azdata.resource.deploy'));
}); });
vscode.commands.registerCommand(commands.DeleteControllerCommand, async (node: TreeNode) => { vscode.commands.registerCommand(commands.RemoveControllerCommand, async (node: TreeNode) => {
await deleteBdcController(treeDataProvider, node); await deleteBdcController(treeDataProvider, node);
}); });
@@ -180,20 +180,20 @@ async function deleteBdcController(treeDataProvider: ControllerTreeDataProvider,
let options = { let options = {
ignoreFocusOut: false, ignoreFocusOut: false,
placeHolder: localize('textConfirmDeleteController', "Are you sure you want to delete \'{0}\'?", controllerNode.label) placeHolder: localize('textConfirmRemoveController', "Are you sure you want to remove \'{0}\'?", controllerNode.label)
}; };
let result = await vscode.window.showQuickPick(Object.keys(choices), options); let result = await vscode.window.showQuickPick(Object.keys(choices), options);
let remove: boolean = !!(result && choices[result]); let remove: boolean = !!(result && choices[result]);
if (remove) { if (remove) {
await deleteControllerInternal(treeDataProvider, controllerNode); await removeControllerInternal(treeDataProvider, controllerNode);
} }
return remove; return remove;
} }
async function deleteControllerInternal(treeDataProvider: ControllerTreeDataProvider, controllerNode: ControllerNode): Promise<void> { async function removeControllerInternal(treeDataProvider: ControllerTreeDataProvider, controllerNode: ControllerNode): Promise<void> {
const deleted = treeDataProvider.deleteController(controllerNode.url, controllerNode.auth, controllerNode.username); const removed = treeDataProvider.removeController(controllerNode.url, controllerNode.auth, controllerNode.username);
if (deleted) { if (removed) {
await treeDataProvider.saveControllers(); await treeDataProvider.saveControllers();
} }
} }