Commit e2536067 authored by Matija Obreza's avatar Matija Obreza

Merge branch '400-permissions-buttons-aren-t-working' into 'master'

Resolve "Permissions buttons aren't working"

Closes #400

See merge request !317
parents d39b8158 1407a0a3
Pipeline #7147 passed with stages
in 5 minutes and 4 seconds
......@@ -29,6 +29,7 @@ class DashboardPage extends BaseMyDataPage<Dataset> {
const mapStateToProps = (state, ownProps) => ({
paged: state.datasets.dashboard.paged,
tab: 'datasets',
dataClassName: Dataset.clazz,
});
const mapDispatchToProps = (dispatch) => bindActionCreators({
......
......@@ -7,6 +7,7 @@ import BaseMyDataPage from 'ui/catalog/dashboard/MyDataPage';
import {listMyDescriptorLists, approveDescriptorList, deleteDescriptorList, unpublishDescriptorList, publishDescriptorList} from 'descriptorlists/actions/dashboard';
import {DescriptorListLink} from 'ui/catalog/Links';
import {PublishState} from 'model/common.model';
import DescriptorList from 'model/catalog/DescriptorList';
const renderDataLink = ({row, children}) => (<DescriptorListLink to={ row } edit={ row.state === PublishState.DRAFT && row._permissions.write }>{ children }</DescriptorListLink>);
......@@ -27,6 +28,7 @@ class DashboardPage extends BaseMyDataPage<any> {
const mapStateToProps = (state, ownProps) => ({
paged: state.descriptorList.dashboard.paged,
tab: 'descriptorlists',
dataClassName: DescriptorList.clazz,
});
const mapDispatchToProps = (dispatch) => bindActionCreators({
......
......@@ -30,6 +30,7 @@ class DashboardPage extends BaseMyDataPage<Descriptor> {
const mapStateToProps = (state, ownProps) => ({
paged: state.descriptors.dashboard.paged,
tab: 'descriptors',
dataClassName: Descriptor.clazz,
filterComponent: DashboardDescriptorFilters,
});
......
......@@ -28,6 +28,7 @@ interface IDataPublishedContainerProps extends React.ClassAttributes<any> {
basePath: string;
filterCodeToUrl: any;
listData: any;
dataClassName: string;
renderDataLink: any;
setPageTitle: (title: string) => void;
addToEditList: (item: any) => void;
......@@ -138,7 +139,7 @@ class BaseMyDataPage<T> extends React.Component<T & IDataPublishedContainerProps
}
public render() {
const {tab, filterComponent, basePath, pagination, addToEditList, removeFromEditList, isEditMode, setEditMode, editList, paged, renderDataLink } = this.props;
const {tab, filterComponent, basePath, pagination, addToEditList, removeFromEditList, isEditMode, setEditMode, editList, paged, dataClassName, renderDataLink } = this.props;
const actionHandlers = this.getActionHandlers();
return (
......@@ -149,6 +150,7 @@ class BaseMyDataPage<T> extends React.Component<T & IDataPublishedContainerProps
filterComponent={ filterComponent }
basePath={ basePath }
onFilter={ this.onFilter }
dataClassName={ dataClassName }
renderDataLink={ renderDataLink }
paged={ paged }
onPaginationChange={ this.onPaginationChange }
......
......@@ -49,7 +49,7 @@ export class DashboardTableRow extends React.Component<any> {
}
public render() {
const {row, tab, index, isEditMode, DataLink} = this.props;
const { row, tab, index, isEditMode, DataLink, dataClassName } = this.props;
const { inEditList } = this.state;
return (
......@@ -78,7 +78,7 @@ export class DashboardTableRow extends React.Component<any> {
<Button variant="raised">{ row.state === PublishState.DRAFT && row._permissions.write ? 'EDIT' : 'VIEW' }</Button>
</DataLink>
{ row._permissions.manage &&
<Permissions clazz={ row.clazz } id={ row.id }/>
<Permissions clazz={ dataClassName } id={ row.id }/>
}
</TableCell>
</TableRow>
......
......@@ -36,6 +36,7 @@ interface IMyDataTableProps extends React.Props<any> {
onPaginationChange: (page: number, results: number, sortBy: string, dir?: string) => void;
pageSort?: string;
onFilter: (filter) => void;
dataClassName: string;
renderDataLink: any;
pagination: any;
promiseListData: any;
......@@ -67,6 +68,7 @@ function MyDataTable({
onPaginationChange,
onFilter,
pagination,
dataClassName,
renderDataLink,
promiseListData,
deleteAllAction,
......@@ -99,6 +101,7 @@ function MyDataTable({
inEditList={ _.includes(editList, row.uuid) }
addToEditAction={ addToEditList }
removeFromEditAction={ removeFromEditList }
dataClassName={ dataClassName }
DataLink={ renderDataLink }
/>
);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment