Commit 57bb752c authored by Matija Obreza's avatar Matija Obreza
Browse files

Cleanup

parent ef9b1fd0
import * as update from 'immutability-helper';
import { IReducerAction } from 'model/common.model';
import { Partner } from 'model/partner.model';
import {log} from 'utilities/debug';
import {
CREATE_PARTNER, GET_PARTNER, RECEIVE_PARTNER, LIST_PARTNERS, RECEIVE_PARTNERS,
......@@ -48,7 +47,7 @@ export default function partner(state = INITIAL_STATE, action: IReducerAction =
// set myPartners
case RECEIVE_MY_PARTNERLIST: {
log('My partners', action.payload);
// log('My partners', action.payload);
return update(state, {
myPartners: { $set: action.payload },
});
......@@ -56,7 +55,7 @@ export default function partner(state = INITIAL_STATE, action: IReducerAction =
// set the paged to whatever came in
case RECEIVE_PARTNERS: {
log('Marking loaded pagedQuery', action.payload);
// log('Marking loaded pagedQuery', action.payload);
return update(state, {
loading: { $set: null },
paged: { $set: action.payload.paged },
......
import * as React from 'react';
import {connect} from 'react-redux';
import {bindActionCreators} from 'redux';
import {log} from 'utilities/debug';
import {logoutRequest, loginAppRequest} from 'actions/login';
import {setAppMounted} from 'actions/appMounted';
......@@ -52,7 +51,6 @@ class App extends React.Component<IAppProps, any> {
public render() {
const { login, logoutRequest, loginAppRequest, route: { routes } } = this.props;
log('Rendering App view');
return (
<div>
<Header login={ login } logoutRequest={ logoutRequest } loginAppRequest={ loginAppRequest } />
......
......@@ -31,7 +31,7 @@ export default class PagedLoader<T> extends React.Component<IProps<T>, any> {
}
public componentWillReceiveProps(nextProps) {
log('nextProps', nextProps);
// log('nextProps', nextProps);
const { paged: { number: pageNumber, content: newContent } } = nextProps;
if (newContent) {
......@@ -81,12 +81,12 @@ export default class PagedLoader<T> extends React.Component<IProps<T>, any> {
if (! list || list.length === 0) {
return null;
}
log(`Rendering ${list.length} items`);
// log(`Rendering ${list.length} items`);
const inTable = colSpan ? true : false;
const visibilityOffset = (roughItemHeight && roughItemHeight || 50) * 10;
const myLoadingIndicator = loadingIndicator || <Loading />;
log(`Visibility offset bottom: ${-visibilityOffset}`);
// log(`Visibility offset bottom: ${-visibilityOffset}`);
const result = [
...list.map((item: T, index) => itemRenderer(item, index)),
......@@ -102,7 +102,7 @@ export default class PagedLoader<T> extends React.Component<IProps<T>, any> {
</div>
),
];
log('Done rendering');
// log('Done rendering');
return result;
}
}
......@@ -34,9 +34,10 @@ const FiltersBlock = ({ title, children, handleSubmit, onSubmit, initialize, cla
const processSubmit = handleSubmit((data) => {
showSnackbar('Applying filters...');
console.log('Submitting', data);
const clean = cleanFilters(data);
log('Submitting filters', clean);
scrollToTop();
return onSubmit(cleanFilters(data));
return onSubmit(clean);
});
return (
......
......@@ -14,7 +14,7 @@ interface IProps {
}
const styles = (theme) => {
console.log(theme);
// console.log(theme);
return ({
helper: {
paddingTop: '0.5rem',
......
......@@ -18,14 +18,14 @@ class MarkdownField extends React.Component<any, any> {
}
public render() {
const {basicMarkdown, input, label, required, meta, meta: {touched, error}, ...custom} = this.props;
const {basicMarkdown, input, label, required, meta, meta: {touched, error}} = this.props;
const basic: boolean = basicMarkdown === undefined || null ? false : basicMarkdown;
return (
<div>
{ (basic || !this.state.previewMode) ?
<FormControl fullWidth required={ required } meta={ meta } label={ label }>
<Input error={ touched && error } multiline={ !basic } { ...input } { ...custom } />
<Input error={ touched && error } multiline={ !basic } { ...input } />
<h6>
{ ! basic && <a onClick={ this.onChangePreviewMode }>Preview Markdown</a> }
<span> { basic ? 'Basic markdown supported: * **' : 'Full markdown supported' }</span>
......
......@@ -22,13 +22,13 @@ class Snackbar extends React.Component<ISnacks, any> {
public componentWillMount() {
const { snack } = this.props;
console.log('Snack willMount', snack);
// console.log('Snack willMount', snack);
this.pushSnack(snack);
}
public componentWillReceiveProps(nextProps) {
const { snack } = nextProps;
console.log('Snack willReceive', snack);
// console.log('Snack willReceive', snack);
this.pushSnack(snack);
}
......
......@@ -367,7 +367,7 @@ const routes = [
auth: [ROLE_USER, ROLE_ADMINISTRATOR],
routes: [
{
path: '/data-published/:tab',
path: '/data-published/:tab?',
component: MyDataPage,
exact: true,
extraProps: {
......@@ -377,27 +377,7 @@ const routes = [
},
},
{
path: '/data-published',
component: MyDataPage,
exact: true,
extraProps: {
title: 'Published data',
basePath: '/dashboard/data-published',
filter: { published: true },
},
},
{
path: '/data-in-preparation/:tab',
component: MyDataPage,
exact: true,
extraProps: {
title: 'Data in preparation',
basePath: '/dashboard/data-in-preparation',
filter: { published: false },
},
},
{
path: '/data-in-preparation',
path: '/data-in-preparation/:tab?',
component: MyDataPage,
exact: true,
extraProps: {
......@@ -407,15 +387,7 @@ const routes = [
},
},
{
path: '/:tab',
component: DashboardPage,
exact: true,
extraProps: {
title: 'My Dashboard',
},
},
{
path: '/',
path: '/:tab?',
component: DashboardPage,
exact: true,
extraProps: {
......
......@@ -78,8 +78,11 @@ export function cleanFilters(filter, keysToSkip?): string {
}
const val = filter[k];
if (_.isObject(val)) {
if (_.isArray(val) && val.length > 0) {
result[k] = val.sort();
if (_.isArray(val)) {
const notUndefined = val.filter((x) => x !== undefined).sort();
if (notUndefined && notUndefined.length > 0) {
result[k] = notUndefined;
}
} else {
const sub = cleanFilters(val, keysToSkip);
if (Object.keys(sub).length) {
......
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