mirror of
https://github.com/ckaczor/azuredatastudio.git
synced 2026-01-27 17:23:21 -05:00
Add Detach Database option to database context menu (#23480)
This commit is contained in:
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user