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 DashboardsTable from 'src/dashboards/components/DashboardsTable'
|
||||||
import FancyScrollbar from 'shared/components/FancyScrollbar'
|
import FancyScrollbar from 'shared/components/FancyScrollbar'
|
||||||
|
|
||||||
|
import Authorized, {EDITOR_ROLE} from 'src/auth/Authorized'
|
||||||
|
|
||||||
const DashboardsPageContents = ({
|
const DashboardsPageContents = ({
|
||||||
dashboards,
|
dashboards,
|
||||||
onDeleteDashboard,
|
onDeleteDashboard,
|
||||||
|
@ -28,12 +30,16 @@ const DashboardsPageContents = ({
|
||||||
<h2 className="panel-title">
|
<h2 className="panel-title">
|
||||||
{tableHeader}
|
{tableHeader}
|
||||||
</h2>
|
</h2>
|
||||||
<button
|
{
|
||||||
className="btn btn-sm btn-primary"
|
<Authorized requiredRole={EDITOR_ROLE}>
|
||||||
onClick={onCreateDashboard}
|
<button
|
||||||
>
|
className="btn btn-sm btn-primary"
|
||||||
<span className="icon plus" /> Create Dashboard
|
onClick={onCreateDashboard}
|
||||||
</button>
|
>
|
||||||
|
<span className="icon plus" /> Create Dashboard
|
||||||
|
</button>
|
||||||
|
</Authorized>
|
||||||
|
}
|
||||||
</div>
|
</div>
|
||||||
<div className="panel-body">
|
<div className="panel-body">
|
||||||
<DashboardsTable
|
<DashboardsTable
|
||||||
|
|
|
@ -2,6 +2,8 @@ import React, {PropTypes} from 'react'
|
||||||
import {Link} from 'react-router'
|
import {Link} from 'react-router'
|
||||||
import _ from 'lodash'
|
import _ from 'lodash'
|
||||||
|
|
||||||
|
import Authorized, {EDITOR_ROLE} from 'src/auth/Authorized'
|
||||||
|
|
||||||
import DeleteConfirmTableCell from 'shared/components/DeleteConfirmTableCell'
|
import DeleteConfirmTableCell from 'shared/components/DeleteConfirmTableCell'
|
||||||
|
|
||||||
const DashboardsTable = ({
|
const DashboardsTable = ({
|
||||||
|
@ -36,11 +38,13 @@ const DashboardsTable = ({
|
||||||
)
|
)
|
||||||
: <span className="empty-string">None</span>}
|
: <span className="empty-string">None</span>}
|
||||||
</td>
|
</td>
|
||||||
<DeleteConfirmTableCell
|
<Authorized requireRole={EDITOR_ROLE}>
|
||||||
onDelete={onDeleteDashboard}
|
<DeleteConfirmTableCell
|
||||||
item={dashboard}
|
onDelete={onDeleteDashboard}
|
||||||
buttonSize="btn-xs"
|
item={dashboard}
|
||||||
/>
|
buttonSize="btn-xs"
|
||||||
|
/>
|
||||||
|
</Authorized>
|
||||||
</tr>
|
</tr>
|
||||||
)}
|
)}
|
||||||
</tbody>
|
</tbody>
|
||||||
|
|
Loading…
Reference in New Issue