mirror of
https://github.com/ckaczor/azuredatastudio.git
synced 2026-02-17 02:51:36 -05:00
Fix restore dialog null references (#20096)
* Fix restore dialog null references * Make database field optional like other properties in viewmodel class
This commit is contained in:
@@ -287,7 +287,7 @@ export class RestoreDialog extends Modal {
|
|||||||
ariaLabel: LocalizedStrings.TARGETDATABASE,
|
ariaLabel: LocalizedStrings.TARGETDATABASE,
|
||||||
placeholder: localize('targetDatabaseTooltip', "Please enter target database name"),
|
placeholder: localize('targetDatabaseTooltip', "Please enter target database name"),
|
||||||
validationOptions: {
|
validationOptions: {
|
||||||
validation: (value: string) => this.viewModel.databases.includes(value) ? ({ type: MessageType.ERROR, content: localize('restoreDialog.targetDatabaseAlreadyExists', "Target database already exists") }) : null
|
validation: (value: string) => this.viewModel.databases?.includes(value) ? ({ type: MessageType.ERROR, content: localize('restoreDialog.targetDatabaseAlreadyExists', "Target database already exists") }) : null
|
||||||
},
|
},
|
||||||
}));
|
}));
|
||||||
|
|
||||||
@@ -666,7 +666,7 @@ export class RestoreDialog extends Modal {
|
|||||||
this._register(attachTableStyler(this._restorePlanTable!, this._themeService));
|
this._register(attachTableStyler(this._restorePlanTable!, this._themeService));
|
||||||
|
|
||||||
this._register(this._targetDatabaseInputBox.onDidChange(dbName => {
|
this._register(this._targetDatabaseInputBox.onDidChange(dbName => {
|
||||||
if (!this.viewModel.databases.includes(dbName)) {
|
if (!this.viewModel.databases?.includes(dbName)) {
|
||||||
if (this.viewModel.targetDatabaseName !== dbName) {
|
if (this.viewModel.targetDatabaseName !== dbName) {
|
||||||
this.viewModel.targetDatabaseName = dbName;
|
this.viewModel.targetDatabaseName = dbName;
|
||||||
this.validateRestore();
|
this.validateRestore();
|
||||||
|
|||||||
@@ -48,7 +48,7 @@ export class RestoreViewModel {
|
|||||||
public selectedBackupSets?: string[];
|
public selectedBackupSets?: string[];
|
||||||
public defaultBackupFolder?: string;
|
public defaultBackupFolder?: string;
|
||||||
public deviceType?: MediaDeviceType;
|
public deviceType?: MediaDeviceType;
|
||||||
public databases: string[];
|
public databases?: string[];
|
||||||
|
|
||||||
private _onSetLastBackupTaken = new Emitter<string>();
|
private _onSetLastBackupTaken = new Emitter<string>();
|
||||||
public onSetLastBackupTaken: Event<string> = this._onSetLastBackupTaken.event;
|
public onSetLastBackupTaken: Event<string> = this._onSetLastBackupTaken.event;
|
||||||
|
|||||||
Reference in New Issue
Block a user