Allow viwer roles or higher to Export a dashboard

pull/10616/head
Iris Scholten 2018-05-29 17:07:29 -07:00
parent bf18e1b7fa
commit 8763a6b270
1 changed files with 29 additions and 22 deletions

View File

@ -2,7 +2,7 @@ import React, {PureComponent, MouseEvent} 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 Authorized, {EDITOR_ROLE, VIEWER_ROLE} from 'src/auth/Authorized'
import ConfirmButton from 'src/shared/components/ConfirmButton' import ConfirmButton from 'src/shared/components/ConfirmButton'
import {Dashboard} from 'src/types' import {Dashboard} from 'src/types'
@ -60,17 +60,23 @@ class DashboardsTable extends PureComponent<Props> {
<span className="empty-string">None</span> <span className="empty-string">None</span>
)} )}
</td> </td>
<Authorized
requiredRole={EDITOR_ROLE}
replaceWithIfNotAuthorized={<td />}
>
<td className="text-right"> <td className="text-right">
<Authorized
requiredRole={VIEWER_ROLE}
replaceWithIfNotAuthorized={<div />}
>
<button <button
className="btn btn-xs btn-default table--show-on-row-hover" className="btn btn-xs btn-default table--show-on-row-hover"
onClick={onExportDashboard(dashboard)} onClick={onExportDashboard(dashboard)}
> >
<span className="icon export" />Export <span className="icon export" />Export
</button> </button>
</Authorized>
<Authorized
requiredRole={EDITOR_ROLE}
replaceWithIfNotAuthorized={<div />}
>
<span>
<button <button
className="btn btn-xs btn-default table--show-on-row-hover" className="btn btn-xs btn-default table--show-on-row-hover"
onClick={onCloneDashboard(dashboard)} onClick={onCloneDashboard(dashboard)}
@ -85,8 +91,9 @@ class DashboardsTable extends PureComponent<Props> {
text="Delete" text="Delete"
customClass="table--show-on-row-hover" customClass="table--show-on-row-hover"
/> />
</td> </span>
</Authorized> </Authorized>
</td>
</tr> </tr>
))} ))}
</tbody> </tbody>