Implement Authorized HOC on DashboardsPage
Signed-off-by: Jared Scheib <jared.scheib@gmail.com>pull/2181/head
parent
7a305887ef
commit
8b7660d3ab
|
@ -3,6 +3,8 @@ import React, {PropTypes} from 'react'
|
|||
import DashboardsTable from 'src/dashboards/components/DashboardsTable'
|
||||
import FancyScrollbar from 'shared/components/FancyScrollbar'
|
||||
|
||||
import Authorized, {EDITOR_ROLE} from 'src/auth/Authorized'
|
||||
|
||||
const DashboardsPageContents = ({
|
||||
dashboards,
|
||||
onDeleteDashboard,
|
||||
|
@ -28,12 +30,16 @@ const DashboardsPageContents = ({
|
|||
<h2 className="panel-title">
|
||||
{tableHeader}
|
||||
</h2>
|
||||
<button
|
||||
className="btn btn-sm btn-primary"
|
||||
onClick={onCreateDashboard}
|
||||
>
|
||||
<span className="icon plus" /> Create Dashboard
|
||||
</button>
|
||||
{
|
||||
<Authorized requiredRole={EDITOR_ROLE}>
|
||||
<button
|
||||
className="btn btn-sm btn-primary"
|
||||
onClick={onCreateDashboard}
|
||||
>
|
||||
<span className="icon plus" /> Create Dashboard
|
||||
</button>
|
||||
</Authorized>
|
||||
}
|
||||
</div>
|
||||
<div className="panel-body">
|
||||
<DashboardsTable
|
||||
|
|
|
@ -2,6 +2,8 @@ import React, {PropTypes} from 'react'
|
|||
import {Link} from 'react-router'
|
||||
import _ from 'lodash'
|
||||
|
||||
import Authorized, {EDITOR_ROLE} from 'src/auth/Authorized'
|
||||
|
||||
import DeleteConfirmTableCell from 'shared/components/DeleteConfirmTableCell'
|
||||
|
||||
const DashboardsTable = ({
|
||||
|
@ -36,11 +38,13 @@ const DashboardsTable = ({
|
|||
)
|
||||
: <span className="empty-string">None</span>}
|
||||
</td>
|
||||
<DeleteConfirmTableCell
|
||||
onDelete={onDeleteDashboard}
|
||||
item={dashboard}
|
||||
buttonSize="btn-xs"
|
||||
/>
|
||||
<Authorized requireRole={EDITOR_ROLE}>
|
||||
<DeleteConfirmTableCell
|
||||
onDelete={onDeleteDashboard}
|
||||
item={dashboard}
|
||||
buttonSize="btn-xs"
|
||||
/>
|
||||
</Authorized>
|
||||
</tr>
|
||||
)}
|
||||
</tbody>
|
||||
|
|
Loading…
Reference in New Issue