mirror of
https://github.com/ckaczor/azuredatastudio.git
synced 2026-02-17 02:51:36 -05:00
Update task labels for Attach, Detach, and Drop Database (#24289)
This commit is contained in:
@@ -108,6 +108,13 @@ export function OpenDetachDatabaseDialogError(error: string): string {
|
|||||||
}, "An error occurred while opening the detach database dialog. {0}", error);
|
}, "An error occurred while opening the detach database dialog. {0}", error);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export function DetachDatabaseOperationDisplayName(objectName: string): string {
|
||||||
|
return localize({
|
||||||
|
key: 'objectManagement.detachDatabaseOperationName',
|
||||||
|
comment: ['{0}: object name.']
|
||||||
|
}, "Detach database '{0}'", objectName);
|
||||||
|
}
|
||||||
|
|
||||||
export function OpenDropDatabaseDialogError(error: string): string {
|
export function OpenDropDatabaseDialogError(error: string): string {
|
||||||
return localize({
|
return localize({
|
||||||
key: 'objectManagement.openDropDatabaseDialogError',
|
key: 'objectManagement.openDropDatabaseDialogError',
|
||||||
@@ -122,6 +129,8 @@ export function OpenAttachDatabaseDialogError(error: string): string {
|
|||||||
}, "An error occurred while opening the attach database dialog. {0}", error);
|
}, "An error occurred while opening the attach database dialog. {0}", error);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export const AttachDatabaseOperationDisplayName = localize('objectManagement.attachDatabaseOperationName', "Attach database");
|
||||||
|
|
||||||
export function OpenObjectPropertiesDialogError(objectType: string, objectName: string, error: string): string {
|
export function OpenObjectPropertiesDialogError(objectType: string, objectName: string, error: string): string {
|
||||||
return localize({
|
return localize({
|
||||||
key: 'objectManagement.openObjectPropertiesDialogError',
|
key: 'objectManagement.openObjectPropertiesDialogError',
|
||||||
|
|||||||
@@ -36,6 +36,10 @@ export class AttachDatabaseDialog extends ObjectManagementDialogBase<Database, D
|
|||||||
return this._databasesToAttach.length > 0;
|
return this._databasesToAttach.length > 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected override get saveChangesTaskLabel(): string {
|
||||||
|
return loc.AttachDatabaseOperationDisplayName;
|
||||||
|
}
|
||||||
|
|
||||||
protected async initializeUI(): Promise<void> {
|
protected async initializeUI(): Promise<void> {
|
||||||
let filesSection = this.initializeAttachSection();
|
let filesSection = this.initializeAttachSection();
|
||||||
let associatedSection = this.initializeAssociatedFilesSection();
|
let associatedSection = this.initializeAssociatedFilesSection();
|
||||||
|
|||||||
@@ -7,34 +7,38 @@ import { ObjectManagementDialogBase, ObjectManagementDialogOptions } from './obj
|
|||||||
import { IObjectManagementService, ObjectManagement } from 'mssql';
|
import { IObjectManagementService, ObjectManagement } from 'mssql';
|
||||||
import { Database, DatabaseViewInfo } from '../interfaces';
|
import { Database, DatabaseViewInfo } from '../interfaces';
|
||||||
import { DetachDatabaseDocUrl } from '../constants';
|
import { DetachDatabaseDocUrl } from '../constants';
|
||||||
import { DatabaseFileGroupLabel, DatabaseFileNameLabel, DatabaseFilePathLabel, DatabaseFileTypeLabel, DatabaseFilesLabel, DetachButtonLabel, DetachDatabaseDialogTitle, DetachDatabaseOptions, DetachDropConnections, DetachUpdateStatistics } from '../localizedConstants';
|
import * as loc from '../localizedConstants';
|
||||||
|
|
||||||
export class DetachDatabaseDialog extends ObjectManagementDialogBase<Database, DatabaseViewInfo> {
|
export class DetachDatabaseDialog extends ObjectManagementDialogBase<Database, DatabaseViewInfo> {
|
||||||
private _dropConnections = false;
|
private _dropConnections = false;
|
||||||
private _updateStatistics = false;
|
private _updateStatistics = false;
|
||||||
|
|
||||||
constructor(objectManagementService: IObjectManagementService, options: ObjectManagementDialogOptions) {
|
constructor(objectManagementService: IObjectManagementService, options: ObjectManagementDialogOptions) {
|
||||||
super(objectManagementService, options, DetachDatabaseDialogTitle(options.database), 'DetachDatabase');
|
super(objectManagementService, options, loc.DetachDatabaseDialogTitle(options.database), 'DetachDatabase');
|
||||||
this.dialogObject.okButton.label = DetachButtonLabel;
|
this.dialogObject.okButton.label = loc.DetachButtonLabel;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override get isDirty(): boolean {
|
protected override get isDirty(): boolean {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected override get saveChangesTaskLabel(): string {
|
||||||
|
return loc.DetachDatabaseOperationDisplayName(this.objectInfo.name);
|
||||||
|
}
|
||||||
|
|
||||||
protected async initializeUI(): Promise<void> {
|
protected async initializeUI(): Promise<void> {
|
||||||
let tableData = this.objectInfo.files.map(file => [file.name, file.type, file.fileGroup, file.path]);
|
let tableData = this.objectInfo.files.map(file => [file.name, file.type, file.fileGroup, file.path]);
|
||||||
let columnNames = [DatabaseFileNameLabel, DatabaseFileTypeLabel, DatabaseFileGroupLabel, DatabaseFilePathLabel];
|
let columnNames = [loc.DatabaseFileNameLabel, loc.DatabaseFileTypeLabel, loc.DatabaseFileGroupLabel, loc.DatabaseFilePathLabel];
|
||||||
let fileTable = this.createTable(DatabaseFilesLabel, columnNames, tableData);
|
let fileTable = this.createTable(loc.DatabaseFilesLabel, columnNames, tableData);
|
||||||
let tableGroup = this.createGroup(DatabaseFilesLabel, [fileTable], false);
|
let tableGroup = this.createGroup(loc.DatabaseFilesLabel, [fileTable], false);
|
||||||
|
|
||||||
let connCheckbox = this.createCheckbox(DetachDropConnections, async checked => {
|
let connCheckbox = this.createCheckbox(loc.DetachDropConnections, async checked => {
|
||||||
this._dropConnections = checked;
|
this._dropConnections = checked;
|
||||||
});
|
});
|
||||||
let updateCheckbox = this.createCheckbox(DetachUpdateStatistics, async checked => {
|
let updateCheckbox = this.createCheckbox(loc.DetachUpdateStatistics, async checked => {
|
||||||
this._updateStatistics = checked;
|
this._updateStatistics = checked;
|
||||||
});
|
});
|
||||||
let checkboxGroup = this.createGroup(DetachDatabaseOptions, [connCheckbox, updateCheckbox], false);
|
let checkboxGroup = this.createGroup(loc.DetachDatabaseOptions, [connCheckbox, updateCheckbox], false);
|
||||||
|
|
||||||
let components = [tableGroup, checkboxGroup];
|
let components = [tableGroup, checkboxGroup];
|
||||||
this.formContainer.addItems(components);
|
this.formContainer.addItems(components);
|
||||||
|
|||||||
@@ -7,38 +7,42 @@ import { ObjectManagementDialogBase, ObjectManagementDialogOptions } from './obj
|
|||||||
import { IObjectManagementService, ObjectManagement } from 'mssql';
|
import { IObjectManagementService, ObjectManagement } from 'mssql';
|
||||||
import { Database, DatabaseViewInfo } from '../interfaces';
|
import { Database, DatabaseViewInfo } from '../interfaces';
|
||||||
import { DropDatabaseDocUrl } from '../constants';
|
import { DropDatabaseDocUrl } from '../constants';
|
||||||
import { DropButtonLabel, DropDatabaseDialogTitle, DeleteBackupHistory, CloseConnections, DropDatabaseOptions, NameText, OwnerText, StatusText, DatabaseDetailsLabel } from '../localizedConstants';
|
import * as loc from '../localizedConstants';
|
||||||
|
|
||||||
export class DropDatabaseDialog extends ObjectManagementDialogBase<Database, DatabaseViewInfo> {
|
export class DropDatabaseDialog extends ObjectManagementDialogBase<Database, DatabaseViewInfo> {
|
||||||
private _dropConnections = false;
|
private _dropConnections = false;
|
||||||
private _deleteBackupHistory = false;
|
private _deleteBackupHistory = false;
|
||||||
|
|
||||||
constructor(objectManagementService: IObjectManagementService, options: ObjectManagementDialogOptions) {
|
constructor(objectManagementService: IObjectManagementService, options: ObjectManagementDialogOptions) {
|
||||||
super(objectManagementService, options, DropDatabaseDialogTitle(options.database), 'DropDatabase');
|
super(objectManagementService, options, loc.DropDatabaseDialogTitle(options.database), 'DropDatabase');
|
||||||
this.dialogObject.okButton.label = DropButtonLabel;
|
this.dialogObject.okButton.label = loc.DropButtonLabel;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override get isDirty(): boolean {
|
protected override get isDirty(): boolean {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected override get saveChangesTaskLabel(): string {
|
||||||
|
return loc.DropObjectOperationDisplayName(loc.DatabaseTypeDisplayName, this.objectInfo.name);
|
||||||
|
}
|
||||||
|
|
||||||
protected async initializeUI(): Promise<void> {
|
protected async initializeUI(): Promise<void> {
|
||||||
let components = [];
|
let components = [];
|
||||||
|
|
||||||
let tableData = [[this.objectInfo.name, this.objectInfo.owner ?? '', this.objectInfo.status ?? '']];
|
let tableData = [[this.objectInfo.name, this.objectInfo.owner ?? '', this.objectInfo.status ?? '']];
|
||||||
let columnNames = [NameText, OwnerText, StatusText];
|
let columnNames = [loc.NameText, loc.OwnerText, loc.StatusText];
|
||||||
let fileTable = this.createTable(DatabaseDetailsLabel, columnNames, tableData);
|
let fileTable = this.createTable(loc.DatabaseDetailsLabel, columnNames, tableData);
|
||||||
let tableGroup = this.createGroup(DatabaseDetailsLabel, [fileTable], false);
|
let tableGroup = this.createGroup(loc.DatabaseDetailsLabel, [fileTable], false);
|
||||||
components.push(tableGroup);
|
components.push(tableGroup);
|
||||||
|
|
||||||
if (!this.viewInfo.isAzureDB && !this.viewInfo.isManagedInstance && !this.viewInfo.isSqlOnDemand) {
|
if (!this.viewInfo.isAzureDB && !this.viewInfo.isManagedInstance && !this.viewInfo.isSqlOnDemand) {
|
||||||
let connCheckbox = this.createCheckbox(CloseConnections, async checked => {
|
let connCheckbox = this.createCheckbox(loc.CloseConnections, async checked => {
|
||||||
this._dropConnections = checked;
|
this._dropConnections = checked;
|
||||||
});
|
});
|
||||||
let updateCheckbox = this.createCheckbox(DeleteBackupHistory, async checked => {
|
let updateCheckbox = this.createCheckbox(loc.DeleteBackupHistory, async checked => {
|
||||||
this._deleteBackupHistory = checked;
|
this._deleteBackupHistory = checked;
|
||||||
});
|
});
|
||||||
let checkboxGroup = this.createGroup(DropDatabaseOptions, [connCheckbox, updateCheckbox], false);
|
let checkboxGroup = this.createGroup(loc.DropDatabaseOptions, [connCheckbox, updateCheckbox], false);
|
||||||
components.push(checkboxGroup);
|
components.push(checkboxGroup);
|
||||||
}
|
}
|
||||||
this.formContainer.addItems(components);
|
this.formContainer.addItems(components);
|
||||||
|
|||||||
@@ -62,12 +62,16 @@ export abstract class ObjectManagementDialogBase<ObjectInfoType extends ObjectMa
|
|||||||
await this.objectManagementService.save(this._contextId, this.objectInfo);
|
await this.objectManagementService.save(this._contextId, this.objectInfo);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected get saveChangesTaskLabel(): string {
|
||||||
|
const typeDisplayName = localizedConstants.getNodeTypeDisplayName(this.options.objectType);
|
||||||
|
return this.options.isNewObject ? localizedConstants.CreateObjectOperationDisplayName(typeDisplayName)
|
||||||
|
: localizedConstants.UpdateObjectOperationDisplayName(typeDisplayName, this.options.objectName);
|
||||||
|
}
|
||||||
|
|
||||||
protected override async initialize(): Promise<void> {
|
protected override async initialize(): Promise<void> {
|
||||||
await super.initialize();
|
await super.initialize();
|
||||||
const typeDisplayName = localizedConstants.getNodeTypeDisplayName(this.options.objectType);
|
|
||||||
this.dialogObject.registerOperation({
|
this.dialogObject.registerOperation({
|
||||||
displayName: this.options.isNewObject ? localizedConstants.CreateObjectOperationDisplayName(typeDisplayName)
|
displayName: this.saveChangesTaskLabel,
|
||||||
: localizedConstants.UpdateObjectOperationDisplayName(typeDisplayName, this.options.objectName),
|
|
||||||
description: '',
|
description: '',
|
||||||
isCancelable: false,
|
isCancelable: false,
|
||||||
operation: async (operation: azdata.BackgroundOperation): Promise<void> => {
|
operation: async (operation: azdata.BackgroundOperation): Promise<void> => {
|
||||||
|
|||||||
Reference in New Issue
Block a user