Commit bc4984b4 authored by Matija Obreza's avatar Matija Obreza
Browse files

Dataset#accessionIdentifiers renamed to AccessionRefs

parent 2634437f
Pipeline #6853 passed with stages
in 5 minutes and 18 seconds
......@@ -8,7 +8,7 @@ import {navigateTo} from 'actions/navigation';
import {ADD_CREATOR_TO_DATASET, ADD_LOCATION, RECEIVE_LOCATION, REMOVE_CREATOR_FROM_DATASET, REMOVE_LOCATION, UPDATE_DATASET_CREATOR, RECEIVE_DATASET, DASHBOARD_REMOVE_DATASET} from 'datasets/constants';
// Models
import {AccessionIdentifier, Dataset} from 'model/dataset.model';
import {AccessionRef, Dataset} from 'model/dataset.model';
import {RepositoryFile} from 'model/repositoryFile.model';
import {Creator} from 'model/creator.model';
import {Location} from 'model/location.model';
......@@ -105,11 +105,11 @@ export {rejectDataset, approveDataset, publishDataset, deleteDataset};
// Accession identifiers step
function updateDatasetAccessionIdentifiers(dataset: Dataset, accessionIdentifiers: AccessionIdentifier[]) {
function updateDatasetAccessionRefs(dataset: Dataset, accessionRefs: AccessionRef[]) {
return (dispatch, getState) => {
const token = getState().login.access_token;
return DatasetService.updateAccessionIdentifiers(token, dataset, accessionIdentifiers)
return DatasetService.updateAccessionRefs(token, dataset, accessionRefs)
.then((saved) => {
dispatch(receiveDataset(saved));
}).catch((error) => {
......@@ -119,7 +119,7 @@ function updateDatasetAccessionIdentifiers(dataset: Dataset, accessionIdentifier
}
// Accession identifiers step exports
export {updateDatasetAccessionIdentifiers};
export {updateDatasetAccessionRefs};
// Descriptors step
......
......@@ -29,7 +29,7 @@ import List from '@material-ui/core/List';
import ListItem from '@material-ui/core/ListItem';
import ListItemText from '@material-ui/core/ListItemText';
import AccessionIdentifiersTable from 'ui/catalog/accession/IdentifiersTable';
import AccessionRefsTable from 'ui/catalog/accession/AccessionRefsTable';
import Permissions from 'ui/common/permission/Permissions';
import CropChips from 'crops/ui/c/CropChips';
......@@ -429,11 +429,11 @@ class DetailInfo extends React.Component<IDetailInfoProps, any> {
</Grid>
) }
{ dataset.accessionIdentifiers && dataset.accessionIdentifiers.length > 0 && (
{ dataset.accessionRefs && dataset.accessionRefs.length > 0 && (
<Grid item xs={ 12 } md={ 12 } lg={ 12 } className="p-10" id="dataset-accessions">
<Section title="Accessions evaluated">
<div className="p-20">
<AccessionIdentifiersTable accessionIdentifiers={ dataset.accessionIdentifiers } />
<AccessionRefsTable accessionRefs={ dataset.accessionRefs } />
</div>
</Section>
</Grid>
......
......@@ -6,15 +6,15 @@ import FormControl from '@material-ui/core/FormControl';
import {log} from 'utilities/debug';
import {AccessionIdentifier} from 'model/dataset.model';
import AccessionIdentifiersTable from 'ui/catalog/accession/IdentifiersTable';
import {AccessionRef} from 'model/dataset.model';
import AccessionRefsTable from 'ui/catalog/accession/AccessionRefsTable';
import {CSV, ICsvConfiguration} from 'utilities/CSV';
import CSVConfiguration, { CSVConfig } from 'ui/common/csv-configuration/CSVConfiguration';
interface IListOfAccession extends React.ClassAttributes<any> {
classes: any;
onAccessionsUpdated: (accessionIdentifiers: AccessionIdentifier[]) => void;
accessionIdentifiers: AccessionIdentifier[];
onAccessionsUpdated: (accessionRefs: AccessionRef[]) => void;
accessionRefs: AccessionRef[];
}
const styleSheet = {
......@@ -72,11 +72,11 @@ class ListOfAccession extends React.Component<IListOfAccession, any> {
log('CSV config', config);
const newIdentifiers: AccessionIdentifier[] = [];
const newIdentifiers: AccessionRef[] = [];
CSV.parse(csvText, config, { headers: [ 'instCode', 'acceNumb', 'genus', 'species', 'doi' ]})
.on('json', (jsonObj) => {
const aid: AccessionIdentifier = new AccessionIdentifier(jsonObj);
const aid: AccessionRef = new AccessionRef(jsonObj);
newIdentifiers.push(aid);
log(aid);
}).on('end', () => {
......@@ -87,7 +87,7 @@ class ListOfAccession extends React.Component<IListOfAccession, any> {
public render() {
const {classes, accessionIdentifiers} = this.props;
const {classes, accessionRefs} = this.props;
return (
<div className={ `${ classes.root } m-20 p-20 even-row` }>
......@@ -114,8 +114,8 @@ class ListOfAccession extends React.Component<IListOfAccession, any> {
</div>
<h3>Accession list: { accessionIdentifiers ? accessionIdentifiers.length : 0 } rows</h3>
<AccessionIdentifiersTable accessionIdentifiers={ accessionIdentifiers } />
<h3>Accession list: { accessionRefs ? accessionRefs.length : 0 } rows</h3>
<AccessionRefsTable accessionRefs={ accessionRefs } />
</div>
);
}
......
......@@ -2,15 +2,15 @@ import * as React from 'react';
import {bindActionCreators} from 'redux';
import {connect} from 'react-redux';
import {Dataset, AccessionIdentifier} from 'model/dataset.model';
import {updateDatasetAccessionIdentifiers} from 'datasets/actions/editor';
import {Dataset, AccessionRef} from 'model/dataset.model';
import {updateDatasetAccessionRefs} from 'datasets/actions/editor';
import ListOfAccesion from './ListOfAccesion';
import steps from 'datasets/ui/dataset-stepper/steps';
import NavigationWrapper from 'ui/common/stepper/NavigationWrapper';
interface IAccessionsListStep extends React.ClassAttributes<any> {
dataset: Dataset;
updateDatasetAccessionIdentifiers: (dataset: Dataset, accessionIdentifiers: AccessionIdentifier[]) => Promise<Dataset>;
updateDatasetAccessionRefs: (dataset: Dataset, accessionRefs: AccessionRef[]) => Promise<Dataset>;
stillLoading: boolean;
onDelete: () => void;
onPublish: () => void;
......@@ -24,9 +24,9 @@ class AccessionsListStep extends React.Component<IAccessionsListStep, any> {
super(props);
}
protected updateAccessionIdentifiers = (accessionIdentifiers: AccessionIdentifier[]) => {
const {dataset, updateDatasetAccessionIdentifiers} = this.props;
updateDatasetAccessionIdentifiers(dataset, accessionIdentifiers);
protected updateAccessionRefs = (accessionRefs: AccessionRef[]) => {
const {dataset, updateDatasetAccessionRefs} = this.props;
updateDatasetAccessionRefs(dataset, accessionRefs);
}
protected gotoStep = (id) => () => {
......@@ -41,8 +41,8 @@ class AccessionsListStep extends React.Component<IAccessionsListStep, any> {
disabled={ false } steps={ steps }
gotoStep={ this.gotoStep } onDelete={ onDelete } onPublish={ onPublish }>
<ListOfAccesion
accessionIdentifiers={ dataset.accessionIdentifiers }
onAccessionsUpdated={ this.updateAccessionIdentifiers }
accessionRefs={ dataset.accessionRefs }
onAccessionsUpdated={ this.updateAccessionRefs }
/>
</NavigationWrapper>
);
......@@ -59,7 +59,7 @@ const mapStateToProps = (state, ownProps) => ({
});
const mapDispatchToProps = (dispatch) => bindActionCreators({
updateDatasetAccessionIdentifiers,
updateDatasetAccessionRefs,
}, dispatch);
export default connect(
......
......@@ -6,7 +6,7 @@ import { Creator } from 'model/creator.model';
import { Descriptor } from 'model/descriptor.model';
import { IAuditedVersionedModelFilter, IStringFilter } from 'model/filter.model';
export class AccessionIdentifier extends EmptyModel {
export class AccessionRef extends EmptyModel {
public doi: string;
public instCode: string;
public acceNumb: string;
......@@ -18,7 +18,7 @@ export class AccessionIdentifier extends EmptyModel {
}
public getClassname(): string {
return 'org.genesys.catalog.model.dataset.AccessionIdentifier';
return 'org.genesys.catalog.model.dataset.AccessionRef';
}
}
......@@ -39,7 +39,7 @@ export class Dataset extends UuidModel implements IUserPermissions {
public repositoryFiles: RepositoryFile[];
public locations: Location[];
public accessionIdentifiers: AccessionIdentifier[];
public accessionRefs: AccessionRef[];
public descriptors: Descriptor[];
public crops: string[];
......
......@@ -4,7 +4,7 @@ import {log} from 'utilities/debug';
import { stringify } from 'query-string';
import {Page, PublishState} from 'model/common.model';
import { Dataset, IDatasetFilter, AccessionIdentifier } from 'model/dataset.model';
import { Dataset, IDatasetFilter, AccessionRef } from 'model/dataset.model';
import { Partner } from 'model/partner.model';
import {
......@@ -123,13 +123,13 @@ export class DatasetService {
}).then(({ data }) => new Dataset(data));
}
public static updateAccessionIdentifiers(token: string, dataset: Dataset, accessionIdentifiers: AccessionIdentifier[]): Promise<Dataset> {
log('Updating accession list', dataset, accessionIdentifiers);
public static updateAccessionRefs(token: string, dataset: Dataset, accessionRefs: AccessionRef[]): Promise<Dataset> {
log('Updating accession list', dataset, accessionRefs);
return authenticatedRequest(token, {
url: `${UPDATE_DATASET_ACCESSIONS_URL}/${dataset.uuid},${dataset.version}`,
method: 'POST',
data: accessionIdentifiers,
data: accessionRefs,
}).then(({ data }) => new Dataset(data));
}
......
......@@ -111,7 +111,7 @@ interface IAccessionLinkProps extends React.Props<any> {
}
const AccessionLink_ = ({ apiUrl, accessionIdentifier }: IAccessionLinkProps) => {
const url = accessionIdentifier.doi ? `${apiUrl}/${accessionIdentifier.doi}` : (accessionIdentifier.accession ? `${apiUrl}/acn/${accessionIdentifier.accession}` : ``);
const url = accessionIdentifier.doi ? `${apiUrl}/${accessionIdentifier.doi}` : (accessionIdentifier.uuid ? `${apiUrl}/acn/${accessionIdentifier.uuid}` : ``);
if (url) {
return (
......
import * as React from 'react';
import { withStyles } from '@material-ui/core/styles';
import { AccessionIdentifier } from 'model/dataset.model';
import { AccessionRef } from 'model/dataset.model';
import { Table as VTable, Column as VColumn, AutoSizer } from 'react-virtualized';
import DOI from 'ui/common/DOI';
import { AccessionLink } from 'ui/catalog/Links';
......@@ -32,25 +32,25 @@ const styles = (theme) => ({
},
});
interface IAccessionIdentifiersTableProps extends React.ClassAttributes<any> {
interface IAccessionRefsTableProps extends React.ClassAttributes<any> {
classes: any;
accessionIdentifiers: AccessionIdentifier[];
accessionRefs: AccessionRef[];
}
class AccessionIdentifiersTable extends React.Component<IAccessionIdentifiersTableProps, any> {
class AccessionRefsTable extends React.Component<IAccessionRefsTableProps, any> {
constructor(props, context) {
super(props, context);
}
public render() {
const { accessionIdentifiers, classes } = this.props;
const rowGetter = ({ index }) => accessionIdentifiers[index];
const renderAccessionNumber = ({rowIndex}) => <AccessionLink accessionIdentifier={ accessionIdentifiers[rowIndex] }/>;
const { accessionRefs, classes } = this.props;
const rowGetter = ({ index }) => accessionRefs[index];
const renderAccessionNumber = ({rowIndex}) => <AccessionLink accessionIdentifier={ accessionRefs[rowIndex] }/>;
const renderDoi = ({ cellData }) => <DOI noPrefix value={ cellData } />;
const rowClassName = ({ index }) => index === -1 ? '' : `${classes.tableCell} ${index % 2 === 0 ? classes.evenRow : classes.oddRow}`;
return accessionIdentifiers && accessionIdentifiers.sort((a, b) => a.acceNumb.localeCompare(b.acceNumb)) && (
return accessionRefs && accessionRefs.sort((a, b) => a.acceNumb.localeCompare(b.acceNumb)) && (
<AutoSizer disableHeight>
{ ({ width }) => (
<VTable
......@@ -59,7 +59,7 @@ class AccessionIdentifiersTable extends React.Component<IAccessionIdentifiersTab
height={ 500 }
headerHeight={ 25 }
rowHeight={ 30 }
rowCount={ accessionIdentifiers.length }
rowCount={ accessionRefs.length }
rowGetter={ rowGetter }
rowClassName={ rowClassName }
headerClassName={ `back-green` }
......@@ -76,4 +76,4 @@ class AccessionIdentifiersTable extends React.Component<IAccessionIdentifiersTab
}
}
export default withStyles(styles)(AccessionIdentifiersTable);
export default withStyles(styles)(AccessionRefsTable);
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