Initial work on Arc tree view (#11008)

* Initial work on Arc tree view

* finish my thoughts
This commit is contained in:
Charles Gagnon
2020-06-18 16:50:31 -07:00
committed by GitHub
parent 935733d23c
commit 88fce764d3
23 changed files with 464 additions and 77 deletions

View File

@@ -3,7 +3,6 @@
* Licensed under the Source EULA. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
import * as azdata from 'azdata';
import * as vscode from 'vscode';
import * as loc from './localizedConstants';
import { IconPathHelper } from './constants';
@@ -14,10 +13,33 @@ import { PostgresModel } from './models/postgresModel';
import { ControllerDashboard } from './ui/dashboards/controller/controllerDashboard';
import { MiaaDashboard } from './ui/dashboards/miaa/miaaDashboard';
import { MiaaModel } from './models/miaaModel';
import { AzureArcTreeDataProvider } from './ui/tree/controllerTreeDataProvider';
import { ControllerTreeNode } from './ui/tree/controllerTreeNode';
import { TreeNode } from './ui/tree/treeNode';
export async function activate(context: vscode.ExtensionContext): Promise<void> {
IconPathHelper.setExtensionContext(context);
const treeDataProvider = new AzureArcTreeDataProvider(context);
vscode.window.registerTreeDataProvider('azureArc', treeDataProvider);
vscode.commands.registerCommand('arc.addController', () => {
// Controller information
const controllerUrl = '';
const auth = new BasicAuth('', '');
const controllerModel = new ControllerModel(controllerUrl, auth);
treeDataProvider.addController(controllerModel);
});
vscode.commands.registerCommand('arc.removeController', (controllerNode: ControllerTreeNode) => {
treeDataProvider.removeController(controllerNode);
});
vscode.commands.registerCommand('arc.openDashboard', async (treeNode: TreeNode) => {
await treeNode.openDashboard().catch(err => vscode.window.showErrorMessage(loc.openDashboardFailed(err)));
});
vscode.commands.registerCommand('arc.manageArcController', async () => {
// Controller information
const controllerUrl = '';
@@ -40,28 +62,12 @@ export async function activate(context: vscode.ExtensionContext): Promise<void>
// Controller information
const controllerUrl = '';
const auth = new BasicAuth('', '');
const connection = await azdata.connection.openConnectionDialog(['MSSQL']);
const connectionProfile: azdata.IConnectionProfile = {
serverName: connection.options['serverName'],
databaseName: connection.options['databaseName'],
authenticationType: connection.options['authenticationType'],
providerName: 'MSSQL',
connectionName: '',
userName: connection.options['user'],
password: connection.options['password'],
savePassword: false,
groupFullName: undefined,
saveProfile: true,
id: connection.connectionId,
groupId: undefined,
options: connection.options
};
const instanceNamespace = '';
const instanceName = '';
try {
const controllerModel = new ControllerModel(controllerUrl, auth);
const miaaModel = new MiaaModel(connectionProfile, controllerUrl, auth, instanceNamespace, instanceName);
const miaaModel = new MiaaModel(controllerUrl, auth, instanceNamespace, instanceName);
const miaaDashboard = new MiaaDashboard(controllerModel, miaaModel);
await Promise.all([
@@ -85,7 +91,7 @@ export async function activate(context: vscode.ExtensionContext): Promise<void>
try {
const controllerModel = new ControllerModel(controllerUrl, auth);
const postgresModel = new PostgresModel(controllerUrl, auth, dbNamespace, dbName);
const postgresDashboard = new PostgresDashboard(loc.postgresDashboard, context, controllerModel, postgresModel);
const postgresDashboard = new PostgresDashboard(context, controllerModel, postgresModel);
await Promise.all([
postgresDashboard.showDashboard(),