Making the Postgres Parameters Page Visible (#14156)

* Having parameters page be visible and fixing information bubbles

* Added sessions to edit commands

* Fix table style
This commit is contained in:
nasc17
2021-02-04 09:52:39 -08:00
committed by GitHub
parent 6907c8edab
commit 814dfba338
2 changed files with 21 additions and 18 deletions

View File

@@ -14,6 +14,7 @@ import { Dashboard } from '../../components/dashboard';
import { PostgresDiagnoseAndSolveProblemsPage } from './postgresDiagnoseAndSolveProblemsPage'; import { PostgresDiagnoseAndSolveProblemsPage } from './postgresDiagnoseAndSolveProblemsPage';
import { PostgresSupportRequestPage } from './postgresSupportRequestPage'; import { PostgresSupportRequestPage } from './postgresSupportRequestPage';
import { PostgresComputeAndStoragePage } from './postgresComputeAndStoragePage'; import { PostgresComputeAndStoragePage } from './postgresComputeAndStoragePage';
import { PostgresParametersPage } from './postgresParametersPage';
export class PostgresDashboard extends Dashboard { export class PostgresDashboard extends Dashboard {
constructor(private _context: vscode.ExtensionContext, private _controllerModel: ControllerModel, private _postgresModel: PostgresModel) { constructor(private _context: vscode.ExtensionContext, private _controllerModel: ControllerModel, private _postgresModel: PostgresModel) {
@@ -34,8 +35,7 @@ export class PostgresDashboard extends Dashboard {
const computeAndStoragePage = new PostgresComputeAndStoragePage(modelView, this._postgresModel); const computeAndStoragePage = new PostgresComputeAndStoragePage(modelView, this._postgresModel);
// TODO: Removed properties page while investigating bug where refreshed values don't appear in UI // 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 propertiesPage = new PostgresPropertiesPage(modelView, this._controllerModel, this._postgresModel);
// TODO: Removed parameters page while investigating bug where UI freezes dealing with large declarative table of components const parametersPage = new PostgresParametersPage(modelView, this._postgresModel);
// const parametersPage = new PostgresParametersPage(modelView, this._postgresModel);
const diagnoseAndSolveProblemsPage = new PostgresDiagnoseAndSolveProblemsPage(modelView, this._context, this._postgresModel); const diagnoseAndSolveProblemsPage = new PostgresDiagnoseAndSolveProblemsPage(modelView, this._context, this._postgresModel);
const supportRequestPage = new PostgresSupportRequestPage(modelView, this._controllerModel, this._postgresModel); const supportRequestPage = new PostgresSupportRequestPage(modelView, this._controllerModel, this._postgresModel);
@@ -45,7 +45,8 @@ export class PostgresDashboard extends Dashboard {
title: loc.settings, title: loc.settings,
tabs: [ tabs: [
connectionStringsPage.tab, connectionStringsPage.tab,
computeAndStoragePage.tab computeAndStoragePage.tab,
parametersPage.tab
] ]
}, },
{ {

View File

@@ -165,7 +165,9 @@ export class PostgresParametersPage extends DashboardPage {
await this._azdataApi.azdata.arc.postgres.server.edit( await this._azdataApi.azdata.arc.postgres.server.edit(
this._postgresModel.info.name, this._postgresModel.info.name,
{ engineSettings: engineSettings.toString() }, { engineSettings: engineSettings.toString() },
this._postgresModel.engineVersion); this._postgresModel.engineVersion,
this._postgresModel.controllerModel.azdataAdditionalEnvVars,
session);
} finally { } finally {
session.dispose(); session.dispose();
} }
@@ -240,7 +242,9 @@ export class PostgresParametersPage extends DashboardPage {
await this._azdataApi.azdata.arc.postgres.server.edit( await this._azdataApi.azdata.arc.postgres.server.edit(
this._postgresModel.info.name, this._postgresModel.info.name,
{ engineSettings: `''`, replaceEngineSettings: true }, { engineSettings: `''`, replaceEngineSettings: true },
this._postgresModel.engineVersion); this._postgresModel.engineVersion,
this._postgresModel.controllerModel.azdataAdditionalEnvVars,
session);
} catch (err) { } catch (err) {
// If an error occurs while resetting the instance then re-enable the reset button since // If an error occurs while resetting the instance then re-enable the reset button since
// the edit wasn't successfully applied // the edit wasn't successfully applied
@@ -405,7 +409,6 @@ export class PostgresParametersPage extends DashboardPage {
// Container to hold input component and information bubble // Container to hold input component and information bubble
const valueContainer = this.modelView.modelBuilder.flexContainer().withLayout({ alignItems: 'center' }).component(); const valueContainer = this.modelView.modelBuilder.flexContainer().withLayout({ alignItems: 'center' }).component();
if (engineSetting.type === 'enum') { if (engineSetting.type === 'enum') {
// If type is enum, component should be drop down menu // If type is enum, component should be drop down menu
let options = engineSetting.options?.slice(1, -1).split(','); let options = engineSetting.options?.slice(1, -1).split(',');
@@ -417,8 +420,7 @@ export class PostgresParametersPage extends DashboardPage {
let valueBox = this.modelView.modelBuilder.dropDown().withProps({ let valueBox = this.modelView.modelBuilder.dropDown().withProps({
values: values, values: values,
value: engineSetting.value, value: engineSetting.value,
width: '150px', width: '150px'
CSSStyles: { 'height': '40px' }
}).component(); }).component();
valueContainer.addItem(valueBox); valueContainer.addItem(valueBox);
@@ -482,9 +484,6 @@ export class PostgresParametersPage extends DashboardPage {
}) })
); );
} else { } else {
// Child components to be added to container
let components: Array<azdata.Component> = [];
// If type is real or interger, component should be inputbox set to inputType of number. Max and min values also set. // If type is real or interger, component should be inputbox set to inputType of number. Max and min values also set.
let valueBox = this.modelView.modelBuilder.inputBox().withProps({ let valueBox = this.modelView.modelBuilder.inputBox().withProps({
required: true, required: true,
@@ -496,7 +495,8 @@ export class PostgresParametersPage extends DashboardPage {
value: engineSetting.value, value: engineSetting.value,
width: '150px' width: '150px'
}).component(); }).component();
components.push(valueBox);
valueContainer.addItem(valueBox, { CSSStyles: { 'margin-right': '0px' } });
this.disposables.push( this.disposables.push(
valueBox.onTextChanged(() => { valueBox.onTextChanged(() => {
@@ -513,12 +513,10 @@ export class PostgresParametersPage extends DashboardPage {
iconPath: IconPathHelper.information, iconPath: IconPathHelper.information,
width: '15px', width: '15px',
height: '15px', height: '15px',
enabled: false enabled: false,
title: loc.allowedValue(loc.rangeSetting(engineSetting.min!, engineSetting.max!))
}).component(); }).component();
valueContainer.addItem(information, { CSSStyles: { 'margin-left': '5px' } });
information.updateProperty('title', loc.allowedValue(loc.rangeSetting(engineSetting.min!, engineSetting.max!)));
components.push(information);
valueContainer.addItems(components);
} }
// Can reset individual parameter // Can reset individual parameter
@@ -545,7 +543,9 @@ export class PostgresParametersPage extends DashboardPage {
await this._azdataApi.azdata.arc.postgres.server.edit( await this._azdataApi.azdata.arc.postgres.server.edit(
this._postgresModel.info.name, this._postgresModel.info.name,
{ engineSettings: engineSetting.parameterName + '=' }, { engineSettings: engineSetting.parameterName + '=' },
this._postgresModel.engineVersion); this._postgresModel.engineVersion,
this._postgresModel.controllerModel.azdataAdditionalEnvVars,
session);
} finally { } finally {
session.dispose(); session.dispose();
} }
@@ -581,6 +581,8 @@ export class PostgresParametersPage extends DashboardPage {
this._parametersTableLoading!.loading = false; this._parametersTableLoading!.loading = false;
} else if (this._postgresModel.engineSettingsLastUpdated) { } else if (this._postgresModel.engineSettingsLastUpdated) {
await this.callGetEngineSettings(); await this.callGetEngineSettings();
this.discardButton!.enabled = false;
this.saveButton!.enabled = false;
} }
} }
} }