Commit 4d6763dd authored by Valeriy Panov's avatar Valeriy Panov
Browse files

#183 Update sortBy on pages

parent 9855f012
......@@ -40,6 +40,14 @@ export class Dataset extends UuidModel implements IUserPermissions {
public _permissions: CurrentPermissions;
public static SORT_OPTIONS = {
title: { label: 'Title' },
accessionCount: { label: 'Accession count' },
descriptorCount: { label: 'Descriptor count' },
versionTag: { label: 'Version' },
...UuidModel.SORT_OPTIONS,
};
public constructor(obj?) {
super(obj);
if (obj && obj._permissions) {
......
......@@ -59,6 +59,16 @@ class DescriptorList extends UuidModel implements IUserPermissions {
public descriptors: Descriptor[];
public _permissions: CurrentPermissions;
public static SORT_OPTIONS = {
crop: { label: 'Crop' },
title: { label: 'Title' },
publisher: { label: 'Publisher' },
versionTag: { label: 'Version' },
bibliographicCitation: { label: 'Bibliographic citation' },
owner: { label: 'Maintainer' },
...UuidModel.SORT_OPTIONS,
};
public constructor(obj?) {
super(obj);
if (obj && obj._permissions) {
......
......@@ -8,6 +8,12 @@ class Partner extends UuidModel implements IUserPermissions {
public urls: string[];
public _permissions: CurrentPermissions;
public static SORT_OPTIONS = {
name: { label: 'Partner name' },
shortName: { label: 'Acronym' },
...UuidModel.SORT_OPTIONS,
};
public constructor(obj?) {
super(obj);
if (obj && obj._permissions) {
......
......@@ -19,6 +19,14 @@ class Vocabulary extends UuidModel implements IUserPermissions {
public terms: VocabularyTerm[];
public _permissions: CurrentPermissions;
public static SORT_OPTIONS = {
title: { label: 'Title' },
versionTag: { label: 'Version' },
url: { label: 'URL' },
owner: { label: 'Maintainer' },
...UuidModel.SORT_OPTIONS,
};
public constructor(obj?) {
super(obj);
if (obj && obj._permissions) {
......
......@@ -14,11 +14,6 @@ import DatasetCard from './c/Card';
import Grid from 'material-ui/Grid';
const sortOptions = {
title: 'Title',
lastModifiedDate: { label: 'Last modified', dir: 'DESC' },
};
const styles = (theme) => ({
filterSection: theme.leftPanel.root,
});
......@@ -91,7 +86,7 @@ class BrowsePage extends React.Component<IDatasetsProps, any> {
<Grid item xs={ 12 }>
<PaginationComponent pageObj={ paged }
onChange={ this.onPaginationChange } displayName="datasets"
sortOptions={ sortOptions } />
sortOptions={ Dataset.SORT_OPTIONS } />
</Grid>
{ stillLoading ? <Loading /> :
<Grid container spacing={ 0 }>
......@@ -106,7 +101,7 @@ class BrowsePage extends React.Component<IDatasetsProps, any> {
<Grid item xs={ 12 }>
<PaginationComponent pageObj={ paged }
onChange={ this.onPaginationChange } displayName="datasets"
sortOptions={ sortOptions } />
sortOptions={ Dataset.SORT_OPTIONS } />
</Grid>
</Grid>
</Grid>
......
......@@ -16,11 +16,6 @@ import PaginationComponent from 'ui/common/pagination';
import DescriptorListCard from 'ui/catalog/descriptorlist/Card';
import DescriptorListFilters from './c/Filters';
const sortOptions = {
title: 'Title',
lastModifiedDate: { label: 'Last modified', dir: 'DESC' },
};
const styles = (theme) => ({
filterSection: theme.leftPanel.root,
});
......@@ -99,7 +94,7 @@ class BrowsePage extends React.Component<IBrowsePageProps, any> {
<Grid item xs={ 12 }>
<PaginationComponent pageObj={ paged }
onChange={ this.onPaginationChange } displayName="datasets"
sortOptions={ sortOptions } />
sortOptions={ DescriptorList.SORT_OPTIONS } />
</Grid>
</Grid>
{ stillLoading ? <Loading /> :
......@@ -114,7 +109,7 @@ class BrowsePage extends React.Component<IBrowsePageProps, any> {
<Grid item xs={ 12 }>
<PaginationComponent pageObj={ paged }
onChange={ this.onPaginationChange } displayName="datasets"
sortOptions={ sortOptions } />
sortOptions={ DescriptorList.SORT_OPTIONS } />
</Grid>
</Grid>
</Grid>
......
......@@ -31,10 +31,6 @@ const styles = (theme) => ({
filterSection: theme.leftPanel.root,
});
const sort = {
name: 'Name',
};
class PartnerListPage extends React.Component<IBrowsePageProps, any> {
protected static needs = [
......@@ -102,7 +98,7 @@ class PartnerListPage extends React.Component<IBrowsePageProps, any> {
pageObj={ paged }
onChange={ this.onPaginationChange }
displayName="partners"
sortOptions={ sort }
sortOptions={ Partner.SORT_OPTIONS }
/>
</Grid>
</Grid>
......@@ -122,7 +118,7 @@ class PartnerListPage extends React.Component<IBrowsePageProps, any> {
pageObj={ paged }
onChange={ this.onPaginationChange }
displayName="partners"
sortOptions={ sort }
sortOptions={ Partner.SORT_OPTIONS }
/>
</Grid>
</Grid>
......
......@@ -32,11 +32,6 @@ interface IBrowsePageProps extends React.ClassAttributes<any> {
createVocabulary: any;
}
const sortOptions = {
title: 'Title',
lastModifiedDate: { label: 'Last modified', dir: 'DESC' },
};
class BrowsePage extends React.Component<IBrowsePageProps & any, any> {
protected static needs = [
......@@ -85,7 +80,7 @@ class BrowsePage extends React.Component<IBrowsePageProps & any, any> {
<PaginationComponent pageObj={ paged }
onChange={ this.onPaginationChange }
displayName="vocabularies"
sortOptions={ sortOptions }
sortOptions={ Vocabulary.SORT_OPTIONS }
/>
</Grid>
{ stillLoading ? <Loading /> :
......@@ -99,7 +94,7 @@ class BrowsePage extends React.Component<IBrowsePageProps & any, any> {
<PaginationComponent pageObj={ paged }
onChange={ this.onPaginationChange }
displayName="vocabularies"
sortOptions={ sortOptions }
sortOptions={ Vocabulary.SORT_OPTIONS }
/>
</Grid>
</Grid>
......
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