Fixed az sql mi-arc show for indirect scenario (#19378)

* Addressed sql mi show for indirect and direct

* Throw error when output is not JSON

Co-authored-by: Candice Ye <canye@microsoft.com>
This commit is contained in:
Candice Ye
2022-05-16 10:51:23 -07:00
committed by GitHub
parent 394417f93e
commit 801f797440
9 changed files with 166 additions and 70 deletions

View File

@@ -288,7 +288,7 @@ export class MiaaBackupsPage extends DashboardPage {
} else {
// If we don't have an endpoint then there's no point in showing the connect button - but the logic
// to display text informing the user of this is already handled by the handleMiaaConfigUpdated
if (this._miaaModel?.config?.properties?.k8SRaw?.status.primaryEndpoint) {
if (this._miaaModel?.config?.status.primaryEndpoint) {
this._connectToServerLoading.loading = false;
this._connectToServerButton.enabled = true;
}
@@ -296,7 +296,7 @@ export class MiaaBackupsPage extends DashboardPage {
}
private refreshRD(): void {
this._saveArgs.retentionDays = this._miaaModel.config?.properties?.k8SRaw?.spec?.backup?.retentionPeriodInDays.toString() ?? '';
this._saveArgs.retentionDays = this._miaaModel.config?.spec?.backup?.retentionPeriodInDays.toString() ?? '';
}
// Create restore button for every database entry in the database table

View File

@@ -330,7 +330,7 @@ export class MiaaComputeAndStoragePage extends DashboardPage {
}
private editCores(): void {
let currentCPUSize = this._miaaModel.config?.properties?.k8SRaw?.spec?.scheduling?.default?.resources?.requests?.cpu;
let currentCPUSize = this._miaaModel.config?.spec?.scheduling?.default?.resources?.requests?.cpu;
if (!currentCPUSize) {
currentCPUSize = '';
@@ -340,7 +340,7 @@ export class MiaaComputeAndStoragePage extends DashboardPage {
this.coresRequestBox!.value = '';
this.saveArgs.coresRequest = undefined;
currentCPUSize = this._miaaModel.config?.properties?.k8SRaw?.spec?.scheduling?.default?.resources?.limits?.cpu;
currentCPUSize = this._miaaModel.config?.spec?.scheduling?.default?.resources?.limits?.cpu;
if (!currentCPUSize) {
currentCPUSize = '';
@@ -353,7 +353,7 @@ export class MiaaComputeAndStoragePage extends DashboardPage {
private editMemory(): void {
let currentMemSizeConversion: string;
let currentMemorySize = this._miaaModel.config?.properties?.k8SRaw?.spec?.scheduling?.default?.resources?.requests?.memory;
let currentMemorySize = this._miaaModel.config?.spec?.scheduling?.default?.resources?.requests?.memory;
if (!currentMemorySize) {
currentMemSizeConversion = '';
@@ -366,7 +366,7 @@ export class MiaaComputeAndStoragePage extends DashboardPage {
this.saveArgs.memoryRequest = undefined;
currentMemorySize = this._miaaModel.config?.properties?.k8SRaw?.spec?.scheduling?.default?.resources?.limits?.memory;
currentMemorySize = this._miaaModel.config?.spec?.scheduling?.default?.resources?.limits?.memory;
if (!currentMemorySize) {
currentMemSizeConversion = '';

View File

@@ -74,11 +74,11 @@ export class MiaaConnectionStringsPage extends DashboardPage {
private getConnectionStrings(): KeyValue[] {
const config = this._miaaModel.config;
if (!config?.properties?.k8SRaw?.status.primaryEndpoint) {
if (!config?.status.primaryEndpoint) {
return [];
}
const externalEndpoint = parseIpAndPort(config.properties?.k8SRaw?.status.primaryEndpoint);
const externalEndpoint = parseIpAndPort(config.status.primaryEndpoint);
const username = this._miaaModel.username ?? '{your_username_here}';
return [
@@ -97,7 +97,7 @@ $conn = sqlsrv_connect($serverName, $connectionInfo);`),
}
private updateConnectionStrings(): void {
this._connectionStringsMessage.value = !this._miaaModel.config?.properties?.k8SRaw?.status.primaryEndpoint ? loc.noExternalEndpoint : '';
this._connectionStringsMessage.value = !this._miaaModel.config?.status.primaryEndpoint ? loc.noExternalEndpoint : '';
this._keyValueContainer.refresh(this.getConnectionStrings());
}
}

View File

@@ -335,11 +335,11 @@ export class MiaaDashboardOverviewPage extends DashboardPage {
private handleMiaaConfigUpdated(): void {
if (this._miaaModel.config) {
this._instanceProperties.status = this._miaaModel.config.properties?.k8SRaw?.status.state || '-';
this._instanceProperties.externalEndpoint = this._miaaModel.config.properties?.k8SRaw?.status.primaryEndpoint || loc.notConfigured;
this._instanceProperties.vCores = this._miaaModel.config.properties?.k8SRaw?.spec?.scheduling?.default?.resources?.limits?.cpu?.toString() || '';
this._databasesMessage.value = !this._miaaModel.config.properties?.k8SRaw?.status.primaryEndpoint ? loc.noExternalEndpoint : '';
if (!this._miaaModel.config.properties?.k8SRaw?.status.primaryEndpoint) {
this._instanceProperties.status = this._miaaModel.config.status.state || '-';
this._instanceProperties.externalEndpoint = this._miaaModel.config.status.primaryEndpoint || loc.notConfigured;
this._instanceProperties.vCores = this._miaaModel.config.spec?.scheduling?.default?.resources?.limits?.cpu?.toString() || '';
this._databasesMessage.value = !this._miaaModel.config.status.primaryEndpoint ? loc.noExternalEndpoint : '';
if (!this._miaaModel.config.status.primaryEndpoint) {
this._databasesContainer.removeItem(this._connectToServerLoading);
}
}
@@ -368,7 +368,7 @@ export class MiaaDashboardOverviewPage extends DashboardPage {
} else {
// If we don't have an endpoint then there's no point in showing the connect button - but the logic
// to display text informing the user of this is already handled by the handleMiaaConfigUpdated
if (this._miaaModel?.config?.properties?.k8SRaw?.status.primaryEndpoint) {
if (this._miaaModel?.config?.status.primaryEndpoint) {
this._connectToServerLoading.loading = false;
this._connectToServerButton.enabled = true;
}
@@ -419,12 +419,12 @@ export class MiaaDashboardOverviewPage extends DashboardPage {
private refreshDashboardLinks(): void {
if (this._miaaModel.config) {
const kibanaUrl = this._miaaModel.config.properties?.k8SRaw?.status.logSearchDashboard ?? '';
const kibanaUrl = this._miaaModel.config.status.logSearchDashboard ?? '';
this._kibanaLink.label = kibanaUrl;
this._kibanaLink.url = kibanaUrl;
this._kibanaLoading!.loading = false;
const grafanaUrl = this._miaaModel.config.properties?.k8SRaw?.status.metricsDashboard ?? '';
const grafanaUrl = this._miaaModel.config.status.metricsDashboard ?? '';
this._grafanaLink.label = grafanaUrl;
this._grafanaLink.url = grafanaUrl;
this._grafanaLoading!.loading = false;

View File

@@ -179,7 +179,7 @@ export class MiaaUpgradeManagementPage extends DashboardPage {
this._controllerModel.azAdditionalEnvVars
);
}
return miaaShowResult.stdout.properties.k8SRaw.status.runningVersion;
return miaaShowResult.stdout.status.runningVersion;
} catch (e) {
console.error(loc.showMiaaError, e);
return undefined;

View File

@@ -26,7 +26,7 @@ export class ConfigureRPOSqlDialog extends InitializingComponent {
public showDialog(dialogTitle: string, retentionDays: string | undefined): azdata.window.Dialog {
const dialog = azdata.window.createModelViewDialog(dialogTitle);
dialog.cancelButton.onClick(() => this.handleCancel());
retentionDays = (retentionDays === undefined ? this._model.config?.properties?.k8SRaw?.spec?.backup?.retentionPeriodInDays?.toString() : retentionDays);
retentionDays = (retentionDays === undefined ? this._model.config?.spec?.backup?.retentionPeriodInDays?.toString() : retentionDays);
dialog.registerContent(async view => {
this.modelBuilder = view.modelBuilder;
this.retentionDaysInputBox = this.modelBuilder.inputBox()