mirror of
https://github.com/ckaczor/azuredatastudio.git
synced 2026-02-17 02:51:36 -05:00
Some cleanup and fixes for Arc/BDC dashboards (#11075)
This commit is contained in:
File diff suppressed because it is too large
Load Diff
@@ -7,7 +7,8 @@
|
|||||||
"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)",
|
"arc.view.welcome.connect" : "No Azure Arc controllers registered. [Learn More](https://azure.microsoft.com/services/azure-arc/)\n[Connect Controller](command:arc.connectToController)",
|
||||||
|
"arc.view.welcome.loading" : "Loading controllers...",
|
||||||
"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",
|
||||||
|
|||||||
@@ -14,6 +14,8 @@ import { ConnectToControllerDialog } from './ui/dialogs/connectControllerDialog'
|
|||||||
export async function activate(context: vscode.ExtensionContext): Promise<void> {
|
export async function activate(context: vscode.ExtensionContext): Promise<void> {
|
||||||
IconPathHelper.setExtensionContext(context);
|
IconPathHelper.setExtensionContext(context);
|
||||||
|
|
||||||
|
await vscode.commands.executeCommand('setContext', 'arc.loaded', false);
|
||||||
|
|
||||||
const treeDataProvider = new AzureArcTreeDataProvider(context);
|
const treeDataProvider = new AzureArcTreeDataProvider(context);
|
||||||
vscode.window.registerTreeDataProvider('azureArc', treeDataProvider);
|
vscode.window.registerTreeDataProvider('azureArc', treeDataProvider);
|
||||||
|
|
||||||
|
|||||||
@@ -62,7 +62,7 @@ export class ControllerModel {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public async refresh(): Promise<void> {
|
public async refresh(showErrors: boolean = true): Promise<void> {
|
||||||
// We haven't gotten our password yet, fetch it now
|
// We haven't gotten our password yet, fetch it now
|
||||||
if (!this._auth) {
|
if (!this._auth) {
|
||||||
let password = '';
|
let password = '';
|
||||||
@@ -93,7 +93,9 @@ export class ControllerModel {
|
|||||||
// If an error occurs show a message so the user knows something failed but still
|
// If an error occurs show a message so the user knows something failed but still
|
||||||
// fire the event so callers can know to update (e.g. so dashboards don't show the
|
// fire the event so callers can know to update (e.g. so dashboards don't show the
|
||||||
// loading icon forever)
|
// loading icon forever)
|
||||||
vscode.window.showErrorMessage(loc.fetchEndpointsFailed(this.info.url, err));
|
if (showErrors) {
|
||||||
|
vscode.window.showErrorMessage(loc.fetchEndpointsFailed(this.info.url, err));
|
||||||
|
}
|
||||||
this._onEndpointsUpdated.fire(this._endpoints);
|
this._onEndpointsUpdated.fire(this._endpoints);
|
||||||
throw err;
|
throw err;
|
||||||
}),
|
}),
|
||||||
@@ -107,7 +109,9 @@ export class ControllerModel {
|
|||||||
// If an error occurs show a message so the user knows something failed but still
|
// If an error occurs show a message so the user knows something failed but still
|
||||||
// fire the event so callers can know to update (e.g. so dashboards don't show the
|
// fire the event so callers can know to update (e.g. so dashboards don't show the
|
||||||
// loading icon forever)
|
// loading icon forever)
|
||||||
vscode.window.showErrorMessage(loc.fetchRegistrationsFailed(this.info.url, err));
|
if (showErrors) {
|
||||||
|
vscode.window.showErrorMessage(loc.fetchRegistrationsFailed(this.info.url, err));
|
||||||
|
}
|
||||||
this._onRegistrationsUpdated.fire(this._registrations);
|
this._onRegistrationsUpdated.fire(this._registrations);
|
||||||
throw err;
|
throw err;
|
||||||
}),
|
}),
|
||||||
|
|||||||
@@ -184,8 +184,24 @@ export class MiaaModel extends ResourceModel {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (!connection) {
|
if (!connection) {
|
||||||
|
// We need the password so prompt the user for it
|
||||||
|
const connectionProfile: azdata.IConnectionProfile = {
|
||||||
|
serverName: (this.registration.externalIp && this.registration.externalPort) ? `${this.registration.externalIp},${this.registration.externalPort}` : '',
|
||||||
|
databaseName: '',
|
||||||
|
authenticationType: 'SqlLogin',
|
||||||
|
providerName: 'MSSQL',
|
||||||
|
connectionName: '',
|
||||||
|
userName: 'sa',
|
||||||
|
password: '',
|
||||||
|
savePassword: true,
|
||||||
|
groupFullName: undefined,
|
||||||
|
saveProfile: true,
|
||||||
|
id: '',
|
||||||
|
groupId: undefined,
|
||||||
|
options: {}
|
||||||
|
};
|
||||||
// Weren't able to load the existing connection so prompt user for new one
|
// Weren't able to load the existing connection so prompt user for new one
|
||||||
connection = await azdata.connection.openConnectionDialog(['MSSQL']);
|
connection = await azdata.connection.openConnectionDialog(['MSSQL'], connectionProfile);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (connection) {
|
if (connection) {
|
||||||
|
|||||||
@@ -10,7 +10,6 @@ import * as TypeMoq from 'typemoq';
|
|||||||
import { AzureArcTreeDataProvider } from '../../../ui/tree/azureArcTreeDataProvider';
|
import { AzureArcTreeDataProvider } from '../../../ui/tree/azureArcTreeDataProvider';
|
||||||
import { ControllerModel } from '../../../models/controllerModel';
|
import { ControllerModel } from '../../../models/controllerModel';
|
||||||
import { ControllerTreeNode } from '../../../ui/tree/controllerTreeNode';
|
import { ControllerTreeNode } from '../../../ui/tree/controllerTreeNode';
|
||||||
import { LoadingControllerNode } from '../../../ui/tree/loadingTreeNode';
|
|
||||||
|
|
||||||
describe('AzureArcTreeDataProvider tests', function (): void {
|
describe('AzureArcTreeDataProvider tests', function (): void {
|
||||||
let treeDataProvider: AzureArcTreeDataProvider;
|
let treeDataProvider: AzureArcTreeDataProvider;
|
||||||
@@ -67,11 +66,10 @@ describe('AzureArcTreeDataProvider tests', function (): void {
|
|||||||
});
|
});
|
||||||
|
|
||||||
describe('getChildren', function (): void {
|
describe('getChildren', function (): void {
|
||||||
it('should return a loading node before loading stored controllers is completed', async function (): Promise<void> {
|
it('should return an empty array before loading stored controllers is completed', async function (): Promise<void> {
|
||||||
treeDataProvider['_loading'] = true;
|
treeDataProvider['_loading'] = true;
|
||||||
let children = await treeDataProvider.getChildren();
|
let children = await treeDataProvider.getChildren();
|
||||||
should(children.length).equal(1, 'While loading we should return the loading node');
|
should(children.length).equal(0, 'While loading we should return an empty array');
|
||||||
should(children[0] instanceof LoadingControllerNode).be.true('Node returned was not a LoadingControllerNode');
|
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should return no children after loading', async function (): Promise<void> {
|
it('should return no children after loading', async function (): Promise<void> {
|
||||||
|
|||||||
@@ -18,7 +18,7 @@ export class ControllerDashboard extends Dashboard {
|
|||||||
public async showDashboard(): Promise<void> {
|
public async showDashboard(): Promise<void> {
|
||||||
await super.showDashboard();
|
await super.showDashboard();
|
||||||
// Kick off the model refresh but don't wait on it since that's all handled with callbacks anyways
|
// Kick off the model refresh but don't wait on it since that's all handled with callbacks anyways
|
||||||
this._controllerModel.refresh().catch(err => console.log(`Error refreshing Controller dashboard ${err}`));
|
this._controllerModel.refresh(false).catch(err => console.log(`Error refreshing Controller dashboard ${err}`));
|
||||||
}
|
}
|
||||||
|
|
||||||
protected async registerTabs(modelView: azdata.ModelView): Promise<(azdata.DashboardTab | azdata.DashboardTabGroup)[]> {
|
protected async registerTabs(modelView: azdata.ModelView): Promise<(azdata.DashboardTab | azdata.DashboardTabGroup)[]> {
|
||||||
|
|||||||
@@ -162,7 +162,7 @@ export class ControllerDashboardOverviewPage extends DashboardPage {
|
|||||||
try {
|
try {
|
||||||
this._propertiesLoadingComponent!.loading = true;
|
this._propertiesLoadingComponent!.loading = true;
|
||||||
this._arcResourcesLoadingComponent!.loading = true;
|
this._arcResourcesLoadingComponent!.loading = true;
|
||||||
await this._controllerModel.refresh();
|
await this.refresh();
|
||||||
} finally {
|
} finally {
|
||||||
refreshButton.enabled = true;
|
refreshButton.enabled = true;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -24,10 +24,6 @@ export class MiaaConnectionStringsPage extends DashboardPage {
|
|||||||
}));
|
}));
|
||||||
}
|
}
|
||||||
|
|
||||||
protected async refresh(): Promise<void> {
|
|
||||||
await this._controllerModel.refresh();
|
|
||||||
}
|
|
||||||
|
|
||||||
protected get title(): string {
|
protected get title(): string {
|
||||||
return loc.connectionStrings;
|
return loc.connectionStrings;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -199,10 +199,7 @@ export class MiaaDashboardOverviewPage extends DashboardPage {
|
|||||||
this._grafanaLoading!.loading = true;
|
this._grafanaLoading!.loading = true;
|
||||||
this._databasesTableLoading!.loading = true;
|
this._databasesTableLoading!.loading = true;
|
||||||
|
|
||||||
await Promise.all([
|
await this.refresh();
|
||||||
this._miaaModel.refresh(),
|
|
||||||
this._controllerModel.refresh()
|
|
||||||
]);
|
|
||||||
} finally {
|
} finally {
|
||||||
refreshButton.enabled = true;
|
refreshButton.enabled = true;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -96,7 +96,7 @@ export class ConnectToControllerDialog {
|
|||||||
const controllerModel = new ControllerModel(this._treeDataProvider, controllerInfo, this.passwordInputBox.value);
|
const controllerModel = new ControllerModel(this._treeDataProvider, controllerInfo, this.passwordInputBox.value);
|
||||||
try {
|
try {
|
||||||
// Validate that we can connect to the controller
|
// Validate that we can connect to the controller
|
||||||
await controllerModel.refresh();
|
await controllerModel.refresh(false);
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
vscode.window.showErrorMessage(loc.connectToControllerFailed(this.urlInputBox.value, err));
|
vscode.window.showErrorMessage(loc.connectToControllerFailed(this.urlInputBox.value, err));
|
||||||
return false;
|
return false;
|
||||||
|
|||||||
@@ -7,7 +7,6 @@ import * as azdata from 'azdata';
|
|||||||
import * as vscode from 'vscode';
|
import * as vscode from 'vscode';
|
||||||
import { ControllerTreeNode } from './controllerTreeNode';
|
import { ControllerTreeNode } from './controllerTreeNode';
|
||||||
import { TreeNode } from './treeNode';
|
import { TreeNode } from './treeNode';
|
||||||
import { LoadingControllerNode as LoadingTreeNode } from './loadingTreeNode';
|
|
||||||
import { ControllerModel, ControllerInfo } from '../../models/controllerModel';
|
import { ControllerModel, ControllerInfo } from '../../models/controllerModel';
|
||||||
|
|
||||||
const mementoToken = 'arcControllers';
|
const mementoToken = 'arcControllers';
|
||||||
@@ -23,7 +22,6 @@ export class AzureArcTreeDataProvider implements vscode.TreeDataProvider<TreeNod
|
|||||||
readonly onDidChangeTreeData: vscode.Event<TreeNode | undefined> = this._onDidChangeTreeData.event;
|
readonly onDidChangeTreeData: vscode.Event<TreeNode | undefined> = this._onDidChangeTreeData.event;
|
||||||
|
|
||||||
private _loading: boolean = true;
|
private _loading: boolean = true;
|
||||||
private _loadingNode = new LoadingTreeNode();
|
|
||||||
|
|
||||||
private _controllerNodes: ControllerTreeNode[] = [];
|
private _controllerNodes: ControllerTreeNode[] = [];
|
||||||
|
|
||||||
@@ -33,9 +31,14 @@ export class AzureArcTreeDataProvider implements vscode.TreeDataProvider<TreeNod
|
|||||||
|
|
||||||
public async getChildren(element?: TreeNode): Promise<TreeNode[]> {
|
public async getChildren(element?: TreeNode): Promise<TreeNode[]> {
|
||||||
if (this._loading) {
|
if (this._loading) {
|
||||||
return [this._loadingNode];
|
return [];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// We set the context here since VS Code takes a bit of time to process the _onDidChangeTreeData
|
||||||
|
// and so if we set it as soon as we finished loading the controllers it would briefly flash
|
||||||
|
// the "connect to controller" welcome view
|
||||||
|
await vscode.commands.executeCommand('setContext', 'arc.loaded', true);
|
||||||
|
|
||||||
if (element) {
|
if (element) {
|
||||||
return element.getChildren();
|
return element.getChildren();
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
@@ -35,7 +35,7 @@ export class ControllerTreeNode extends TreeNode {
|
|||||||
// First reset our deferred promise so we're sure we'll get the refreshed children
|
// First reset our deferred promise so we're sure we'll get the refreshed children
|
||||||
this._childrenRefreshPromise = new Deferred();
|
this._childrenRefreshPromise = new Deferred();
|
||||||
try {
|
try {
|
||||||
await this.model.refresh();
|
await this.model.refresh(false);
|
||||||
await this._childrenRefreshPromise.promise;
|
await this._childrenRefreshPromise.promise;
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
// Couldn't get the children and TreeView doesn't have a way to collapse a node
|
// Couldn't get the children and TreeView doesn't have a way to collapse a node
|
||||||
|
|||||||
@@ -1,18 +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 vscode from 'vscode';
|
|
||||||
import * as loc from '../../localizedConstants';
|
|
||||||
import { TreeNode } from './treeNode';
|
|
||||||
|
|
||||||
/**
|
|
||||||
* A placeholder TreeNode to display while we're loading the initial set of stored nodes
|
|
||||||
*/
|
|
||||||
export class LoadingControllerNode extends TreeNode {
|
|
||||||
|
|
||||||
constructor() {
|
|
||||||
super(loc.loading, vscode.TreeItemCollapsibleState.None, 'loading');
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,186 +1,192 @@
|
|||||||
{
|
{
|
||||||
"name": "big-data-cluster",
|
"name": "big-data-cluster",
|
||||||
"displayName": "%text.sqlServerBigDataClusters%",
|
"displayName": "%text.sqlServerBigDataClusters%",
|
||||||
"description": "%description%",
|
"description": "%description%",
|
||||||
"version": "1.0.0",
|
"version": "1.0.0",
|
||||||
"publisher": "Microsoft",
|
"publisher": "Microsoft",
|
||||||
"preview": true,
|
"preview": true,
|
||||||
"license": "https://raw.githubusercontent.com/Microsoft/azuredatastudio/main/LICENSE.txt",
|
"license": "https://raw.githubusercontent.com/Microsoft/azuredatastudio/main/LICENSE.txt",
|
||||||
"icon": "images/extension.png",
|
"icon": "images/extension.png",
|
||||||
"engines": {
|
"engines": {
|
||||||
"vscode": "*",
|
"vscode": "*",
|
||||||
"azdata": "*"
|
"azdata": "*"
|
||||||
},
|
},
|
||||||
"activationEvents": [
|
"activationEvents": [
|
||||||
"onCommand:bigDataClusters.command.mount",
|
"onCommand:bigDataClusters.command.mount",
|
||||||
"onCommand:bigDataClusters.command.refreshmount",
|
"onCommand:bigDataClusters.command.refreshmount",
|
||||||
"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.removeController",
|
"onCommand:bigDataClusters.command.removeController",
|
||||||
"onCommand:bigDataClusters.command.manageController",
|
"onCommand:bigDataClusters.command.manageController",
|
||||||
"onCommand:bigDataClusters.command.refreshController",
|
"onCommand:bigDataClusters.command.refreshController",
|
||||||
"onView:sqlBigDataCluster"
|
"onView:sqlBigDataCluster"
|
||||||
],
|
],
|
||||||
"repository": {
|
"repository": {
|
||||||
"type": "git",
|
"type": "git",
|
||||||
"url": "https://github.com/Microsoft/azuredatastudio.git"
|
"url": "https://github.com/Microsoft/azuredatastudio.git"
|
||||||
},
|
},
|
||||||
"main": "./out/extension",
|
"main": "./out/extension",
|
||||||
"contributes": {
|
"contributes": {
|
||||||
"dataExplorer": {
|
"dataExplorer": {
|
||||||
"sqlBigDataCluster": [
|
"sqlBigDataCluster": [
|
||||||
{
|
{
|
||||||
"id": "sqlBigDataCluster",
|
"id": "sqlBigDataCluster",
|
||||||
"name": "%text.sqlServerBigDataClusters%"
|
"name": "%text.sqlServerBigDataClusters%"
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
"menus": {
|
"menus": {
|
||||||
"commandPalette": [
|
"commandPalette": [
|
||||||
{
|
{
|
||||||
"command": "bigDataClusters.command.createController",
|
"command": "bigDataClusters.command.createController",
|
||||||
"when": "false"
|
"when": "false"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"command": "bigDataClusters.command.connectController",
|
"command": "bigDataClusters.command.connectController",
|
||||||
"when": "false"
|
"when": "false"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"command": "bigDataClusters.command.removeController",
|
"command": "bigDataClusters.command.removeController",
|
||||||
"when": "false"
|
"when": "false"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"command": "bigDataClusters.command.refreshController",
|
"command": "bigDataClusters.command.refreshController",
|
||||||
"when": "false"
|
"when": "false"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"command": "bigDataClusters.command.manageController",
|
"command": "bigDataClusters.command.manageController",
|
||||||
"when": "false"
|
"when": "false"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"command": "bigDataClusters.command.mount",
|
"command": "bigDataClusters.command.mount",
|
||||||
"when": "false"
|
"when": "false"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"command": "bigDataClusters.command.refreshmount",
|
"command": "bigDataClusters.command.refreshmount",
|
||||||
"when": "false"
|
"when": "false"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"command": "bigDataClusters.command.deletemount",
|
"command": "bigDataClusters.command.deletemount",
|
||||||
"when": "false"
|
"when": "false"
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"view/title": [
|
"view/title": [
|
||||||
{
|
{
|
||||||
"command": "bigDataClusters.command.createController",
|
"command": "bigDataClusters.command.createController",
|
||||||
"when": "view == sqlBigDataCluster",
|
"when": "view == sqlBigDataCluster",
|
||||||
"group": "navigation@1"
|
"group": "navigation@1"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"command": "bigDataClusters.command.connectController",
|
"command": "bigDataClusters.command.connectController",
|
||||||
"when": "view == sqlBigDataCluster",
|
"when": "view == sqlBigDataCluster",
|
||||||
"group": "navigation@2"
|
"group": "navigation@2"
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"view/item/context": [
|
"view/item/context": [
|
||||||
{
|
{
|
||||||
"command": "bigDataClusters.command.manageController",
|
"command": "bigDataClusters.command.manageController",
|
||||||
"when": "view == sqlBigDataCluster && viewItem == bigDataClusters.itemType.controllerNode",
|
"when": "view == sqlBigDataCluster && viewItem == bigDataClusters.itemType.controllerNode",
|
||||||
"group": "navigation@1"
|
"group": "navigation@1"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"command": "bigDataClusters.command.refreshController",
|
"command": "bigDataClusters.command.refreshController",
|
||||||
"when": "view == sqlBigDataCluster && viewItem == bigDataClusters.itemType.controllerNode",
|
"when": "view == sqlBigDataCluster && viewItem == bigDataClusters.itemType.controllerNode",
|
||||||
"group": "navigation@2"
|
"group": "navigation@2"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"command": "bigDataClusters.command.removeController",
|
"command": "bigDataClusters.command.removeController",
|
||||||
"when": "view == sqlBigDataCluster && viewItem == bigDataClusters.itemType.controllerNode",
|
"when": "view == sqlBigDataCluster && viewItem == bigDataClusters.itemType.controllerNode",
|
||||||
"group": "navigation@3"
|
"group": "navigation@3"
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"objectExplorer/item/context": [
|
"objectExplorer/item/context": [
|
||||||
{
|
{
|
||||||
"command": "bigDataClusters.command.mount",
|
"command": "bigDataClusters.command.mount",
|
||||||
"when": "nodeType=~/^mssqlCluster/ && nodeType!=mssqlCluster:message && nodeSubType=~/^(?!:mount).*$/",
|
"when": "nodeType=~/^mssqlCluster/ && nodeType!=mssqlCluster:message && nodeSubType=~/^(?!:mount).*$/",
|
||||||
"group": "1mssqlCluster@10"
|
"group": "1mssqlCluster@10"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"command": "bigDataClusters.command.refreshmount",
|
"command": "bigDataClusters.command.refreshmount",
|
||||||
"when": "nodeType == mssqlCluster:folder && nodeSubType==:mount:",
|
"when": "nodeType == mssqlCluster:folder && nodeSubType==:mount:",
|
||||||
"group": "1mssqlCluster@11"
|
"group": "1mssqlCluster@11"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"command": "bigDataClusters.command.deletemount",
|
"command": "bigDataClusters.command.deletemount",
|
||||||
"when": "nodeType == mssqlCluster:folder && nodeSubType==:mount:",
|
"when": "nodeType == mssqlCluster:folder && nodeSubType==:mount:",
|
||||||
"group": "1mssqlCluster@12"
|
"group": "1mssqlCluster@12"
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
"commands": [
|
"commands": [
|
||||||
{
|
{
|
||||||
"command": "bigDataClusters.command.createController",
|
"command": "bigDataClusters.command.createController",
|
||||||
"title": "%command.createController.title%",
|
"title": "%command.createController.title%",
|
||||||
"icon": "$(add)"
|
"icon": "$(add)"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"command": "bigDataClusters.command.connectController",
|
"command": "bigDataClusters.command.connectController",
|
||||||
"title": "%command.connectController.title%",
|
"title": "%command.connectController.title%",
|
||||||
"icon": "$(disconnect)"
|
"icon": "$(disconnect)"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"command": "bigDataClusters.command.removeController",
|
"command": "bigDataClusters.command.removeController",
|
||||||
"title": "%command.removeController.title%",
|
"title": "%command.removeController.title%",
|
||||||
"when": "viewItem == bigDataClusters.itemType.controllerNode"
|
"when": "viewItem == bigDataClusters.itemType.controllerNode"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"command": "bigDataClusters.command.refreshController",
|
"command": "bigDataClusters.command.refreshController",
|
||||||
"title": "%command.refreshController.title%",
|
"title": "%command.refreshController.title%",
|
||||||
"icon": "$(refresh)"
|
"icon": "$(refresh)"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"command": "bigDataClusters.command.manageController",
|
"command": "bigDataClusters.command.manageController",
|
||||||
"title": "%command.manageController.title%"
|
"title": "%command.manageController.title%"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"command": "bigDataClusters.command.mount",
|
"command": "bigDataClusters.command.mount",
|
||||||
"title": "%command.mount.title%"
|
"title": "%command.mount.title%"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"command": "bigDataClusters.command.refreshmount",
|
"command": "bigDataClusters.command.refreshmount",
|
||||||
"title": "%command.refreshmount.title%"
|
"title": "%command.refreshmount.title%"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"command": "bigDataClusters.command.deletemount",
|
"command": "bigDataClusters.command.deletemount",
|
||||||
"title": "%command.deletemount.title%"
|
"title": "%command.deletemount.title%"
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"configuration": {
|
"configuration": {
|
||||||
"type": "object",
|
"type": "object",
|
||||||
"title": "%bdc.configuration.title%",
|
"title": "%bdc.configuration.title%",
|
||||||
"properties": {
|
"properties": {
|
||||||
"bigDataCluster.ignoreSslVerification": {
|
"bigDataCluster.ignoreSslVerification": {
|
||||||
"type": "boolean",
|
"type": "boolean",
|
||||||
"default": true,
|
"default": true,
|
||||||
"description": "%bdc.ignoreSslVerification.desc%"
|
"description": "%bdc.ignoreSslVerification.desc%"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"viewsWelcome": [
|
"viewsWelcome": [
|
||||||
{
|
{
|
||||||
"view": "sqlBigDataCluster",
|
"view": "sqlBigDataCluster",
|
||||||
"contents": "%bdc.view.welcome%"
|
"contents": "%bdc.view.welcome.connect%",
|
||||||
}
|
"when": "bdc.loaded"
|
||||||
]
|
},
|
||||||
},
|
{
|
||||||
"dependencies": {
|
"view": "sqlBigDataCluster",
|
||||||
"ads-kerberos": "^1.1.3",
|
"contents": "%bdc.view.welcome.loading%",
|
||||||
"request": "^2.88.0",
|
"when": "!bdc.loaded"
|
||||||
"vscode-nls": "^4.0.0"
|
}
|
||||||
},
|
]
|
||||||
"devDependencies": {
|
},
|
||||||
"@types/request": "^2.48.3",
|
"dependencies": {
|
||||||
"vscode": "^1.1.36"
|
"ads-kerberos": "^1.1.3",
|
||||||
}
|
"request": "^2.88.0",
|
||||||
|
"vscode-nls": "^4.0.0"
|
||||||
|
},
|
||||||
|
"devDependencies": {
|
||||||
|
"@types/request": "^2.48.3",
|
||||||
|
"vscode": "^1.1.36"
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -3,13 +3,14 @@
|
|||||||
"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.removeController.title" : "Remove Controller",
|
"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.view.welcome.connect": "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.view.welcome.loading": "Loading controllers...",
|
||||||
|
"bdc.ignoreSslVerification.desc": "Ignore SSL verification errors against SQL Server Big Data Cluster endpoints such as HDFS, Spark, and Controller if true"
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -10,7 +10,6 @@ import { TreeNode } from './treeNode';
|
|||||||
import { IControllerTreeChangeHandler } from './controllerTreeChangeHandler';
|
import { IControllerTreeChangeHandler } from './controllerTreeChangeHandler';
|
||||||
import { ControllerRootNode, ControllerNode } from './controllerTreeNode';
|
import { ControllerRootNode, ControllerNode } from './controllerTreeNode';
|
||||||
import { showErrorMessage } from '../utils';
|
import { showErrorMessage } from '../utils';
|
||||||
import { LoadingControllerNode } from './loadingControllerNode';
|
|
||||||
import { AuthType } from 'bdc';
|
import { AuthType } from 'bdc';
|
||||||
|
|
||||||
const localize = nls.loadMessageBundle();
|
const localize = nls.loadMessageBundle();
|
||||||
@@ -35,7 +34,6 @@ export class ControllerTreeDataProvider implements vscode.TreeDataProvider<TreeN
|
|||||||
|
|
||||||
constructor(private memento: vscode.Memento) {
|
constructor(private memento: vscode.Memento) {
|
||||||
this.root = new ControllerRootNode(this);
|
this.root = new ControllerRootNode(this);
|
||||||
this.root.addChild(new LoadingControllerNode());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public async getChildren(element?: TreeNode): Promise<TreeNode[]> {
|
public async getChildren(element?: TreeNode): Promise<TreeNode[]> {
|
||||||
@@ -45,6 +43,11 @@ export class ControllerTreeDataProvider implements vscode.TreeDataProvider<TreeN
|
|||||||
|
|
||||||
if (!this.initialized) {
|
if (!this.initialized) {
|
||||||
this.loadSavedControllers().catch(err => { vscode.window.showErrorMessage(localize('bdc.controllerTreeDataProvider.error', "Unexpected error loading saved controllers: {0}", err)); });
|
this.loadSavedControllers().catch(err => { vscode.window.showErrorMessage(localize('bdc.controllerTreeDataProvider.error', "Unexpected error loading saved controllers: {0}", err)); });
|
||||||
|
} else {
|
||||||
|
// We set the context here since VS Code takes a bit of time to process the _onDidChangeTreeData
|
||||||
|
// and so if we set it as soon as we finished loading the controllers it would briefly flash
|
||||||
|
// the "connect to controller" welcome view
|
||||||
|
await vscode.commands.executeCommand('setContext', 'bdc.loaded', true);
|
||||||
}
|
}
|
||||||
|
|
||||||
return this.root.getChildren();
|
return this.root.getChildren();
|
||||||
@@ -87,21 +90,9 @@ export class ControllerTreeDataProvider implements vscode.TreeDataProvider<TreeN
|
|||||||
}
|
}
|
||||||
|
|
||||||
private removeNonControllerNodes(): void {
|
private removeNonControllerNodes(): void {
|
||||||
this.removePlaceholderNodes(this.root.children);
|
|
||||||
this.removeDefectiveControllerNodes(this.root.children);
|
this.removeDefectiveControllerNodes(this.root.children);
|
||||||
}
|
}
|
||||||
|
|
||||||
private removePlaceholderNodes(nodes: TreeNode[]): void {
|
|
||||||
if (nodes.length > 0) {
|
|
||||||
for (let i = 0; i < nodes.length; ++i) {
|
|
||||||
if (nodes[i] instanceof LoadingControllerNode
|
|
||||||
) {
|
|
||||||
nodes.splice(i--, 1);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private removeDefectiveControllerNodes(nodes: TreeNode[]): void {
|
private removeDefectiveControllerNodes(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) {
|
||||||
|
|||||||
@@ -1,45 +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 LoadingControllerNode extends TreeNode {
|
|
||||||
private readonly nodeType: string;
|
|
||||||
|
|
||||||
constructor() {
|
|
||||||
super(localize('textLoadingWithDots', "Loading..."));
|
|
||||||
this.nodeType = BdcItemType.loadingController;
|
|
||||||
}
|
|
||||||
|
|
||||||
public async getChildren(): Promise<TreeNode[]> {
|
|
||||||
return [];
|
|
||||||
}
|
|
||||||
|
|
||||||
public getTreeItem(): vscode.TreeItem {
|
|
||||||
let item = new vscode.TreeItem(this.label, vscode.TreeItemCollapsibleState.None);
|
|
||||||
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
|
|
||||||
};
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -26,8 +26,9 @@ const endpointNotFoundError = localize('mount.error.endpointNotFound', "Controll
|
|||||||
|
|
||||||
let throttleTimers: { [key: string]: any } = {};
|
let throttleTimers: { [key: string]: any } = {};
|
||||||
|
|
||||||
export function activate(extensionContext: vscode.ExtensionContext): IExtension {
|
export async function activate(extensionContext: vscode.ExtensionContext): Promise<IExtension> {
|
||||||
IconPathHelper.setExtensionContext(extensionContext);
|
IconPathHelper.setExtensionContext(extensionContext);
|
||||||
|
await vscode.commands.executeCommand('setContext', 'bdc.loaded', false);
|
||||||
const treeDataProvider = new ControllerTreeDataProvider(extensionContext.globalState);
|
const treeDataProvider = new ControllerTreeDataProvider(extensionContext.globalState);
|
||||||
vscode.window.registerTreeDataProvider('sqlBigDataCluster', treeDataProvider);
|
vscode.window.registerTreeDataProvider('sqlBigDataCluster', treeDataProvider);
|
||||||
registerCommands(extensionContext, treeDataProvider);
|
registerCommands(extensionContext, treeDataProvider);
|
||||||
|
|||||||
Reference in New Issue
Block a user