Skip to content

Commit

Permalink
Fix progress notification issues
Browse files Browse the repository at this point in the history
Signed-off-by: Doron Nahari <doron.nahari@sap.com>
  • Loading branch information
DoroNahari committed Sep 29, 2020
1 parent 7e7d0cd commit 6bd9865
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 6 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,10 @@

- [scm] show in the commit textbox the branch to which the commit will go [#6156](https://github.com/eclipse-theia/theia/pull/6156)

<a name="breaking_changes_1.7.0">[Breaking Changes:](#breaking_changes_1.7.0)</a>

- [core] change progress notification cancelable property default from true to false [#8479](https://github.com/eclipse-theia/theia/pull/8479)
- [messages] empty notifications and progress notifications will not be shown [#8479](https://github.com/eclipse-theia/theia/pull/8479)

## v1.6.0 - 24/09/2020

Expand Down
4 changes: 1 addition & 3 deletions packages/core/src/common/message-service-protocol.ts
Original file line number Diff line number Diff line change
Expand Up @@ -42,9 +42,7 @@ export interface ProgressMessage extends Message {
export namespace ProgressMessage {
export const Cancel = 'Cancel';
export function isCancelable(message: ProgressMessage): boolean {
return !message.options
|| message.options.cancelable === undefined
|| message.options.cancelable === true;
return !!message.options && !!message.options.cancelable;
}
}

Expand Down
11 changes: 8 additions & 3 deletions packages/messages/src/browser/notifications-manager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -66,8 +66,12 @@ export class NotificationManager extends MessageClient {
protected readonly onUpdatedEmitter = new Emitter<NotificationUpdateEvent>();
readonly onUpdated = this.onUpdatedEmitter.event;
protected readonly fireUpdatedEvent = throttle(() => {
const notifications = deepClone(Array.from(this.notifications.values()));
const toasts = deepClone(Array.from(this.toasts.values()));
const notifications = deepClone(Array.from(this.notifications.values()).filter((notification: Notification) =>
notification.message
));
const toasts = deepClone(Array.from(this.toasts.values()).filter((toast: Notification) =>
toast.message
));
const visibilityState = this.visibilityState;
this.onUpdatedEmitter.fire({ notifications, toasts, visibilityState });
}, 250, { leading: true, trailing: true });
Expand Down Expand Up @@ -269,7 +273,8 @@ export class NotificationManager extends MessageClient {
if (cancellationToken.isCancellationRequested) {
this.clear(messageId);
} else {
notification.message = update.message ? `${originalMessage.text}: ${update.message}` : originalMessage.text;
notification.message = originalMessage.text && update.message ? `${originalMessage.text}: ${update.message}` :
originalMessage.text || update?.message || notification.message;
notification.progress = this.toPlainProgress(update);
}
this.fireUpdatedEvent();
Expand Down

0 comments on commit 6bd9865

Please sign in to comment.