Add Detach Database option to database context menu (#23480)

This commit is contained in:
Cory Rivera
2023-06-27 12:32:09 -07:00
committed by GitHub
parent fcb56da720
commit e5aa752740
12 changed files with 176 additions and 10 deletions

View File

@@ -35,12 +35,16 @@ export abstract class ObjectManagementDialogBase<ObjectInfoType extends ObjectMa
private _viewInfo: ViewInfoType;
private _originalObjectInfo: ObjectInfoType;
constructor(protected readonly objectManagementService: IObjectManagementService, options: ObjectManagementDialogOptions) {
super(options.isNewObject ? localizedConstants.NewObjectDialogTitle(localizedConstants.getNodeTypeDisplayName(options.objectType, true)) :
localizedConstants.ObjectPropertiesDialogTitle(localizedConstants.getNodeTypeDisplayName(options.objectType, true), options.objectName),
getDialogName(options.objectType, options.isNewObject),
options
);
constructor(protected readonly objectManagementService: IObjectManagementService, options: ObjectManagementDialogOptions, dialogTitle?: string, dialogName?: string) {
if (!dialogTitle) {
dialogTitle = options.isNewObject
? localizedConstants.NewObjectDialogTitle(localizedConstants.getNodeTypeDisplayName(options.objectType, true))
: localizedConstants.ObjectPropertiesDialogTitle(localizedConstants.getNodeTypeDisplayName(options.objectType, true), options.objectName);
}
if (!dialogName) {
dialogName = getDialogName(options.objectType, options.isNewObject);
}
super(dialogTitle, dialogName, options);
this._contextId = generateUuid();
}
@@ -54,6 +58,10 @@ export abstract class ObjectManagementDialogBase<ObjectInfoType extends ObjectMa
return errors;
}
protected async saveChanges(contextId: string, object: ObjectManagement.SqlObject): Promise<void> {
await this.objectManagementService.save(this._contextId, this.objectInfo);
}
protected override async initialize(): Promise<void> {
await super.initialize();
const typeDisplayName = localizedConstants.getNodeTypeDisplayName(this.options.objectType);
@@ -67,7 +75,7 @@ export abstract class ObjectManagementDialogBase<ObjectInfoType extends ObjectMa
try {
if (this.isDirty) {
const startTime = Date.now();
await this.objectManagementService.save(this._contextId, this.objectInfo);
await this.saveChanges(this._contextId, this.objectInfo);
if (this.options.objectExplorerContext) {
if (this.options.isNewObject) {
await refreshNode(this.options.objectExplorerContext);