Add BDC create controller action (#11019)

This commit is contained in:
Charles Gagnon
2020-06-19 16:11:54 -07:00
committed by GitHub
parent 74c2853f14
commit 99d26fb769
11 changed files with 52 additions and 63 deletions

View File

@@ -56,7 +56,7 @@
{
"command": "arc.connectToController",
"title": "%command.connectToController.title%",
"icon": "$(debug-disconnect)"
"icon": "$(disconnect)"
},
{
"command": "arc.removeController",

View File

@@ -20,21 +20,6 @@ class SslAuth implements Authentication {
}
}
export class KerberosAuth extends SslAuth implements Authentication {
constructor(public kerberosToken: string) {
super();
}
applyToRequest(requestOptions: request.Options): void {
super.applyToRequest(requestOptions);
if (requestOptions && requestOptions.headers) {
requestOptions.headers['Authorization'] = `Negotiate ${this.kerberosToken}`;
}
requestOptions.auth = undefined;
}
}
export class BasicAuth extends SslAuth implements Authentication {
constructor(public username: string, public password: string) {
super();
@@ -48,20 +33,6 @@ export class BasicAuth extends SslAuth implements Authentication {
}
}
export class OAuthWithSsl extends SslAuth implements Authentication {
constructor(public accessToken: string) {
super();
}
applyToRequest(requestOptions: request.Options): void {
super.applyToRequest(requestOptions);
if (requestOptions && requestOptions.headers) {
requestOptions.headers['Authorization'] = `Bearer ${this.accessToken}`;
}
requestOptions.auth = undefined;
}
}
/* Retrieves the current setting for whether to ignore SSL verification errors */
export function getIgnoreSslVerificationConfigSetting(): boolean {
const arcConfigSectionName = 'arc';

View File

@@ -12,14 +12,15 @@
"azdata": "*"
},
"activationEvents": [
"onCommand:bigDataClusters.command.mount",
"onCommand:bigDataClusters.command.refreshmount",
"onCommand:bigDataClusters.command.deletemount",
"onCommand:bigDataClusters.command.addController",
"onCommand:bigDataClusters.command.deleteController",
"onCommand:bigDataClusters.command.manageController",
"onCommand:bigDataClusters.command.refreshController",
"onView:sqlBigDataCluster"
"onCommand:bigDataClusters.command.mount",
"onCommand:bigDataClusters.command.refreshmount",
"onCommand:bigDataClusters.command.deletemount",
"onCommand:bigDataClusters.command.createController",
"onCommand:bigDataClusters.command.connectController",
"onCommand:bigDataClusters.command.deleteController",
"onCommand:bigDataClusters.command.manageController",
"onCommand:bigDataClusters.command.refreshController",
"onView:sqlBigDataCluster"
],
"repository": {
"type": "git",
@@ -38,7 +39,11 @@
"menus": {
"commandPalette": [
{
"command": "bigDataClusters.command.addController",
"command": "bigDataClusters.command.createController",
"when": "false"
},
{
"command": "bigDataClusters.command.connectController",
"when": "false"
},
{
@@ -68,9 +73,14 @@
],
"view/title": [
{
"command": "bigDataClusters.command.addController",
"command": "bigDataClusters.command.createController",
"when": "view == sqlBigDataCluster",
"group": "navigation"
"group": "navigation@1"
},
{
"command": "bigDataClusters.command.connectController",
"when": "view == sqlBigDataCluster",
"group": "navigation@2"
}
],
"view/item/context": [
@@ -110,10 +120,15 @@
},
"commands": [
{
"command": "bigDataClusters.command.addController",
"title": "%command.addController.title%",
"command": "bigDataClusters.command.createController",
"title": "%command.createController.title%",
"icon": "$(add)"
},
{
"command": "bigDataClusters.command.connectController",
"title": "%command.connectController.title%",
"icon": "$(disconnect)"
},
{
"command": "bigDataClusters.command.deleteController",
"title": "%command.deleteController.title%",
@@ -154,7 +169,7 @@
}
},
"dependencies": {
"ads-kerberos": "^1.1.3",
"ads-kerberos": "^1.1.3",
"request": "^2.88.0",
"vscode-nls": "^4.0.0"
},

View File

@@ -1,7 +1,8 @@
{
"description": "Support for managing SQL Server Big Data Clusters",
"text.sqlServerBigDataClusters": "SQL Server Big Data Clusters",
"command.addController.title": "Connect to Controller",
"command.connectController.title": "Connect to Existing Controller",
"command.createController.title": "Create New Controller",
"command.deleteController.title" : "Delete",
"command.refreshController.title" : "Refresh",
"command.manageController.title" : "Manage",

View File

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

View File

@@ -11,12 +11,12 @@ import { BdcItemType } from '../constants';
const localize = nls.loadMessageBundle();
export class AddControllerNode extends TreeNode {
export class ConnectControllerNode extends TreeNode {
private readonly nodeType: string;
constructor() {
super(localize('textBigDataClusterControllerWithDots', "Add SQL Server Big Data Cluster controller..."));
this.nodeType = BdcItemType.addController;
super(localize('textBigDataClusterControllerWithDots', "Connect to SQL Server Big Data Cluster controller..."));
this.nodeType = BdcItemType.connectController;
}
public async getChildren(): Promise<TreeNode[]> {
@@ -27,7 +27,7 @@ export class AddControllerNode extends TreeNode {
let item = new vscode.TreeItem(this.label, vscode.TreeItemCollapsibleState.None);
item.command = {
title: localize('textConnectToController', "Connect to Controller"),
command: 'bigDataClusters.command.addController',
command: 'bigDataClusters.command.connectController',
arguments: [this]
};
item.contextValue = this.nodeType;

View File

@@ -8,7 +8,7 @@ import * as azdata from 'azdata';
import * as nls from 'vscode-nls';
import { TreeNode } from './treeNode';
import { IControllerTreeChangeHandler } from './controllerTreeChangeHandler';
import { AddControllerNode } from './addControllerNode';
import { ConnectControllerNode } from './connectControllerNode';
import { ControllerRootNode, ControllerNode } from './controllerTreeNode';
import { showErrorMessage } from '../utils';
import { LoadingControllerNode } from './loadingControllerNode';
@@ -95,7 +95,7 @@ export class ControllerTreeDataProvider implements vscode.TreeDataProvider<TreeN
private removePlaceholderNodes(nodes: TreeNode[]): void {
if (nodes.length > 0) {
for (let i = 0; i < nodes.length; ++i) {
if (nodes[i] instanceof AddControllerNode ||
if (nodes[i] instanceof ConnectControllerNode ||
nodes[i] instanceof LoadingControllerNode
) {
nodes.splice(i--, 1);
@@ -143,7 +143,7 @@ export class ControllerTreeDataProvider implements vscode.TreeDataProvider<TreeN
this.root.clearChildren();
if (treeNodes.length === 0) {
this.root.addChild(new AddControllerNode());
this.root.addChild(new ConnectControllerNode());
} else {
treeNodes.forEach(node => this.root.addChild(node));
}

View File

@@ -174,7 +174,7 @@ export class ControllerNode extends ControllerTreeNode {
}
if (!this._password) {
vscode.commands.executeCommand('bigDataClusters.command.addController', this);
vscode.commands.executeCommand('bigDataClusters.command.connectController', this);
return this.children as ControllerTreeNode[];
}
return undefined;

View File

@@ -4,7 +4,8 @@
*--------------------------------------------------------------------------------------------*/
export const ManageControllerCommand = 'bigDataClusters.command.manageController';
export const AddControllerCommand = 'bigDataClusters.command.addController';
export const CreateControllerCommand = 'bigDataClusters.command.createController';
export const ConnectControllerCommand = 'bigDataClusters.command.connectController';
export const DeleteControllerCommand = 'bigDataClusters.command.deleteController';
export const RefreshControllerCommand = 'bigDataClusters.command.refreshController';
export const MountHdfsCommand = 'bigDataClusters.command.mount';

View File

@@ -28,8 +28,8 @@ let throttleTimers: { [key: string]: any } = {};
export function activate(extensionContext: vscode.ExtensionContext): IExtension {
IconPathHelper.setExtensionContext(extensionContext);
let treeDataProvider = new ControllerTreeDataProvider(extensionContext.globalState);
registerTreeDataProvider(treeDataProvider);
const treeDataProvider = new ControllerTreeDataProvider(extensionContext.globalState);
vscode.window.registerTreeDataProvider('sqlBigDataCluster', treeDataProvider);
registerCommands(extensionContext, treeDataProvider);
return {
getClusterController(url: string, authType: AuthType, username?: string, password?: string): IClusterController {
@@ -41,13 +41,13 @@ export function activate(extensionContext: vscode.ExtensionContext): IExtension
export function deactivate() {
}
function registerTreeDataProvider(treeDataProvider: ControllerTreeDataProvider): void {
vscode.window.registerTreeDataProvider('sqlBigDataCluster', treeDataProvider);
}
function registerCommands(context: vscode.ExtensionContext, treeDataProvider: ControllerTreeDataProvider): void {
vscode.commands.registerCommand(commands.AddControllerCommand, (node?: TreeNode) => {
runThrottledAction(commands.AddControllerCommand, () => addBdcController(treeDataProvider, node));
vscode.commands.registerCommand(commands.ConnectControllerCommand, (node?: TreeNode) => {
runThrottledAction(commands.ConnectControllerCommand, () => addBdcController(treeDataProvider, node));
});
vscode.commands.registerCommand(commands.CreateControllerCommand, () => {
runThrottledAction(commands.CreateControllerCommand, () => vscode.commands.executeCommand('azdata.resource.deploy'));
});
vscode.commands.registerCommand(commands.DeleteControllerCommand, async (node: TreeNode) => {

View File

@@ -251,6 +251,7 @@ export namespace Codicon {
export const database = new Codicon('database', { character: '\\eace' });
export const debugContinue = new Codicon('debug-continue', { character: '\\eacf' });
export const debugDisconnect = new Codicon('debug-disconnect', { character: '\\ead0' });
export const disconnect = new Codicon('disconnect', { character: '\\ead0' }); // {{SQL CARBON EDIT}} Uncolored version of debug-disconnect
export const debugPause = new Codicon('debug-pause', { character: '\\ead1' });
export const debugRestart = new Codicon('debug-restart', { character: '\\ead2' });
export const debugStart = new Codicon('debug-start', { character: '\\ead3' });