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,33 +60,40 @@ class DashboardsTable extends PureComponent<Props> {
<span className="empty-string">None</span> <span className="empty-string">None</span>
)} )}
</td> </td>
<Authorized <td className="text-right">
requiredRole={EDITOR_ROLE} <Authorized
replaceWithIfNotAuthorized={<td />} requiredRole={VIEWER_ROLE}
> replaceWithIfNotAuthorized={<div />}
<td className="text-right"> >
<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>
<button </Authorized>
className="btn btn-xs btn-default table--show-on-row-hover" <Authorized
onClick={onCloneDashboard(dashboard)} requiredRole={EDITOR_ROLE}
> replaceWithIfNotAuthorized={<div />}
<span className="icon duplicate" /> >
Clone <span>
</button> <button
<ConfirmButton className="btn btn-xs btn-default table--show-on-row-hover"
confirmAction={onDeleteDashboard(dashboard)} onClick={onCloneDashboard(dashboard)}
size="btn-xs" >
type="btn-danger" <span className="icon duplicate" />
text="Delete" Clone
customClass="table--show-on-row-hover" </button>
/> <ConfirmButton
</td> confirmAction={onDeleteDashboard(dashboard)}
</Authorized> size="btn-xs"
type="btn-danger"
text="Delete"
customClass="table--show-on-row-hover"
/>
</span>
</Authorized>
</td>
</tr> </tr>
))} ))}
</tbody> </tbody>