Sha256: 049a306aa5e6211785ce7e1f0fd41079b6cb86dd9877d466e22cd92a392b314b
Contents?: true
Size: 986 Bytes
Versions: 21
Compression:
Stored size: 986 Bytes
Contents
import React from 'react'; import { translate as __ } from 'foremanReact/common/I18n'; import helpers from '../../move_to_foreman/common/helpers'; import { notify } from '../../move_to_foreman/foreman_toast_notifications'; const link = id => ({ children: __('Go to task page'), href: helpers.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.`)); 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) : ''}`); notify({ message, type: task.result, link: link(task.id), }); };
Version data entries
21 entries across 21 versions & 1 rubygems