From c979823fe0ac307bcf121a806a9f282bfe173e5f Mon Sep 17 00:00:00 2001 From: Eugen Neuber <eugen.neuber@tugraz.at> Date: Mon, 9 Dec 2019 16:46:25 +0100 Subject: [PATCH] Add vpu-icon to notification message --- packages/common/error.js | 8 ++++++-- packages/common/styles.js | 5 +++++ 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/packages/common/error.js b/packages/common/error.js index 5a53bda9..8c8be68c 100644 --- a/packages/common/error.js +++ b/packages/common/error.js @@ -7,8 +7,9 @@ import {i18n} from "./i18n"; * @param jqXHR * @param textStatus * @param errorThrown + * @param icon */ -export const handleXhrError = (jqXHR, textStatus, errorThrown) => { +export const handleXhrError = (jqXHR, textStatus, errorThrown, icon = "sad") => { if (textStatus !== "abort") { // try to show hydra error text let body = jqXHR.responseJSON !== undefined && jqXHR.responseJSON["hydra:description"] !== undefined ? @@ -22,6 +23,7 @@ export const handleXhrError = (jqXHR, textStatus, errorThrown) => { notify({ "summary": i18n.t('error.summary'), "body": body, + "icon": icon, "type": "danger", }); } @@ -32,8 +34,9 @@ export const handleXhrError = (jqXHR, textStatus, errorThrown) => { * * @param error * @param summary + * @param icon */ -export const handleFetchError = async (error, summary = "") => { +export const handleFetchError = async (error, summary = "", icon = "sad") => { // return if user aborted the request if (error.name === "AbortError") { return; @@ -57,6 +60,7 @@ export const handleFetchError = async (error, summary = "") => { notify({ "summary": summary === "" ? i18n.t('error.summary') : summary, "body": body, + "icon": icon, "type": "danger", }); }; diff --git a/packages/common/styles.js b/packages/common/styles.js index 448f086d..3adf59f4 100644 --- a/packages/common/styles.js +++ b/packages/common/styles.js @@ -298,6 +298,11 @@ export function getNotificationCSS() { background: transparent; } + .notification vpu-icon { + font-size: 1.4em; + margin-right: 0.4em; + } + .notification > .delete { position: absolute; right: 0.5rem; -- GitLab