Notify user to restart server (#24351)

This commit is contained in:
Barbara Valdez
2023-09-08 23:53:59 -07:00
committed by GitHub
parent 0b149cd85b
commit 4a9feedbcc

View File

@@ -87,9 +87,13 @@ export class ServerPropertiesDialog extends ObjectManagementDialogBase<Server, S
private queryWaitInput: azdata.InputBoxComponent;
private activeTabId: string;
private shouldRestartServer: boolean = false;
constructor(objectManagementService: IObjectManagementService, options: ObjectManagementDialogOptions) {
super(objectManagementService, options);
this.disposables.push(this.dialogObject.onClosed(async () => {
await this.notifyServerRestart();
}));
}
protected override get helpUrl(): string {
@@ -364,6 +368,13 @@ export class ServerPropertiesDialog extends ObjectManagementDialogBase<Server, S
return errors;
}
private async notifyServerRestart(): Promise<void> {
if (this.shouldRestartServer) {
await vscode.window.showInformationMessage(localizedConstants.needToRestartServer, { modal: true });
this.shouldRestartServer = false;
}
}
private initializeProcessorsSection(): void {
const isEnabled = this.engineEdition !== azdata.DatabaseEngineEdition.SqlManagedInstance;
let nodes: NumaNode[] = this.objectInfo.numaNodes;
@@ -491,7 +502,7 @@ export class ServerPropertiesDialog extends ObjectManagementDialogBase<Server, S
private initializeSecuritySection(): void {
// cannot change auth mode in sql managed instance or non windows instances
const isEnabled = this.engineEdition !== azdata.DatabaseEngineEdition.SqlManagedInstance && this.objectInfo.platform !== 'Windows';
const isEnabled = this.engineEdition !== azdata.DatabaseEngineEdition.SqlManagedInstance && this.objectInfo.platform === 'Windows';
const radioServerGroupName = 'serverAuthenticationRadioGroup';
this.onlyWindowsAuthRadioButton = this.createRadioButton(localizedConstants.onlyWindowsAuthModeText, radioServerGroupName, this.objectInfo.authenticationMode === ServerLoginMode.Integrated, async () => { await this.handleAuthModeChange(); });
this.sqlServerAndWindowsAuthRadioButton = this.createRadioButton(localizedConstants.sqlServerAndWindowsAuthText, radioServerGroupName, this.objectInfo.authenticationMode === ServerLoginMode.Mixed, async () => { await this.handleAuthModeChange(); });
@@ -529,7 +540,7 @@ export class ServerPropertiesDialog extends ObjectManagementDialogBase<Server, S
this.objectInfo.authenticationMode = ServerLoginMode.Mixed;
}
if (this.objectInfo.authenticationMode !== this.originalObjectInfo.authenticationMode) {
await vscode.window.showInformationMessage(localizedConstants.needToRestartServer, { modal: true });
this.shouldRestartServer = true;
}
}
@@ -580,21 +591,33 @@ export class ServerPropertiesDialog extends ObjectManagementDialogBase<Server, S
this.dataLocationInput = this.createInputBox(async (newValue) => {
this.objectInfo.dataLocation = newValue;
if (this.objectInfo.dataLocation !== this.originalObjectInfo.dataLocation) {
this.shouldRestartServer = true;
}
}, dataLocationInputboxProps);
const dataLocationButton = this.createBrowseButton(async () => {
const newPath = await this.selectFolder(this.objectInfo.dataLocation);
this.dataLocationInput.value = newPath;
this.objectInfo.dataLocation = newPath;
if (this.objectInfo.dataLocation !== this.originalObjectInfo.dataLocation) {
this.shouldRestartServer = true;
}
}, isEnabled);
const dataLocationInputContainer = this.createLabelInputContainer(localizedConstants.dataLocationText, [this.dataLocationInput, dataLocationButton])
this.logLocationInput = this.createInputBox(async (newValue) => {
this.objectInfo.logLocation = newValue;
if (this.objectInfo.logLocation !== this.originalObjectInfo.logLocation) {
this.shouldRestartServer = true;
}
}, logLocationInputboxProps);
const logLocationButton = this.createBrowseButton(async () => {
const newPath = await this.selectFolder(this.objectInfo.logLocation);
this.logLocationInput.value = newPath;
this.objectInfo.logLocation = newPath;
if (this.objectInfo.logLocation !== this.originalObjectInfo.logLocation) {
this.shouldRestartServer = true;
}
}, isEnabled);
const logLocationInputContainer = this.createLabelInputContainer(localizedConstants.logLocationText, [this.logLocationInput, logLocationButton])
@@ -782,5 +805,4 @@ export class ServerPropertiesDialog extends ObjectManagementDialogBase<Server, S
this.advancedTab = this.createTab(this.advancedTabId, localizedConstants.AdvancedSectionHeader, advancedTabContainer);
}
}