mirror of
https://github.com/ckaczor/azuredatastudio.git
synced 2026-01-13 17:22:15 -05:00
Fix issues found in the bug bash (#23741)
Co-authored-by: Charles Gagnon <chgagnon@microsoft.com>
This commit is contained in:
@@ -28,9 +28,11 @@ export const AlterApplicationRoleDocUrl = 'https://learn.microsoft.com/sql/t-sql
|
||||
export const CreateDatabaseRoleDocUrl = 'https://learn.microsoft.com/sql/t-sql/statements/create-role-transact-sql';
|
||||
export const AlterDatabaseRoleDocUrl = 'https://learn.microsoft.com/sql/t-sql/statements/alter-role-transact-sql';
|
||||
export const CreateDatabaseDocUrl = 'https://learn.microsoft.com/sql/t-sql/statements/create-database-transact-sql';
|
||||
export const ViewServerPropertiesDocUrl = 'https://learn.microsoft.com/sql/t-sql/functions/serverproperty-transact-sql';
|
||||
export const ViewGeneralServerPropertiesDocUrl = 'https://learn.microsoft.com/sql/t-sql/functions/serverproperty-transact-sql';
|
||||
export const ViewMemoryServerPropertiesDocUrl = 'https://learn.microsoft.com/sql/database-engine/configure-windows/server-properties-memory-page';
|
||||
export const DetachDatabaseDocUrl = 'https://go.microsoft.com/fwlink/?linkid=2240322';
|
||||
export const DatabasePropertiesDocUrl = 'https://learn.microsoft.com/sql/relational-databases/databases/database-properties-general-page';
|
||||
export const DatabaseGeneralPropertiesDocUrl = 'https://learn.microsoft.com/sql/relational-databases/databases/database-properties-general-page';
|
||||
export const DatabaseOptionsPropertiesDocUrl = 'https://learn.microsoft.com/sql/relational-databases/databases/database-properties-options-page'
|
||||
|
||||
export const enum TelemetryActions {
|
||||
CreateObject = 'CreateObject',
|
||||
|
||||
@@ -125,7 +125,7 @@ export function ObjectPropertiesDialogTitle(objectType: string, objectName: stri
|
||||
return localize({
|
||||
key: 'objectManagement.objectPropertiesDialogTitle',
|
||||
comment: ['{0} object type, {1}: object name.']
|
||||
}, '{0} - {1} (Preview)', objectType, objectName);
|
||||
}, '{0} Properties (Preview) - {1}', objectType, objectName);
|
||||
}
|
||||
|
||||
export function RenameObjectOperationDisplayName(objectType: string, originalName: string, newName: string): string {
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -7,11 +7,12 @@ import { ObjectManagementDialogBase, ObjectManagementDialogOptions } from './obj
|
||||
import { DefaultInputWidth } from '../../ui/dialogBase';
|
||||
import { IObjectManagementService } from 'mssql';
|
||||
import * as localizedConstants from '../localizedConstants';
|
||||
import { ViewServerPropertiesDocUrl } from '../constants';
|
||||
import { ViewGeneralServerPropertiesDocUrl, ViewMemoryServerPropertiesDocUrl } from '../constants';
|
||||
import { Server, ServerViewInfo } from '../interfaces';
|
||||
|
||||
export class ServerPropertiesDialog extends ObjectManagementDialogBase<Server, ServerViewInfo> {
|
||||
private generalTab: azdata.Tab;
|
||||
private readonly generalTabId: string = 'generalId';
|
||||
private platformSection: azdata.GroupContainer;
|
||||
private sqlServerSection: azdata.GroupContainer;
|
||||
private nameInput: azdata.InputBoxComponent;
|
||||
@@ -34,18 +35,31 @@ export class ServerPropertiesDialog extends ObjectManagementDialogBase<Server, S
|
||||
private versionInput: azdata.InputBoxComponent;
|
||||
|
||||
private memoryTab: azdata.Tab;
|
||||
private readonly memoryTabId: string = 'memoryId';
|
||||
private memorySection: azdata.GroupContainer;
|
||||
private minServerMemoryInput: azdata.InputBoxComponent;
|
||||
private maxServerMemoryInput: azdata.InputBoxComponent;
|
||||
private engineEdition: azdata.DatabaseEngineEdition;
|
||||
|
||||
private activeTabId: string;
|
||||
|
||||
constructor(objectManagementService: IObjectManagementService, options: ObjectManagementDialogOptions) {
|
||||
super(objectManagementService, options);
|
||||
this.dialogObject.customButtons[1].enabled = false;
|
||||
}
|
||||
|
||||
protected override get helpUrl(): string {
|
||||
return ViewServerPropertiesDocUrl;
|
||||
let helpUrl = '';
|
||||
switch (this.activeTabId) {
|
||||
case this.generalTabId:
|
||||
helpUrl = ViewGeneralServerPropertiesDocUrl;
|
||||
break;
|
||||
case this.memoryTabId:
|
||||
helpUrl = ViewMemoryServerPropertiesDocUrl;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
return helpUrl;
|
||||
}
|
||||
|
||||
protected override onFormFieldChange(): void {
|
||||
@@ -66,6 +80,10 @@ export class ServerPropertiesDialog extends ObjectManagementDialogBase<Server, S
|
||||
'margin': '-10px 0px 0px -10px'
|
||||
}
|
||||
}).component();
|
||||
this.disposables.push(
|
||||
serverPropertiesTabbedPannel.onTabChanged(async tabId => {
|
||||
this.activeTabId = tabId;
|
||||
}));
|
||||
this.formContainer.addItem(serverPropertiesTabbedPannel);
|
||||
}
|
||||
|
||||
@@ -158,19 +176,19 @@ export class ServerPropertiesDialog extends ObjectManagementDialogBase<Server, S
|
||||
|
||||
const generalContainer = this.createGroup('', [this.platformSection, this.sqlServerSection])
|
||||
|
||||
this.generalTab = this.createTab('generalId', localizedConstants.GeneralSectionHeader, generalContainer);
|
||||
this.generalTab = this.createTab(this.generalTabId, localizedConstants.GeneralSectionHeader, generalContainer);
|
||||
}
|
||||
|
||||
private initializeMemorySection(): void {
|
||||
const isEnabled = this.engineEdition !== azdata.DatabaseEngineEdition.SqlManagedInstance;
|
||||
this.minServerMemoryInput = this.createInputBox(localizedConstants.minServerMemoryText, async (newValue) => {
|
||||
this.objectInfo.minServerMemory.value = +newValue;
|
||||
}, this.objectInfo.minServerMemory.value.toString(), isEnabled, 'number', DefaultInputWidth, this.objectInfo.minServerMemory.minimumValue, this.objectInfo.minServerMemory.maximumValue);
|
||||
}, this.objectInfo.minServerMemory.value.toString(), isEnabled, 'number', DefaultInputWidth, true, this.objectInfo.minServerMemory.minimumValue, this.objectInfo.minServerMemory.maximumValue);
|
||||
const minMemoryContainer = this.createLabelInputContainer(localizedConstants.minServerMemoryText, this.minServerMemoryInput);
|
||||
|
||||
this.maxServerMemoryInput = this.createInputBox(localizedConstants.maxServerMemoryText, async (newValue) => {
|
||||
this.objectInfo.maxServerMemory.value = +newValue;
|
||||
}, this.objectInfo.maxServerMemory.value.toString(), isEnabled, 'number', DefaultInputWidth, this.objectInfo.maxServerMemory.minimumValue, this.objectInfo.maxServerMemory.maximumValue);
|
||||
}, this.objectInfo.maxServerMemory.value.toString(), isEnabled, 'number', DefaultInputWidth, true, this.objectInfo.maxServerMemory.minimumValue, this.objectInfo.maxServerMemory.maximumValue);
|
||||
const maxMemoryContainer = this.createLabelInputContainer(localizedConstants.maxServerMemoryText, this.maxServerMemoryInput);
|
||||
|
||||
this.memorySection = this.createGroup('', [
|
||||
@@ -178,7 +196,7 @@ export class ServerPropertiesDialog extends ObjectManagementDialogBase<Server, S
|
||||
maxMemoryContainer
|
||||
], false);
|
||||
|
||||
this.memoryTab = this.createTab('memoryId', localizedConstants.MemoryText, this.memorySection);
|
||||
this.memoryTab = this.createTab(this.memoryTabId, localizedConstants.MemoryText, this.memorySection);
|
||||
}
|
||||
|
||||
protected override async validateInput(): Promise<string[]> {
|
||||
|
||||
@@ -147,8 +147,8 @@ export abstract class DialogBase<DialogResult> {
|
||||
return this.createInputBox(ariaLabel, textChangeHandler, value, enabled, 'password', width);
|
||||
}
|
||||
|
||||
protected createInputBox(ariaLabel: string, textChangeHandler: (newValue: string) => Promise<void>, value: string = '', enabled: boolean = true, type: azdata.InputBoxInputType = 'text', width: number = DefaultInputWidth, min?: number, max?: number): azdata.InputBoxComponent {
|
||||
const inputbox = this.modelView.modelBuilder.inputBox().withProps({ inputType: type, enabled: enabled, ariaLabel: ariaLabel, value: value, width: width, min: min, max: max }).component();
|
||||
protected createInputBox(ariaLabel: string, textChangeHandler: (newValue: string) => Promise<void>, value: string = '', enabled: boolean = true, type: azdata.InputBoxInputType = 'text', width: number = DefaultInputWidth, required?: boolean, min?: number, max?: number): azdata.InputBoxComponent {
|
||||
const inputbox = this.modelView.modelBuilder.inputBox().withProps({ inputType: type, enabled: enabled, ariaLabel: ariaLabel, value: value, width: width, required: required, min: min, max: max }).component();
|
||||
this.disposables.push(inputbox.onTextChanged(async () => {
|
||||
await textChangeHandler(inputbox.value!);
|
||||
this.onFormFieldChange();
|
||||
|
||||
Reference in New Issue
Block a user