Commit 01bac888 authored by Matija Obreza's avatar Matija Obreza
Browse files

Descriptor card updated

- Added `<PartnerLink`
- Moved descriptors.model to descriptor.model
- Moved `IDescriptorFilter` to descriptor.model
parent 5ea976e1
......@@ -3,7 +3,7 @@ import { push } from 'react-router-redux';
import { Page } from 'model/common.model';
import { Dataset, IDatasetFilter, AccessionIdentifier } from 'model/dataset.model';
import { Creator } from 'model/creator.model';
import { Descriptor } from 'model/descriptors.model';
import { Descriptor } from 'model/descriptor.model';
import { Location } from 'model/location.model';
import { RepositoryFile } from 'model/repositoryFile.model';
import { DatasetService } from 'service/DatasetService';
......
import { push } from 'react-router-redux';
import { DescriptorListService } from 'service/DescriptorListService';
import { DescriptorList, Descriptor } from 'model/descriptors.model';
import { DescriptorList, Descriptor } from 'model/descriptor.model';
import { IDescriptorListFilter } from 'model/filter.model';
import { Page } from 'model/common.model';
......
......@@ -4,7 +4,7 @@ import {SubmissionError} from 'redux-form';
import {dereferenceReferences} from 'utilities';
import {DescriptorService} from 'service/DescriptorService';
import {CREATE_DESCRIPTOR, RECEIVE_DESCRIPTOR, RECEIVE_DESCRIPTOR_PAGE } from 'constants/descriptors';
import {Descriptor} from 'model/descriptors.model';
import {Descriptor} from 'model/descriptor.model';
import {Partner} from 'model/partner.model';
import {Page} from 'model/common.model';
......
import { ADD_UPDATE_DESCRIPTOR_FILTER } from 'constants/filter';
import {IDescriptorFilter} from 'model/filter.model';
import {IDescriptorFilter} from 'model/descriptor.model';
function updateDescriptorFilterModel(filter: IDescriptorFilter) {
return (dispatch, getState) => {
......
import { UuidModel } from './common.model';
import { UuidModel } from 'model/common.model';
class Creator extends UuidModel {
public fullName: string;
......
import { UuidModel, CurrentPermissions, IUserPermissions } from './common.model';
import { UuidModel, CurrentPermissions, IUserPermissions } from 'model/common.model';
class Crop extends UuidModel implements IUserPermissions {
public code: string;
......
import { EmptyModel, UuidModel, CurrentPermissions, IUserPermissions } from './common.model';
import { RepositoryFile } from './repositoryFile.model';
import { Location } from './location.model';
import { Partner } from './partner.model';
import { Creator } from './creator.model';
import { Descriptor } from './descriptors.model';
import { IAuditedVersionedModelFilter, IStringFilter } from './filter.model';
import { EmptyModel, UuidModel, CurrentPermissions, IUserPermissions } from 'model/common.model';
import { RepositoryFile } from 'model/repositoryFile.model';
import { Location } from 'model/location.model';
import { Partner } from 'model/partner.model';
import { Creator } from 'model/creator.model';
import { Descriptor } from 'model/descriptor.model';
import { IAuditedVersionedModelFilter, IStringFilter } from 'model/filter.model';
export class AccessionIdentifier extends EmptyModel {
public doi: string;
......
import { UuidModel, CurrentPermissions, IUserPermissions } from './common.model';
import { Partner } from './partner.model';
import { Vocabulary, VocabularyTerm } from './vocabulary.model';
import { UuidModel, CurrentPermissions, IUserPermissions } from 'model/common.model';
import { Partner } from 'model/partner.model';
import { Vocabulary, VocabularyTerm } from 'model/vocabulary.model';
import { IAuditedVersionedModelFilter, IStringFilter } from 'model/filter.model';
class Descriptor extends UuidModel implements IUserPermissions {
public static DATATYPES: { [key: string]: any; } = {
......@@ -15,9 +16,9 @@ class Descriptor extends UuidModel implements IUserPermissions {
public static CATEGORIES: { [key: string]: any; } = {
PASSPORT: 'Passport descriptor',
MANAGEMENT: 'Management descriptor',
ENVIRONMENT: 'Environment and',
CHARACTERIZATION: 'Characterization descriptor',
EVALUATION: 'Evaluation descriptor',
ENVIRONMENT: 'Environment or site descriptor',
ABIOTICSTRESS: 'Abiotic stress',
BIOTICSTRESS: 'Biotic stress',
MOLECULAR: 'Molecular marker',
......@@ -68,6 +69,17 @@ class Descriptor extends UuidModel implements IUserPermissions {
}
}
export interface IDescriptorFilter extends IAuditedVersionedModelFilter {
crop?: string[];
title?: IStringFilter;
published?: boolean;
bibliographicCitation?: IStringFilter;
columnName?: IStringFilter;
description?: IStringFilter;
integerOnly?: boolean;
uom?: IStringFilter;
}
class DescriptorList extends UuidModel implements IUserPermissions {
public crop: string;
public title: string;
......
......@@ -41,16 +41,6 @@ export interface IPartnerFilter extends IAuditedVersionedModelFilter {
wiewsCodes?: string[];
}
export interface IDescriptorFilter extends IAuditedVersionedModelFilter {
title?: IStringFilter;
published?: boolean;
bibliographicCitation?: IStringFilter;
columnName?: IStringFilter;
description?: IStringFilter;
integerOnly?: boolean;
uom?: IStringFilter;
}
export interface IDescriptorListFilter extends IAuditedVersionedModelFilter {
published?: boolean;
title?: IStringFilter;
......
import { UuidModel } from './common.model';
import { UuidModel } from 'model/common.model';
class Location extends UuidModel {
public userCountry: string;
......
import { UuidModel, CurrentPermissions, IUserPermissions } from './common.model';
import { UuidModel, CurrentPermissions, IUserPermissions } from 'model/common.model';
class Partner extends UuidModel implements IUserPermissions {
public name: string;
......
import { UuidModel } from './common.model';
import { UuidModel } from 'model/common.model';
class RepositoryFile extends UuidModel {
public title: string;
......
import { UuidModel, CurrentPermissions, IUserPermissions } from './common.model';
import { IAuditedVersionedModelFilter, IStringFilter } from './filter.model';
import { Partner } from './partner.model';
import { UuidModel, CurrentPermissions, IUserPermissions } from 'model/common.model';
import { IAuditedVersionedModelFilter, IStringFilter } from 'model/filter.model';
import { Partner } from 'model/partner.model';
class VocabularyTerm {
public code: string;
......
import * as update from 'immutability-helper';
import { DescriptorList } from 'model/descriptors.model';
import { DescriptorList } from 'model/descriptor.model';
import { Page } from 'model/common.model';
import { GET_DESCRIPTORLIST, RECEIVE_DESCRIPTORLIST, CREATE_DESCRIPTORLIST, LIST_DESCRIPTORLISTS, RECEIVE_DESCRIPTORLISTS } from 'constants/descriptors';
......
import * as update from 'immutability-helper';
import { IReducerAction } from 'model/common.model';
import { Descriptor } from 'model/descriptors.model';
import { Descriptor } from 'model/descriptor.model';
import {
CREATE_DESCRIPTOR, RECEIVE_DESCRIPTOR,
......
......@@ -3,7 +3,7 @@ import * as update from 'immutability-helper';
import { RECEIVE_DESCRIPTOR_PAGE } from 'constants/descriptors';
import { Page } from 'model/common.model';
import { Descriptor } from 'model/descriptors.model';
import { Descriptor } from 'model/descriptor.model';
const INITIAL_STATE = {
descriptorPage: null,
......
import { DescriptorList } from 'model/descriptors.model';
import { DescriptorList } from 'model/descriptor.model';
import { Page } from 'model/common.model';
import { MY_LIST_DESCRIPTORSLISTS_URL, GET_DESCRIPTORLIST_URL, REMOVE_DESCRIPTORLIST_URL,
CREATE_DESCRIPTORLIST_URL, UPDATE_DESCRIPTORLIST_URL, LIST_DESCRIPTORLISTS_URL, PUBLISH_DESCRIPTORLIST_URL,
......
import { dereferenceReferences } from 'utilities';
import authenticatedRequest from 'utilities/requestUtils';
import {MY_DESCRIPTORS_LIST_URL, LIST_DESCRIPTORS_URL, GET_DESCRIPTOR_URL, CREATE_DESCRIPTOR_URL, UPDATE_DESCRIPTOR_URL, PUBLISH_DESCRIPTOR_URL, GET_DESCRIPTOR_CATEGORIES_URL} from 'constants/apiURLS';
import { MY_DESCRIPTORS_LIST_URL, LIST_DESCRIPTORS_URL, GET_DESCRIPTOR_URL, CREATE_DESCRIPTOR_URL,
UPDATE_DESCRIPTOR_URL, PUBLISH_DESCRIPTOR_URL, GET_DESCRIPTOR_CATEGORIES_URL } from 'constants/apiURLS';
import {Descriptor} from 'model/descriptors.model';
import { Descriptor, IDescriptorFilter } from 'model/descriptor.model';
import { Partner } from 'model/partner.model';
import {Page} from 'model/common.model';
import {IDescriptorFilter} from 'model/filter.model';
import { Page } from 'model/common.model';
// class ApiError {
......
......@@ -7,11 +7,12 @@ import Grid from 'material-ui/Grid';
import Markdown from 'ui/common/markdown';
import Button from 'material-ui/Button';
import { Descriptor } from 'model/descriptors.model';
import { Descriptor } from 'model/descriptor.model';
import { VocabularyTerm } from 'model/vocabulary.model';
import { DescriptorLink } from 'ui/common/Links';
import { DescriptorLink, PartnerLink } from 'ui/common/Links';
// TODO Introduce T function to the project
const T = (code: string): string => {
switch (code) {
case 'descriptor.category.PASSPORT': return 'Passport descriptor';
......@@ -30,10 +31,11 @@ const T = (code: string): string => {
case 'descriptor.dataType.BOOLEAN': return 'Yes/no';
case 'descriptor.dataType.DATE': return 'Date';
case 'crop.null': return null;
case 'crop.maize': return 'Maize';
case 'crop.yam': return 'Yam';
default: return code;
default: return null;
}
};
......@@ -156,7 +158,8 @@ const DescriptorCard = ({complete = true, compact, descriptor, classes, classNam
const displayPref: ICardProps = compact ? BRIEF_DISPLAY() : COMPLETE_DISPLAY();
for (const prop of Object.keys(other)) {
displayPref[prop] = !displayPref[prop];
// console.log(`prop ${prop} ${other[prop]} ${displayPref[prop]}`);
displayPref[prop] = other[prop] ? !displayPref[prop] : other[prop];
}
if (other.textLength) {
displayPref.textLength = other.textLength;
......@@ -177,7 +180,7 @@ const DescriptorCard = ({complete = true, compact, descriptor, classes, classNam
{ descriptor.key && <div className="font-bold">This is a key descriptor for access and utilization of PGR.</div> }
<Grid container spacing={ 0 }>
<Grid item xs={ 12 }>
{ displayPref.publisher && (
{ (displayPref.publisher) && (
<Grid container spacing={ 0 } className={ `${classes.dataContainer} ${classes.grayRowsOdd}` }>
<Grid item xs={ 12 } md={ 3 }>
<Typography type="title" component="h3" className={ `${classes.gray} ${classes.grayTitleSmall} ${classes.pdBottom0}` }>
......@@ -185,8 +188,8 @@ const DescriptorCard = ({complete = true, compact, descriptor, classes, classNam
</Typography>
</Grid>
<Grid item xs={ 12 } md={ 9 } className={ `${classes.gray} ${classes.rightTextWrapper} ${classes.pdTop0}` }>
<Typography type="display3" component="h3" className="blue pt-10 pb-10 pl-15">
{ descriptor.publisher || '' }
<Typography type="display3" component="h3" className="pt-10 pb-10 pl-15">
{ descriptor.publisher || <i>Not specified</i> }
</Typography>
</Grid>
</Grid>
......@@ -199,8 +202,8 @@ const DescriptorCard = ({complete = true, compact, descriptor, classes, classNam
</Typography>
</Grid>
<Grid item xs={ 12 } md={ 9 } className={ `${classes.gray} ${classes.rightTextWrapper} ${classes.pdTop0}` }>
<Typography type="display3" component="h3" className="blue pt-10 pb-10 pl-15">
{ descriptor.owner.name || '' }
<Typography type="display3" component="h3" className="pt-10 pb-10 pl-15">
<PartnerLink to={ descriptor.owner }>{ descriptor.owner.name || '' }</PartnerLink>
</Typography>
</Grid>
</Grid>
......@@ -219,7 +222,7 @@ const DescriptorCard = ({complete = true, compact, descriptor, classes, classNam
</Grid>
</Grid>
) }
{ (displayPref.crop && descriptor.crop) && (
{ (displayPref.crop) && (
<Grid container spacing={ 0 } className={ `${classes.dataContainer} ${classes.grayRowsOdd}` }>
<Grid item xs={ 12 } md={ 3 }>
<Typography type="title" component="h3" className={ `${classes.gray} ${classes.grayTitleSmall} ${classes.pdBottom0}` }>
......@@ -228,7 +231,7 @@ const DescriptorCard = ({complete = true, compact, descriptor, classes, classNam
</Grid>
<Grid item xs={ 12 } md={ 9 } className={ `${classes.gray} ${classes.rightTextWrapper} ${classes.pdTop0}` }>
<Typography type="display3" component="h3" className="pt-10 pb-10 pl-15">
{ T(`crop.${descriptor.crop}`) || descriptor.crop }
{ T(`crop.${descriptor.crop}`) || descriptor.crop || <i>Not specified</i> }
</Typography>
</Grid>
</Grid>
......
......@@ -3,7 +3,7 @@ import { reduxForm } from 'redux-form';
import {withStyles} from 'material-ui/styles';
import Button from 'material-ui/Button';
import { Descriptor } from 'model/descriptors.model';
import { Descriptor } from 'model/descriptor.model';
import StringFilter from 'ui/common/filter/StringFilter';
import StringArrFilter from 'ui/common/filter/StringArrFilter';
......
Supports Markdown
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