Commit 953d8f1e authored by Viacheslav Pavlov's avatar Viacheslav Pavlov

Merge branch '217-subsets-dashboard' into 'master'

Resolve "Subsets: dashboard"

Closes #217

See merge request genesys-pgr/genesys-ui!223
parents 9972aa24 ba86a790
......@@ -298,18 +298,18 @@ class DetailInfo extends React.Component<IDetailInfoProps, any> {
: null
}
{ dataset.state === PublishState.DRAFT && dataset._permissions.write &&
<Button onClick={ this.onPublish } type="button">{ t('common:action.publish') }</Button>
<Button onClick={ this.onPublish } type="button">{ t('common:action.publish') }</Button>
}
{ dataset.state !== PublishState.PUBLISHED && dataset._permissions.write &&
<Button onClick={ this.onReject } type="button">{ t('common:action.edit') }</Button>
<Button onClick={ this.onReject } type="button">{ t('common:action.edit') }</Button>
}
{ dataset.state === PublishState.REVIEWING &&
<Authorize role="ROLE_ADMINISTRATOR">
<Button onClick={ this.onApprove } type="button">{ t('common:action.approve') }</Button>
</Authorize>
<Authorize role="ROLE_ADMINISTRATOR">
<Button onClick={ this.onApprove } type="button">{ t('common:action.approve') }</Button>
</Authorize>
}
{ dataset.state !== PublishState.PUBLISHED && deleteDataset && dataset._permissions.delete &&
<Button onClick={ this.onDelete } type="button">{ t('common:action.delete') }</Button>
<Button onClick={ this.onDelete } type="button">{ t('common:action.delete') }</Button>
}
{ dataset._permissions.manage && <Permissions clazz={ Dataset.clazz } id={ dataset.id }/> }
</CardActions>
......@@ -332,10 +332,10 @@ class DetailInfo extends React.Component<IDetailInfoProps, any> {
<Properties>
{ dataset.creators && dataset.creators.map((e: DatasetCreator, i) => (
<PropertiesItem title={ t(`datasets.common.creator.role.${e.role}`) } key={ e.id }>
<span>
<b>{ e.fullName }</b>
{ e.institutionalAffiliation && <span> { e.institutionalAffiliation }</span> }
</span>
<span>
<b>{ e.fullName }</b>
{ e.institutionalAffiliation && <span> { e.institutionalAffiliation }</span> }
</span>
{ /* { e.email && <div><a href={ `mailto:${e.email}` }>{ e.email }</a></div> } */ }
</PropertiesItem>
)) }
......
......@@ -47,7 +47,7 @@ class DisplayPage extends React.Component<IDisplayPageProps, any> {
const {unpublishSubset, subset, navigateTo} = this.props;
if (subset) {
unpublishSubset(subset);
navigateTo('/dashboard/subsets');
setTimeout(() => navigateTo('/dashboard/subsets'), 100);
}
}
......
......@@ -2,6 +2,7 @@ import * as React from 'react';
import { translate } from 'react-i18next';
import Subset from 'model/subset/Subset';
import {PublishState} from 'model/common.model';
import { SubsetLink, InstituteLink } from 'ui/genesys/Links';
import Card, {CardHeader, CardContent, CardActions} from 'ui/common/Card';
import Markdown from 'ui/common/markdown';
......@@ -22,6 +23,7 @@ const SubsetCard = (
actions,
index,
dataClassName,
isAdmin = false,
t,
...other
}: {
......@@ -31,6 +33,7 @@ const SubsetCard = (
actions?: any,
index: number,
dataClassName: string;
isAdmin?: boolean;
t: any
} & React.ClassAttributes<any>) => {
......@@ -41,7 +44,8 @@ const SubsetCard = (
<div className="mb-15">
<b>
{ index !== undefined && `${index + 1}. ` }
<SubsetLink to={ subset }/>
<SubsetLink to={ subset }
edit={ subset.state === PublishState.DRAFT && (subset._permissions.write || isAdmin) || subset.state === PublishState.REVIEWING && isAdmin }/>
</b>
<b></b>
<span>{ subset.wiewsCode }</span>
......
......@@ -98,7 +98,7 @@ class StepNavigation extends React.Component<IStepNavigationProps, any> {
}
case PublishState.REVIEWING: {
return (
<div className={ classes.actionsArea }>
<span className={ classes.actionsArea }>
<Button disabled={ disabled } variant="contained" onClick={ onUnpublish } className={ classes.btnBlue }>
{ t('common:action.reject') }
</Button>
......@@ -107,7 +107,7 @@ class StepNavigation extends React.Component<IStepNavigationProps, any> {
{ t('common:action.approve') }
</Button>
</Authorize>
</div>
</span>
);
}
case PublishState.DRAFT: {
......
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