mirror of
https://github.com/ckaczor/azuredatastudio.git
synced 2026-03-09 12:01:37 -04:00
* 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>
120 lines
4.8 KiB
TypeScript
120 lines
4.8 KiB
TypeScript
/*---------------------------------------------------------------------------------------------
|
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
* 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 { KeyValueContainer, KeyValue, InputKeyValue, TextKeyValue, LinkKeyValue } from '../../components/keyValueContainer';
|
|
import { DashboardPage } from '../../components/dashboardPage';
|
|
import { ControllerModel } from '../../../models/controllerModel';
|
|
import { PostgresModel } from '../../../models/postgresModel';
|
|
import { ControllerDashboard } from '../controller/controllerDashboard';
|
|
|
|
export class PostgresPropertiesPage extends DashboardPage {
|
|
private loading?: azdata.LoadingComponent;
|
|
private keyValueContainer?: KeyValueContainer;
|
|
|
|
constructor(modelView: azdata.ModelView, dashboard: azdata.window.ModelViewDashboard, private _controllerModel: ControllerModel, private _postgresModel: PostgresModel) {
|
|
super(modelView, dashboard);
|
|
|
|
this.disposables.push(this._postgresModel.onConfigUpdated(
|
|
() => this.eventuallyRunOnInitialized(() => this.handleServiceUpdated())));
|
|
|
|
this.disposables.push(this._controllerModel.onRegistrationsUpdated(
|
|
() => this.eventuallyRunOnInitialized(() => this.handleRegistrationsUpdated())));
|
|
}
|
|
|
|
protected get title(): string {
|
|
return loc.properties;
|
|
}
|
|
|
|
protected get id(): string {
|
|
return 'postgres-properties';
|
|
}
|
|
|
|
protected get icon(): { dark: string; light: string; } {
|
|
return IconPathHelper.properties;
|
|
}
|
|
|
|
protected get container(): azdata.Component {
|
|
const root = this.modelView.modelBuilder.divContainer().component();
|
|
const content = this.modelView.modelBuilder.divContainer().component();
|
|
root.addItem(content, { CSSStyles: { 'margin': '20px' } });
|
|
|
|
content.addItem(this.modelView.modelBuilder.text().withProps({
|
|
value: loc.properties,
|
|
CSSStyles: { ...cssStyles.title, 'margin-bottom': '25px' }
|
|
}).component());
|
|
|
|
this.keyValueContainer = new KeyValueContainer(this.modelView.modelBuilder, this.getProperties());
|
|
this.keyValueContainer.container.updateCssStyles({ 'max-width': '750px' });
|
|
this.disposables.push(this.keyValueContainer);
|
|
|
|
this.loading = this.modelView.modelBuilder.loadingComponent()
|
|
.withItem(this.keyValueContainer.container)
|
|
.withProps({
|
|
loading: !this._postgresModel.configLastUpdated && !this._controllerModel.registrationsLastUpdated
|
|
}).component();
|
|
|
|
content.addItem(this.loading);
|
|
this.initialized = true;
|
|
return root;
|
|
}
|
|
|
|
protected get toolbarContainer(): azdata.ToolbarContainer {
|
|
const refreshButton = this.modelView.modelBuilder.button().withProps({
|
|
label: loc.refresh,
|
|
iconPath: IconPathHelper.refresh
|
|
}).component();
|
|
|
|
this.disposables.push(
|
|
refreshButton.onDidClick(async () => {
|
|
refreshButton.enabled = false;
|
|
try {
|
|
this.loading!.loading = true;
|
|
await Promise.all([
|
|
this._postgresModel.refresh(),
|
|
this._controllerModel.refresh(false, this._controllerModel.info.namespace)
|
|
]);
|
|
} catch (error) {
|
|
vscode.window.showErrorMessage(loc.refreshFailed(error));
|
|
}
|
|
finally {
|
|
refreshButton.enabled = true;
|
|
}
|
|
}));
|
|
|
|
return this.modelView.modelBuilder.toolbarContainer().withToolbarItems([
|
|
{ component: refreshButton }
|
|
]).component();
|
|
}
|
|
|
|
private getProperties(): KeyValue[] {
|
|
const endpoint = this._postgresModel.endpoint;
|
|
const status = this._postgresModel.config?.status;
|
|
const controllerDashboard = new ControllerDashboard(this._controllerModel);
|
|
|
|
return [
|
|
new InputKeyValue(this.modelView.modelBuilder, loc.coordinatorEndpoint, endpoint ? `postgresql://postgres@${endpoint.ip}:${endpoint.port}` : ''),
|
|
new InputKeyValue(this.modelView.modelBuilder, loc.postgresAdminUsername, 'postgres'),
|
|
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.status, status ? `${status.state} (${status.readyPods} ${loc.podsReady})` : loc.unknown)
|
|
];
|
|
}
|
|
|
|
private handleRegistrationsUpdated() {
|
|
this.keyValueContainer?.refresh(this.getProperties());
|
|
this.loading!.loading = false;
|
|
}
|
|
|
|
private handleServiceUpdated() {
|
|
this.keyValueContainer?.refresh(this.getProperties());
|
|
this.loading!.loading = false;
|
|
}
|
|
}
|