Sha256: 02046f7b2bd8ca1e56e8ed6a7136896e38744522a5fb6ea0c1e35374d3d4e4f3
Contents?: true
Size: 959 Bytes
Versions: 16
Compression:
Stored size: 959 Bytes
Contents
import React from 'react'; import { translate as __ } from 'foremanReact/common/I18n'; import { urlBuilder } from 'foremanReact/common/urlHelpers'; const link = id => ({ children: __('Go to task page'), href: urlBuilder('foreman_tasks/tasks', '', id), }); const getErrors = task => ( <ul> {task.humanized.errors.map(error => ( <li key={error}> {error} </li> ))} </ul> ); export const renderTaskStartedToast = (task) => { if (!task) return; const message = (__(`Task ${task.humanized.action} has started.`)); window.tfm.toastNotifications.notify({ message, type: 'info', link: link(task.id), }); }; export const renderTaskFinishedToast = (task) => { if (!task) return; const message = __(`Task ${task.action} completed with a result of ${task.result}. ${task.errors ? getErrors(task) : ''}`); window.tfm.toastNotifications.notify({ message, type: task.result, link: link(task.id), }); };
Version data entries
16 entries across 16 versions & 1 rubygems