mirror of
https://github.com/ckaczor/azuredatastudio.git
synced 2026-02-14 18:46:34 -05:00
Merge VS Code 1.23.1 (#1520)
This commit is contained in:
@@ -1,31 +0,0 @@
|
||||
<?xml version='1.0' standalone='no' ?>
|
||||
<svg xmlns='http://www.w3.org/2000/svg' version='1.1' width='10px' height='10px'>
|
||||
<style>
|
||||
circle {
|
||||
animation: ball 0.6s linear infinite;
|
||||
}
|
||||
|
||||
circle:nth-child(2) { animation-delay: 0.075s; }
|
||||
circle:nth-child(3) { animation-delay: 0.15s; }
|
||||
circle:nth-child(4) { animation-delay: 0.225s; }
|
||||
circle:nth-child(5) { animation-delay: 0.3s; }
|
||||
circle:nth-child(6) { animation-delay: 0.375s; }
|
||||
circle:nth-child(7) { animation-delay: 0.45s; }
|
||||
circle:nth-child(8) { animation-delay: 0.525s; }
|
||||
|
||||
@keyframes ball {
|
||||
from { opacity: 1; }
|
||||
to { opacity: 0.3; }
|
||||
}
|
||||
</style>
|
||||
<g style="fill:white;">
|
||||
<circle cx='5' cy='1' r='1' style='opacity:0.3;' />
|
||||
<circle cx='7.8284' cy='2.1716' r='1' style='opacity:0.3;' />
|
||||
<circle cx='9' cy='5' r='1' style='opacity:0.3;' />
|
||||
<circle cx='7.8284' cy='7.8284' r='1' style='opacity:0.3;' />
|
||||
<circle cx='5' cy='9' r='1' style='opacity:0.3;' />
|
||||
<circle cx='2.1716' cy='7.8284' r='1' style='opacity:0.3;' />
|
||||
<circle cx='1' cy='5' r='1' style='opacity:0.3;' />
|
||||
<circle cx='2.1716' cy='2.1716' r='1' style='opacity:0.3;' />
|
||||
</g>
|
||||
</svg>
|
||||
|
Before Width: | Height: | Size: 1.1 KiB |
@@ -4,11 +4,11 @@
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
|
||||
.monaco-workbench > .part.statusbar > .statusbar-item.progress {
|
||||
background-image: url(progress.svg);
|
||||
background-repeat: no-repeat;
|
||||
background-position: left;
|
||||
padding-left: 14px;
|
||||
display: inline;
|
||||
padding-left: 5px;
|
||||
}
|
||||
|
||||
.monaco-workbench > .part.statusbar > .statusbar-item.progress .spinner-container {
|
||||
padding-right: 5px;
|
||||
}
|
||||
|
||||
.monaco-workbench .progress-badge > .badge-content {
|
||||
|
||||
@@ -3,9 +3,9 @@
|
||||
* Licensed under the Source EULA. See License.txt in the project root for license information.
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
|
||||
import lifecycle = require('vs/base/common/lifecycle');
|
||||
import * as lifecycle from 'vs/base/common/lifecycle';
|
||||
import { TPromise } from 'vs/base/common/winjs.base';
|
||||
import types = require('vs/base/common/types');
|
||||
import * as types from 'vs/base/common/types';
|
||||
import { ProgressBar } from 'vs/base/browser/ui/progressbar/progressbar';
|
||||
import { IViewletService } from 'vs/workbench/services/viewlet/browser/viewlet';
|
||||
import { IPanelService } from 'vs/workbench/services/panel/common/panelService';
|
||||
@@ -102,17 +102,17 @@ export class WorkbenchProgressService extends ScopedService implements IProgress
|
||||
|
||||
// Replay Infinite Progress
|
||||
else if (this.progressState.infinite) {
|
||||
this.progressbar.infinite().getContainer().show();
|
||||
this.progressbar.infinite().show();
|
||||
}
|
||||
|
||||
// Replay Finite Progress (Total & Worked)
|
||||
else {
|
||||
if (this.progressState.total) {
|
||||
this.progressbar.total(this.progressState.total).getContainer().show();
|
||||
this.progressbar.total(this.progressState.total).show();
|
||||
}
|
||||
|
||||
if (this.progressState.worked) {
|
||||
this.progressbar.worked(this.progressState.worked).getContainer().show();
|
||||
this.progressbar.worked(this.progressState.worked).show();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -152,20 +152,12 @@ export class WorkbenchProgressService extends ScopedService implements IProgress
|
||||
|
||||
// Infinite: Start Progressbar and Show after Delay
|
||||
if (!types.isUndefinedOrNull(infinite)) {
|
||||
if (types.isUndefinedOrNull(delay)) {
|
||||
this.progressbar.infinite().getContainer().show();
|
||||
} else {
|
||||
this.progressbar.infinite().getContainer().showDelayed(delay);
|
||||
}
|
||||
this.progressbar.infinite().show(delay);
|
||||
}
|
||||
|
||||
// Finite: Start Progressbar and Show after Delay
|
||||
else if (!types.isUndefinedOrNull(total)) {
|
||||
if (types.isUndefinedOrNull(delay)) {
|
||||
this.progressbar.total(total).getContainer().show();
|
||||
} else {
|
||||
this.progressbar.total(total).getContainer().showDelayed(delay);
|
||||
}
|
||||
this.progressbar.total(total).show(delay);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -200,7 +192,7 @@ export class WorkbenchProgressService extends ScopedService implements IProgress
|
||||
this.progressState.infinite = true;
|
||||
this.progressState.worked = void 0;
|
||||
this.progressState.total = void 0;
|
||||
this.progressbar.infinite().getContainer().show();
|
||||
this.progressbar.infinite().show();
|
||||
}
|
||||
},
|
||||
|
||||
@@ -209,7 +201,7 @@ export class WorkbenchProgressService extends ScopedService implements IProgress
|
||||
this.progressState.done = true;
|
||||
|
||||
if (this.isActive) {
|
||||
this.progressbar.stop().getContainer().hide();
|
||||
this.progressbar.stop().hide();
|
||||
}
|
||||
}
|
||||
};
|
||||
@@ -244,7 +236,7 @@ export class WorkbenchProgressService extends ScopedService implements IProgress
|
||||
this.clearProgressState();
|
||||
|
||||
if (this.isActive) {
|
||||
this.progressbar.stop().getContainer().hide();
|
||||
this.progressbar.stop().hide();
|
||||
}
|
||||
};
|
||||
|
||||
@@ -257,11 +249,7 @@ export class WorkbenchProgressService extends ScopedService implements IProgress
|
||||
|
||||
// Show Progress when active
|
||||
if (this.isActive) {
|
||||
if (types.isUndefinedOrNull(delay)) {
|
||||
this.progressbar.infinite().getContainer().show();
|
||||
} else {
|
||||
this.progressbar.infinite().getContainer().showDelayed(delay);
|
||||
}
|
||||
this.progressbar.infinite().show(delay);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -16,6 +16,9 @@ import { StatusbarAlignment, IStatusbarRegistry, StatusbarItemDescriptor, Extens
|
||||
import { TPromise } from 'vs/base/common/winjs.base';
|
||||
import { always } from 'vs/base/common/async';
|
||||
import { ProgressBadge, IActivityService } from 'vs/workbench/services/activity/common/activity';
|
||||
import { INotificationService, Severity, INotificationHandle, INotificationActions } from 'vs/platform/notification/common/notification';
|
||||
import { Action } from 'vs/base/common/actions';
|
||||
import { once } from 'vs/base/common/event';
|
||||
|
||||
class WindowProgressItem implements IStatusbarItem {
|
||||
|
||||
@@ -30,9 +33,25 @@ class WindowProgressItem implements IStatusbarItem {
|
||||
|
||||
render(element: HTMLElement): IDisposable {
|
||||
this._element = element;
|
||||
this._label = new OcticonLabel(this._element);
|
||||
this._element.classList.add('progress');
|
||||
|
||||
const container = document.createElement('span');
|
||||
this._element.appendChild(container);
|
||||
|
||||
const spinnerContainer = document.createElement('span');
|
||||
spinnerContainer.classList.add('spinner-container');
|
||||
container.appendChild(spinnerContainer);
|
||||
|
||||
const spinner = new OcticonLabel(spinnerContainer);
|
||||
spinner.text = '$(sync~spin)';
|
||||
|
||||
const labelContainer = document.createElement('span');
|
||||
container.appendChild(labelContainer);
|
||||
|
||||
this._label = new OcticonLabel(labelContainer);
|
||||
|
||||
this.hide();
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
@@ -62,15 +81,18 @@ export class ProgressService2 implements IProgressService2 {
|
||||
|
||||
constructor(
|
||||
@IActivityService private readonly _activityBar: IActivityService,
|
||||
@IViewletService private readonly _viewletService: IViewletService
|
||||
@IViewletService private readonly _viewletService: IViewletService,
|
||||
@INotificationService private readonly _notificationService: INotificationService
|
||||
) {
|
||||
//
|
||||
}
|
||||
|
||||
withProgress<P extends Thenable<R>, R=any>(options: IProgressOptions, task: (progress: IProgress<IProgressStep>) => P): P {
|
||||
withProgress<P extends Thenable<R>, R=any>(options: IProgressOptions, task: (progress: IProgress<IProgressStep>) => P, onDidCancel?: () => void): P {
|
||||
|
||||
const { location } = options;
|
||||
switch (location) {
|
||||
case ProgressLocation.Notification:
|
||||
return this._withNotificationProgress(options, task, onDidCancel);
|
||||
case ProgressLocation.Window:
|
||||
return this._withWindowProgress(options, task);
|
||||
case ProgressLocation.Explorer:
|
||||
@@ -85,7 +107,7 @@ export class ProgressService2 implements IProgressService2 {
|
||||
}
|
||||
}
|
||||
|
||||
private _withWindowProgress<P extends Thenable<R>, R=any>(options: IProgressOptions, callback: (progress: IProgress<{ message?: string, percentage?: number }>) => P): P {
|
||||
private _withWindowProgress<P extends Thenable<R>, R=any>(options: IProgressOptions, callback: (progress: IProgress<{ message?: string }>) => P): P {
|
||||
|
||||
const task: [IProgressOptions, Progress<IProgressStep>] = [options, new Progress<IProgressStep>(() => this._updateWindowProgress())];
|
||||
|
||||
@@ -134,8 +156,8 @@ export class ProgressService2 implements IProgressService2 {
|
||||
if (options.title && options.title !== title) {
|
||||
title = localize('progress.subtitle', "{0} - {1}", options.title, title);
|
||||
}
|
||||
if (options.tooltip) {
|
||||
title = localize('progress.title', "{0}: {1}", options.tooltip, title);
|
||||
if (options.source) {
|
||||
title = localize('progress.title', "{0}: {1}", options.source, title);
|
||||
}
|
||||
|
||||
WindowProgressItem.Instance.text = text;
|
||||
@@ -144,7 +166,95 @@ export class ProgressService2 implements IProgressService2 {
|
||||
}
|
||||
}
|
||||
|
||||
private _withViewletProgress<P extends Thenable<R>, R=any>(viewletId: string, task: (progress: IProgress<{ message?: string, percentage?: number }>) => P): P {
|
||||
private _withNotificationProgress<P extends Thenable<R>, R=any>(options: IProgressOptions, callback: (progress: IProgress<{ message?: string, increment?: number }>) => P, onDidCancel?: () => void): P {
|
||||
const toDispose: IDisposable[] = [];
|
||||
|
||||
const createNotification = (message: string, increment?: number): INotificationHandle => {
|
||||
if (!message) {
|
||||
return undefined; // we need a message at least
|
||||
}
|
||||
|
||||
const actions: INotificationActions = { primary: [] };
|
||||
if (options.cancellable) {
|
||||
const cancelAction = new class extends Action {
|
||||
constructor() {
|
||||
super('progress.cancel', localize('cancel', "Cancel"), null, true);
|
||||
}
|
||||
|
||||
run(): TPromise<any> {
|
||||
if (typeof onDidCancel === 'function') {
|
||||
onDidCancel();
|
||||
}
|
||||
|
||||
return TPromise.as(undefined);
|
||||
}
|
||||
};
|
||||
toDispose.push(cancelAction);
|
||||
|
||||
actions.primary.push(cancelAction);
|
||||
}
|
||||
|
||||
const handle = this._notificationService.notify({
|
||||
severity: Severity.Info,
|
||||
message: options.title,
|
||||
source: options.source,
|
||||
actions
|
||||
});
|
||||
|
||||
updateProgress(handle, increment);
|
||||
|
||||
once(handle.onDidClose)(() => {
|
||||
dispose(toDispose);
|
||||
});
|
||||
|
||||
return handle;
|
||||
};
|
||||
|
||||
const updateProgress = (notification: INotificationHandle, increment?: number): void => {
|
||||
if (typeof increment === 'number' && increment >= 0) {
|
||||
notification.progress.total(100); // always percentage based
|
||||
notification.progress.worked(increment);
|
||||
} else {
|
||||
notification.progress.infinite();
|
||||
}
|
||||
};
|
||||
|
||||
let handle: INotificationHandle;
|
||||
const updateNotification = (message?: string, increment?: number): void => {
|
||||
if (!handle) {
|
||||
handle = createNotification(message, increment);
|
||||
} else {
|
||||
if (typeof message === 'string') {
|
||||
handle.updateMessage(message);
|
||||
}
|
||||
|
||||
if (typeof increment === 'number') {
|
||||
updateProgress(handle, increment);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
// Show initially
|
||||
updateNotification(options.title);
|
||||
|
||||
// Update based on progress
|
||||
const p = callback({
|
||||
report: progress => {
|
||||
updateNotification(progress.message, progress.increment);
|
||||
}
|
||||
});
|
||||
|
||||
// Show progress for at least 800ms and then hide once done or canceled
|
||||
always(TPromise.join([TPromise.timeout(800), p]), () => {
|
||||
if (handle) {
|
||||
handle.close();
|
||||
}
|
||||
});
|
||||
|
||||
return p;
|
||||
}
|
||||
|
||||
private _withViewletProgress<P extends Thenable<R>, R=any>(viewletId: string, task: (progress: IProgress<{ message?: string }>) => P): P {
|
||||
|
||||
const promise = task(emptyProgress);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user