mirror of
https://github.com/ckaczor/azuredatastudio.git
synced 2026-02-10 18:22:34 -05:00
Fixes for Arc Postgres (#11012)
This commit is contained in:
@@ -1 +1,21 @@
|
||||
<svg id="fc890127-728b-4ac0-b5da-86cdfc191e86" xmlns="http://www.w3.org/2000/svg" width="18" height="18" viewBox="0 0 18 18"><defs><linearGradient id="a28dee20-4c71-46b5-b957-804c67da725a" x1="2.44" y1="10.67" x2="15.27" y2="10.67" gradientTransform="translate(0.14 -0.5) rotate(-0.01)" gradientUnits="userSpaceOnUse"><stop offset="0" stop-color="#005ba1"/><stop offset="0.07" stop-color="#0060a9"/><stop offset="0.36" stop-color="#0071c8"/><stop offset="0.52" stop-color="#0078d4"/><stop offset="0.64" stop-color="#0074cd"/><stop offset="0.82" stop-color="#006abb"/><stop offset="1" stop-color="#005ba1"/></linearGradient></defs><title>Icon-databases-131</title><path d="M9,5.14c-3.54,0-6.41-1-6.41-2.32V15.18c0,1.27,2.82,2.3,6.32,2.32H9c3.54,0,6.41-1,6.41-2.32V2.82C15.41,4.1,12.54,5.14,9,5.14Z" fill="url(#a28dee20-4c71-46b5-b957-804c67da725a)"/><path d="M15.41,2.82c0,1.28-2.87,2.32-6.41,2.32s-6.41-1-6.41-2.32S5.46.5,9,.5s6.41,1,6.41,2.32" fill="#e8e8e8"/><path d="M13.91,2.63c0,.82-2.2,1.48-4.91,1.48S4.08,3.45,4.08,2.64,6.28,1.16,9,1.16s4.91.66,4.91,1.47" fill="#50e6ff"/><path d="M9,3a11.65,11.65,0,0,0-3.9.57A11.53,11.53,0,0,0,9,4.11a11.47,11.47,0,0,0,3.89-.58A11.93,11.93,0,0,0,9,3Z" fill="#198ab3"/><path d="M12,9c0,.08,0,.24,0,.42a5.12,5.12,0,0,0-.08.63c0,.12,0,.3.05.46s0,.27,0,.36a1.68,1.68,0,0,1-.25.86.43.43,0,0,0,0,.07l.1.12a10.55,10.55,0,0,0,1.06-2.38h0c.28-.95.31-1.63.09-1.92a2.58,2.58,0,0,0-2.68-.86,3.29,3.29,0,0,1,.91.67A2.28,2.28,0,0,1,12,9Zm-.31.08a1.15,1.15,0,0,0-.79.09c-.29.18-.2.55,0,1a7.77,7.77,0,0,0,.35.85l.09.16h0c.05.08.08.15.11.2l.08.13a1.28,1.28,0,0,0,.18-.65,2.86,2.86,0,0,0,0-.33c0-.17,0-.36-.05-.49a6.1,6.1,0,0,1,.08-.69C11.71,9.24,11.72,9.13,11.73,9.05Zm-.3.41a.4.4,0,0,1-.18.1h0a.33.33,0,0,1-.14,0A.23.23,0,0,1,11,9.4h0c0-.07.11-.13.24-.15h.19s.09,0,.09.08A.2.2,0,0,1,11.43,9.46Zm-4.69.89c0-.07,0-.13,0-.17a1,1,0,0,0,0-.17,5.55,5.55,0,0,1,0-1A5.22,5.22,0,0,1,7,7.94,2.41,2.41,0,0,1,7.58,7,4.78,4.78,0,0,0,6.23,6.8a1.87,1.87,0,0,0-1.1.3A2,2,0,0,0,4.5,8.92,12.27,12.27,0,0,0,5,11.16c.34,1.14.73,1.84,1.07,1.95h0c.15.05.31,0,.47-.21.28-.34.54-.63.69-.8A1.88,1.88,0,0,1,6.74,10.35Zm.26.4a2.18,2.18,0,0,0,.06.56,1.5,1.5,0,0,0,.26.44,1.07,1.07,0,0,0,.35.25,1.09,1.09,0,0,0,.39.08c0-.17.14-.38.23-.6a4.35,4.35,0,0,0,.21-.59,6.61,6.61,0,0,0,0-1.11c0-.09,0-.19-.06-.3a.45.45,0,0,0-.12-.27l0,0A.66.66,0,0,0,8,9.08H7.8a1.56,1.56,0,0,0-.48.14A2,2,0,0,0,7,9.41v.11c0,.2,0,.41,0,.61v0a.86.86,0,0,1,0,.15l0,.39H7Zm.66-1.34,0,0a.46.46,0,0,1,.28,0,.6.6,0,0,1,.19.06c.09,0,.1.11.09.14h0a.37.37,0,0,1-.12.13A.3.3,0,0,1,8,9.73h0a.34.34,0,0,1-.28-.28Zm.74,3a.23.23,0,0,0-.13.06l-.14.17c-.17.21-.24.28-.73.38a.52.52,0,0,0-.26.1.58.58,0,0,0,.24.11,1.18,1.18,0,0,0,.72,0A1.7,1.7,0,0,0,8.45,13a.61.61,0,0,0,.2-.31.36.36,0,0,0-.1-.28A.15.15,0,0,0,8.4,12.39Zm4.61,0a1.63,1.63,0,0,1-1.13,0,.22.22,0,0,0-.14,0,.3.3,0,0,0-.17.14,1.09,1.09,0,0,0,0,.31,1.8,1.8,0,0,0,1.1-.1,1.36,1.36,0,0,0,.48-.34Zm-2.4-2.14c-.14-.41-.34-1,.18-1.36a1.35,1.35,0,0,1,.89-.15A3.18,3.18,0,0,0,11,7.64l-.1-.1-.06-.06h0a.34.34,0,0,0-.06-.06l0,0,0,0A2.34,2.34,0,0,0,10.11,7,2.63,2.63,0,0,0,9,6.78a1.52,1.52,0,0,0-.7.11A1.77,1.77,0,0,0,8,7a2.1,2.1,0,0,0-.74,1,5.84,5.84,0,0,0-.21,1,1.66,1.66,0,0,1,1-.23.84.84,0,0,1,.77.91,7.26,7.26,0,0,1,0,1.27,3.87,3.87,0,0,1-.23.63c-.06.17-.14.35-.18.49a.5.5,0,0,1,.38.14.66.66,0,0,1,.19.53H9c0,.08,0,.16,0,.24a6.55,6.55,0,0,0,.24,2.44.54.54,0,0,0,.24.21.6.6,0,0,0,.31.1,1.3,1.3,0,0,0,1-.34,1.05,1.05,0,0,0,.29-.66c.07-.45.22-1.7.24-2h0a.72.72,0,0,1,.09-.44.63.63,0,0,1,.27-.24A5.36,5.36,0,0,1,10.61,10.24Z" fill="#f2f2f2"/></svg>
|
||||
<svg xmlns="http://www.w3.org/2000/svg" width="18" height="18" viewBox="0 0 18 18">
|
||||
<defs>
|
||||
<linearGradient id="b1fb58c5-adbd-490c-9397-f63a4aec6742" x1="2.94" y1="8.438" x2="14.1" y2="8.438" gradientUnits="userSpaceOnUse">
|
||||
<stop offset="0" stop-color="#005ba1"/>
|
||||
<stop offset="1" stop-color="#005ba1"/>
|
||||
</linearGradient>
|
||||
</defs>
|
||||
<g id="b51be867-49c1-4050-afa7-3520ffba5e24">
|
||||
<path d="M17.549,15.146c-.16.7-1.035,1.391-2.617,1.929a21.585,21.585,0,0,1-12.125.017C1.35,16.578.564,15.922.441,15.25c-.022-.118,0-1.966,0-1.966l17.136-.16S17.569,15.061,17.549,15.146Z" fill="#5ea0ef"/>
|
||||
<ellipse cx="9.001" cy="13.246" rx="8.576" ry="2.965" transform="translate(-0.133 0.091) rotate(-0.575)" fill="#50e6ff"/>
|
||||
<path d="M8.52,4.067c-3.082,0-5.58-.87-5.58-2.019v10.76c0,1.106,2.455,2,5.5,2.02H8.52c3.082,0,5.58-.871,5.58-2.02V2.048C14.1,3.171,11.6,4.067,8.52,4.067Z" fill="url(#b1fb58c5-adbd-490c-9397-f63a4aec6742)"/>
|
||||
<path d="M14.1,2.048c0,1.123-2.5,2.019-5.58,2.019S2.94,3.2,2.94,2.048,5.438.028,8.52.028,14.1.9,14.1,2.048" fill="#e8e8e8"/>
|
||||
<path d="M12.8,1.882c0,.714-1.924,1.289-4.283,1.289S4.237,2.594,4.237,1.882,6.161.6,8.52.6,12.8,1.177,12.8,1.886" fill="#50e6ff"/>
|
||||
<path d="M8.52,2.2a10.054,10.054,0,0,0-3.386.5,9.941,9.941,0,0,0,3.386.472,9.684,9.684,0,0,0,3.386-.5A10.328,10.328,0,0,0,8.52,2.2Z" fill="#198ab3"/>
|
||||
<path d="M11.308,7.494v.365a4.627,4.627,0,0,0-.069.549,1.383,1.383,0,0,0,.043.4.735.735,0,0,1,0,.313,1.453,1.453,0,0,1-.217.748.311.311,0,0,0,0,.061l.087.105a9.189,9.189,0,0,0,.922-2.071h0c.244-.827.27-1.418.078-1.671A2.244,2.244,0,0,0,9.82,5.545a2.839,2.839,0,0,1,.792.583A1.981,1.981,0,0,1,11.308,7.494Zm-.269.07a1,1,0,0,0-.688.078c-.252.157-.174.478,0,.87a6.893,6.893,0,0,0,.3.74l.078.139h0c.044.069.07.13.1.174l.069.113a1.114,1.114,0,0,0,.157-.566,2.29,2.29,0,0,0,0-.287,1.325,1.325,0,0,0-.043-.426,5.247,5.247,0,0,1,.069-.6.694.694,0,0,1-.009-.262Zm-.261.356a.335.335,0,0,1-.157.087h0a.279.279,0,0,1-.122,0,.2.2,0,0,1-.061-.165h0c0-.061.1-.113.209-.13h.165s.079,0,.079.069a.174.174,0,0,1-.079.113ZM6.7,8.7V8.547a.914.914,0,0,0,0-.148,4.682,4.682,0,0,1,0-.87,4.461,4.461,0,0,1,.261-.957,2.093,2.093,0,0,1,.5-.818A4.13,4.13,0,0,0,6.288,5.58a1.62,1.62,0,0,0-.957.261,1.739,1.739,0,0,0-.549,1.583,10.727,10.727,0,0,0,.435,1.949c.3.992.636,1.6.931,1.7h0c.131.044.27,0,.409-.182.244-.3.47-.549.6-.7a1.633,1.633,0,0,1-.427-1.522Zm.226.348a1.9,1.9,0,0,0,.052.487,1.321,1.321,0,0,0,.226.383.865.865,0,0,0,.644.287,1.809,1.809,0,0,1,.2-.522,3.6,3.6,0,0,0,.183-.513,5.77,5.77,0,0,0,0-.966.5.5,0,0,0-.052-.261A.39.39,0,0,0,8.071,7.7h0a.565.565,0,0,0-.243-.139H7.654a1.356,1.356,0,0,0-.418.121,1.731,1.731,0,0,0-.278.166v.626h0a.955.955,0,0,1,0,.131v.339h0ZM7.5,7.877h0a.406.406,0,0,1,.244,0,.538.538,0,0,1,.165.052c.078,0,.087.1.078.122h0a.331.331,0,0,1-.1.113.226.226,0,0,1-.052-.035h0a.3.3,0,0,1-.244-.243Zm.644,2.61a.2.2,0,0,0-.113.052l-.122.148c-.148.183-.209.244-.635.331a.452.452,0,0,0-.226.087.5.5,0,0,0,.209.1,1.029,1.029,0,0,0,.626,0,1.518,1.518,0,0,0,.339-.226.523.523,0,0,0,.174-.27.311.311,0,0,0-.087-.244.13.13,0,0,0-.13-.017Zm4.011,0a1.409,1.409,0,0,1-.983,0,.2.2,0,0,0-.122,0,.263.263,0,0,0-.148.122,1.017,1.017,0,0,0,0,.27,1.573,1.573,0,0,0,.958-.087,1.182,1.182,0,0,0,.417-.3ZM10.064,8.625c-.122-.357-.3-.87.157-1.183A1.178,1.178,0,0,1,11,7.311a2.763,2.763,0,0,0-.557-1l-.087-.087L10.3,6.171h0a.32.32,0,0,0-.052-.052h0a2.044,2.044,0,0,0-.583-.365A2.291,2.291,0,0,0,8.7,5.562a1.335,1.335,0,0,0-.609.1,1.512,1.512,0,0,0-.261.1,1.821,1.821,0,0,0-.644.87A5.156,5.156,0,0,0,7,7.494a1.443,1.443,0,0,1,.87-.2.731.731,0,0,1,.671.787v.005a6.179,6.179,0,0,1,0,1.105,3.269,3.269,0,0,1-.2.548c-.052.148-.122.3-.156.426a.435.435,0,0,1,.33.122.577.577,0,0,1,.166.461H8.7v.209a5.682,5.682,0,0,0,.209,2.123.459.459,0,0,0,.209.183.527.527,0,0,0,.269.087,1.135,1.135,0,0,0,.871-.3.914.914,0,0,0,.252-.574c.061-.392.191-1.479.209-1.74h0a.624.624,0,0,1,.078-.383.547.547,0,0,1,.235-.209A4.663,4.663,0,0,1,10.1,8.573Z" fill="#f2f2f2"/>
|
||||
<g>
|
||||
<ellipse cx="13.771" cy="12.537" rx="2.677" ry="1.942" transform="translate(-4.839 11.835) rotate(-40.155)" fill="#76bc2d"/>
|
||||
<path d="M13.111,13.376a.939.939,0,0,1,.039-1.589c1-.719,1.065.317.262.451,0,.372,1.047.328,1.5-.5.506-.937-.98-1.53-2.269-.109-.824.909-.844,2.153-.117,2.424a2.2,2.2,0,0,0,2.822-2.3C14.65,13.373,13.661,13.609,13.111,13.376Z" fill="#fff"/>
|
||||
</g>
|
||||
</g>
|
||||
</svg>
|
||||
|
||||
|
Before Width: | Height: | Size: 3.5 KiB After Width: | Height: | Size: 4.3 KiB |
@@ -107,24 +107,40 @@ export function getDatabaseStateDisplayText(state: string): string {
|
||||
* @param name The name of the resource to delete
|
||||
* @returns Promise resolving to true if the user confirmed the name, false if the input box was closed for any other reason
|
||||
*/
|
||||
export async function promptForResourceDeletion(namespace: string, name: string): Promise<boolean> {
|
||||
|
||||
/**
|
||||
* Opens an input box prompting and validating the user's input.
|
||||
* @param options Options for the input box
|
||||
* @param title An optional title for the input box
|
||||
* @returns Promise resolving to the user's input if it passed validation,
|
||||
* or undefined if the input box was closed for any other reason
|
||||
*/
|
||||
async function promptInputBox(title: string, options: vscode.InputBoxOptions): Promise<string> {
|
||||
const inputBox = vscode.window.createInputBox();
|
||||
inputBox.title = loc.resourceDeletionWarning(namespace, name);
|
||||
inputBox.placeholder = name;
|
||||
inputBox.title = title;
|
||||
inputBox.prompt = options.prompt;
|
||||
inputBox.placeholder = options.placeHolder;
|
||||
inputBox.password = options.password ?? false;
|
||||
inputBox.value = options.value ?? '';
|
||||
inputBox.ignoreFocusOut = options.ignoreFocusOut ?? false;
|
||||
|
||||
return new Promise(resolve => {
|
||||
let valueAccepted = false;
|
||||
inputBox.onDidAccept(() => {
|
||||
if (inputBox.value === name) {
|
||||
valueAccepted = true;
|
||||
inputBox.hide();
|
||||
resolve(true);
|
||||
} else {
|
||||
inputBox.validationMessage = loc.invalidResourceDeletionName(inputBox.value);
|
||||
inputBox.onDidAccept(async () => {
|
||||
if (options.validateInput) {
|
||||
const errorMessage = await options.validateInput(inputBox.value);
|
||||
if (errorMessage) {
|
||||
inputBox.validationMessage = errorMessage;
|
||||
return;
|
||||
}
|
||||
}
|
||||
valueAccepted = true;
|
||||
inputBox.hide();
|
||||
resolve(inputBox.value);
|
||||
});
|
||||
inputBox.onDidHide(() => {
|
||||
if (!valueAccepted) {
|
||||
resolve(false);
|
||||
resolve(undefined);
|
||||
}
|
||||
inputBox.dispose();
|
||||
});
|
||||
@@ -135,6 +151,46 @@ export async function promptForResourceDeletion(namespace: string, name: string)
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Opens an input box prompting the user to enter in the name of a resource to delete
|
||||
* @param namespace The namespace of the resource to delete
|
||||
* @param name The name of the resource to delete
|
||||
* @returns Promise resolving to true if the user confirmed the name, false if the input box was closed for any other reason
|
||||
*/
|
||||
export async function promptForResourceDeletion(namespace: string, name: string): Promise<boolean> {
|
||||
const title = loc.resourceDeletionWarning(namespace, name);
|
||||
const options: vscode.InputBoxOptions = {
|
||||
placeHolder: name,
|
||||
validateInput: input => input !== name ? loc.invalidResourceDeletionName(name) : ''
|
||||
};
|
||||
|
||||
return await promptInputBox(title, options) !== undefined;
|
||||
}
|
||||
|
||||
/**
|
||||
* Opens an input box prompting the user to enter and confirm a password
|
||||
* @param validate A function that accepts the password and returns an error message if it's invalid
|
||||
* @returns Promise resolving to the password if it passed validation,
|
||||
* or false if the input box was closed for any other reason
|
||||
*/
|
||||
export async function promptAndConfirmPassword(validate: (input: string) => string): Promise<string | false> {
|
||||
const title = loc.resetPassword;
|
||||
const options: vscode.InputBoxOptions = {
|
||||
prompt: loc.enterNewPassword,
|
||||
password: true,
|
||||
validateInput: input => validate(input)
|
||||
};
|
||||
|
||||
const password = await promptInputBox(title, options);
|
||||
if (password) {
|
||||
options.prompt = loc.confirmNewPassword;
|
||||
options.validateInput = input => input !== password ? loc.thePasswordsDoNotMatch : '';
|
||||
return promptInputBox(title, options);
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the message to display for a given error object that may be a variety of types.
|
||||
* @param error The error object
|
||||
|
||||
@@ -98,15 +98,19 @@ export const worker = localize('arc.worker', "Worker");
|
||||
export const monitor = localize('arc.monitor', "Monitor");
|
||||
export const newDatabase = localize('arc.newDatabase', "New Database");
|
||||
export const databaseName = localize('arc.databaseName', "Database name");
|
||||
export const newPassword = localize('arc.newPassword', "New password");
|
||||
export const enterNewPassword = localize('arc.enterNewPassword', "Enter a new password");
|
||||
export const confirmNewPassword = localize('arc.confirmNewPassword', "Confirm the new password");
|
||||
export const learnAboutPostgresClients = localize('arc.learnAboutPostgresClients', "Learn more about Azure PostgreSQL Hyperscale client interfaces");
|
||||
export const node = localize('arc.node', "node");
|
||||
export const nodes = localize('arc.nodes', "nodes");
|
||||
export const storagePerNode = localize('arc.storagePerNode', "storage per node");
|
||||
export const arcResources = localize('arc.arcResources', "Azure Arc Resources");
|
||||
export const enterANonEmptyPassword = localize('arc.enterANonEmptyPassword', "Enter a non empty password or press escape to exit.");
|
||||
export const thePasswordsDoNotMatch = localize('arc.thePasswordsDoNotMatch', "The passwords do not match. Confirm the password or press escape to exit.");
|
||||
export const passwordReset = localize('arc.passwordReset', "Password reset successfully");
|
||||
export const passwordResetFailed = localize('arc.passwordResetFailed', "Failed to reset password");
|
||||
|
||||
export function databaseCreated(name: string): string { return localize('arc.databaseCreated', "Database {0} created", name); }
|
||||
export function passwordReset(name: string): string { return localize('arc.passwordReset', "Password reset for service {0}", name); }
|
||||
export function resourceDeleted(name: string): string { return localize('arc.resourceDeleted', "Resource '{0}' deleted", name); }
|
||||
export function couldNotFindAzureResource(name: string): string { return localize('arc.couldNotFindAzureResource', "Could not find Azure resource for {0}", name); }
|
||||
export function copiedToClipboard(name: string): string { return localize('arc.copiedToClipboard', "{0} copied to clipboard", name); }
|
||||
@@ -127,6 +131,5 @@ export function invalidResourceDeletionName(name: string): string { return local
|
||||
export function refreshFailed(error: any): string { return localize('arc.refreshFailed', "Refresh failed. {0}", getErrorMessage(error)); }
|
||||
export function openDashboardFailed(error: any): string { return localize('arc.openDashboardFailed', "Error opening dashboard. {0}", getErrorMessage(error)); }
|
||||
export function resourceDeletionFailed(name: string, error: any): string { return localize('arc.resourceDeletionFailed', "Failed to delete resource {0}. {1}", name, getErrorMessage(error)); }
|
||||
export function passwordResetFailed(name: string, error: any): string { return localize('arc.passwordResetFailed', "Failed to reset password for service {0}. {1}", name, getErrorMessage(error)); }
|
||||
export function databaseCreationFailed(name: string, error: any): string { return localize('arc.databaseCreationFailed', "Failed to create database {0}. {1}", name, getErrorMessage(error)); }
|
||||
export function connectToControllerFailed(url: string, error: any): string { return localize('arc.connectToControllerFailed', "Could not connect to controller {0}. {1}", url, getErrorMessage(error)); }
|
||||
|
||||
@@ -17,16 +17,12 @@ export enum PodRole {
|
||||
export class PostgresModel {
|
||||
private _databaseRouter: DatabaseRouterApi;
|
||||
private _service?: DuskyObjectModelsDatabaseService;
|
||||
private _password?: string;
|
||||
private _pods?: V1Pod[];
|
||||
private readonly _onServiceUpdated = new vscode.EventEmitter<DuskyObjectModelsDatabaseService>();
|
||||
private readonly _onPasswordUpdated = new vscode.EventEmitter<string>();
|
||||
private readonly _onPodsUpdated = new vscode.EventEmitter<V1Pod[]>();
|
||||
public onServiceUpdated = this._onServiceUpdated.event;
|
||||
public onPasswordUpdated = this._onPasswordUpdated.event;
|
||||
public onPodsUpdated = this._onPodsUpdated.event;
|
||||
public serviceLastUpdated?: Date;
|
||||
public passwordLastUpdated?: Date;
|
||||
public podsLastUpdated?: Date;
|
||||
|
||||
constructor(controllerUrl: string, auth: Authentication, private _namespace: string, private _name: string) {
|
||||
@@ -54,11 +50,6 @@ export class PostgresModel {
|
||||
return this._service;
|
||||
}
|
||||
|
||||
/** Returns the service's password */
|
||||
public get password(): string | undefined {
|
||||
return this._password;
|
||||
}
|
||||
|
||||
/** Returns the service's pods */
|
||||
public get pods(): V1Pod[] | undefined {
|
||||
return this._pods;
|
||||
@@ -72,11 +63,6 @@ export class PostgresModel {
|
||||
this.serviceLastUpdated = new Date();
|
||||
this._onServiceUpdated.fire(this._service);
|
||||
}),
|
||||
this._databaseRouter.getDuskyPassword(this._namespace, this._name).then(response => {
|
||||
this._password = response.body;
|
||||
this.passwordLastUpdated = new Date();
|
||||
this._onPasswordUpdated.fire(this._password!);
|
||||
}),
|
||||
this._databaseRouter.getDuskyPods(this._namespace, this._name).then(response => {
|
||||
this._pods = response.body;
|
||||
this.podsLastUpdated = new Date();
|
||||
|
||||
@@ -17,7 +17,6 @@ export class PostgresConnectionStringsPage extends DashboardPage {
|
||||
constructor(protected modelView: azdata.ModelView, private _postgresModel: PostgresModel) {
|
||||
super(modelView);
|
||||
this._postgresModel.onServiceUpdated(() => this.eventuallyRunOnInitialized(() => this.refresh()));
|
||||
this._postgresModel.onPasswordUpdated(() => this.eventuallyRunOnInitialized(() => this.refresh()));
|
||||
}
|
||||
|
||||
protected get title(): string {
|
||||
@@ -43,18 +42,19 @@ export class PostgresConnectionStringsPage extends DashboardPage {
|
||||
}).component());
|
||||
|
||||
const info = this.modelView.modelBuilder.text().withProperties<azdata.TextComponentProperties>({
|
||||
value: `${loc.selectConnectionString}. `,
|
||||
value: loc.selectConnectionString,
|
||||
CSSStyles: { ...cssStyles.text, 'margin-block-start': '0px', 'margin-block-end': '0px' }
|
||||
}).component();
|
||||
|
||||
const link = this.modelView.modelBuilder.hyperlink().withProperties<azdata.HyperlinkComponentProperties>({
|
||||
label: loc.learnAboutPostgresClients,
|
||||
url: 'http://example.com', // TODO link to documentation
|
||||
url: 'https://docs.microsoft.com/azure/postgresql/concepts-connection-libraries',
|
||||
}).component();
|
||||
|
||||
content.addItem(
|
||||
this.modelView.modelBuilder.flexContainer().withItems([info, link]).withLayout({ flexWrap: 'wrap' }).component(),
|
||||
{ CSSStyles: { display: 'inline-flex', 'margin-bottom': '25px' } });
|
||||
const infoAndLink = this.modelView.modelBuilder.flexContainer().withLayout({ flexWrap: 'wrap' }).component();
|
||||
infoAndLink.addItem(info, { CSSStyles: { 'margin-right': '5px' } });
|
||||
infoAndLink.addItem(link);
|
||||
content.addItem(infoAndLink, { CSSStyles: { 'margin-bottom': '25px' } });
|
||||
|
||||
this.keyValueContainer = new KeyValueContainer(this.modelView.modelBuilder, []);
|
||||
content.addItem(this.keyValueContainer.container);
|
||||
|
||||
@@ -9,11 +9,8 @@ import * as loc from '../../../localizedConstants';
|
||||
import { ControllerModel } from '../../../models/controllerModel';
|
||||
import { PostgresModel } from '../../../models/postgresModel';
|
||||
import { PostgresOverviewPage } from './postgresOverviewPage';
|
||||
import { PostgresComputeStoragePage } from './postgresComputeStoragePage';
|
||||
import { PostgresConnectionStringsPage } from './postgresConnectionStringsPage';
|
||||
import { PostgresBackupPage } from './postgresBackupPage';
|
||||
import { PostgresPropertiesPage } from './postgresPropertiesPage';
|
||||
import { PostgresNetworkingPage } from './postgresNetworkingPage';
|
||||
import { Dashboard } from '../../components/dashboard';
|
||||
import { PostgresDiagnoseAndSolveProblemsPage } from './postgresDiagnoseAndSolveProblemsPage';
|
||||
import { PostgresSupportRequestPage } from './postgresSupportRequestPage';
|
||||
@@ -25,11 +22,8 @@ export class PostgresDashboard extends Dashboard {
|
||||
|
||||
protected async registerTabs(modelView: azdata.ModelView): Promise<(azdata.DashboardTab | azdata.DashboardTabGroup)[]> {
|
||||
const overviewPage = new PostgresOverviewPage(modelView, this._controllerModel, this._postgresModel);
|
||||
const computeStoragePage = new PostgresComputeStoragePage(modelView);
|
||||
const connectionStringsPage = new PostgresConnectionStringsPage(modelView, this._postgresModel);
|
||||
const backupPage = new PostgresBackupPage(modelView);
|
||||
const propertiesPage = new PostgresPropertiesPage(modelView, this._controllerModel, this._postgresModel);
|
||||
const networkingPage = new PostgresNetworkingPage(modelView);
|
||||
const diagnoseAndSolveProblemsPage = new PostgresDiagnoseAndSolveProblemsPage(modelView, this._context, this._postgresModel);
|
||||
const supportRequestPage = new PostgresSupportRequestPage(modelView, this._controllerModel, this._postgresModel);
|
||||
|
||||
@@ -38,16 +32,9 @@ export class PostgresDashboard extends Dashboard {
|
||||
{
|
||||
title: loc.settings,
|
||||
tabs: [
|
||||
computeStoragePage.tab,
|
||||
connectionStringsPage.tab,
|
||||
backupPage.tab,
|
||||
propertiesPage.tab
|
||||
]
|
||||
}, {
|
||||
title: loc.security,
|
||||
tabs: [
|
||||
networkingPage.tab
|
||||
]
|
||||
},
|
||||
{
|
||||
title: loc.supportAndTroubleshooting,
|
||||
|
||||
@@ -51,7 +51,7 @@ export class PostgresDiagnoseAndSolveProblemsPage extends DashboardPage {
|
||||
troubleshootButton.onDidClick(() => {
|
||||
process.env['POSTGRES_SERVER_NAMESPACE'] = this._postgresModel.namespace;
|
||||
process.env['POSTGRES_SERVER_NAME'] = this._postgresModel.name;
|
||||
vscode.commands.executeCommand('bookTreeView.openBook', this._context.asAbsolutePath('notebooks/arc'), true, 'postgres/tsg100-troubleshoot-postgres');
|
||||
vscode.commands.executeCommand('bookTreeView.openBook', this._context.asAbsolutePath('notebooks/arcDataServices'), true, 'postgres/tsg100-troubleshoot-postgres');
|
||||
});
|
||||
|
||||
content.addItem(troubleshootButton);
|
||||
|
||||
@@ -7,11 +7,11 @@ import * as vscode from 'vscode';
|
||||
import * as azdata from 'azdata';
|
||||
import * as loc from '../../../localizedConstants';
|
||||
import { IconPathHelper, cssStyles, ResourceType } from '../../../constants';
|
||||
import { DuskyObjectModelsDatabase, DuskyObjectModelsDatabaseServiceArcPayload, V1Pod } from '../../../controller/generated/dusky/api';
|
||||
import { DuskyObjectModelsDatabase, V1Pod, DuskyObjectModelsDatabaseServiceArcPayload } from '../../../controller/generated/dusky/api';
|
||||
import { DashboardPage } from '../../components/dashboardPage';
|
||||
import { ControllerModel } from '../../../models/controllerModel';
|
||||
import { PostgresModel, PodRole } from '../../../models/postgresModel';
|
||||
import { promptForResourceDeletion } from '../../../common/utils';
|
||||
import { promptForResourceDeletion, promptAndConfirmPassword } from '../../../common/utils';
|
||||
|
||||
export class PostgresOverviewPage extends DashboardPage {
|
||||
private propertiesLoading?: azdata.LoadingComponent;
|
||||
@@ -28,7 +28,6 @@ export class PostgresOverviewPage extends DashboardPage {
|
||||
super(modelView);
|
||||
this._controllerModel.onEndpointsUpdated(() => this.eventuallyRunOnInitialized(() => this.refreshEndpoints()));
|
||||
this._controllerModel.onRegistrationsUpdated(() => this.eventuallyRunOnInitialized(() => this.refreshProperties()));
|
||||
this._postgresModel.onPasswordUpdated(() => this.eventuallyRunOnInitialized(() => this.refreshProperties()));
|
||||
|
||||
this._postgresModel.onServiceUpdated(() => this.eventuallyRunOnInitialized(() => {
|
||||
this.refreshProperties();
|
||||
@@ -178,10 +177,11 @@ export class PostgresOverviewPage extends DashboardPage {
|
||||
let name;
|
||||
try {
|
||||
name = await vscode.window.showInputBox({ prompt: loc.databaseName });
|
||||
if (name === undefined) { return; }
|
||||
const db: DuskyObjectModelsDatabase = { name: name }; // TODO support other options (sharded, owner)
|
||||
await this._postgresModel.createDatabase(db);
|
||||
vscode.window.showInformationMessage(loc.databaseCreated(db.name ?? ''));
|
||||
if (name) {
|
||||
const db: DuskyObjectModelsDatabase = { name: name }; // TODO support other options (sharded, owner)
|
||||
await this._postgresModel.createDatabase(db);
|
||||
vscode.window.showInformationMessage(loc.databaseCreated(db.name ?? ''));
|
||||
}
|
||||
} catch (error) {
|
||||
vscode.window.showErrorMessage(loc.databaseCreationFailed(name ?? '', error));
|
||||
} finally {
|
||||
@@ -198,15 +198,16 @@ export class PostgresOverviewPage extends DashboardPage {
|
||||
resetPasswordButton.onDidClick(async () => {
|
||||
resetPasswordButton.enabled = false;
|
||||
try {
|
||||
const password = await vscode.window.showInputBox({ prompt: loc.newPassword, password: true });
|
||||
if (password === undefined) { return; }
|
||||
await this._postgresModel.update(s => {
|
||||
s.arc = s.arc ?? new DuskyObjectModelsDatabaseServiceArcPayload();
|
||||
s.arc.servicePassword = password;
|
||||
});
|
||||
vscode.window.showInformationMessage(loc.passwordReset(this._postgresModel.fullName));
|
||||
const password = await promptAndConfirmPassword(input => !input ? loc.enterANonEmptyPassword : '');
|
||||
if (password) {
|
||||
await this._postgresModel.update(s => {
|
||||
s.arc = s.arc ?? new DuskyObjectModelsDatabaseServiceArcPayload();
|
||||
s.arc.servicePassword = password;
|
||||
});
|
||||
vscode.window.showInformationMessage(loc.passwordReset);
|
||||
}
|
||||
} catch (error) {
|
||||
vscode.window.showErrorMessage(loc.passwordResetFailed(this._postgresModel.fullName, error));
|
||||
vscode.window.showErrorMessage(loc.passwordResetFailed);
|
||||
} finally {
|
||||
resetPasswordButton.enabled = true;
|
||||
}
|
||||
@@ -289,7 +290,7 @@ export class PostgresOverviewPage extends DashboardPage {
|
||||
|
||||
this.properties!.propertyItems = [
|
||||
{ displayName: loc.name, value: this._postgresModel.name },
|
||||
{ displayName: loc.coordinatorEndpoint, value: `postgresql://postgres:${this._postgresModel.password}@${endpoint.ip}:${endpoint.port}` },
|
||||
{ displayName: loc.coordinatorEndpoint, value: `postgresql://postgres@${endpoint.ip}:${endpoint.port}` },
|
||||
{ displayName: loc.status, value: this._postgresModel.service?.status?.state ?? '' },
|
||||
{ displayName: loc.postgresAdminUsername, value: 'postgres' },
|
||||
{ displayName: loc.dataController, value: this._controllerModel?.namespace ?? '' },
|
||||
|
||||
@@ -18,7 +18,6 @@ export class PostgresPropertiesPage extends DashboardPage {
|
||||
constructor(protected modelView: azdata.ModelView, private _controllerModel: ControllerModel, private _postgresModel: PostgresModel) {
|
||||
super(modelView);
|
||||
this._postgresModel.onServiceUpdated(() => this.eventuallyRunOnInitialized(() => this.refresh()));
|
||||
this._postgresModel.onPasswordUpdated(() => this.eventuallyRunOnInitialized(() => this.refresh()));
|
||||
this._controllerModel.onRegistrationsUpdated(() => this.eventuallyRunOnInitialized(() => this.refresh()));
|
||||
}
|
||||
|
||||
@@ -78,7 +77,7 @@ export class PostgresPropertiesPage extends DashboardPage {
|
||||
|
||||
private refresh() {
|
||||
const endpoint: { ip?: string, port?: number } = this._postgresModel.endpoint;
|
||||
const connectionString = `postgresql://postgres:${this._postgresModel.password}@${endpoint.ip}:${endpoint.port}`;
|
||||
const connectionString = `postgresql://postgres@${endpoint.ip}:${endpoint.port}`;
|
||||
const registration = this._controllerModel.getRegistration(ResourceType.postgresInstances, this._postgresModel.namespace, this._postgresModel.name);
|
||||
|
||||
this.keyValueContainer?.refresh([
|
||||
@@ -86,7 +85,7 @@ export class PostgresPropertiesPage extends DashboardPage {
|
||||
new InputKeyValue(loc.postgresAdminUsername, 'postgres'),
|
||||
new TextKeyValue(loc.status, this._postgresModel.service?.status?.state ?? 'Unknown'),
|
||||
new LinkKeyValue(loc.dataController, this._controllerModel.namespace ?? '', _ => vscode.window.showInformationMessage('TODO: Go to data controller')),
|
||||
new LinkKeyValue(loc.nodeConfiguration, this._postgresModel.configuration, _ => vscode.window.showInformationMessage('TODO: Go to configuration')),
|
||||
new TextKeyValue(loc.nodeConfiguration, this._postgresModel.configuration),
|
||||
new TextKeyValue(loc.postgresVersion, this._postgresModel.service?.spec?.engine?.version?.toString() ?? ''),
|
||||
new TextKeyValue(loc.resourceGroup, registration?.resourceGroupName ?? ''),
|
||||
new TextKeyValue(loc.subscriptionId, registration?.subscriptionId ?? '')
|
||||
|
||||
Reference in New Issue
Block a user