diff --git a/CHANGELOG.md b/CHANGELOG.md index 481e5727215cc..79c42aedfa46f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -8,6 +8,8 @@ [Breaking Changes:](#breaking_changes_1.7.0) - [plugin-metrics] renamed `AnalyticsFromRequests.succesfulResponses` to `AnalyticsFromRequests.successfulResponses` []() +- [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 diff --git a/packages/core/src/common/message-service-protocol.ts b/packages/core/src/common/message-service-protocol.ts index 277edb66059d8..b3c2f13686ce5 100644 --- a/packages/core/src/common/message-service-protocol.ts +++ b/packages/core/src/common/message-service-protocol.ts @@ -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?.cancelable; } } diff --git a/packages/messages/src/browser/notification-component.tsx b/packages/messages/src/browser/notification-component.tsx index 53565e85e25d1..38f60324634ad 100644 --- a/packages/messages/src/browser/notification-component.tsx +++ b/packages/messages/src/browser/notification-component.tsx @@ -68,6 +68,7 @@ export class NotificationComponent extends React.Component
@@ -80,7 +81,7 @@ export class NotificationComponent extends React.Component )} -
  • + { !isProgress && (
  • )}
  • {(source || !!actions.length) && ( @@ -100,7 +101,7 @@ export class NotificationComponent extends React.Component )}
    - {typeof progress === 'number' && ( + { isProgress && (
    diff --git a/packages/messages/src/browser/notifications-manager.ts b/packages/messages/src/browser/notifications-manager.ts index 2c0f7b00fd752..c89e935e3bb01 100644 --- a/packages/messages/src/browser/notifications-manager.ts +++ b/packages/messages/src/browser/notifications-manager.ts @@ -66,8 +66,12 @@ export class NotificationManager extends MessageClient { protected readonly onUpdatedEmitter = new Emitter(); 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 }); @@ -269,8 +273,9 @@ export class NotificationManager extends MessageClient { if (cancellationToken.isCancellationRequested) { this.clear(messageId); } else { - notification.message = update.message ? `${originalMessage.text}: ${update.message}` : originalMessage.text; - notification.progress = this.toPlainProgress(update); + notification.message = originalMessage.text && update.message ? `${originalMessage.text}: ${update.message}` : + originalMessage.text || update?.message || notification.message; + notification.progress = this.toPlainProgress(update) || notification.progress; } this.fireUpdatedEvent(); }