Skip to content

Commit

Permalink
Add troubleshoot button to arc controller/MIAA dashboard (#12534)
Browse files Browse the repository at this point in the history
* Add troubleshoot button to arc controller dashboard

* Add MIAA button

* Fix links
  • Loading branch information
Charles-Gagnon authored Sep 21, 2020
1 parent 50dbe65 commit 41ace44
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 4 deletions.
3 changes: 3 additions & 0 deletions extensions/arc/src/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand Down Expand Up @@ -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<azdata.ButtonProperties>({
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();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand Down Expand Up @@ -257,6 +257,17 @@ export class MiaaDashboardOverviewPage extends DashboardPage {
}
}));

const troubleshootButton = this.modelView.modelBuilder.button().withProperties<azdata.ButtonProperties>({
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 },
Expand Down

0 comments on commit 41ace44

Please sign in to comment.