Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Notify user to restart server #24351

Merged
merged 6 commits into from
Sep 9, 2023
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 24 additions & 4 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 @@ -528,9 +539,7 @@ export class ServerPropertiesDialog extends ObjectManagementDialogBase<Server, S
if (this.sqlServerAndWindowsAuthRadioButton.checked) {
this.objectInfo.authenticationMode = ServerLoginMode.Mixed;
}
if (this.objectInfo.authenticationMode !== this.originalObjectInfo.authenticationMode) {
await vscode.window.showInformationMessage(localizedConstants.needToRestartServer, { modal: true });
}
this.shouldRestartServer = this.objectInfo.authenticationMode !== this.originalObjectInfo.authenticationMode;
}

private async handleAuditLevelChange(): Promise<void> {
Expand Down Expand Up @@ -580,21 +589,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 +803,4 @@ export class ServerPropertiesDialog extends ObjectManagementDialogBase<Server, S

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

}
1 change: 1 addition & 0 deletions extensions/mssql/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
{
"extends": "../tsconfig.base.json",
"compilerOptions": {
"experimentalDecorators": true,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this decorator part still needed?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

oh I forgot to remove it

"outDir": "./out",
"strict": false,
"noUnusedParameters": false
Expand Down