Skip to content

Commit

Permalink
Notify user to restart server (#24351)
Browse files Browse the repository at this point in the history
  • Loading branch information
barbaravaldez authored and siyangMicrosoft committed Oct 12, 2023
1 parent b9b9b86 commit 319f577
Showing 1 changed file with 25 additions and 3 deletions.
28 changes: 25 additions & 3 deletions extensions/mssql/src/objectManagement/ui/serverPropertiesDialog.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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(); });
Expand Down Expand Up @@ -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;
}
}

Expand Down Expand Up @@ -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])

Expand Down Expand Up @@ -782,5 +805,4 @@ export class ServerPropertiesDialog extends ObjectManagementDialogBase<Server, S

this.advancedTab = this.createTab(this.advancedTabId, localizedConstants.AdvancedSectionHeader, advancedTabContainer);
}

}

0 comments on commit 319f577

Please sign in to comment.