Skip to content

Commit

Permalink
More server properties fixes (#24366)
Browse files Browse the repository at this point in the history
* fix locks min value

* disable login auditing in linux

* disable some properties from advanced tab
  • Loading branch information
barbaravaldez authored Sep 11, 2023
1 parent 89e4157 commit 41e7569
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 7 deletions.
1 change: 1 addition & 0 deletions extensions/mssql/src/objectManagement/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ export const enum FolderType {
}

export const PublicServerRoleName = 'public';
export const Windows = 'Windows';

export const CreateUserDocUrl = 'https://learn.microsoft.com/sql/t-sql/statements/create-user-transact-sql';
export const AlterUserDocUrl = 'https://learn.microsoft.com/sql/t-sql/statements/alter-user-transact-sql';
Expand Down
4 changes: 2 additions & 2 deletions extensions/mssql/src/objectManagement/interfaces.ts
Original file line number Diff line number Diff line change
Expand Up @@ -593,8 +593,8 @@ export interface Server extends ObjectManagement.SqlObject {
* The server login types.
*/
export const enum ServerLoginMode {
Integrated, //windows auth only
Mixed // both sql server and windows auth
Integrated = 1, //windows auth only
Mixed = 2// both sql server and windows auth
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -350,6 +350,7 @@ export const scanStartupProcsLabel = localize('objectManagement.scanStartupProcs
export const twoDigitYearCutoffLabel = localize('objectManagement.twoDigitYearCutoffLabel', "Two Digit Year Cutoff");
export const costThresholdParallelismLabel = localize('objectManagement.costThresholdParallelismLabel', "Cost Threshold Parallelism");
export const locksLabel = localize('objectManagement.locksLabel', "Locks");
export function locksValidation(minValue: number): string { return localize('objectManagement.locksValidation', "Value should be greater than {0}. Choose 0 for default settings.", minValue); }
export const maxDegreeParallelismLabel = localize('objectManagement.maxDegreeParallelismLabel', "Max Degree Parallelism");
export const queryWaitLabel = localize('objectManagement.queryWaitLabel', "Query Wait");

Expand Down
25 changes: 20 additions & 5 deletions extensions/mssql/src/objectManagement/ui/serverPropertiesDialog.ts
Original file line number Diff line number Diff line change
Expand Up @@ -91,8 +91,11 @@ export class ServerPropertiesDialog extends ObjectManagementDialogBase<Server, S

constructor(objectManagementService: IObjectManagementService, options: ObjectManagementDialogOptions) {
super(objectManagementService, options);
this.disposables.push(this.dialogObject.onClosed(async () => {
await this.notifyServerRestart();
this.disposables.push(this.dialogObject.onClosed(async (reason: azdata.window.CloseReason) => {
if (reason === 'ok') {
// only show message if user apply changes
await this.notifyServerRestart();
}
}));
}

Expand Down Expand Up @@ -501,8 +504,9 @@ export class ServerPropertiesDialog extends ObjectManagementDialogBase<Server, S
}

private initializeSecuritySection(): void {
const isWindows = this.objectInfo.platform === constants.Windows;
// 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 && isWindows;
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 All @@ -518,6 +522,11 @@ export class ServerPropertiesDialog extends ObjectManagementDialogBase<Server, S
this.failedLoginsOnlyRadioButton = this.createRadioButton(localizedConstants.failedLoginsOnlyText, radioLoginsGroupName, this.objectInfo.loginAuditing === AuditLevel.Failure, async () => { await this.handleAuditLevelChange(); });
this.successfulLoginsOnlyRadioButton = this.createRadioButton(localizedConstants.successfulLoginsOnlyText, radioLoginsGroupName, this.objectInfo.loginAuditing === AuditLevel.Success, async () => { await this.handleAuditLevelChange(); });
this.bothFailedAndSuccessfulLoginsRadioButton = this.createRadioButton(localizedConstants.bothFailedAndSuccessfulLoginsText, radioLoginsGroupName, this.objectInfo.loginAuditing === AuditLevel.All, async () => { await this.handleAuditLevelChange(); });
// cannot change values in serverLogin section on Linux
this.noneRadioButton.enabled = isWindows;
this.failedLoginsOnlyRadioButton.enabled = isWindows;
this.successfulLoginsOnlyRadioButton.enabled = isWindows;
this.bothFailedAndSuccessfulLoginsRadioButton.enabled = isWindows;
const serverLoginSection = this.createGroup(localizedConstants.loginAuditingText, [
this.noneRadioButton,
this.failedLoginsOnlyRadioButton,
Expand Down Expand Up @@ -670,6 +679,7 @@ export class ServerPropertiesDialog extends ObjectManagementDialogBase<Server, S
}

private initializeAdvancedSection(): void {
const isEnabled = this.engineEdition !== azdata.DatabaseEngineEdition.SqlManagedInstance;
this.allowTriggerToFireOthersDropdown = this.createDropdown(localizedConstants.allowTriggerToFireOthersLabel, async (newValue) => {
this.objectInfo.allowTriggerToFireOthers = newValue === 'True';
}, ['True', 'False'], this.objectInfo.allowTriggerToFireOthers ? 'True' : 'False');
Expand Down Expand Up @@ -733,7 +743,7 @@ export class ServerPropertiesDialog extends ObjectManagementDialogBase<Server, S

this.scanStartupProcsDropdown = this.createDropdown(localizedConstants.scanStartupProcsLabel, async (newValue) => {
this.objectInfo.scanStartupProcs = newValue === 'True';
}, ['True', 'False'], this.objectInfo.scanStartupProcs ? 'True' : 'False');
}, ['True', 'False'], this.objectInfo.scanStartupProcs ? 'True' : 'False', isEnabled);
const scanStartupProcsContainer = this.createLabelInputContainer(localizedConstants.scanStartupProcsLabel, this.scanStartupProcsDropdown);

this.twoDigitYearCutoffInput = this.createInputBox(async (newValue) => {
Expand Down Expand Up @@ -761,8 +771,13 @@ export class ServerPropertiesDialog extends ObjectManagementDialogBase<Server, S
}, {
ariaLabel: localizedConstants.locksLabel,
inputType: 'number',
enabled: isEnabled,
max: this.objectInfo.locks.maximumValue,
value: this.objectInfo.locks.value.toString()
min: 0,
value: this.objectInfo.locks.value.toString(),
validationErrorMessage: localizedConstants.locksValidation(this.objectInfo.locks.minimumValue)
}, async () => {
return !(+this.locksInput.value < this.objectInfo.locks.minimumValue && +this.locksInput.value !== 0);
});
const locksContainer = this.createLabelInputContainer(localizedConstants.locksLabel, this.locksInput);

Expand Down

0 comments on commit 41e7569

Please sign in to comment.