From d260e3a65bdec981fd98db8a2352caa9bef9ae55 Mon Sep 17 00:00:00 2001 From: Jules Laplace Date: Sat, 26 Sep 2020 15:30:15 +0200 Subject: finalizing fixing refactor!! --- frontend/app/api/index.js | 3 -- frontend/app/app.js | 44 -------------------------- frontend/app/router.js | 44 ++++++++++++++++++++++++++ frontend/app/views/page/components/tile.new.js | 2 +- frontend/index.js | 2 +- 5 files changed, 46 insertions(+), 49 deletions(-) delete mode 100644 frontend/app/app.js create mode 100644 frontend/app/router.js (limited to 'frontend') diff --git a/frontend/app/api/index.js b/frontend/app/api/index.js index c3d0aa4..41cf624 100644 --- a/frontend/app/api/index.js +++ b/frontend/app/api/index.js @@ -1,5 +1,4 @@ import { crud_actions } from 'app/api/crud.actions' -import * as util from 'app/api/utils' /* for our crud events, create corresponding actions @@ -14,8 +13,6 @@ so you can do ... folderActions.upload(12, form_data) */ -export { util } - export const actions = [ 'graph', 'page', diff --git a/frontend/app/app.js b/frontend/app/app.js deleted file mode 100644 index 8dbbd0f..0000000 --- a/frontend/app/app.js +++ /dev/null @@ -1,44 +0,0 @@ -import React, { Component } from 'react' -import { ConnectedRouter } from 'connected-react-router' -import { Route } from 'react-router' - -// import actions from 'app/actions' - -import * as views from 'app/views' - -const viewList = Object.keys(views).map(name => { - const view = views[name] - let path, exact = false - if (name === 'graph') { - path = '/:graph_name' - exact = true - } else if (name === 'page') { - path = '/:graph_name/:page_name' - exact = true - } else { - path = '/' + name - } - return ( - - ) -}) - -export default class App extends Component { - componentDidMount() { - // actions.modelzoo.index() - } - render() { - return ( - -
- {viewList} - { - // redirect to index!! - setTimeout(() => this.props.history.push('/index'), 10) - return null - }} /> -
-
- ) - } -} diff --git a/frontend/app/router.js b/frontend/app/router.js new file mode 100644 index 0000000..8dbbd0f --- /dev/null +++ b/frontend/app/router.js @@ -0,0 +1,44 @@ +import React, { Component } from 'react' +import { ConnectedRouter } from 'connected-react-router' +import { Route } from 'react-router' + +// import actions from 'app/actions' + +import * as views from 'app/views' + +const viewList = Object.keys(views).map(name => { + const view = views[name] + let path, exact = false + if (name === 'graph') { + path = '/:graph_name' + exact = true + } else if (name === 'page') { + path = '/:graph_name/:page_name' + exact = true + } else { + path = '/' + name + } + return ( + + ) +}) + +export default class App extends Component { + componentDidMount() { + // actions.modelzoo.index() + } + render() { + return ( + +
+ {viewList} + { + // redirect to index!! + setTimeout(() => this.props.history.push('/index'), 10) + return null + }} /> +
+
+ ) + } +} diff --git a/frontend/app/views/page/components/tile.new.js b/frontend/app/views/page/components/tile.new.js index fb609a5..b491fdd 100644 --- a/frontend/app/views/page/components/tile.new.js +++ b/frontend/app/views/page/components/tile.new.js @@ -35,7 +35,7 @@ class TileNew extends Component { graph={this.props.graph.show.res} page={this.props.page.show.res} initialData={null} - sortOrder={this.props.page.show.res.tiles.length} + sortOrder={this.props.page.show.res.tiles ? this.props.page.show.res.tiles.length : []} onSubmit={this.handleSubmit.bind(this)} /> ) diff --git a/frontend/index.js b/frontend/index.js index 393282c..8daf531 100644 --- a/frontend/index.js +++ b/frontend/index.js @@ -4,7 +4,7 @@ import { Provider } from 'react-redux' import Router from 'app/router' -import { store, history } from '/store' +import { store, history } from 'app/store' const container = document.createElement('div') container.classList.add('container') -- cgit v1.2.3-70-g09d2