mirror of
https://github.com/ckaczor/azuredatastudio.git
synced 2026-02-05 17:23:51 -05:00
Some promise fixes (#8216)
* Some promise fixes * changes to how we're logging errors * Fix the tests * Fix a few other issues
This commit is contained in:
@@ -6,9 +6,7 @@
|
||||
import { ITelemetryService } from 'vs/platform/telemetry/common/telemetry';
|
||||
import { IInstantiationService } from 'vs/platform/instantiation/common/instantiation';
|
||||
import * as types from 'vs/base/common/types';
|
||||
|
||||
import * as azdata from 'azdata';
|
||||
|
||||
import { ICapabilitiesService } from 'sql/platform/capabilities/common/capabilitiesService';
|
||||
import { IRestoreService, IRestoreDialogController, TaskExecutionMode } from 'sql/platform/restore/common/restoreService';
|
||||
import { OptionsDialog } from 'sql/workbench/browser/modal/optionsDialog';
|
||||
@@ -64,7 +62,7 @@ export class RestoreService implements IRestoreService {
|
||||
return new Promise<azdata.RestoreResponse>((resolve, reject) => {
|
||||
const providerResult = this.getProvider(connectionUri);
|
||||
if (providerResult) {
|
||||
TelemetryUtils.addTelemetry(this._telemetryService, this.logService, TelemetryKeys.RestoreRequested, { provider: providerResult.providerName });
|
||||
TelemetryUtils.addTelemetry(this._telemetryService, this.logService, TelemetryKeys.RestoreRequested, { provider: providerResult.providerName }).catch((e) => this.logService.error(e));
|
||||
providerResult.provider.restore(connectionUri, restoreInfo).then(result => {
|
||||
resolve(result);
|
||||
}, error => {
|
||||
@@ -149,7 +147,8 @@ export class RestoreDialogController implements IRestoreDialogController {
|
||||
@IConnectionManagementService private _connectionService: IConnectionManagementService,
|
||||
@ICapabilitiesService private _capabilitiesService: ICapabilitiesService,
|
||||
@IObjectExplorerService private _objectExplorerService: IObjectExplorerService,
|
||||
@ITaskService private _taskService: ITaskService
|
||||
@ITaskService private _taskService: ITaskService,
|
||||
@ILogService private _logService: ILogService,
|
||||
) {
|
||||
}
|
||||
|
||||
@@ -165,11 +164,14 @@ export class RestoreDialogController implements IRestoreDialogController {
|
||||
const self = this;
|
||||
let connectionProfile = self._connectionService.getConnectionProfile(self._ownerUri);
|
||||
let activeNode = self._objectExplorerService.getObjectExplorerNode(connectionProfile);
|
||||
this._taskService.onTaskComplete(response => {
|
||||
this._taskService.onTaskComplete(async response => {
|
||||
if (result.taskId === response.id && this.isSuccessfulRestore(response) && activeNode) {
|
||||
self._objectExplorerService.refreshTreeNode(activeNode.getSession(), activeNode).then(result => {
|
||||
self._objectExplorerService.getServerTreeView().refreshTree();
|
||||
});
|
||||
try {
|
||||
await self._objectExplorerService.refreshTreeNode(activeNode.getSession(), activeNode);
|
||||
await self._objectExplorerService.getServerTreeView().refreshTree();
|
||||
} catch (e) {
|
||||
this._logService.error(e);
|
||||
}
|
||||
}
|
||||
});
|
||||
let restoreDialog = this._restoreDialogs[this._currentProvider];
|
||||
@@ -279,7 +281,7 @@ export class RestoreDialogController implements IRestoreDialogController {
|
||||
}
|
||||
|
||||
private handleOnClose(): void {
|
||||
this._connectionService.disconnect(this._ownerUri);
|
||||
this._connectionService.disconnect(this._ownerUri).catch((e) => this._logService.error(e));
|
||||
}
|
||||
|
||||
private handleOnCancel(): void {
|
||||
|
||||
Reference in New Issue
Block a user