Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Create project and feed refactor #41

Merged
merged 33 commits into from
Dec 18, 2018
Merged
Show file tree
Hide file tree
Changes from 8 commits
Commits
Show all changes
33 commits
Select commit Hold shift + click to select a range
fedccee
refactor(project): WIP on making create project page
evansiroky Oct 10, 2017
2df4c97
refactor(project): add new create project page
evansiroky Oct 10, 2017
d0fd4f0
refactor(feed): add new create page for feedSource
evansiroky Oct 11, 2017
c45f70d
refactor(project): add form validation to create project
evansiroky Oct 11, 2017
d416930
test(map): fix failing test
evansiroky Oct 11, 2017
5b54069
test(flow): use mastarm flow
evansiroky Oct 11, 2017
8770e45
Merge branch 'dev' into create-project-and-feed
evansiroky Oct 16, 2017
b16fa76
refactor(i18n): rename a message key for ProjectSettings
evansiroky Oct 16, 2017
0564c8f
refactor(project): next CreateFeedSource in ProjectViewer
evansiroky Oct 17, 2017
5798de8
Merge branch 'dev' into create-project-and-feed
evansiroky Oct 10, 2018
a755e45
refactor(flow): refactor app so there are no flow errors
evansiroky Oct 11, 2018
aa8311f
refactor(feed): make create feed work without errors
evansiroky Oct 19, 2018
c8225d1
test(end-to-end): update end-to-end tests to use updated create proje…
evansiroky Oct 19, 2018
83f3723
Merge branch 'dev' into create-project-and-feed
evansiroky Oct 19, 2018
428e2a1
test(etc): fix failing tests after merge
evansiroky Oct 19, 2018
db909ce
test(e2e): fix e2e tests after mastarm update
evansiroky Oct 20, 2018
49178ed
refactor(deployment): fix deployment messages
evansiroky Oct 20, 2018
4da358e
feat(feed): add cancel buttons to create project/feed forms
evansiroky Nov 8, 2018
d83e26c
refactor(project): fix project update
evansiroky Nov 8, 2018
f4fa51e
refactor(project): remove default language field
evansiroky Nov 13, 2018
74a2e11
refactor(project): refetch project feeds after update so they aren't …
evansiroky Nov 13, 2018
4c26e12
refactor(create-feed-project): tweaks to create feed and project forms
landonreed Nov 15, 2018
37e900c
build(yarn): remove valid-url package
landonreed Nov 15, 2018
a4cbef4
fix(css): use leaflet cdn css (due to marker icon url issue)
landonreed Nov 15, 2018
f78bff0
refactor(loading): add style prop to loading component
landonreed Nov 15, 2018
dcde748
test(flow): fix flow type for Loading component props
landonreed Nov 15, 2018
e755adc
refactor(add autoFocus):
landonreed Nov 16, 2018
b35b4fa
refactor(create-project-feed): address PR comments
landonreed Nov 28, 2018
229262e
Merge pull request #255 from catalogueglobal/create-project-and-feed-ltr
Dec 3, 2018
dbec4dd
Merge branch 'container-refactor' into create-project-and-feed
evansiroky Dec 14, 2018
ee339a2
refactor(various): fix a bunch of stuff that went wrong with a merge
evansiroky Dec 15, 2018
80855c8
refactor(test): fix e2e tests and update to puppeteer v1.11
evansiroky Dec 17, 2018
bec5597
Merge branch 'dev' into create-project-and-feed
landonreed Dec 18, 2018
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion i18n/english.yml
Original file line number Diff line number Diff line change
Expand Up @@ -230,7 +230,7 @@ components:
title: Real-time updaters
walkSpeed: Walk Speed
title: Deployment
general:
fields:
location:
boundingBox: 'Bounding box (W,S,E,N)'
defaultLanguage: Default language
Expand Down
2 changes: 1 addition & 1 deletion i18n/espanol.yml
Original file line number Diff line number Diff line change
Expand Up @@ -223,7 +223,7 @@ components:
title: Real-time updaters
walkSpeed: Walk Speed
title: Deployment
general:
fields:
location:
boundingBox: 'Bounding box (W,S,E,N)'
defaultLanguage: Default language
Expand Down
2 changes: 1 addition & 1 deletion i18n/francais.yml
Original file line number Diff line number Diff line change
Expand Up @@ -223,7 +223,7 @@ components:
title: Real-time updaters
walkSpeed: Walk Speed
title: Deployment
general:
fields:
location:
boundingBox: 'Bounding box (W,S,E,N)'
defaultLanguage: Default language
Expand Down
31 changes: 19 additions & 12 deletions lib/common/containers/App.js
Original file line number Diff line number Diff line change
@@ -1,26 +1,27 @@
import React, { Component, PropTypes } from 'react'
import { Router, Route, browserHistory } from 'react-router'

import ActiveUserAdmin from '../../admin/containers/ActiveUserAdmin'
import MainAlertsViewer from '../../alerts/containers/MainAlertsViewer'
import ActiveAlertEditor from '../../alerts/containers/ActiveAlertEditor'
import PageNotFound from '../components/PageNotFound'
import ActiveGtfsEditor from '../../editor/containers/ActiveGtfsEditor'
import { checkExistingLogin, login } from '../../manager/actions/user'
import { isModuleEnabled } from '../util/config'

import ActiveDeploymentViewer from '../../manager/containers/ActiveDeploymentViewer'
import ActiveFeedSourceViewer from '../../manager/containers/ActiveFeedSourceViewer'
import ActiveProjectViewer from '../../manager/containers/ActiveProjectViewer'
import ActiveProjectsList from '../../manager/containers/ActiveProjectsList'
import ActiveProjectViewer from '../../manager/containers/ActiveProjectViewer'
import ActiveUserHomePage from '../../manager/containers/ActiveUserHomePage'
import CreateProject from '../../manager/containers/CreateProject'
import CreateFeedSource from '../../manager/containers/CreateFeedSource'
import ActivePublicFeedSourceViewer from '../../public/containers/ActivePublicFeedSourceViewer'
import ActiveDeploymentViewer from '../../manager/containers/ActiveDeploymentViewer'
import ActivePublicFeedsViewer from '../../public/containers/ActivePublicFeedsViewer'
import ActiveSignupPage from '../../public/containers/ActiveSignupPage'
import ActiveUserHomePage from '../../manager/containers/ActiveUserHomePage'
import ActiveUserAccount from '../../public/containers/ActiveUserAccount'
import ActiveUserAdmin from '../../admin/containers/ActiveUserAdmin'
import MainAlertsViewer from '../../alerts/containers/MainAlertsViewer'
import ActiveAlertEditor from '../../alerts/containers/ActiveAlertEditor'
import MainSignsViewer from '../../signs/containers/MainSignsViewer'
import ActiveSignEditor from '../../signs/containers/ActiveSignEditor'
import PageNotFound from '../components/PageNotFound'
import ActiveGtfsPlusEditor from '../../gtfsplus/containers/ActiveGtfsPlusEditor'
import ActiveGtfsEditor from '../../editor/containers/ActiveGtfsEditor'
import ActiveSignEditor from '../../signs/containers/ActiveSignEditor'
import MainSignsViewer from '../../signs/containers/MainSignsViewer'
import {isModuleEnabled} from '../util/config'

export default class App extends Component {
static propTypes = {
Expand Down Expand Up @@ -85,6 +86,12 @@ export default class App extends Component {
{path: '/', component: ActivePublicFeedsViewer, onEnter: this.checkLogin},
{path: '/public/feed/:feedSourceId(/version/:feedVersionIndex)', component: ActivePublicFeedSourceViewer, onEnter: this.checkLogin},
{path: '/project', component: ActiveProjectsList, onEnter: this.requireAuth},
{path: '/project/new', component: CreateProject, onEnter: this.requireAuth},
{
path: '/project/:projectId/newFeedSource',
component: CreateFeedSource,
onEnter: this.requireAuth
},
{path: '/project/:projectId(/:subpage)(/:subsubpage)', component: ActiveProjectViewer, onEnter: this.requireAuth},
{
path: '/feed/:feedSourceId/edit(/:activeComponent)(/:activeEntityId)(/:subComponent)(/:subEntityId)(/:subSubComponent)(/:activeSubSubEntity)',
Expand Down
7 changes: 6 additions & 1 deletion lib/common/util/config.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ export function isExtensionEnabled (extensionName: string): boolean {
)
}

export function initializeConfig () {
function initializeConfig () {
if (!process.env.SETTINGS) {
throw new Error('SETTINGS environment variable not set')
}
Expand Down Expand Up @@ -70,3 +70,8 @@ export function initializeConfig () {
// console.log('config', config)
window.DT_CONFIG = config
}

if (process.env.NODE_ENV !== 'test') {
// skip this, cause there's an error in jest
initializeConfig()
}
3 changes: 0 additions & 3 deletions lib/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ import 'babel-polyfill'
import mount from '@conveyal/woonerf/mount'

import App from './common/containers/App'
import {initializeConfig} from './common/util/config'
import * as managerReducers from './manager/reducers'
import admin from './admin/reducers'
import alerts from './alerts/reducers'
Expand All @@ -12,8 +11,6 @@ import * as gtfsPlusReducers from './gtfsplus/reducers'
import editor from './editor/reducers'
import gtfs from './gtfs/reducers'

initializeConfig()

mount({
app: App,
reducers: {
Expand Down
20 changes: 9 additions & 11 deletions lib/manager/actions/feeds.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import { browserHistory } from 'react-router'

import { secureFetch } from '../../common/actions'
import { fetchProject, fetchProjectWithFeeds } from './projects'
import { setErrorMessage, startJobMonitor } from './status'
Expand Down Expand Up @@ -50,26 +52,22 @@ function receivePublicFeeds (feeds) {
}
}

export function createFeedSource (projectId) {
return {
type: 'CREATE_FEEDSOURCE',
projectId
}
}

export function savingFeedSource () {
return {
type: 'SAVING_FEEDSOURCE'
}
}

export function saveFeedSource (props) {
export function createFeedSource (feed) {
return function (dispatch, getState) {
dispatch(savingFeedSource())
const url = '/api/manager/secure/feedsource'
return dispatch(secureFetch(url, 'post', props))
.then((res) => {
return dispatch(fetchProjectWithFeeds(props.projectId))
return dispatch(secureFetch(url, 'post', feed))
.then((res) => res.json())
.then((createdFeed) => {
return dispatch(fetchProjectWithFeeds(feed.projectId)).then(() => {
browserHistory.push(`/feed/${createdFeed.id}`)
})
})
}
}
Expand Down
24 changes: 13 additions & 11 deletions lib/manager/actions/projects.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import { browserHistory } from 'react-router'

import { secureFetch } from '../../common/actions'
import { getConfigProperty } from '../../common/util/config'
import { fetchProjectFeeds } from './feeds'
Expand Down Expand Up @@ -177,13 +179,6 @@ export function deployPublic (project) {
}
}

export function createProject (project) {
return {
type: 'CREATE_PROJECT',
project
}
}

export function requestingSync () {
return {
type: 'REQUESTING_SYNC'
Expand Down Expand Up @@ -255,13 +250,20 @@ function savingProject (props) {
}
}

export function saveProject (props) {
export function createProject (project) {
return function (dispatch, getState) {
dispatch(savingProject(props))
dispatch(savingProject(project))
const url = '/api/manager/secure/project'
return dispatch(secureFetch(url, 'post', props))
let newProjectId
return dispatch(secureFetch(url, 'post', project))
.then((res) => res.json())
.then((json) => dispatch(fetchProjects()))
.then((json) => {
newProjectId = json.id
return dispatch(fetchProjects())
})
.then(() => {
browserHistory.push(`/project/${newProjectId}`)
})
}
}

Expand Down
Loading