From 41ace44f328f21801816f6db950d086f1c6632c3 Mon Sep 17 00:00:00 2001 From: Charles Gagnon Date: Mon, 21 Sep 2020 15:03:23 -0700 Subject: [PATCH] Add troubleshoot button to arc controller/MIAA dashboard (#12534) * Add troubleshoot button to arc controller dashboard * Add MIAA button * Fix links --- extensions/arc/src/constants.ts | 3 +++ .../controllerDashboardOverviewPage.ts | 18 +++++++++++++++--- .../miaa/miaaDashboardOverviewPage.ts | 13 ++++++++++++- 3 files changed, 30 insertions(+), 4 deletions(-) diff --git a/extensions/arc/src/constants.ts b/extensions/arc/src/constants.ts index 8d232e4d8d..7522f9373a 100644 --- a/extensions/arc/src/constants.ts +++ b/extensions/arc/src/constants.ts @@ -9,6 +9,9 @@ export const refreshActionId = 'arc.refresh'; export const credentialNamespace = 'arcCredentials'; +export const controllerTroubleshootDocsUrl = 'https://aka.ms/arc-data-tsg'; +export const miaaTroubleshootDocsUrl = 'https://aka.ms/miaa-tsg'; + export interface IconPath { dark: string; light: string; diff --git a/extensions/arc/src/ui/dashboards/controller/controllerDashboardOverviewPage.ts b/extensions/arc/src/ui/dashboards/controller/controllerDashboardOverviewPage.ts index 1d3caecbb3..a917e26adc 100644 --- a/extensions/arc/src/ui/dashboards/controller/controllerDashboardOverviewPage.ts +++ b/extensions/arc/src/ui/dashboards/controller/controllerDashboardOverviewPage.ts @@ -8,7 +8,7 @@ import * as azdata from 'azdata'; import * as azurecore from 'azurecore'; import * as vscode from 'vscode'; import { getConnectionModeDisplayText, getResourceTypeIcon, resourceTypeToDisplayName } from '../../../common/utils'; -import { cssStyles, Endpoints, IconPathHelper, iconSize } from '../../../constants'; +import { cssStyles, Endpoints, IconPathHelper, controllerTroubleshootDocsUrl, iconSize } from '../../../constants'; import * as loc from '../../../localizedConstants'; import { ControllerModel } from '../../../models/controllerModel'; import { DashboardPage } from '../../components/dashboardPage'; @@ -178,18 +178,30 @@ export class ControllerDashboardOverviewPage extends DashboardPage { this._openInAzurePortalButton.onDidClick(async () => { const config = this._controllerModel.controllerConfig; if (config) { - vscode.env.openExternal(vscode.Uri.parse( + await vscode.env.openExternal(vscode.Uri.parse( `https://portal.azure.com/#resource/subscriptions/${config.spec.settings.azure.subscription}/resourceGroups/${config.spec.settings.azure.resourceGroup}/providers/Microsoft.AzureData/${ResourceType.dataControllers}/${config.metadata.name}`)); } else { vscode.window.showErrorMessage(loc.couldNotFindControllerRegistration); } })); + const troubleshootButton = this.modelView.modelBuilder.button().withProperties({ + label: loc.troubleshoot, + iconPath: IconPathHelper.wrench + }).component(); + + this.disposables.push( + troubleshootButton.onDidClick(async () => { + await vscode.env.openExternal(vscode.Uri.parse(controllerTroubleshootDocsUrl)); + }) + ); + return this.modelView.modelBuilder.toolbarContainer().withToolbarItems( [ { component: newInstance }, { component: refreshButton, toolbarSeparatorAfter: true }, - { component: this._openInAzurePortalButton } + { component: this._openInAzurePortalButton, toolbarSeparatorAfter: true }, + { component: troubleshootButton } ] ).component(); } diff --git a/extensions/arc/src/ui/dashboards/miaa/miaaDashboardOverviewPage.ts b/extensions/arc/src/ui/dashboards/miaa/miaaDashboardOverviewPage.ts index 2baaf57479..27fe13add8 100644 --- a/extensions/arc/src/ui/dashboards/miaa/miaaDashboardOverviewPage.ts +++ b/extensions/arc/src/ui/dashboards/miaa/miaaDashboardOverviewPage.ts @@ -8,7 +8,7 @@ import * as azdataExt from 'azdata-ext'; import * as azurecore from 'azurecore'; import * as vscode from 'vscode'; import { getDatabaseStateDisplayText, promptForInstanceDeletion } from '../../../common/utils'; -import { cssStyles, Endpoints, IconPathHelper } from '../../../constants'; +import { cssStyles, Endpoints, IconPathHelper, miaaTroubleshootDocsUrl } from '../../../constants'; import * as loc from '../../../localizedConstants'; import { ControllerModel } from '../../../models/controllerModel'; import { MiaaModel } from '../../../models/miaaModel'; @@ -257,6 +257,17 @@ export class MiaaDashboardOverviewPage extends DashboardPage { } })); + const troubleshootButton = this.modelView.modelBuilder.button().withProperties({ + label: loc.troubleshoot, + iconPath: IconPathHelper.wrench + }).component(); + + this.disposables.push( + troubleshootButton.onDidClick(async () => { + await vscode.env.openExternal(vscode.Uri.parse(miaaTroubleshootDocsUrl)); + }) + ); + return this.modelView.modelBuilder.toolbarContainer().withToolbarItems( [ { component: deleteButton },