Fix backup/restore dialog titles not updating (#23164)

* Fix backup/restore dialog titles not updating

* Don't cast
This commit is contained in:
Charles Gagnon
2023-05-18 10:58:56 -07:00
committed by GitHub
parent 1efe948abe
commit d3f1d594e9
3 changed files with 17 additions and 6 deletions

View File

@@ -24,6 +24,7 @@ import { invalidProvider } from 'sql/base/common/errors';
import { ILogService } from 'vs/platform/log/common/log';
import { IAdsTelemetryService } from 'sql/platform/telemetry/common/telemetry';
import { DatabaseEngineEdition } from 'sql/workbench/api/common/sqlExtHostTypes';
import { localize } from 'vs/nls';
export class RestoreService implements IRestoreService {
@@ -300,6 +301,7 @@ export class RestoreDialogController implements IRestoreDialogController {
this._connectionService.connect(connection, this._ownerUri).then(connectionResult => {
this._sessionId = undefined;
this._currentProvider = this.getCurrentProviderId();
const dialogTitle = localize('restoreDialogTitle', 'Restore database - {0}:{1}', connection.serverName, connection.databaseName);
if (!this._restoreDialogs[this._currentProvider]) {
let newRestoreDialog: RestoreDialog | OptionsDialog;
if (this._currentProvider === ConnectionConstants.mssqlProviderName) {
@@ -311,12 +313,16 @@ export class RestoreDialogController implements IRestoreDialogController {
newRestoreDialog.onDatabaseListFocused(() => this.fetchDatabases(provider));
} else {
newRestoreDialog = this._instantiationService.createInstance(
OptionsDialog, 'Restore database - ' + connection.serverName + ':' + connection.databaseName, 'RestoreOptions', undefined);
OptionsDialog, dialogTitle, 'RestoreOptions', undefined);
newRestoreDialog.onOk(() => this.handleOnRestore());
}
newRestoreDialog.onCloseEvent(() => this.handleOnClose());
newRestoreDialog.render();
this._restoreDialogs[this._currentProvider] = newRestoreDialog;
} else if (this._currentProvider !== ConnectionConstants.mssqlProviderName) {
// Update the title for non-MSSQL restores each time so they show the correct database name since those
// use just a basic OptionsDialog which doesn't get updated on every open
this._restoreDialogs[this._currentProvider].title = dialogTitle;
}
if (this._currentProvider === ConnectionConstants.mssqlProviderName) {