Fix issues found in the bug bash (#23741)

Co-authored-by: Charles Gagnon <chgagnon@microsoft.com>
This commit is contained in:
Barbara Valdez
2023-07-11 10:15:41 -07:00
committed by GitHub
parent af0e2baa7e
commit 017fcf14b0
5 changed files with 57 additions and 15 deletions

View File

@@ -7,7 +7,7 @@ import * as azdata from 'azdata';
import { ObjectManagementDialogBase, ObjectManagementDialogOptions } from './objectManagementDialogBase';
import { IObjectManagementService } from 'mssql';
import * as localizedConstants from '../localizedConstants';
import { CreateDatabaseDocUrl, DatabasePropertiesDocUrl } from '../constants';
import { CreateDatabaseDocUrl, DatabaseGeneralPropertiesDocUrl, DatabaseOptionsPropertiesDocUrl } from '../constants';
import { Database, DatabaseViewInfo } from '../interfaces';
import { convertNumToTwoDecimalStringInMB } from '../utils';
import { isUndefinedOrNull } from '../../types';
@@ -20,6 +20,7 @@ export class DatabaseDialog extends ObjectManagementDialogBase<Database, Databas
// Database properties options
// General Tab
private readonly generalTabId: string = 'generalDatabaseId';
private nameInput: azdata.InputBoxComponent;
private backupSection: azdata.GroupContainer;
private lastDatabaseBackupInput: azdata.InputBoxComponent;
@@ -35,6 +36,7 @@ export class DatabaseDialog extends ObjectManagementDialogBase<Database, Databas
private memoryUsedInput: azdata.InputBoxComponent;
private collationInput: azdata.InputBoxComponent;
// Options Tab
private readonly optionsTabId: string = 'optionsDatabaseId';
private autoCreateIncrementalStatisticsInput: azdata.CheckBoxComponent;
private autoCreateStatisticsInput: azdata.CheckBoxComponent;
private autoShrinkInput: azdata.CheckBoxComponent;
@@ -47,12 +49,28 @@ export class DatabaseDialog extends ObjectManagementDialogBase<Database, Databas
private encryptionEnabledInput: azdata.CheckBoxComponent;
private restrictAccessInput!: azdata.DropDownComponent;
private activeTabId: string;
constructor(objectManagementService: IObjectManagementService, options: ObjectManagementDialogOptions) {
super(objectManagementService, options);
}
protected override get helpUrl(): string {
return this.options.isNewObject ? CreateDatabaseDocUrl : DatabasePropertiesDocUrl;
return this.options.isNewObject ? CreateDatabaseDocUrl : this.getDatabasePropertiesDocUrl();
}
private getDatabasePropertiesDocUrl(): string {
let helpUrl = '';
switch (this.activeTabId) {
case this.generalTabId:
helpUrl = DatabaseGeneralPropertiesDocUrl;
break;
case this.optionsTabId:
helpUrl = DatabaseOptionsPropertiesDocUrl;
default:
break;
}
return helpUrl;
}
protected async initializeUI(): Promise<void> {
@@ -83,7 +101,7 @@ export class DatabaseDialog extends ObjectManagementDialogBase<Database, Databas
// Initilaize general Tab
this.generalTab = {
title: localizedConstants.GeneralSectionHeader,
id: 'general',
id: this.generalTabId,
content: this.createGroup('', [
this.databaseSection,
this.backupSection
@@ -93,7 +111,7 @@ export class DatabaseDialog extends ObjectManagementDialogBase<Database, Databas
// Initilaize Options Tab
this.optionsTab = {
title: localizedConstants.OptionsSectionHeader,
id: 'options',
id: this.optionsTabId,
content: this.createGroup('', this.optionsTabSectionsContainer, false)
};
@@ -107,6 +125,10 @@ export class DatabaseDialog extends ObjectManagementDialogBase<Database, Databas
}
})
.component();
this.disposables.push(
propertiesTabbedPannel.onTabChanged(async tabId => {
this.activeTabId = tabId;
}));
this.formContainer.addItem(propertiesTabbedPannel);
}
}