mirror of
https://github.com/ckaczor/azuredatastudio.git
synced 2026-01-19 17:22:48 -05:00
* Adding migration service to sql migrations * enabling auto flush log * Adding support for env variable * Adding TDE Migration service * code cleanup * updating service downloader * Removing custom output channel * remove unnecessary await * Updated service version to get latest code * Consolidate TDE into migration service * Sync to latest main * Update sql-migration package version * Fix merge conflict error * Fixing all merge conflicts * Fixing stuff * removing extra whitespace * Cleaning up --------- Co-authored-by: Akshay Mata <akma@microsoft.com>
47 lines
1.6 KiB
TypeScript
47 lines
1.6 KiB
TypeScript
/*---------------------------------------------------------------------------------------------
|
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
* Licensed under the Source EULA. See License.txt in the project root for license information.
|
|
*--------------------------------------------------------------------------------------------*/
|
|
|
|
import { ApiType, MigrationExtensionService } from './features';
|
|
import * as constants from '../constants/strings';
|
|
import * as vscode from 'vscode';
|
|
|
|
export class MigrationServiceProvider {
|
|
private services: Map<ApiType, MigrationExtensionService> = new Map();
|
|
|
|
constructor() {
|
|
}
|
|
|
|
public addService(service: MigrationExtensionService) {
|
|
this.services.set(service.providerId, service);
|
|
}
|
|
|
|
public async getService(serviceId: ApiType): Promise<MigrationExtensionService> {
|
|
if (this.services.has(serviceId)) {
|
|
return this.services.get(serviceId)!;
|
|
}
|
|
return this.waitUntilProviderReady(serviceId);
|
|
}
|
|
|
|
public async waitUntilProviderReady(serviceId: ApiType): Promise<MigrationExtensionService> {
|
|
const service = await vscode.window.withProgress({
|
|
location: vscode.ProgressLocation.Notification,
|
|
title: constants.waitingForService(serviceId),
|
|
cancellable: false
|
|
}, (progress, token) => {
|
|
return new Promise<MigrationExtensionService>(resolve => {
|
|
const interval = setInterval(() => {
|
|
if (this.services.has(serviceId)) {
|
|
clearInterval(interval);
|
|
resolve(this.services.get(serviceId)!);
|
|
}
|
|
}, 250);
|
|
});
|
|
});
|
|
return service;
|
|
}
|
|
}
|
|
|
|
export const migrationServiceProvider = new MigrationServiceProvider();
|