From 52f8b4d6e11fa9136d3e3af3b7ea7977373fad89 Mon Sep 17 00:00:00 2001 From: Dennis Eichhorn Date: Sat, 1 Jun 2019 20:53:36 +0200 Subject: [PATCH] Allow hidden notification --- Message/Notification/NotificationLevel.js | 3 ++- Message/Request/Request.js | 12 ++++++------ UI/Component/Form.js | 2 +- tests/Message/Notification/NotificationLevelTest.js | 1 + 4 files changed, 10 insertions(+), 8 deletions(-) diff --git a/Message/Notification/NotificationLevel.js b/Message/Notification/NotificationLevel.js index 750d3cf..ab950c4 100644 --- a/Message/Notification/NotificationLevel.js +++ b/Message/Notification/NotificationLevel.js @@ -10,5 +10,6 @@ export const NotificationLevel = Object.freeze({ OK: 'ok', INFO: 'info', WARNING: 'warning', - ERROR: 'error' + ERROR: 'error', + HIDDEN: 'hidden' }); diff --git a/Message/Request/Request.js b/Message/Request/Request.js index f05fd8d..0967395 100644 --- a/Message/Request/Request.js +++ b/Message/Request/Request.js @@ -1,9 +1,9 @@ -import { RequestMethod } from './RequestMethod.js' -import { RequestType } from './RequestType.js' -import { BrowserType } from './BrowserType.js' -import { OSType } from './OSType.js' -import { UriFactory } from '../../Uri/UriFactory.js' -import { Logger } from '../../Log/Logger.js' +import { Logger } from '../../Log/Logger.js'; +import { UriFactory } from '../../Uri/UriFactory.js'; +import { BrowserType } from './BrowserType.js'; +import { OSType } from './OSType.js'; +import { RequestMethod } from './RequestMethod.js'; +import { RequestType } from './RequestType.js'; /** * Request class. diff --git a/UI/Component/Form.js b/UI/Component/Form.js index 804c940..28b4910 100644 --- a/UI/Component/Form.js +++ b/UI/Component/Form.js @@ -303,7 +303,7 @@ export class Form { // maybe there could be global response actions where injecting them to every form would not make any sense // however not many if any use cases come to mind right now where this would be necessary self.app.responseManager.run(response.get('type'), response.get(), request); - } else if (typeof o.status !== 'undefined') { + } else if (typeof o.status !== 'undefined' && o.status !== NotificationLevel.HIDDEN) { self.app.notifyManager.send( new NotificationMessage(o.status, o.title, o.message), NotificationType.APP_NOTIFICATION ); diff --git a/tests/Message/Notification/NotificationLevelTest.js b/tests/Message/Notification/NotificationLevelTest.js index 4b599f3..f7aa1b9 100644 --- a/tests/Message/Notification/NotificationLevelTest.js +++ b/tests/Message/Notification/NotificationLevelTest.js @@ -15,6 +15,7 @@ describe('NotificationLevelTest', function () expect(jsOMS.Message.Notification.NotificationLevel.INFO).toBe('info'); expect(jsOMS.Message.Notification.NotificationLevel.WARNING).toBe('warning'); expect(jsOMS.Message.Notification.NotificationLevel.ERROR).toBe('error'); + expect(jsOMS.Message.Notification.NotificationLevel.HIDDEN).toBe('hidden'); }); }); });