DisplayPage.tsx 22.9 KB
Newer Older
1
import * as React from 'react';
2
3
import { connect } from 'react-redux';
import { bindActionCreators } from 'redux';
Matija Obreza's avatar
Matija Obreza committed
4
import { translate } from 'react-i18next';
5
import { withStyles } from '@material-ui/core/styles';
6
7

// Actions
8
import { loadAccession, applyFilters, loadAccessionAuditLog } from 'accessions/actions/public';
9
import { addAccessionToMyList, removeAccessionFromMyList } from 'list/actions/public';
10
import navigateTo from 'actions/navigation';
11

12
13
14
// Constants
import { ROLE_USER } from 'constants/userRoles';

15
// Models
16
import AccessionDetails from 'model/accession/AccessionDetails';
Viacheslav Pavlov's avatar
Viacheslav Pavlov committed
17
import RepositoryFile from 'model/repository/RepositoryFile';
18
import AccessionAuditLog from 'model/accession/AccessionAuditLog';
Oleksii Savran's avatar
Oleksii Savran committed
19
import MapLayer from 'model/genesys/MapTileLayer';
20
21

// UI
Matija Obreza's avatar
Matija Obreza committed
22
23
import PrettyDate from 'ui/common/time/PrettyDate';
import PageLayout, { PageContents, MainSection, PageSection } from 'ui/layout/PageLayout';
24
25
import ContentHeader from 'ui/common/heading/ContentHeader';
import Loading from 'ui/common/Loading';
Matija Obreza's avatar
Matija Obreza committed
26
27
28
29
30
import { Properties, PropertiesItem } from 'ui/common/Properties';
import DOI from 'ui/common/DOI';
import { ExternalLink } from 'ui/common/Links';
import SciName from 'ui/genesys/SciName';
import { ScrollToTopOnMount } from 'ui/common/page/scrollers';
Viacheslav Pavlov's avatar
Viacheslav Pavlov committed
31
import ReduxCheckbox from 'ui/common/checkbox';
32
import CropChips from 'crop/ui/c/CropChips';
33
import LocationMap from 'ui/common/LocationMap';
34
35
import {CountryLink, DatasetLink, InstituteLink, SubsetLink} from 'ui/genesys/Links';
import PropertiesCard from 'ui/common/PropertiesCard';
Viacheslav Pavlov's avatar
Viacheslav Pavlov committed
36
import GridContainer from 'ui/layout/GridContainer';
37
import McpdDate from 'ui/common/time/McpdDate';
38
import PdciTable from './c/PdciTable';
Viacheslav Pavlov's avatar
Viacheslav Pavlov committed
39
40
import ImageGalleryView from 'repository/ui/c/ImageGalleryView';
import Button from '@material-ui/core/Button/Button';
41
42
import AuditedInfo from 'ui/common/AuditedInfo';
import Authorize from 'ui/common/authorized/Authorize';
Viacheslav Pavlov's avatar
Viacheslav Pavlov committed
43
import BioClimateDisplay from 'accessions/ui/c/BioClimateDisplay';
Viacheslav Pavlov's avatar
Viacheslav Pavlov committed
44
import PageTitle from 'ui/common/PageTitle';
Matija Obreza's avatar
Matija Obreza committed
45

46
47
48
49
const styles = (theme) => ({
  pageSection: {
    marginBottom: '1em',
  },
Matija Obreza's avatar
Matija Obreza committed
50
51
52
53
54
55
  selected: {
    background: '#c9e2cb',
  },
  historic: {
    background: '#ffe2e2 !important',
  },
56
57
});

58

59
60
61
interface IBrowsePageProps {
  t?: any;
  classes?: any;
62

63
  uuid: string;
64
  doi: string; // DOI comes from the route without the '10.'
65
  accession: AccessionDetails;
66
  auditLog: AccessionAuditLog;
67
  error: any;
Viacheslav Pavlov's avatar
Viacheslav Pavlov committed
68
  loading: boolean;
69
  loadAccession: any;
70
  loadAccessionAuditLog: any;
Viacheslav Pavlov's avatar
Viacheslav Pavlov committed
71
72
73
  accessions: any;
  addAccessionToMyList: any;
  removeAccessionFromMyList: any;
Matija Obreza's avatar
Matija Obreza committed
74
  applyFilters: any;
75
  navigateTo: (location: string) => void;
Oleksii Savran's avatar
Oleksii Savran committed
76
  mapLayers: MapLayer[];
77
78
79
80
81
}

class BrowsePage extends React.Component<IBrowsePageProps, any> {

  protected static needs = [
82
    ({ params: { uuid, doi } }) => {
Viacheslav Pavlov's avatar
Viacheslav Pavlov committed
83
        return doi ? loadAccession({ doi: `10.${doi}` }) :  loadAccession({ uuid });
84
85
86
87
88
89
90
91
    },
  ];

  constructor(props: IBrowsePageProps, context: any) {
      super(props, context);
  }

  public componentWillMount() {
92
93
94
    const { doi, uuid, loadAccession } = this.props;
    const accession = this.props.accession ? this.props.accession.details : null;

95
96
97
98
    const theDoi = `10.${doi}`;
    if (doi && (! accession || theDoi !== accession.doi)) {
      loadAccession({ doi: theDoi });
    }
99
    if (uuid && (! accession || uuid !== accession.uuid)) {
100
      loadAccession({ uuid });
101
102
103
    }
  }

104
105
106
107
108
109
110
111
112
  public componentWillReceiveProps(nextProps): void {
    const {uuid, doi, navigateTo} = this.props;
    const accession = this.props.accession ? this.props.accession.details : null;

    if (accession && accession.doi && !doi && accession.uuid === uuid) {
      navigateTo(`/${accession.doi}`);
    }
  }

113
114
115
116
117
118
119
120
121
122
123
  private loadAuditLog = () => {
    const { doi, uuid, loadAccessionAuditLog } = this.props;

    const theDoi = `10.${doi}`;
    if (doi) {
      loadAccessionAuditLog({ doi: theDoi });
    } else {
      loadAccessionAuditLog({uuid});
    }
  }

Viacheslav Pavlov's avatar
Viacheslav Pavlov committed
124
  private onCheckboxChange = (event, checked) => {
125
      const {accession: {details: accession}, addAccessionToMyList, removeAccessionFromMyList} = this.props;
Viacheslav Pavlov's avatar
Viacheslav Pavlov committed
126
127
128
129
130
131
132
      if (checked) {
          addAccessionToMyList(accession.uuid);
      } else {
          removeAccessionFromMyList(accession.uuid);
        }
  }

Matija Obreza's avatar
Matija Obreza committed
133
134
135
136
137
138
139

  private applyFilterForInstituteSpecies = () => {
    const { accession: {details: accession}, applyFilters } = this.props;
    const filter = {holder: {code: [ accession.institute.code ]}, taxa: { genus: [ accession.taxonomy.genus ], species: [ accession.taxonomy.species ] }};
    applyFilters(filter);
  }

140
  public render() {
Viacheslav Pavlov's avatar
Viacheslav Pavlov committed
141
    const { t, error, loading, accessions, auditLog, classes, mapLayers } = this.props;
142
143
144

    const { auditAccession, auditAccessionId, auditAccessionCollect, auditAccessionGeo } = auditLog || { auditAccession: {}, auditAccessionId: {}, auditAccessionCollect: {}, auditAccessionGeo: {} };

145
    const { details: accession, pdci, datasets, subsets, files, imageGallery } = this.props.accession ?
146
147
      this.props.accession
      :
Viacheslav Pavlov's avatar
Viacheslav Pavlov committed
148
      {details: null, pdci: null, datasets: null, subsets: null, files: null, imageGallery: null};
149

Matija Obreza's avatar
Matija Obreza committed
150
    const isChecked  =  accession && accessions && accessions.includes(accession.uuid);
151

Matija Obreza's avatar
Matija Obreza committed
152
153
    const hasLatLon = accession && accession.geo && accession.geo.latitude !== null && accession.geo.longitude !== null;

154
    return (
Oleksii Savran's avatar
Oleksii Savran committed
155
      <PageLayout withFooter>
Matija Obreza's avatar
Matija Obreza committed
156
        <ScrollToTopOnMount />
Viacheslav Pavlov's avatar
Viacheslav Pavlov committed
157
        <PageTitle title={ !loading && accession ? accession.accessionNumber : t('common:label.loading', { what: t('accessions.public.p.display.title') }) } />
Viacheslav Pavlov's avatar
Viacheslav Pavlov committed
158
        <ContentHeader
Viacheslav Pavlov's avatar
Viacheslav Pavlov committed
159
          title={ !loading && accession ? accession.accessionNumber : t('common:label.loading', { what: t('accessions.public.p.display.title') }) }
Viacheslav Pavlov's avatar
Viacheslav Pavlov committed
160
161
          subtitle={ t('accessions.public.p.display.subTitle') }
        />
Matija Obreza's avatar
Matija Obreza committed
162

Viacheslav Pavlov's avatar
Viacheslav Pavlov committed
163
        { loading ? <Loading /> :
164
165
          <div>
            { error && <div>{ JSON.stringify(error) }</div> }
Matija Obreza's avatar
Matija Obreza committed
166

167
            { accession &&
Viacheslav Pavlov's avatar
Viacheslav Pavlov committed
168
              <PageContents className="pt-1rem">
Matija Obreza's avatar
Matija Obreza committed
169
                <MainSection className={ isChecked ? classes.selected : accession.historic ?  classes.historic : '' } title={
170
                  <div>
Viacheslav Pavlov's avatar
Viacheslav Pavlov committed
171
                    { t('accessions.public.p.display.title') }
172
                    <div className="float-right">
173
174
175
                        <Authorize role={ ROLE_USER }>
                            <Button className="mr-20" variant="contained" onClick={ this.loadAuditLog }>{ t('accessions.public.p.display.loadChanges') }</Button>
                        </Authorize>
176
177
178
                        <ReduxCheckbox
                            label={
                                <b>
Viacheslav Pavlov's avatar
i18n    
Viacheslav Pavlov committed
179
                                    { isChecked ? t('accessions.public.p.display.removeFromMyList', {accessionNumber: accession.accessionNumber}) : t('accessions.public.p.display.addToMyList', {accessionNumber: accession.accessionNumber}) }
180
181
182
183
184
185
186
187
188
189
190
191
                                </b>
                            }
                            input={ {
                                value: isChecked,
                                onChange: this.onCheckboxChange,
                            } }
                        />
                    </div>
                  </div>
                  }
                >
                  <Properties>
192
193
194
195
196
197
                    { accession.doi &&
                      <PropertiesItem title={ t('accessions.public.p.display.DOI') }>
                        <DOI noPrefix value={ accession.doi } />
                          <AuditedInfo info={ auditAccession.doi }/>
                      </PropertiesItem>
                    }
198
199
200
201
                    <PropertiesItem title={ t('accessions.common.acceNumb') } >
                      { accession.accessionNumber }
                      <AuditedInfo info={ auditAccession.accessionNumber }/>
                    </PropertiesItem>
202
                    <PropertiesItem title={ t('accessions.public.p.display.holdingInstitute') }>
203
204
205
                      <InstituteLink to={ accession.institute }>
                        { accession.institute.fullName }
                      </InstituteLink>
Matija Obreza's avatar
Matija Obreza committed
206
207
                      <span> &mdash; </span>
                      <CountryLink noflag country={ accession.institute.country }/>
208
209
210
211
212
213
214
215
216
217
218
219
                      <AuditedInfo info={ auditAccession.institute }/>
                    </PropertiesItem>
                    { accession.historic &&
                      <PropertiesItem className={ accession.historic ?  classes.historic : '' } title={ t('accessions.public.p.display.historic') }>
                        { t('accessions.public.p.display.isHistoric') }
                        <AuditedInfo info={ auditAccession.historic }/>
                      </PropertiesItem>
                    }
                    <PropertiesItem title={ t('accessions.common.instituteCode') }>
                      { accession.institute.code }
                      <AuditedInfo info={ auditAccession.instituteCode }/>
                    </PropertiesItem>
220
221
222
223
224
                    { accession.institute && accession.institute.owner &&
                      <PropertiesItem title={ t('accessions.public.p.display.partner') }>
                        <b>{ accession.institute.owner.shortName }</b> { accession.institute.owner.name }
                      </PropertiesItem>
                    }
225
226
227
                    <PropertiesItem title={ t('accessions.public.p.display.acquisitionDate') }>
                      <McpdDate value={ accession.acquisitionDate } />
                      <AuditedInfo info={ auditAccession.acquisitionDate }/>
228
                    </PropertiesItem>
229
230
231
232
233
234
                    { accession.countryOfOrigin &&
                      <PropertiesItem title={ t('accessions.common.countryOfOrigin') }>
                          <CountryLink country={ accession.countryOfOrigin }/>
                          <AuditedInfo info={ auditAccession.countryOfOrigin }/>
                      </PropertiesItem>
                    }
235
236
237
                    { accession.sampStat &&
                      <PropertiesItem title={ t('accessions.common.sampStat') }>
                        { t(`accessions.common.sampleStatus.${accession.sampStat}`) }
238
                        <AuditedInfo info={ auditAccession.sampStat } tPrefix="accessions.common.sampleStatus"/>
239
240
                      </PropertiesItem>
                    }
241
                    { accession.storage && accession.storage.length > 0 && <PropertiesItem title={ t('accessions.common.storageType') }>
242
                      { accession.storage.map((storage, i) => (
Viacheslav Pavlov's avatar
i18n    
Viacheslav Pavlov committed
243
                        <div key={ storage } style={ {width: '100%', paddingTop: '.25rem'} }>{ t(`accessions.common.storage.${storage}`) }</div>
244
                      )) }
Matija Obreza's avatar
Matija Obreza committed
245
                        <AuditedInfo info={ auditAccessionId.storage } tPrefix="accessions.common.storage"/>
246
                    </PropertiesItem> }
247
248
                    <PropertiesItem title={ t('accessions.public.p.display.availability') } keepEmpty>
                      { t(`accessions.common.available.${accession.available}`) }
249
                      <AuditedInfo info={ auditAccession.available } tPrefix="accessions.common.available"/>
250
251
252
                    </PropertiesItem>
                    <PropertiesItem title={ t('accessions.public.p.display.ITPGRFAMLS') } keepEmpty>
                      { t(`accessions.common.mlsStatus.${accession.mlsStatus}`) }
253
                      <AuditedInfo info={ auditAccession.mlsStatus } tPrefix="accessions.common.mlsStatus"/>
254
                    </PropertiesItem>
255
256
257
258
259
260
261
262
263
264
265
266
                    { accession.donorCode &&
                      <PropertiesItem title={ t('accessions.public.p.display.donorInstitute') }>
                        { accession.donorCode }
                        <AuditedInfo info={ auditAccession.donorCode }/>
                      </PropertiesItem>
                    }
                    { accession.donorNumb &&
                      <PropertiesItem title={ t('accessions.public.p.display.donorAccessionNumber') }>
                        { accession.donorNumb }
                        <AuditedInfo info={ auditAccession.donorNumb }/>
                      </PropertiesItem>
                    }
267
                    { accession.duplSite && accession.duplSite.length > 0 && <PropertiesItem title={ t('accessions.public.p.display.safetyDuplicationInstitute') }>
268
                      { accession.duplSite.map((duplSite, i) => (
Viacheslav Pavlov's avatar
Viacheslav Pavlov committed
269
                        <div key={ duplSite } style={ {width: '100%', paddingTop: '.25rem'} }>{ duplSite }</div>
270
                      )) }
Matija Obreza's avatar
Matija Obreza committed
271
                      <AuditedInfo info={ auditAccessionId.duplSite }/>
272
                    </PropertiesItem> }
Matija Obreza's avatar
Matija Obreza committed
273

274
275
276
277
278
279
                    { accession.acceUrl &&
                      <PropertiesItem title={ t('accessions.public.p.display.accessionURL') }>
                          <ExternalLink link={ accession.acceUrl } />
                          <AuditedInfo info={ auditAccession.acceUrl }/>
                      </PropertiesItem>
                    }
280
281
                  </Properties>
                </MainSection>
Matija Obreza's avatar
Matija Obreza committed
282

283
284
285
286
                { imageGallery &&
                  <ImageGalleryView className={ classes.pageSection } imageGallery={ imageGallery }/>
                }

287
                <PageSection title={ t('accessions.common.taxonomy') }>
288
                  <Properties>
289
290
291
                    <PropertiesItem title={ t('accessions.common.genus') }>
                      { accession.taxonomy.genus }
                    </PropertiesItem>
292
                    <PropertiesItem title={ t('accessions.common.species') }>
293
294
                      { accession.taxonomy.species }
                      { '' }
Matija Obreza's avatar
Matija Obreza committed
295
                      <a onClick={ this.applyFilterForInstituteSpecies }>View <i>{ `${accession.taxonomy.genus} ${accession.taxonomy.species}` }</i> at { accession.institute.code }</a>
296
297
298
299
                    </PropertiesItem>
                    <PropertiesItem title={ t('accessions.public.p.display.scientificName') }>
                        <SciName taxa={ accession.taxonomy.taxonNameHtml } />
                        <AuditedInfo info={ auditAccession.taxonomy }/>
300
                    </PropertiesItem>
301
                    { accession.crop && <PropertiesItem title={ t('accessions.public.p.display.cropName') }><CropChips crops={ accession.crop.shortName } /></PropertiesItem> }
302
303
304
305
                    <PropertiesItem title={ t('accessions.public.p.display.providedCropName') }>
                      { accession.cropName }
                      <AuditedInfo info={ auditAccession.cropName }/>
                    </PropertiesItem>
306
307
                  </Properties>
                </PageSection>
Matija Obreza's avatar
Cleanup    
Matija Obreza committed
308
309

                { (accession.donorCode || (accession.aliases && accession.aliases.length > 0)) &&
310
                  <PageSection title={ t('accessions.public.p.display.accessionNames') }>
311
                    <Properties>
312
313
314
315
316
317
318
                      { accession.donorCode &&
                        <PropertiesItem title={ t('accessions.common.alias.DONORNUMB') }>
                          { accession.donorNumb } <em>{ accession.donorCode }</em>
                          <AuditedInfo info={ auditAccession.donorNumb }/>
                          <AuditedInfo info={ auditAccession.donorCode }/>
                        </PropertiesItem>
                      }
319
                      { accession.aliases && accession.aliases.map((alias) => (
Viacheslav Pavlov's avatar
i18n    
Viacheslav Pavlov committed
320
                        <PropertiesItem key={ alias.id } title={ t(`accessions.common.alias.${alias.aliasType}`) }>{ alias.name } <em>{ alias.usedBy }</em></PropertiesItem>
321
322
323
324
                      )) }
                    </Properties>
                  </PageSection>
                }
325

326
                { accession.coll &&
327
                  <PageSection title={ t('accessions.public.p.display.collectingInformation') }>
328
                    <Properties>
329
330
331
332
333
334
335
336
337
338
339
340
                      { accession.countryOfOrigin &&
                        <PropertiesItem title={ t('accessions.common.countryOfOrigin') }>
                          <CountryLink country={ accession.countryOfOrigin }/>
                          <AuditedInfo info={ auditAccessionCollect.countryOfOrigin }/>
                        </PropertiesItem>
                      }
                      { accession.coll.collDate &&
                        <PropertiesItem key="collDate" title={ t(`accessions.common.coll.collDate`) }>
                          <McpdDate value={ accession.coll.collDate } />
                          <AuditedInfo info={ auditAccessionCollect.collDate }/>
                        </PropertiesItem>
                      }
Oleksii Savran's avatar
Oleksii Savran committed
341
342
343
                      { accession.coll.collSrc &&
                        <PropertiesItem key="collSrc" title={ t(`accessions.common.coll.collSrc`) }>
                          { t(`accessions.common.collectingSource.${accession.coll.collSrc}`) }
344
                          <AuditedInfo info={ auditAccessionCollect.collSrc } tPrefix="accessions.common.collectingSource"/>
Oleksii Savran's avatar
Oleksii Savran committed
345
346
                        </PropertiesItem>
                      }
347
                      { accession.coll &&
Oleksii Savran's avatar
Oleksii Savran committed
348
                        [ 'collMissId', 'collNumb', 'collSite' ]
349
                          .filter((prop) => accession.coll[prop] !== null).map((prop) => (
350
351
352
353
                          <PropertiesItem key={ prop } title={ t(`accessions.common.coll.${prop}`) }>
                            { accession.coll[prop] }
                            <AuditedInfo info={ auditAccessionCollect[prop] }/>
                          </PropertiesItem>
354
                        ))
355
                      }
356
357
358
                      { accession.coll &&
                        [ 'collCode', 'collName' ]
                          .filter((prop) => accession.coll[prop].length).map((prop) => (
359
360
361
362
                          <PropertiesItem key={ prop } title={ t(`accessions.common.coll.${prop}`) }>
                            { accession.coll[prop] }
                            <AuditedInfo info={ auditAccessionCollect[prop] }/>
                          </PropertiesItem>
363
364
365
366
367
                        ))
                      }
                      { accession.geo &&
                        [ 'latitude', 'longitude', 'datum', 'method', 'uncertainty', 'elevation' ]
                          .filter((prop) => accession.geo[prop] !== null).map((prop) => (
368
369
370
371
                          <PropertiesItem key={ prop } title={ t(`accessions.common.geo.${prop}`) }>
                            { accession.geo[prop] }
                            <AuditedInfo info={ auditAccessionGeo[prop] }/>
                          </PropertiesItem>
372
373
374
375
376
                        ))
                      }
                    </Properties>

                    { hasLatLon &&
Oleksii Savran's avatar
Oleksii Savran committed
377
378
379
380
                      <LocationMap
                        locations={ [{ id: accession.geo.id, lat: accession.geo.latitude, lng: accession.geo.longitude }] }
                        mapLayers={ mapLayers }
                      />
381
382
383
                    }
                  </PageSection>
                }
Matija Obreza's avatar
Matija Obreza committed
384

Viacheslav Pavlov's avatar
Viacheslav Pavlov committed
385
                { accession.geo && accession.geo.climate &&
386
                 <BioClimateDisplay climateData={ accession.geo.climate } extraFilters={ { taxa: { genus: [ accession.taxonomy.genus ] } } } />
Viacheslav Pavlov's avatar
Viacheslav Pavlov committed
387
388
                }

389
                { accession.remarks && accession.remarks.length > 0 && <PageSection title={ t('accessions.public.p.display.remarks') }>
390
391
392
393
394
395
                  <Properties>
                    { accession.remarks && accession.remarks.map((remark) => (
                      <PropertiesItem key={ remark.id } title={ remark.fieldName }>{ remark.remark }</PropertiesItem>
                    )) }
                  </Properties>
                </PageSection> }
Matija Obreza's avatar
Matija Obreza committed
396

397
398
399
400
401
402
                { files &&
                  <PageSection title={ t('accessions.public.p.display.relatedResources') }>
                    <Properties>
                      { files.map((e: RepositoryFile) => (
                        <PropertiesItem key={ e.uuid } title={
                          <a href={ `/proxy/api/v1/repository/download/${e.uuid}` }>
403
                            <Button variant="contained" component="span">
404
405
406
407
408
409
410
411
412
413
414
                              { t('common:action.download') }
                            </Button>
                          </a>
                        }>
                          <b>{ e.originalFilename }</b>
                        </PropertiesItem>
                      )) }
                    </Properties>
                  </PageSection>
                }

415
                { pdci && <PdciTable pdci={ pdci } title={ t('accessions.public.p.display.pdci') }/> }
Matija Obreza's avatar
Matija Obreza committed
416

417
                <PageSection title={ t('accessions.public.p.display.metadata') }>
418
                  <Properties>
419
420
421
422
                    <PropertiesItem title={ t('common:label.UUID') }>
                      { `urn:uuid:${accession.uuid}` }
                      <AuditedInfo info={ auditAccessionId.uuid }/>
                    </PropertiesItem>
423
424
425
                    <PropertiesItem title={ t('accessions.public.p.display.permanentURL') }><ExternalLink link={ `https://purl.org/germplasm/id/${accession.uuid}` } /></PropertiesItem>
                    <PropertiesItem title={ t('common:label.lastUpdated') }><PrettyDate value={ accession.lastModifiedDate } /></PropertiesItem>
                    <PropertiesItem title={ t('common:label.created') }><PrettyDate value={ accession.createdDate } /></PropertiesItem>
426
427
                  </Properties>
                </PageSection>
428

Viacheslav Pavlov's avatar
Viacheslav Pavlov committed
429
                <GridContainer className="mb-15">
430
431
432
                  { datasets && datasets.length > 0 &&
                  <PropertiesCard
                    small
433
                    title={ t('accessions.public.p.display.associatedDatasets') }
434
                    propertyItemProps={ { keepEmpty: true } }
Matija Obreza's avatar
Matija Obreza committed
435
                    propertiesList={ datasets.map((dataset) => ({ value: <DatasetLink to={ dataset } /> })) }
436
437
438
439
440
                  />
                  }
                  { subsets && subsets.length > 0 &&
                  <PropertiesCard
                    small
441
                    title={ t('accessions.public.p.display.associatedSubsets') }
442
                    propertyItemProps={ { keepEmpty: true } }
Matija Obreza's avatar
Matija Obreza committed
443
                    propertiesList={ subsets.map((subset) => ({ value: <SubsetLink to={ subset } /> })) }
444
445
                  />
                  }
Viacheslav Pavlov's avatar
Viacheslav Pavlov committed
446
                </GridContainer>
447
448
449
              </PageContents>
            }
          </div>
Matija Obreza's avatar
Matija Obreza committed
450
        }
451
452
453
454
455
456
      </PageLayout>
    );
  }
}

const mapStateToProps = (state, ownProps) => ({
Viacheslav Pavlov's avatar
Viacheslav Pavlov committed
457
458
459
460
  accession: state.accessions.public.accession ? state.accessions.public.accession.data : undefined,
  auditLog: state.accessions.public.auditLog ? state.accessions.public.auditLog.data : undefined,
  error: state.accessions.public.accession ? state.accessions.public.accession.error : undefined,
  loading: state.accessions.public.accession ? state.accessions.public.accession.loading : false,
461
  uuid: ownProps.match.params.uuid,
462
  doi: ownProps.match.params.doi,
463
  accessions: state.list.public.myList.accessions,
Oleksii Savran's avatar
Oleksii Savran committed
464
  mapLayers: state.accessions.public.mapLayers,
465
466
467
});

const mapDispatchToProps = (dispatch) => bindActionCreators({
Viacheslav Pavlov's avatar
Viacheslav Pavlov committed
468
469
  addAccessionToMyList,
  removeAccessionFromMyList,
470
  loadAccession,
471
  loadAccessionAuditLog,
Matija Obreza's avatar
Matija Obreza committed
472
  applyFilters,
473
  navigateTo,
474
475
476
}, dispatch);


477
export default connect(mapStateToProps, mapDispatchToProps)(withStyles(styles)(translate()(BrowsePage)));