mirror of
https://github.com/ckaczor/azuredatastudio.git
synced 2026-02-16 18:46:40 -05:00
Add BDC create controller action (#11019)
This commit is contained in:
@@ -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'
|
||||
}
|
||||
|
||||
|
||||
@@ -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;
|
||||
@@ -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));
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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';
|
||||
|
||||
@@ -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) => {
|
||||
|
||||
Reference in New Issue
Block a user