feat(ui) - dashboard - report
This commit is contained in:
parent
59f51cde26
commit
7c2539ec93
3 changed files with 40 additions and 10 deletions
|
|
@ -0,0 +1,33 @@
|
|||
import React from 'react';
|
||||
import { ItemMenu } from 'UI';
|
||||
import { connect } from 'react-redux';
|
||||
|
||||
interface Props {
|
||||
editHandler: any
|
||||
deleteHandler: any
|
||||
renderReport: any
|
||||
isEnterprise: boolean
|
||||
}
|
||||
function DashboardOptions(props: Props) {
|
||||
const { editHandler, deleteHandler, renderReport, isEnterprise } = props;
|
||||
const menuItems = [
|
||||
{ icon: 'pencil', text: 'Rename', onClick: editHandler },
|
||||
{ icon: 'text-paragraph', text: 'Add Description', onClick: editHandler },
|
||||
{ icon: 'users', text: 'Visibility & Access', onClick: editHandler },
|
||||
{ icon: 'trash', text: 'Delete', onClick: deleteHandler },
|
||||
]
|
||||
if (isEnterprise) {
|
||||
menuItems.unshift({ icon: 'pdf-download', text: 'Download Report', onClick: renderReport });
|
||||
}
|
||||
|
||||
return (
|
||||
<ItemMenu
|
||||
label="Options"
|
||||
items={menuItems}
|
||||
/>
|
||||
);
|
||||
}
|
||||
|
||||
export default connect(state => ({
|
||||
isEnterprise: state.getIn([ 'user', 'client', 'edition' ]) === 'ee',
|
||||
}))(DashboardOptions);
|
||||
|
|
@ -0,0 +1 @@
|
|||
export { default } from './DashboardOptions';
|
||||
|
|
@ -1,7 +1,7 @@
|
|||
import React, { useEffect } from 'react';
|
||||
import { useObserver } from 'mobx-react-lite';
|
||||
import { useStore } from 'App/mstore';
|
||||
import { Button, PageTitle, Loader, NoContent, ItemMenu } from 'UI';
|
||||
import { Button, PageTitle, Loader, NoContent } from 'UI';
|
||||
import { withSiteId } from 'App/routes';
|
||||
import withModal from 'App/components/Modal/withModal';
|
||||
import DashboardWidgetGrid from '../DashboardWidgetGrid';
|
||||
|
|
@ -14,6 +14,7 @@ import DateRange from 'Shared/DateRange';
|
|||
import AlertFormModal from 'App/components/Alerts/AlertFormModal';
|
||||
import withPageTitle from 'HOCs/withPageTitle';
|
||||
import withReport from 'App/components/hocs/withReport';
|
||||
import DashboardOptions from '../DashboardOptions';
|
||||
|
||||
interface Props {
|
||||
siteId: number;
|
||||
|
|
@ -110,15 +111,10 @@ function DashboardView(props: Props) {
|
|||
</div>
|
||||
<div className="mx-4" />
|
||||
<div className="flex items-center">
|
||||
<ItemMenu
|
||||
label="Options"
|
||||
items={[
|
||||
{ icon: 'pdf-download', text: 'Download Report', onClick: props.renderReport },
|
||||
{ icon: 'pencil', text: 'Rename', onClick: onEdit },
|
||||
{ icon: 'text-paragraph', text: 'Add Description', onClick: onEdit },
|
||||
{ icon: 'users', text: 'Visibility & Access', onClick: onEdit },
|
||||
{ icon: 'trash', text: 'Delete', onClick: onDelete },
|
||||
]}
|
||||
<DashboardOptions
|
||||
editHandler={onEdit}
|
||||
deleteHandler={onDelete}
|
||||
renderReport={props.renderReport}
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue