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

Code cleanup

- Removed unused imports and variables
- Fixed whitespace
parent a10b5fe0
import { push } from 'react-router-redux';
import { SubmissionError } from 'redux-form';
import { Page } from 'model/common.model';
import { Dataset, IDatasetFilter, AccessionIdentifier } from 'model/dataset.model';
......@@ -9,14 +8,9 @@ import { Location } from 'model/location.model';
import { DatasetService } from 'service/DatasetService';
import { CreatorService } from 'service/CreatorService';
import { LocationService } from 'service/LocationService';
import { RepositoryFile } from 'model/repositoryFile.model';
import { RepositoryFileService } from 'service/RepositoryFileService';
import { RECEIVE_REPOSITORY_FILE, REMOVE_REPOSITORY_FILE, ADD_REPOSITORY_FILE } from 'constants/repositoryFile';
import { CREATE_DATASET, RECEIVE_DATASET, RECEIVE_DATASET_PAGE } from 'constants/datasets';
import { ADD_CREATOR_TO_DATASET, REMOVE_CREATOR_FROM_DATASET, UPDATE_DATASET_CREATOR } from 'constants/datasets';
import { ADD_LOCATION, RECEIVE_LOCATION, REMOVE_LOCATION } from 'constants/datasets';
import { CREATE_DATASET, RECEIVE_DATASET, RECEIVE_DATASET_PAGE, ADD_CREATOR_TO_DATASET, REMOVE_CREATOR_FROM_DATASET, UPDATE_DATASET_CREATOR, ADD_LOCATION, RECEIVE_LOCATION, REMOVE_LOCATION } from 'constants/datasets';
const receiveDataset = (dataset: Dataset) => ({
type: RECEIVE_DATASET, payload: dataset,
......@@ -166,7 +160,7 @@ function removeDescriptorsFromDatasetRequest(dataset: Dataset, descriptor: Descr
export {
listMyDatasets, listDatasetsRequest, loadDataset, createDataset, saveDataset,
publishDataset, receiveDataset, editDataset, showDataset, updateDatasetAccessionIdentifiers,
addDescriptorsToDatasetRequest, removeDescriptorsFromDatasetRequest
addDescriptorsToDatasetRequest, removeDescriptorsFromDatasetRequest,
};
const uploadRepositoryFileRequest = (dataset: Dataset, file: File) => (dispatch, getState) => {
......
import { push } from 'react-router-redux';
import { SubmissionError } from 'redux-form';
import { dereferenceReferences } from 'utilities';
import { DescriptorListService } from 'service/DescriptorListService';
import { DescriptorList, Descriptor } from 'model/descriptors.model';
import { IDescriptorListFilter } from 'model/filter.model';
import { Partner } from 'model/partner.model';
import { Page } from 'model/common.model';
import {
GET_DESCRIPTORLIST, RECEIVE_DESCRIPTORLIST,
CREATE_DESCRIPTORLIST, EDIT_DESCRIPTORLIST,
SAVE_DESCRIPTORLIST, DELETE_DESCRIPTORLIST, PUBLISH_DESCRIPTORLIST,
CREATE_DESCRIPTORLIST,
LIST_DESCRIPTORLISTS, RECEIVE_DESCRIPTORLISTS,
} from 'constants/descriptors';
......
import {UuidModel} from './common.model';
import { UuidModel } from './common.model';
class Creator extends UuidModel {
public fullName: string;
public email: string;
public phoneNumber: number;
public fax: number;
public institutionalAffiliation: string;
public instituteAddress: string;
public uuid: string;
public role: CreatorRole;
public fullName: string;
public email: string;
public phoneNumber: number;
public fax: number;
public institutionalAffiliation: string;
public instituteAddress: string;
public uuid: string;
public role: CreatorRole;
public constructor(obj?) {
super(obj);
}
public constructor(obj?) {
super(obj);
}
public getClassname(): string {
return 'org.genesys.catalog.model.Creator';
}
public getClassname(): string {
return 'org.genesys.catalog.model.Creator';
}
}
enum CreatorRole {
CONTACT = 'CONTACT',
CONTRIBUTOR = 'CONTRIBUTOR',
CONTACT = 'CONTACT',
CONTRIBUTOR = 'CONTRIBUTOR',
}
export {Creator, CreatorRole};
export { Creator, CreatorRole };
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 { 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';
export class AccessionIdentifier extends EmptyModel {
......@@ -13,51 +13,51 @@ export class AccessionIdentifier extends EmptyModel {
public genus: string;
public constructor(obj?) {
super(obj);
super(obj);
}
public getClassname(): string {
return 'org.genesys.catalog.model.dataset.AccessionIdentifier';
return 'org.genesys.catalog.model.dataset.AccessionIdentifier';
}
}
export class Dataset extends UuidModel implements IUserPermissions {
public title: string;
public description: string;
public rights: string;
public language: string;
public source: string;
public creators: Creator[];
public owner: string | Partner | any;
public repositoryFiles: RepositoryFile[];
public locations: Location[];
public accessionIdentifiers: AccessionIdentifier[];
public descriptors: Descriptor[];
public accessionCount: number;
public descriptorCount: number;
public _permissions: CurrentPermissions;
public constructor(obj?) {
super(obj);
if (obj && obj._permissions) {
this._permissions = new CurrentPermissions(obj._permissions);
}
}
public title: string;
public description: string;
public rights: string;
public language: string;
public source: string;
public creators: Creator[];
public owner: string | Partner | any;
public repositoryFiles: RepositoryFile[];
public locations: Location[];
public accessionIdentifiers: AccessionIdentifier[];
public descriptors: Descriptor[];
public accessionCount: number;
public descriptorCount: number;
public getClassname(): string {
return 'org.genesys.catalog.model.dataset.Dataset';
public _permissions: CurrentPermissions;
public constructor(obj?) {
super(obj);
if (obj && obj._permissions) {
this._permissions = new CurrentPermissions(obj._permissions);
}
}
public getClassname(): string {
return 'org.genesys.catalog.model.dataset.Dataset';
}
}
export interface IDatasetFilter extends IAuditedVersionedModelFilter {
published?: boolean;
active?: boolean;
title?: IStringFilter;
description?: IStringFilter;
language?: string[];
lastModifiedBy?: number[];
published?: boolean;
active?: boolean;
title?: IStringFilter;
description?: IStringFilter;
language?: string[];
lastModifiedBy?: number[];
}
......@@ -59,4 +59,4 @@ class DescriptorList extends UuidModel implements IUserPermissions {
}
}
export { Descriptor, DescriptorList }
export { Descriptor, DescriptorList };
export interface IBasicModelFilter {
id?: number[];
id?: number[];
}
export interface IVersionedModelFilter extends IBasicModelFilter {
version?: number[];
version?: number[];
}
export interface IDateFilter {
ge?: Date;
gt?: Date;
le?: Date;
lt?: Date;
ge?: Date;
gt?: Date;
le?: Date;
lt?: Date;
}
export interface INumberFilter {
eq?: number;
gt?: number;
ge?: number;
lt?: number;
le?: number;
eq?: number;
gt?: number;
ge?: number;
lt?: number;
le?: number;
}
export interface IStringFilter {
eq?: string; // equals
contains?: string; // like
sw?: string; // starts with
eq?: string; // equals
contains?: string; // like
sw?: string; // starts with
}
export interface IAuditedVersionedModelFilter extends IVersionedModelFilter {
createdBy?: number[];
lastModifiedBy?: number[];
createdDate?: IDateFilter;
lastModifiedDate?: IDateFilter;
createdBy?: number[];
lastModifiedBy?: number[];
createdDate?: IDateFilter;
lastModifiedDate?: IDateFilter;
}
export interface IPartnerFilter extends IAuditedVersionedModelFilter {
shortName?: string[];
name?: IStringFilter;
wiewsCodes?: string[];
shortName?: string[];
name?: IStringFilter;
wiewsCodes?: string[];
}
export interface IDescriptorFilter extends IAuditedVersionedModelFilter {
title?: IStringFilter;
published?: boolean;
bibliographicCitation?: IStringFilter;
columnName?: IStringFilter;
description?: IStringFilter;
integerOnly?: boolean;
uom?: IStringFilter;
title?: IStringFilter;
published?: boolean;
bibliographicCitation?: IStringFilter;
columnName?: IStringFilter;
description?: IStringFilter;
integerOnly?: boolean;
uom?: IStringFilter;
}
export interface IDescriptorListFilter extends IAuditedVersionedModelFilter {
published?: boolean;
title?: IStringFilter;
description?: IStringFilter;
crop?: string[];
bibliographicCitation?: IStringFilter;
published?: boolean;
title?: IStringFilter;
description?: IStringFilter;
crop?: string[];
bibliographicCitation?: IStringFilter;
}
import {UuidModel} from './common.model';
import { UuidModel } from './common.model';
class Location extends UuidModel {
public userCountry: string;
public mapCountry: string;
public stateProvince: string;
public verbatimLocality: string;
public decimalLatitude: number;
public decimalLongitude: number;
public userCountry: string;
public mapCountry: string;
public stateProvince: string;
public verbatimLocality: string;
public decimalLatitude: number;
public decimalLongitude: number;
public constructor(obj?) {
super(obj);
}
public constructor(obj?) {
super(obj);
}
public getClassname(): string {
return 'org.genesys.catalog.model.dataset.Location';
}
public getClassname(): string {
return 'org.genesys.catalog.model.dataset.Location';
}
}
export {Location}
export { Location };
import { UuidModel, CurrentPermissions, IUserPermissions } from './common.model';
class Partner extends UuidModel implements IUserPermissions {
public name: string;
public shortName: string;
public description: string;
public wiewsCodes: string[];
public urls: string[];
public _permissions: CurrentPermissions;
public name: string;
public shortName: string;
public description: string;
public wiewsCodes: string[];
public urls: string[];
public _permissions: CurrentPermissions;
public constructor(obj?) {
super(obj);
if (obj && obj._permissions) {
this._permissions = new CurrentPermissions(obj._permissions);
}
}
public constructor(obj?) {
super(obj);
if (obj && obj._permissions) {
this._permissions = new CurrentPermissions(obj._permissions);
}
}
public getClassname(): string {
return 'org.genesys.common.model.Partner';
}
public getClassname(): string {
return 'org.genesys.common.model.Partner';
}
}
export { Partner }
export { Partner };
import {UuidModel} from './common.model';
import { UuidModel } from './common.model';
class RepositoryFile extends UuidModel {
public path: string;
public originalFilename: string;
public contentType: string;
public size: number;
public format: string;
public path: string;
public originalFilename: string;
public contentType: string;
public size: number;
public format: string;
public constructor(obj?) {
super(obj);
}
public constructor(obj?) {
super(obj);
}
public getClassname(): string {
return 'org.genesys.filerepository.model.RepositoryFile';
}
public getClassname(): string {
return 'org.genesys.filerepository.model.RepositoryFile';
}
}
export {RepositoryFile};
export { RepositoryFile };
class ServerInfo {
public artifactId: string;
public version: string;
public revision: string;
public hostName: string;
class ServerInfo {
public artifactId: string;
public version: string;
public revision: string;
public hostName: string;
public constructor(obj?) {
if (obj !== null && obj !== undefined) {
Object.keys(obj).forEach((p) => this[p] = obj[p]);
}
}
public constructor(obj?) {
if (obj !== null && obj !== undefined) {
Object.keys(obj).forEach((p) => this[p] = obj[p]);
}
}
}
export { ServerInfo }
export { ServerInfo };
......@@ -32,9 +32,9 @@ class Vocabulary extends UuidModel implements IUserPermissions {
}
interface IVocabularyFilter extends IAuditedVersionedModelFilter {
published?: boolean;
published?: boolean;
title?: IStringFilter;
description?: IStringFilter;
}
export { Vocabulary, VocabularyTerm, IVocabularyFilter }
export { Vocabulary, VocabularyTerm, IVocabularyFilter };
import * as update from 'immutability-helper';
import { CREATE_DATASET, RECEIVE_DATASET, RECEIVE_DATASET_PAGE, ADD_CREATOR_TO_DATASET, REMOVE_CREATOR_FROM_DATASET, UPDATE_DATASET_CREATOR } from 'constants/datasets';
import { ADD_LOCATION, RECEIVE_LOCATION, REMOVE_LOCATION } from 'constants/datasets';
import { ADD_REPOSITORY_FILE, REMOVE_REPOSITORY_FILE } from 'constants/repositoryFile';
import { CREATE_DATASET, RECEIVE_DATASET, RECEIVE_DATASET_PAGE, ADD_CREATOR_TO_DATASET, REMOVE_CREATOR_FROM_DATASET, UPDATE_DATASET_CREATOR, ADD_LOCATION, RECEIVE_LOCATION, REMOVE_LOCATION } from 'constants/datasets';
import { Dataset } from 'model/dataset.model';
......
import * as update from 'immutability-helper';
import { DescriptorList, Descriptor } from 'model/descriptors.model';
import { DescriptorList } from 'model/descriptors.model';
import { Page } from 'model/common.model';
import {
GET_DESCRIPTORLIST, RECEIVE_DESCRIPTORLIST,
CREATE_DESCRIPTORLIST, EDIT_DESCRIPTORLIST,
SAVE_DESCRIPTORLIST, DELETE_DESCRIPTORLIST, PUBLISH_DESCRIPTORLIST,
LIST_DESCRIPTORLISTS, RECEIVE_DESCRIPTORLISTS,
} from 'constants/descriptors';
import { GET_DESCRIPTORLIST, RECEIVE_DESCRIPTORLIST, CREATE_DESCRIPTORLIST, LIST_DESCRIPTORLISTS, RECEIVE_DESCRIPTORLISTS } from 'constants/descriptors';
const INITIAL_STATE = {
const INITIAL_STATE: {
currentDescriptorList: DescriptorList;
paged: Page<DescriptorList>;
pagedQuery: any;
loading: boolean;
} = {
currentDescriptorList: null,
paged: null,
pagedQuery: null,
......
......@@ -11,10 +11,6 @@ const INITIAL_STATE = {
currentDescriptor: null,
};
function onlyUnique(value, index, self) {
return self.indexOf(value) === index;
}
function descriptors(state = INITIAL_STATE, action: IReducerAction = { type: '' }) {
switch (action.type) {
......
......@@ -67,4 +67,4 @@ export default function partner(state = INITIAL_STATE, action: IReducerAction =
default:
return state;
}
};
}
......@@ -3,9 +3,7 @@ import * as update from 'immutability-helper';
import { IReducerAction } from 'model/common.model';
import { Vocabulary } from 'model/vocabulary.model';
import {
CREATE_VOCABULARY, GET_VOCABULARY, RECEIVE_VOCABULARY, LIST_VOCABULARIES, RECEIVE_VOCABULARIES,
} from 'constants/vocabulary';
import { CREATE_VOCABULARY, RECEIVE_VOCABULARY, RECEIVE_VOCABULARIES } from 'constants/vocabulary';
const INITIAL_STATE = {
currentVocabulary: null,
......
import { DescriptorList, Descriptor } from 'model/descriptors.model';
import { DescriptorList } from 'model/descriptors.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 * as React from 'react';
import {withStyles} from 'material-ui/styles';
import Card, {CardHeader, CardMedia, CardContent, CardActions} from 'material-ui/Card';
import Card, {CardHeader, CardContent, CardActions} from 'material-ui/Card';
import Divider from 'material-ui/Divider';
import Typography from 'material-ui/Typography';
import Grid from 'material-ui/Grid';
import {Link} from 'react-router';
import Markdown from 'ui/common/markdown';
import Button from 'material-ui/Button';
......@@ -285,7 +284,7 @@ class DescriptorCard extends React.Component<IDescriptorCardProps, any> {
) }
</Card>
);
};
}
}
......
......@@ -10,7 +10,6 @@ import DescriptorSearchMenu from 'ui/catalog/descriptor/DescriptorSearchMenu';
import {Page} from 'model/common.model';
import DescriptorCard from 'ui/catalog/descriptor/DescriptorCard';
import PaginationComponent from 'ui/common/pagination';
import {Dataset} from 'model/dataset.model';
interface IDescriptorPickerProps extends React.ClassAttributes<any> {
classes: any;
......@@ -74,7 +73,7 @@ class DescriptorPicker extends React.Component<IDescriptorPickerProps, any> {
const {loadDescriptors} = this.props;
this.setState({sortBy});
this.props.loadDescriptors(page, results, sortBy);
loadDescriptors(page, results, sortBy);
}
private onDescriptorSelected = (select) => (descriptor: Descriptor) => {
......
import * as React from 'react';
import {withStyles} from 'material-ui/styles';
import Grid from 'material-ui/Grid';
import {bindActionCreators} from 'redux';
import {connect} from 'react-redux';
......@@ -42,13 +41,12 @@ class DescriptorSearchMenu extends React.Component<IDescriptorSearchMenuProps, a
}
public render() {
const {classes} = this.props;
return (
<ExpandFiltersComponent title="Search">
<DescriptorFilterForm onSubmit={ this.handleFilterFormSubmit }/>
</ExpandFiltersComponent>
);
};
}
}
const mapStateToProps = (state, ownProps) => ({
......
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