feat(notification/error): link to settings/logs for admins (#2521)
Fixes #2516
This commit is contained in:
committed by
Julien Fontanet
parent
377efcd054
commit
4c21175ca7
@@ -16,6 +16,7 @@ const messages = {
|
||||
editableLongClickPlaceholder: 'Long click to edit',
|
||||
editableClickPlaceholder: 'Click to edit',
|
||||
browseFiles: 'Browse files',
|
||||
showLogs: 'Show logs',
|
||||
|
||||
// ----- Modals -----
|
||||
alertOk: 'OK',
|
||||
|
||||
@@ -1,5 +1,10 @@
|
||||
import _ from 'intl'
|
||||
import ButtonLink from 'button-link'
|
||||
import Icon from 'icon'
|
||||
import React, { Component } from 'react'
|
||||
import ReactNotify from 'react-notify'
|
||||
import { connectStore } from 'utils'
|
||||
import { isAdmin } from 'selectors'
|
||||
|
||||
let instance
|
||||
|
||||
@@ -7,6 +12,9 @@ export let error
|
||||
export let info
|
||||
export let success
|
||||
|
||||
@connectStore({
|
||||
isAdmin,
|
||||
})
|
||||
export class Notification extends Component {
|
||||
componentDidMount () {
|
||||
if (instance) {
|
||||
@@ -32,7 +40,26 @@ export class Notification extends Component {
|
||||
return
|
||||
}
|
||||
|
||||
error = (title, body) => notification.error(title, body, 3e3)
|
||||
error = (title, body) =>
|
||||
notification.error(
|
||||
title,
|
||||
this.props.isAdmin ? (
|
||||
<div>
|
||||
<div>{body}</div>
|
||||
<ButtonLink
|
||||
btnStyle='danger'
|
||||
className='mt-1'
|
||||
size='small'
|
||||
to='/settings/logs'
|
||||
>
|
||||
<Icon icon='logs' /> {_('showLogs')}
|
||||
</ButtonLink>
|
||||
</div>
|
||||
) : (
|
||||
body
|
||||
),
|
||||
6e3
|
||||
)
|
||||
info = (title, body) => notification.info(title, body, 3e3)
|
||||
success = (title, body) => notification.success(title, body, 3e3)
|
||||
}}
|
||||
|
||||
@@ -27,6 +27,10 @@
|
||||
@extend .fa;
|
||||
@extend .fa-envelope-o;
|
||||
}
|
||||
&-logs {
|
||||
@extend .fa;
|
||||
@extend .fa-list;
|
||||
}
|
||||
&-alarm {
|
||||
@extend .fa;
|
||||
@extend .fa-exclamation-triangle;
|
||||
|
||||
Reference in New Issue
Block a user