Changing Postgres Hyperscale to Postgres Azure Arc in ADS (#20445)

* Hard code enginer ver to 14 and remove extension from wizard field and notebook

* Removed hyperscale text from everywhere but links

* Made PostgreSQL into PostgreSQL server and other text changes. Removed worker nodes

* Removed coordinator node text

* Removed worker nodes from compute + storage. Changed az arc-server to server-arc. postgresParameters.ts may need

* Removed tabs for extensions, coord nodes, worker nodes, resource health, diagnose and solve

* Removed node configuation and pg version from overview and properties. Edited arialabels

* Change server group nodes to server

* Removed type from overview table and aded Preview tags

* Removed info bubble and added padding to top of title

* Removed checkbox from PG create wizard. Added link and text

* Remove engine version

* Changed naming conventions

* Removed coord and server group from variables

* Removed properties

* Removed Server table, admin username, reset password

* Removed function from notebook

* Change wording

* bump version

Co-authored-by: Candice Ye <canye@microsoft.com>
This commit is contained in:
Candice Ye
2022-08-26 13:24:48 -07:00
committed by GitHub
parent 04ca5fbe42
commit bd0c4cdb51
26 changed files with 307 additions and 936 deletions

View File

@@ -13,7 +13,6 @@ import { PostgresModel } from '../../../models/postgresModel';
import { convertToGibibyteString } from '../../../common/utils';
export type RoleSpecifier = {
workers?: string,
coordinator?: string
};
@@ -28,12 +27,6 @@ export type ConfigurationSpecModel = {
export class PostgresComputeAndStoragePage extends DashboardPage {
private userInputContainer!: azdata.DivContainer;
private workerCountBox!: azdata.InputBoxComponent;
private workerCoresLimitBox!: azdata.InputBoxComponent;
private workerCoresRequestBox!: azdata.InputBoxComponent;
private workerMemoryLimitBox!: azdata.InputBoxComponent;
private workerMemoryRequestBox!: azdata.InputBoxComponent;
private coordinatorCoresLimitBox!: azdata.InputBoxComponent;
private coordinatorCoresRequestBox!: azdata.InputBoxComponent;
private coordinatorMemoryLimitBox!: azdata.InputBoxComponent;
@@ -88,12 +81,6 @@ export class PostgresComputeAndStoragePage extends DashboardPage {
CSSStyles: { ...cssStyles.text, 'margin-block-start': '0px', 'margin-block-end': '0px' }
}).component();
const workerNodeslink = this.modelView.modelBuilder.hyperlink().withProps({
label: loc.addingWorkerNodes,
url: 'https://docs.microsoft.com/azure/azure-arc/data/scale-up-down-postgresql-hyperscale-server-group-using-cli',
CSSStyles: { 'margin-block-start': '0px', 'margin-block-end': '0px' }
}).component();
const infoComputeStorage_p3 = this.modelView.modelBuilder.text().withProps({
value: loc.computeAndStorageDescriptionPartThree,
CSSStyles: { ...cssStyles.text, 'margin-block-start': '0px', 'margin-block-end': '0px' }
@@ -125,7 +112,6 @@ export class PostgresComputeAndStoragePage extends DashboardPage {
.withItems([
infoComputeStorage_p1,
infoComputeStorage_p2,
workerNodeslink,
infoComputeStorage_p3,
memoryVCoreslink,
infoComputeStorage_p4,
@@ -165,10 +151,9 @@ export class PostgresComputeAndStoragePage extends DashboardPage {
},
async (_progress, _token): Promise<void> => {
try {
await this._azApi.az.postgres.arcserver.edit(
await this._azApi.az.postgres.serverarc.update(
this._postgresModel.info.name,
{
workers: this.saveArgs.workers,
coresRequest: this.schedulingParamsToEdit(this.saveArgs.coresRequest!),
coresLimit: this.schedulingParamsToEdit(this.saveArgs.coresLimit!),
memoryRequest: this.schedulingParamsToEdit(this.saveArgs.memoryRequest!),
@@ -210,11 +195,6 @@ export class PostgresComputeAndStoragePage extends DashboardPage {
this.discardButton.onDidClick(async () => {
this.discardButton.enabled = false;
try {
this.workerCountBox.value = this.currentConfiguration.workers!.toString();
this.workerCoresRequestBox.value = this.currentConfiguration.coresRequest!.workers;
this.workerCoresLimitBox.value = this.currentConfiguration.coresLimit!.workers;
this.workerMemoryRequestBox.value = this.currentConfiguration.memoryRequest!.workers;
this.workerMemoryLimitBox.value = this.currentConfiguration.memoryLimit!.workers;
this.coordinatorCoresRequestBox.value = this.currentConfiguration.coresRequest!.coordinator;
this.coordinatorCoresLimitBox.value = this.currentConfiguration.coresLimit!.coordinator;
this.coordinatorMemoryRequestBox.value = this.currentConfiguration.memoryRequest!.coordinator;
@@ -234,131 +214,21 @@ export class PostgresComputeAndStoragePage extends DashboardPage {
private schedulingParamsToEdit(arg: RoleSpecifier): string | undefined {
// A comma-separated list of roles with values can be specified in format <role>=<value>.
if (arg.workers && arg.coordinator) {
return `"${arg.workers},${arg.coordinator}"`;
if (arg.coordinator) {
return `"${arg.coordinator}"`;
} else {
return arg.workers ?? arg.coordinator ?? undefined;
return arg.coordinator ?? undefined;
}
}
private initializeConfigurationBoxes(): void {
// Worker node count
this.workerCountBox = this.modelView.modelBuilder.inputBox().withProps({
readOnly: false,
min: 0,
inputType: 'number',
placeHolder: loc.loading,
required: true,
ariaLabel: loc.workerNodeCount,
validationErrorMessage: loc.workerOneNodeValidationMessage
}).withValidation((component) => {
if (component.value === '1') {
return false;
}
return true;
}).component();
this.disposables.push(
this.workerCountBox.onTextChanged(() => {
if (!this.saveValueToEdit(this.workerCountBox, this.currentConfiguration.workers!.toString())) {
this.saveArgs.workers = undefined;
} else {
this.saveArgs.workers = parseInt(this.workerCountBox.value!);
}
})
);
// Worker nodes cores request
this.workerCoresRequestBox = this.modelView.modelBuilder.inputBox().withProps({
readOnly: false,
min: 1,
inputType: 'number',
placeHolder: loc.loading,
ariaLabel: loc.workerCoresRequest
}).component();
this.disposables.push(
this.workerCoresRequestBox.onTextChanged(() => {
if (!(this.saveValueToEdit(this.workerCoresRequestBox, this.currentConfiguration.coresRequest!.workers!))) {
this.saveArgs.coresRequest!.workers = undefined;
} else if (this.workerCoresRequestBox.value === '') {
this.saveArgs.coresRequest!.workers = 'w=';
} else {
this.saveArgs.coresRequest!.workers = `w=${this.workerCoresRequestBox.value}`;
}
})
);
// Worker nodes cores limit
this.workerCoresLimitBox = this.modelView.modelBuilder.inputBox().withProps({
readOnly: false,
min: 1,
inputType: 'number',
placeHolder: loc.loading,
ariaLabel: loc.workerCoresLimit
}).component();
this.disposables.push(
this.workerCoresLimitBox.onTextChanged(() => {
if (!(this.saveValueToEdit(this.workerCoresLimitBox, this.currentConfiguration.coresLimit!.workers!))) {
this.saveArgs.coresLimit!.workers = undefined;
} else if (this.workerCoresLimitBox.value === '') {
this.saveArgs.coresLimit!.workers = 'w=';
} else {
this.saveArgs.coresLimit!.workers = `w=${this.workerCoresLimitBox.value}`;
}
})
);
// Worker nodes memory request
this.workerMemoryRequestBox = this.modelView.modelBuilder.inputBox().withProps({
readOnly: false,
min: 0.25,
inputType: 'number',
placeHolder: loc.loading,
ariaLabel: loc.workerMemoryRequest
}).component();
this.disposables.push(
this.workerMemoryRequestBox.onTextChanged(() => {
if (!(this.saveValueToEdit(this.workerMemoryRequestBox, this.currentConfiguration.memoryRequest!.workers!))) {
this.saveArgs.memoryRequest!.workers = undefined;
} else if (this.workerMemoryRequestBox.value === '') {
this.saveArgs.memoryRequest!.workers = 'w=';
} else {
this.saveArgs.memoryRequest!.workers = `w=${this.workerMemoryRequestBox.value}Gi`;
}
})
);
// Worker nodes memory limit
this.workerMemoryLimitBox = this.modelView.modelBuilder.inputBox().withProps({
readOnly: false,
min: 0.25,
inputType: 'number',
placeHolder: loc.loading,
ariaLabel: loc.workerMemoryLimit
}).component();
this.disposables.push(
this.workerMemoryLimitBox.onTextChanged(() => {
if (!(this.saveValueToEdit(this.workerMemoryLimitBox, this.currentConfiguration.memoryLimit!.workers!))) {
this.saveArgs.memoryLimit!.workers = undefined;
} else if (this.workerMemoryLimitBox.value === '') {
this.saveArgs.memoryLimit!.workers = 'w=';
} else {
this.saveArgs.memoryLimit!.workers = `w=${this.workerMemoryLimitBox.value}Gi`;
}
})
);
// Coordinator node cores request
this.coordinatorCoresRequestBox = this.modelView.modelBuilder.inputBox().withProps({
readOnly: false,
min: 1,
inputType: 'number',
placeHolder: loc.loading,
ariaLabel: loc.coordinatorCoresRequest
ariaLabel: loc.coresRequest
}).component();
this.disposables.push(
@@ -379,7 +249,7 @@ export class PostgresComputeAndStoragePage extends DashboardPage {
min: 1,
inputType: 'number',
placeHolder: loc.loading,
ariaLabel: loc.coordinatorCoresLimit
ariaLabel: loc.coresLimit
}).component();
this.disposables.push(
@@ -400,7 +270,7 @@ export class PostgresComputeAndStoragePage extends DashboardPage {
min: 0.25,
inputType: 'number',
placeHolder: loc.loading,
ariaLabel: loc.coordinatorMemoryRequest
ariaLabel: loc.memoryRequest
}).component();
this.disposables.push(
@@ -421,7 +291,7 @@ export class PostgresComputeAndStoragePage extends DashboardPage {
min: 0.25,
inputType: 'number',
placeHolder: loc.loading,
ariaLabel: loc.coordinatorMemoryLimit
ariaLabel: loc.memoryLimit
}).component();
this.disposables.push(
@@ -439,7 +309,6 @@ export class PostgresComputeAndStoragePage extends DashboardPage {
private createUserInputWorkerSection(): azdata.Component[] {
if (this._postgresModel.configLastUpdated) {
this.editWorkerNodeCount();
this.refreshCoresRequest();
this.refreshCoresLimit();
this.refreshMemoryRequest();
@@ -447,21 +316,7 @@ export class PostgresComputeAndStoragePage extends DashboardPage {
}
return [
this.modelView.modelBuilder.text().withProps({
value: loc.workerNodes,
CSSStyles: { ...cssStyles.title, 'margin-top': '25px' }
}).component(),
this.createWorkerNodesSectionContainer(),
this.createCoresMemorySection(loc.configurationPerNode, loc.workerNodesConfigurationInformation),
this.createConfigurationSectionContainer(loc.coresRequest, this.workerCoresRequestBox),
this.createConfigurationSectionContainer(loc.coresLimit, this.workerCoresLimitBox),
this.createConfigurationSectionContainer(loc.memoryRequest, this.workerMemoryRequestBox),
this.createConfigurationSectionContainer(loc.memoryLimit, this.workerMemoryLimitBox),
this.modelView.modelBuilder.text().withProps({
value: loc.coordinatorNode,
CSSStyles: { ...cssStyles.title, 'margin-top': '25px' }
}).component(),
this.createCoresMemorySection(loc.configuration, loc.coordinatorNodeConfigurationInformation),
this.createCoresMemorySection(loc.configuration),
this.createConfigurationSectionContainer(loc.coresRequest, this.coordinatorCoresRequestBox),
this.createConfigurationSectionContainer(loc.coresLimit, this.coordinatorCoresLimitBox),
this.createConfigurationSectionContainer(loc.memoryRequest, this.coordinatorMemoryRequestBox),
@@ -469,34 +324,6 @@ export class PostgresComputeAndStoragePage extends DashboardPage {
];
}
private createWorkerNodesSectionContainer(): azdata.FlexContainer {
const inputFlex = { flex: '0 1 150px' };
const keyFlex = { flex: `0 1 250px` };
const flexContainer = this.modelView.modelBuilder.flexContainer().withLayout({
flexWrap: 'wrap',
alignItems: 'center'
}).component();
const keyComponent = this.modelView.modelBuilder.text().withProps({
value: loc.workerNodeCount,
requiredIndicator: true,
description: loc.workerNodesInformation,
CSSStyles: { ...cssStyles.text, 'margin-block-start': '0px', 'margin-block-end': '0px' }
}).component();
const keyContainer = this.modelView.modelBuilder.flexContainer().withLayout({ alignItems: 'center' }).component();
keyContainer.addItem(keyComponent, { CSSStyles: { 'margin-right': '0px', 'margin-bottom': '15px' } });
flexContainer.addItem(keyContainer, keyFlex);
const inputContainer = this.modelView.modelBuilder.flexContainer().withLayout({ alignItems: 'center' }).component();
inputContainer.addItem(this.workerCountBox, { CSSStyles: { 'margin-bottom': '15px', 'min-width': '50px', 'max-width': '225px' } });
flexContainer.addItem(inputContainer, inputFlex);
return flexContainer;
}
private createConfigurationSectionContainer(key: string, input: azdata.Component): azdata.FlexContainer {
const inputFlex = { flex: '0 1 150px' };
@@ -550,17 +377,7 @@ export class PostgresComputeAndStoragePage extends DashboardPage {
}
}
private editWorkerNodeCount(): void {
// scale.shards was renamed to scale.workers. Check both for backwards compatibility.
let scale = this._postgresModel.config?.spec.scale;
this.currentConfiguration.workers = scale?.workers ?? scale?.shards ?? 0;
this.workerCountBox.placeHolder = '';
this.workerCountBox.value = this.currentConfiguration.workers.toString();
this.saveArgs.workers = undefined;
}
private createCoresMemorySection(title: string, description: string): azdata.DivContainer {
private createCoresMemorySection(title: string): azdata.DivContainer {
const titleFlex = { flex: `0 1 250px` };
const flexContainer = this.modelView.modelBuilder.flexContainer().withLayout({
@@ -570,12 +387,11 @@ export class PostgresComputeAndStoragePage extends DashboardPage {
const titleComponent = this.modelView.modelBuilder.text().withProps({
value: title,
description: description,
CSSStyles: { ...cssStyles.title, 'font-weight': 'bold', 'margin-block-start': '0px', 'margin-block-end': '0px' }
}).component();
const titleContainer = this.modelView.modelBuilder.flexContainer().withLayout({ alignItems: 'center' }).component();
titleContainer.addItem(titleComponent, { CSSStyles: { 'margin-right': '0px', 'margin-bottom': '15px' } });
titleContainer.addItem(titleComponent, { CSSStyles: { 'margin-right': '0px', 'margin-bottom': '15px', 'margin-top': '15px' } });
flexContainer.addItem(titleContainer, titleFlex);
@@ -586,15 +402,6 @@ export class PostgresComputeAndStoragePage extends DashboardPage {
}
private refreshCoresRequest(): void {
// Workers
let workersCR = this._postgresModel.config?.spec.scheduling?.roles?.worker?.resources?.requests?.cpu ?? this._postgresModel.config?.spec.scheduling?.default?.resources?.requests?.cpu;
if (!workersCR) {
workersCR = '';
}
this.workerCoresRequestBox.placeHolder = '';
this.workerCoresRequestBox.value = workersCR;
// Coordinator
let coordinatorCR = this._postgresModel.config?.spec.scheduling?.roles?.coordinator?.resources?.requests?.cpu ?? this._postgresModel.config?.spec.scheduling?.default?.resources?.requests?.cpu;
if (!coordinatorCR) {
@@ -606,7 +413,6 @@ export class PostgresComputeAndStoragePage extends DashboardPage {
// Update saved current configuration
this.currentConfiguration.coresRequest = {
workers: workersCR,
coordinator: coordinatorCR
};
@@ -615,15 +421,6 @@ export class PostgresComputeAndStoragePage extends DashboardPage {
}
private refreshCoresLimit(): void {
// Workers
let workersCL = this._postgresModel.config?.spec.scheduling?.roles?.worker?.resources?.limits?.cpu ?? this._postgresModel.config?.spec.scheduling?.default?.resources?.limits?.cpu;
if (!workersCL) {
workersCL = '';
}
this.workerCoresLimitBox.placeHolder = '';
this.workerCoresLimitBox.value = workersCL;
// Coordinator
let coordinatorCL = this._postgresModel.config?.spec.scheduling?.roles?.coordinator?.resources?.limits?.cpu ?? this._postgresModel.config?.spec.scheduling?.default?.resources?.limits?.cpu;
if (!coordinatorCL) {
@@ -635,7 +432,6 @@ export class PostgresComputeAndStoragePage extends DashboardPage {
// Update saved current configuration
this.currentConfiguration.coresLimit = {
workers: workersCL,
coordinator: coordinatorCL
};
@@ -644,16 +440,6 @@ export class PostgresComputeAndStoragePage extends DashboardPage {
}
private refreshMemoryRequest(): void {
// Workers
let currentWorkersMemoryRequest = this._postgresModel.config?.spec.scheduling?.roles?.worker?.resources?.requests?.memory ?? this._postgresModel.config?.spec.scheduling?.default?.resources?.requests?.memory;
let workersMR = '';
if (currentWorkersMemoryRequest) {
workersMR = convertToGibibyteString(currentWorkersMemoryRequest);
}
this.workerMemoryRequestBox.placeHolder = '';
this.workerMemoryRequestBox.value = workersMR;
// Coordinator
let currentCoordinatorMemoryRequest = this._postgresModel.config?.spec.scheduling?.roles?.coordinator?.resources?.requests?.memory ?? this._postgresModel.config?.spec.scheduling?.default?.resources?.requests?.memory;
let coordinatorMR = '';
@@ -666,7 +452,6 @@ export class PostgresComputeAndStoragePage extends DashboardPage {
// Update saved current configuration
this.currentConfiguration.memoryRequest = {
workers: workersMR,
coordinator: coordinatorMR
};
@@ -675,16 +460,6 @@ export class PostgresComputeAndStoragePage extends DashboardPage {
}
private refreshMemoryLimit(): void {
// Workers
let currentWorkersMemoryLimit = this._postgresModel.config?.spec.scheduling?.roles?.worker?.resources?.limits?.memory ?? this._postgresModel.config?.spec.scheduling?.default?.resources?.limits?.memory;
let workersML = '';
if (currentWorkersMemoryLimit) {
workersML = convertToGibibyteString(currentWorkersMemoryLimit);
}
this.workerMemoryLimitBox.placeHolder = '';
this.workerMemoryLimitBox.value = workersML;
// Coordinator
let currentCoordinatorMemoryLimit = this._postgresModel.config?.spec.scheduling?.roles?.coordinator?.resources?.limits?.memory ?? this._postgresModel.config?.spec.scheduling?.default?.resources?.limits?.memory;
let coordinatorML = '';
@@ -697,7 +472,6 @@ export class PostgresComputeAndStoragePage extends DashboardPage {
// Update saved current configuration
this.currentConfiguration.memoryLimit = {
workers: workersML,
coordinator: coordinatorML
};
@@ -706,7 +480,6 @@ export class PostgresComputeAndStoragePage extends DashboardPage {
}
private handleServiceUpdated(): void {
this.editWorkerNodeCount();
this.refreshCoresRequest();
this.refreshCoresLimit();
this.refreshMemoryRequest();

View File

@@ -35,28 +35,4 @@ export class PostgresCoordinatorNodeParametersPage extends PostgresParametersPag
return this._postgresModel.coordinatorNodeEngineSettings;
}
protected async saveParameterEdits(engineSettings: string): Promise<void> {
await this._azApi.az.postgres.arcserver.edit(
this._postgresModel.info.name,
{ coordinatorEngineSettings: engineSettings },
this._postgresModel.controllerModel.info.namespace,
this._postgresModel.controllerModel.azAdditionalEnvVars);
}
protected async resetAllParameters(): Promise<void> {
await this._azApi.az.postgres.arcserver.edit(
this._postgresModel.info.name,
{ coordinatorEngineSettings: `''`, replaceEngineSettings: true },
this._postgresModel.controllerModel.info.namespace,
this._postgresModel.controllerModel.azAdditionalEnvVars);
}
protected async resetParameter(parameterName: string): Promise<void> {
await this._azApi.az.postgres.arcserver.edit(
this._postgresModel.info.name,
{ coordinatorEngineSettings: parameterName + '=' },
this._postgresModel.controllerModel.info.namespace,
this._postgresModel.controllerModel.azAdditionalEnvVars);
}
}

View File

@@ -3,7 +3,6 @@
* 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 { ControllerModel } from '../../../models/controllerModel';
@@ -11,17 +10,11 @@ import { PostgresModel } from '../../../models/postgresModel';
import { PostgresOverviewPage } from './postgresOverviewPage';
import { PostgresConnectionStringsPage } from './postgresConnectionStringsPage';
import { Dashboard } from '../../components/dashboard';
import { PostgresDiagnoseAndSolveProblemsPage } from './postgresDiagnoseAndSolveProblemsPage';
import { PostgresSupportRequestPage } from './postgresSupportRequestPage';
import { PostgresComputeAndStoragePage } from './postgresComputeAndStoragePage';
import { PostgresWorkerNodeParametersPage } from './postgresWorkerNodeParametersPage';
import { PostgresPropertiesPage } from './postgresPropertiesPage';
import { PostgresResourceHealthPage } from './postgresResourceHealthPage';
import { PostgresCoordinatorNodeParametersPage } from './postgresCoordinatorNodeParametersPage';
import { PostgresExtensionsPage } from './postgresExtensionsPage';
export class PostgresDashboard extends Dashboard {
constructor(private _context: vscode.ExtensionContext, private _controllerModel: ControllerModel, private _postgresModel: PostgresModel) {
constructor(private _controllerModel: ControllerModel, private _postgresModel: PostgresModel) {
super(loc.postgresDashboard(_postgresModel.info.name), 'ArcPgDashboard');
}
@@ -35,34 +28,22 @@ export class PostgresDashboard extends Dashboard {
protected async registerTabs(modelView: azdata.ModelView): Promise<(azdata.DashboardTab | azdata.DashboardTabGroup)[]> {
const overviewPage = new PostgresOverviewPage(modelView, this.dashboard, this._controllerModel, this._postgresModel);
const extensionsPage = new PostgresExtensionsPage(modelView, this.dashboard, this._postgresModel);
const connectionStringsPage = new PostgresConnectionStringsPage(modelView, this.dashboard, this._postgresModel);
const computeAndStoragePage = new PostgresComputeAndStoragePage(modelView, this.dashboard, this._postgresModel);
const propertiesPage = new PostgresPropertiesPage(modelView, this.dashboard, this._controllerModel, this._postgresModel);
const coordinatorNodeParametersPage = new PostgresCoordinatorNodeParametersPage(modelView, this.dashboard, this._postgresModel);
const workerNodeParametersPage = new PostgresWorkerNodeParametersPage(modelView, this.dashboard, this._postgresModel);
const diagnoseAndSolveProblemsPage = new PostgresDiagnoseAndSolveProblemsPage(modelView, this.dashboard, this._context, this._controllerModel, this._postgresModel);
const supportRequestPage = new PostgresSupportRequestPage(modelView, this.dashboard, this._controllerModel, this._postgresModel);
const resourceHealthPage = new PostgresResourceHealthPage(modelView, this.dashboard, this._postgresModel);
return [
overviewPage.tab,
{
title: loc.settings,
tabs: [
propertiesPage.tab,
extensionsPage.tab,
connectionStringsPage.tab,
computeAndStoragePage.tab,
coordinatorNodeParametersPage.tab,
workerNodeParametersPage.tab
computeAndStoragePage.tab
]
},
{
title: loc.supportAndTroubleshooting,
tabs: [
resourceHealthPage.tab,
diagnoseAndSolveProblemsPage.tab,
supportRequestPage.tab
]
}

View File

@@ -129,7 +129,6 @@ export class PostgresExtensionsPage extends DashboardPage {
try {
this.addExtensionsButton.enabled = false;
this.dropExtensionsButton.enabled = false;
let extensionList = this.extensionNames.length ? this.extensionNames.join() + ',' + extArg : extArg;
await vscode.window.withProgress(
{
location: vscode.ProgressLocation.Notification,
@@ -138,11 +137,9 @@ export class PostgresExtensionsPage extends DashboardPage {
},
async (_progress, _token): Promise<void> => {
await this._azApi.az.postgres.arcserver.edit(
await this._azApi.az.postgres.serverarc.update(
this._postgresModel.info.name,
{
extensions: extensionList
},
{},
this._postgresModel.controllerModel.info.namespace,
this._postgresModel.controllerModel.azAdditionalEnvVars);
@@ -272,11 +269,9 @@ export class PostgresExtensionsPage extends DashboardPage {
cancellable: false
},
async (_progress, _token): Promise<void> => {
await this._azApi.az.postgres.arcserver.edit(
await this._azApi.az.postgres.serverarc.update(
this._postgresModel.info.name,
{
extensions: this.extensionNames.join()
},
{},
this._postgresModel.controllerModel.info.namespace,
this._postgresModel.controllerModel.azAdditionalEnvVars
);

View File

@@ -7,16 +7,15 @@ import * as vscode from 'vscode';
import * as azdata from 'azdata';
import * as azExt from 'az-ext';
import * as loc from '../../../localizedConstants';
import { IconPathHelper, cssStyles, iconSize } from '../../../constants';
import { IconPathHelper, cssStyles } from '../../../constants';
import { DashboardPage } from '../../components/dashboardPage';
import { ControllerModel } from '../../../models/controllerModel';
import { PostgresModel } from '../../../models/postgresModel';
import { promptAndConfirmPassword, promptForInstanceDeletion } from '../../../common/utils';
import { promptForInstanceDeletion } from '../../../common/utils';
import { ResourceType } from 'arc';
export type PodStatusModel = {
podName: azdata.Component,
type: string,
status: string
};
@@ -32,9 +31,6 @@ export class PostgresOverviewPage extends DashboardPage {
private grafanaLink!: azdata.HyperlinkComponent;
private deleteButton!: azdata.ButtonComponent;
private podStatusTable!: azdata.DeclarativeTableComponent;
private podStatusData: PodStatusModel[] = [];
private readonly _azApi: azExt.IExtension;
constructor(modelView: azdata.ModelView, dashboard: azdata.window.ModelViewDashboard, private _controllerModel: ControllerModel, private _postgresModel: PostgresModel) {
@@ -147,99 +143,11 @@ export class PostgresOverviewPage extends DashboardPage {
}).component();
content.addItem(endpointsTable);
// Server Group Nodes
content.addItem(this.modelView.modelBuilder.text().withProps({
value: loc.serverGroupNodes,
CSSStyles: titleCSS,
headingLevel: 1
}).component());
this.podStatusTable = this.modelView.modelBuilder.declarativeTable().withProps({
width: '100%',
ariaLabel: loc.serverGroupNodes,
columns: [
{
displayName: loc.name,
valueType: azdata.DeclarativeDataType.component,
isReadOnly: true,
width: '35%',
headerCssStyles: cssStyles.tableHeader,
rowCssStyles: {
...cssStyles.tableRow,
'overflow': 'hidden',
'text-overflow': 'ellipsis',
'white-space': 'nowrap',
'max-width': '0'
}
},
{
displayName: loc.type,
valueType: azdata.DeclarativeDataType.string,
isReadOnly: true,
width: '35%',
headerCssStyles: cssStyles.tableHeader,
rowCssStyles: cssStyles.tableRow
},
{
displayName: loc.status,
valueType: azdata.DeclarativeDataType.string,
isReadOnly: true,
width: '30%',
headerCssStyles: cssStyles.tableHeader,
rowCssStyles: cssStyles.tableRow
}
],
dataValues: this.createPodStatusDataValues()
}).component();
this.serverGroupNodesLoading = this.modelView.modelBuilder.loadingComponent()
.withItem(this.podStatusTable)
.withProps({
loading: !this._postgresModel.configLastUpdated
}).component();
this.refreshServerNodes();
content.addItem(this.serverGroupNodesLoading, { CSSStyles: cssStyles.text });
this.initialized = true;
return root;
}
protected get toolbarContainer(): azdata.ToolbarContainer {
// Reset password
const resetPasswordButton = this.modelView.modelBuilder.button().withProps({
label: loc.resetPassword,
iconPath: IconPathHelper.edit
}).component();
this.disposables.push(
resetPasswordButton.onDidClick(async () => {
resetPasswordButton.enabled = false;
try {
const password = await promptAndConfirmPassword(input => !input ? loc.enterANonEmptyPassword : '');
if (password) {
await this._azApi.az.postgres.arcserver.edit(
this._postgresModel.info.name,
{
adminPassword: true,
noWait: true
},
this._postgresModel.controllerModel.info.namespace,
Object.assign({ 'AZDATA_PASSWORD': password }, this._controllerModel.azAdditionalEnvVars));
vscode.window.showInformationMessage(loc.passwordReset);
}
} catch (error) {
vscode.window.showErrorMessage(loc.passwordResetFailed(error));
} finally {
resetPasswordButton.enabled = true;
}
}));
// Delete service
this.deleteButton = this.modelView.modelBuilder.button().withProps({
label: loc.deleteText,
@@ -258,7 +166,7 @@ export class PostgresOverviewPage extends DashboardPage {
cancellable: false
},
async (_progress, _token) => {
return await this._azApi.az.postgres.arcserver.delete(this._postgresModel.info.name, this._postgresModel.controllerModel.info.namespace, this._controllerModel.azAdditionalEnvVars);
return await this._azApi.az.postgres.serverarc.delete(this._postgresModel.info.name, this._postgresModel.controllerModel.info.namespace, this._controllerModel.azAdditionalEnvVars);
}
);
await this._controllerModel.refreshTreeNode();
@@ -323,7 +231,6 @@ export class PostgresOverviewPage extends DashboardPage {
}));
return this.modelView.modelBuilder.toolbarContainer().withToolbarItems([
{ component: resetPasswordButton },
{ component: this.deleteButton },
{ component: refreshButton, toolbarSeparatorAfter: true },
{ component: openInAzurePortalButton }
@@ -341,70 +248,10 @@ export class PostgresOverviewPage extends DashboardPage {
{ displayName: loc.namespace, value: this._postgresModel.config?.metadata.namespace || '-' },
{ displayName: loc.subscriptionId, value: azure?.subscription || '-' },
{ displayName: loc.externalEndpoint, value: this._postgresModel.config?.status.primaryEndpoint || '-' },
{ displayName: loc.status, value: status ? `${status.state} (${status.readyPods} ${loc.podsReady})` : '-' },
{ displayName: loc.postgresAdminUsername, value: 'postgres' },
{ displayName: loc.postgresVersion, value: this._postgresModel.engineVersion ?? '-' },
{ displayName: loc.nodeConfiguration, value: this._postgresModel.scaleConfiguration || '-' }
{ displayName: loc.status, value: status ? `${status.state} (${status.readyPods} ${loc.podsReady})` : '-' }
];
}
private getPodStatus(): PodStatusModel[] {
let podModels: PodStatusModel[] = [];
const podStatus = this._postgresModel.config?.status.podsStatus;
podStatus?.forEach((p: { conditions: any[]; name: any; role: string; }) => {
// If a condition of the pod has a status of False, pod is not Ready
const status = p.conditions.find(c => c.status === 'False') ? loc.notReady : loc.ready;
const podLabelContainer = this.modelView.modelBuilder.flexContainer().withProps({
CSSStyles: { 'alignItems': 'center', 'height': '15px' }
}).component();
const imageComponent = this.modelView.modelBuilder.image().withProps({
iconPath: IconPathHelper.postgres,
width: iconSize,
height: iconSize,
iconHeight: '15px',
iconWidth: '15px'
}).component();
let podLabel = this.modelView.modelBuilder.text().withProps({
value: p.name,
}).component();
if (p.role.toUpperCase() === loc.worker.toUpperCase()) {
podLabelContainer.addItem(imageComponent, { CSSStyles: { 'margin-left': '15px', 'margin-right': '0px' } });
podLabelContainer.addItem(podLabel);
let pod: PodStatusModel = {
podName: podLabelContainer,
type: loc.worker,
status: status
};
podModels.push(pod);
} else {
podLabelContainer.addItem(imageComponent, { CSSStyles: { 'margin-right': '0px' } });
podLabelContainer.addItem(podLabel);
let pod: PodStatusModel = {
podName: podLabelContainer,
type: loc.coordinator,
status: status
};
podModels.unshift(pod);
}
});
return podModels;
}
private createPodStatusDataValues(): azdata.DeclarativeTableCellValue[][] {
let podDataValue: (string | azdata.Component)[][] = this.podStatusData.map(p => [p.podName, p.type, p.status]);
return podDataValue.map(p => {
return p.map((value): azdata.DeclarativeTableCellValue => {
return { value: value };
});
});
}
private refreshDashboardLinks(): void {
if (this._postgresModel.config) {
const kibanaUrl = this._postgresModel.config.status.logSearchDashboard ?? '';
@@ -419,14 +266,6 @@ export class PostgresOverviewPage extends DashboardPage {
}
}
private refreshServerNodes(): void {
if (this._postgresModel.config) {
this.podStatusData = this.getPodStatus();
this.podStatusTable.setDataValues(this.createPodStatusDataValues());
this.serverGroupNodesLoading.loading = false;
}
}
private handleRegistrationsUpdated() {
this.properties!.propertyItems = this.getProperties();
this.propertiesLoading!.loading = false;
@@ -436,6 +275,5 @@ export class PostgresOverviewPage extends DashboardPage {
this.properties!.propertyItems = this.getProperties();
this.propertiesLoading!.loading = false;
this.refreshDashboardLinks();
this.refreshServerNodes();
}
}

View File

@@ -151,7 +151,6 @@ export abstract class PostgresParametersPage extends DashboardPage {
this.parameterUpdates.forEach((value, key) => {
engineSettings.push(`${key}="${value}"`);
});
await this.saveParameterEdits(engineSettings.toString());
} catch (err) {
// If an error occurs while editing the instance then re-enable the save button since
// the edit wasn't successfully applied
@@ -224,7 +223,6 @@ export abstract class PostgresParametersPage extends DashboardPage {
},
async (_progress, _token): Promise<void> => {
try {
await this.resetAllParameters();
} catch (err) {
// If an error occurs while resetting the instance then re-enable the reset button since
// the edit wasn't successfully applied
@@ -425,7 +423,6 @@ export abstract class PostgresParametersPage extends DashboardPage {
cancellable: false
},
async (_progress, _token): Promise<void> => {
await this.resetParameter(engineSetting.parameterName!);
try {
await this.callGetEngineSettings();
} catch (error) {
@@ -649,10 +646,4 @@ export abstract class PostgresParametersPage extends DashboardPage {
await this.callGetEngineSettings();
}
}
protected abstract saveParameterEdits(engineSettings: string): Promise<void>;
protected abstract resetAllParameters(): Promise<void>;
protected abstract resetParameter(parameterName: string): Promise<void>;
}

View File

@@ -103,9 +103,7 @@ export class PostgresPropertiesPage extends DashboardPage {
new InputKeyValue(this.modelView.modelBuilder, loc.subscriptionId, this._controllerModel.controllerConfig?.spec.settings.azure.subscription ?? ''),
new TextKeyValue(this.modelView.modelBuilder, loc.resourceGroup, this._controllerModel.controllerConfig?.spec.settings.azure.resourceGroup ?? ''),
new LinkKeyValue(this.modelView.modelBuilder, loc.dataController, this._controllerModel.controllerConfig?.metadata.name ?? '', () => controllerDashboard.showDashboard()),
new TextKeyValue(this.modelView.modelBuilder, loc.nodeConfiguration, this._postgresModel.scaleConfiguration ?? ''),
new TextKeyValue(this.modelView.modelBuilder, loc.status, status ? `${status.state} (${status.readyPods} ${loc.podsReady})` : loc.unknown),
new TextKeyValue(this.modelView.modelBuilder, loc.postgresVersion, this._postgresModel.engineVersion ?? ''),
new TextKeyValue(this.modelView.modelBuilder, loc.status, status ? `${status.state} (${status.readyPods} ${loc.podsReady})` : loc.unknown)
];
}

View File

@@ -36,27 +36,4 @@ export class PostgresWorkerNodeParametersPage extends PostgresParametersPage {
return this._postgresModel.workerNodesEngineSettings;
}
protected async saveParameterEdits(engineSettings: string): Promise<void> {
await this._azApi.az.postgres.arcserver.edit(
this._postgresModel.info.name,
{ workerEngineSettings: engineSettings },
this._postgresModel.controllerModel.info.namespace,
this._postgresModel.controllerModel.azAdditionalEnvVars);
}
protected async resetAllParameters(): Promise<void> {
await this._azApi.az.postgres.arcserver.edit(
this._postgresModel.info.name,
{ workerEngineSettings: `''`, replaceEngineSettings: true },
this._postgresModel.controllerModel.info.namespace,
this._postgresModel.controllerModel.azAdditionalEnvVars);
}
protected async resetParameter(parameterName: string): Promise<void> {
await this._azApi.az.postgres.arcserver.edit(
this._postgresModel.info.name,
{ workerEngineSettings: parameterName + '=' },
this._postgresModel.controllerModel.info.namespace,
this._postgresModel.controllerModel.azAdditionalEnvVars);
}
}