2022-07-23 23:45:48 +05:30
|
|
|
import { createAlert } from '~/flash';
|
|
|
|
import { s__ } from '~/locale';
|
|
|
|
|
|
|
|
export const displayAndLogError = (error) =>
|
|
|
|
createAlert({
|
|
|
|
message: s__('Incident|Something went wrong while fetching incident timeline events.'),
|
|
|
|
captureError: true,
|
|
|
|
error,
|
|
|
|
});
|
|
|
|
|
|
|
|
const EVENT_ICONS = {
|
|
|
|
comment: 'comment',
|
2022-08-13 15:12:31 +05:30
|
|
|
issues: 'issues',
|
|
|
|
status: 'status',
|
2022-07-23 23:45:48 +05:30
|
|
|
default: 'comment',
|
|
|
|
};
|
|
|
|
|
|
|
|
export const getEventIcon = (actionName) => {
|
|
|
|
return EVENT_ICONS[actionName] ?? EVENT_ICONS.default;
|
|
|
|
};
|
2022-08-13 15:12:31 +05:30
|
|
|
|
|
|
|
/**
|
|
|
|
* Returns a date shifted by the current timezone offset. Allows
|
|
|
|
* date.getHours() and similar to return UTC values.
|
|
|
|
*
|
|
|
|
* @returns {Date}
|
|
|
|
*/
|
|
|
|
export const getUtcShiftedDateNow = () => {
|
|
|
|
const date = new Date();
|
|
|
|
date.setMinutes(date.getMinutes() + date.getTimezoneOffset());
|
|
|
|
return date;
|
|
|
|
};
|