From 3bc4178ea8afffa4324e43686410bb8b6a3d33ab Mon Sep 17 00:00:00 2001 From: Brian Bergeron Date: Tue, 22 Sep 2020 11:19:49 -0700 Subject: [PATCH] Arc - Enable Postgres support request link (#12560) Co-authored-by: Brian Bergeron --- .../dashboards/postgres/postgresDashboard.ts | 2 +- .../postgres/postgresSupportRequestPage.ts | 18 ++++++++++-------- 2 files changed, 11 insertions(+), 9 deletions(-) diff --git a/extensions/arc/src/ui/dashboards/postgres/postgresDashboard.ts b/extensions/arc/src/ui/dashboards/postgres/postgresDashboard.ts index 2c23aceb06..4b77b75026 100644 --- a/extensions/arc/src/ui/dashboards/postgres/postgresDashboard.ts +++ b/extensions/arc/src/ui/dashboards/postgres/postgresDashboard.ts @@ -33,7 +33,7 @@ export class PostgresDashboard extends Dashboard { // TODO: Removed properties page while investigating bug where refreshed values don't appear in UI // const propertiesPage = new PostgresPropertiesPage(modelView, this._controllerModel, this._postgresModel); const diagnoseAndSolveProblemsPage = new PostgresDiagnoseAndSolveProblemsPage(modelView, this._context, this._postgresModel); - const supportRequestPage = new PostgresSupportRequestPage(modelView); + const supportRequestPage = new PostgresSupportRequestPage(modelView, this._controllerModel, this._postgresModel); return [ overviewPage.tab, diff --git a/extensions/arc/src/ui/dashboards/postgres/postgresSupportRequestPage.ts b/extensions/arc/src/ui/dashboards/postgres/postgresSupportRequestPage.ts index 14a5be718a..34b477daff 100644 --- a/extensions/arc/src/ui/dashboards/postgres/postgresSupportRequestPage.ts +++ b/extensions/arc/src/ui/dashboards/postgres/postgresSupportRequestPage.ts @@ -3,13 +3,17 @@ * Licensed under the Source EULA. See License.txt in the project root for license information. *--------------------------------------------------------------------------------------------*/ +import * as vscode from 'vscode'; import * as azdata from 'azdata'; import * as loc from '../../../localizedConstants'; import { IconPathHelper, cssStyles } from '../../../constants'; import { DashboardPage } from '../../components/dashboardPage'; +import { ControllerModel } from '../../../models/controllerModel'; +import { ResourceType } from 'arc'; +import { PostgresModel } from '../../../models/postgresModel'; export class PostgresSupportRequestPage extends DashboardPage { - constructor(protected modelView: azdata.ModelView) { + constructor(protected modelView: azdata.ModelView, private _controllerModel: ControllerModel, private _postgresModel: PostgresModel) { super(modelView); } @@ -48,15 +52,13 @@ export class PostgresSupportRequestPage extends DashboardPage { this.disposables.push( supportRequestButton.onDidClick(() => { - /* - const r = this._controllerModel.getRegistration(ResourceType.postgresInstances, this._postgresModel.namespace, this._postgresModel.name); - if (!r) { - vscode.window.showErrorMessage(loc.couldNotFindAzureResource(this._postgresModel.fullName)); - } else { + const azure = this._controllerModel.controllerConfig?.spec.settings.azure; + if (azure) { vscode.env.openExternal(vscode.Uri.parse( - `https://portal.azure.com/#resource/subscriptions/${r.subscriptionId}/resourceGroups/${r.resourceGroupName}/providers/Microsoft.AzureData/${ResourceType.postgresInstances}/${r.instanceName}/supportrequest`)); + `https://portal.azure.com/#resource/subscriptions/${azure.subscription}/resourceGroups/${azure.resourceGroup}/providers/Microsoft.AzureData/${ResourceType.postgresInstances}/${this._postgresModel.info.name}/supportrequest`)); + } else { + vscode.window.showErrorMessage(loc.couldNotFindControllerRegistration); } - */ })); content.addItem(supportRequestButton);