More server properties fixes (#24366)

* fix locks min value

* disable login auditing in linux

* disable some properties from advanced tab
This commit is contained in:
Barbara Valdez
2023-09-11 12:53:25 -07:00
committed by GitHub
parent 89e41572a8
commit 41e7569fde
4 changed files with 24 additions and 7 deletions

View File

@@ -16,6 +16,7 @@ export const enum FolderType {
} }
export const PublicServerRoleName = 'public'; 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 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'; export const AlterUserDocUrl = 'https://learn.microsoft.com/sql/t-sql/statements/alter-user-transact-sql';

View File

@@ -593,8 +593,8 @@ export interface Server extends ObjectManagement.SqlObject {
* The server login types. * The server login types.
*/ */
export const enum ServerLoginMode { export const enum ServerLoginMode {
Integrated, //windows auth only Integrated = 1, //windows auth only
Mixed // both sql server and windows auth Mixed = 2// both sql server and windows auth
} }
/** /**

View File

@@ -350,6 +350,7 @@ export const scanStartupProcsLabel = localize('objectManagement.scanStartupProcs
export const twoDigitYearCutoffLabel = localize('objectManagement.twoDigitYearCutoffLabel', "Two Digit Year Cutoff"); export const twoDigitYearCutoffLabel = localize('objectManagement.twoDigitYearCutoffLabel', "Two Digit Year Cutoff");
export const costThresholdParallelismLabel = localize('objectManagement.costThresholdParallelismLabel', "Cost Threshold Parallelism"); export const costThresholdParallelismLabel = localize('objectManagement.costThresholdParallelismLabel', "Cost Threshold Parallelism");
export const locksLabel = localize('objectManagement.locksLabel', "Locks"); 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 maxDegreeParallelismLabel = localize('objectManagement.maxDegreeParallelismLabel', "Max Degree Parallelism");
export const queryWaitLabel = localize('objectManagement.queryWaitLabel', "Query Wait"); export const queryWaitLabel = localize('objectManagement.queryWaitLabel', "Query Wait");

View File

@@ -91,8 +91,11 @@ export class ServerPropertiesDialog extends ObjectManagementDialogBase<Server, S
constructor(objectManagementService: IObjectManagementService, options: ObjectManagementDialogOptions) { constructor(objectManagementService: IObjectManagementService, options: ObjectManagementDialogOptions) {
super(objectManagementService, options); super(objectManagementService, options);
this.disposables.push(this.dialogObject.onClosed(async () => { this.disposables.push(this.dialogObject.onClosed(async (reason: azdata.window.CloseReason) => {
await this.notifyServerRestart(); if (reason === 'ok') {
// only show message if user apply changes
await this.notifyServerRestart();
}
})); }));
} }
@@ -501,8 +504,9 @@ export class ServerPropertiesDialog extends ObjectManagementDialogBase<Server, S
} }
private initializeSecuritySection(): void { private initializeSecuritySection(): void {
const isWindows = this.objectInfo.platform === constants.Windows;
// cannot change auth mode in sql managed instance or non windows instances // 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'; const radioServerGroupName = 'serverAuthenticationRadioGroup';
this.onlyWindowsAuthRadioButton = this.createRadioButton(localizedConstants.onlyWindowsAuthModeText, radioServerGroupName, this.objectInfo.authenticationMode === ServerLoginMode.Integrated, async () => { await this.handleAuthModeChange(); }); 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(); }); this.sqlServerAndWindowsAuthRadioButton = this.createRadioButton(localizedConstants.sqlServerAndWindowsAuthText, radioServerGroupName, this.objectInfo.authenticationMode === ServerLoginMode.Mixed, async () => { await this.handleAuthModeChange(); });
@@ -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.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.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(); }); 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, [ const serverLoginSection = this.createGroup(localizedConstants.loginAuditingText, [
this.noneRadioButton, this.noneRadioButton,
this.failedLoginsOnlyRadioButton, this.failedLoginsOnlyRadioButton,
@@ -670,6 +679,7 @@ export class ServerPropertiesDialog extends ObjectManagementDialogBase<Server, S
} }
private initializeAdvancedSection(): void { private initializeAdvancedSection(): void {
const isEnabled = this.engineEdition !== azdata.DatabaseEngineEdition.SqlManagedInstance;
this.allowTriggerToFireOthersDropdown = this.createDropdown(localizedConstants.allowTriggerToFireOthersLabel, async (newValue) => { this.allowTriggerToFireOthersDropdown = this.createDropdown(localizedConstants.allowTriggerToFireOthersLabel, async (newValue) => {
this.objectInfo.allowTriggerToFireOthers = newValue === 'True'; this.objectInfo.allowTriggerToFireOthers = newValue === 'True';
}, ['True', 'False'], this.objectInfo.allowTriggerToFireOthers ? 'True' : 'False'); }, ['True', 'False'], this.objectInfo.allowTriggerToFireOthers ? 'True' : 'False');
@@ -733,7 +743,7 @@ export class ServerPropertiesDialog extends ObjectManagementDialogBase<Server, S
this.scanStartupProcsDropdown = this.createDropdown(localizedConstants.scanStartupProcsLabel, async (newValue) => { this.scanStartupProcsDropdown = this.createDropdown(localizedConstants.scanStartupProcsLabel, async (newValue) => {
this.objectInfo.scanStartupProcs = newValue === 'True'; 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); const scanStartupProcsContainer = this.createLabelInputContainer(localizedConstants.scanStartupProcsLabel, this.scanStartupProcsDropdown);
this.twoDigitYearCutoffInput = this.createInputBox(async (newValue) => { this.twoDigitYearCutoffInput = this.createInputBox(async (newValue) => {
@@ -761,8 +771,13 @@ export class ServerPropertiesDialog extends ObjectManagementDialogBase<Server, S
}, { }, {
ariaLabel: localizedConstants.locksLabel, ariaLabel: localizedConstants.locksLabel,
inputType: 'number', inputType: 'number',
enabled: isEnabled,
max: this.objectInfo.locks.maximumValue, 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); const locksContainer = this.createLabelInputContainer(localizedConstants.locksLabel, this.locksInput);