mirror of
https://github.com/microsoft/vscode.git
synced 2026-04-25 19:18:59 +01:00
re order sync views
This commit is contained in:
@@ -6,7 +6,7 @@
|
||||
import { IUserDataSyncService, IAuthenticationProvider, getUserDataSyncStore, isAuthenticationProvider, IUserDataAutoSyncService, SyncResource, IResourcePreview, ISyncResourcePreview, Change, IManualSyncTask } from 'vs/platform/userDataSync/common/userDataSync';
|
||||
import { ITelemetryService } from 'vs/platform/telemetry/common/telemetry';
|
||||
import { registerSingleton } from 'vs/platform/instantiation/common/extensions';
|
||||
import { IUserDataSyncWorkbenchService, IUserDataSyncAccount, AccountStatus, CONTEXT_SYNC_ENABLEMENT, CONTEXT_SYNC_STATE, CONTEXT_ACCOUNT_STATE, SHOW_SYNC_LOG_COMMAND_ID, getSyncAreaLabel, IUserDataSyncPreview, IUserDataSyncResourceGroup, CONTEXT_SHOW_MANUAL_SYNC_VIEW, SHOW_SYNCED_DATA_COMMAND_ID, MANUAL_SYNC_VIEW_ID } from 'vs/workbench/services/userDataSync/common/userDataSync';
|
||||
import { IUserDataSyncWorkbenchService, IUserDataSyncAccount, AccountStatus, CONTEXT_SYNC_ENABLEMENT, CONTEXT_SYNC_STATE, CONTEXT_ACCOUNT_STATE, SHOW_SYNC_LOG_COMMAND_ID, getSyncAreaLabel, IUserDataSyncPreview, IUserDataSyncResourceGroup, CONTEXT_SHOW_MANUAL_SYNC_VIEW, MANUAL_SYNC_VIEW_ID, CONTEXT_ENABLE_VIEWS, SYNC_VIEW_CONTAINER_ID } from 'vs/workbench/services/userDataSync/common/userDataSync';
|
||||
import { AuthenticationSession, AuthenticationSessionsChangeEvent } from 'vs/editor/common/modes';
|
||||
import { Disposable, DisposableStore } from 'vs/base/common/lifecycle';
|
||||
import { Emitter, Event } from 'vs/base/common/event';
|
||||
@@ -25,7 +25,6 @@ import { canceled } from 'vs/base/common/errors';
|
||||
import { INotificationService, Severity } from 'vs/platform/notification/common/notification';
|
||||
import { IDialogService } from 'vs/platform/dialogs/common/dialogs';
|
||||
import { IContextKey, IContextKeyService } from 'vs/platform/contextkey/common/contextkey';
|
||||
import { ICommandService } from 'vs/platform/commands/common/commands';
|
||||
import { Action } from 'vs/base/common/actions';
|
||||
import { IProgressService, ProgressLocation } from 'vs/platform/progress/common/progress';
|
||||
import { isEqual } from 'vs/base/common/resources';
|
||||
@@ -82,6 +81,7 @@ export class UserDataSyncWorkbenchService extends Disposable implements IUserDat
|
||||
private readonly syncStatusContext: IContextKey<string>;
|
||||
private readonly accountStatusContext: IContextKey<string>;
|
||||
private readonly showManualSyncViewContext: IContextKey<boolean>;
|
||||
private readonly viewsEnablementContext: IContextKey<boolean>;
|
||||
|
||||
readonly userDataSyncPreview: UserDataSyncPreview = this._register(new UserDataSyncPreview(this.userDataSyncService));
|
||||
|
||||
@@ -101,7 +101,6 @@ export class UserDataSyncWorkbenchService extends Disposable implements IUserDat
|
||||
@INotificationService private readonly notificationService: INotificationService,
|
||||
@IProgressService private readonly progressService: IProgressService,
|
||||
@IDialogService private readonly dialogService: IDialogService,
|
||||
@ICommandService private readonly commandService: ICommandService,
|
||||
@IContextKeyService contextKeyService: IContextKeyService,
|
||||
@IViewsService private readonly viewsService: IViewsService,
|
||||
@IViewDescriptorService private readonly viewDescriptorService: IViewDescriptorService,
|
||||
@@ -112,6 +111,7 @@ export class UserDataSyncWorkbenchService extends Disposable implements IUserDat
|
||||
this.syncEnablementContext = CONTEXT_SYNC_ENABLEMENT.bindTo(contextKeyService);
|
||||
this.syncStatusContext = CONTEXT_SYNC_STATE.bindTo(contextKeyService);
|
||||
this.accountStatusContext = CONTEXT_ACCOUNT_STATE.bindTo(contextKeyService);
|
||||
this.viewsEnablementContext = CONTEXT_ENABLE_VIEWS.bindTo(contextKeyService);
|
||||
this.showManualSyncViewContext = CONTEXT_SHOW_MANUAL_SYNC_VIEW.bindTo(contextKeyService);
|
||||
|
||||
decorationsService.registerDecorationsProvider(this.userDataSyncPreview);
|
||||
@@ -338,7 +338,7 @@ export class UserDataSyncWorkbenchService extends Disposable implements IUserDat
|
||||
this.userDataSyncPreview.setManualSyncPreview(task, preview);
|
||||
|
||||
this.showManualSyncViewContext.set(true);
|
||||
await this.commandService.executeCommand(SHOW_SYNCED_DATA_COMMAND_ID);
|
||||
await this.enableSyncViews();
|
||||
await this.viewsService.openView(MANUAL_SYNC_VIEW_ID);
|
||||
|
||||
await Event.toPromise(Event.filter(this.userDataSyncPreview.onDidChangeChanges, e => e.length === 0));
|
||||
@@ -369,6 +369,22 @@ export class UserDataSyncWorkbenchService extends Disposable implements IUserDat
|
||||
}
|
||||
}
|
||||
|
||||
async showSyncActivity(): Promise<void> {
|
||||
await this.enableSyncViews();
|
||||
await this.viewsService.openViewContainer(SYNC_VIEW_CONTAINER_ID);
|
||||
}
|
||||
|
||||
private async enableSyncViews(): Promise<void> {
|
||||
this.viewsEnablementContext.set(true);
|
||||
const viewContainer = this.viewDescriptorService.getViewContainerById(SYNC_VIEW_CONTAINER_ID);
|
||||
if (viewContainer) {
|
||||
const model = this.viewDescriptorService.getViewContainerModel(viewContainer);
|
||||
if (!model.activeViewDescriptors.length) {
|
||||
await Event.toPromise(Event.filter(model.onDidChangeActiveViewDescriptors, e => model.activeViewDescriptors.length > 0));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private isSupportedAuthenticationProviderId(authenticationProviderId: string): boolean {
|
||||
return this.authenticationProviders.some(({ id }) => id === authenticationProviderId);
|
||||
}
|
||||
|
||||
@@ -54,7 +54,9 @@ export interface IUserDataSyncWorkbenchService {
|
||||
turnOn(): Promise<void>;
|
||||
turnoff(everyWhere: boolean): Promise<void>;
|
||||
signIn(): Promise<void>;
|
||||
|
||||
resetSyncedData(): Promise<void>;
|
||||
showSyncActivity(): Promise<void>;
|
||||
}
|
||||
|
||||
export function getSyncAreaLabel(source: SyncResource): string {
|
||||
@@ -83,7 +85,7 @@ export const CONTEXT_SHOW_MANUAL_SYNC_VIEW = new RawContextKey<boolean>(`showMan
|
||||
// Commands
|
||||
export const CONFIGURE_SYNC_COMMAND_ID = 'workbench.userDataSync.actions.configure';
|
||||
export const SHOW_SYNC_LOG_COMMAND_ID = 'workbench.userDataSync.actions.showLog';
|
||||
export const SHOW_SYNCED_DATA_COMMAND_ID = 'workbench.userDataSync.actions.showSyncedData';
|
||||
|
||||
// VIEWS
|
||||
export const SYNC_VIEW_CONTAINER_ID = 'workbench.view.sync';
|
||||
export const MANUAL_SYNC_VIEW_ID = 'workbench.views.manualSyncView';
|
||||
|
||||
Reference in New Issue
Block a user