From 740457804a5acd7654a50fe75dc0afca5f9253ea Mon Sep 17 00:00:00 2001 From: Landon Reed Date: Tue, 27 Nov 2018 13:27:52 -0500 Subject: [PATCH 001/324] fix(deployments): only fetch feed source deployments if module enabled --- lib/manager/actions/feeds.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lib/manager/actions/feeds.js b/lib/manager/actions/feeds.js index bfded3016..45783839f 100644 --- a/lib/manager/actions/feeds.js +++ b/lib/manager/actions/feeds.js @@ -3,6 +3,7 @@ import {createAction, type ActionType} from 'redux-actions' import {createVoidPayloadAction, secureFetch} from '../../common/actions' +import {isModuleEnabled} from '../../common/util/config' import {fetchFeedSourceDeployments} from './deployments' import {fetchSnapshots} from '../../editor/actions/snapshots' import {fetchProject, fetchProjectWithFeeds} from './projects' @@ -160,7 +161,7 @@ function fetchRelatedTables (feedSource: Feed) { return function (dispatch: dispatchFn, getState: getStateFn) { dispatch(fetchFeedVersions(feedSource)) dispatch(fetchSnapshots(feedSource)) - dispatch(fetchFeedSourceDeployments(feedSource)) + if (isModuleEnabled('deployment')) dispatch(fetchFeedSourceDeployments(feedSource)) } } From 2460b2e01ece2dfc3096e8864d3d089da305b2b9 Mon Sep 17 00:00:00 2001 From: Landon Reed Date: Tue, 27 Nov 2018 15:56:59 -0500 Subject: [PATCH 002/324] fix(alerts): handle bad response for GTFS stops and routes --- lib/alerts/reducers/alerts.js | 6 +++--- lib/gtfs/actions/general.js | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/lib/alerts/reducers/alerts.js b/lib/alerts/reducers/alerts.js index 27d2e0c9d..4b4bde303 100644 --- a/lib/alerts/reducers/alerts.js +++ b/lib/alerts/reducers/alerts.js @@ -52,12 +52,12 @@ const alerts = ( } const entities = state.entities const alerts = clone(state.all) - const {feedId} = action.payload - const {feed} = action.payload.results - if (!feed) { + const {feedId, results} = action.payload + if (!results || !results.feed) { console.warn(`Error fetching entity results for feed ${feedId}.`) return state } + const {feed} = results // for those entities we requested, assign the gtfs data to the saved entities for (var i = 0; i < entities.length; i++) { const entity = entities[i] diff --git a/lib/gtfs/actions/general.js b/lib/gtfs/actions/general.js index e63c33599..f7b342965 100644 --- a/lib/gtfs/actions/general.js +++ b/lib/gtfs/actions/general.js @@ -85,7 +85,7 @@ export function fetchStopsAndRoutes (entities: Array, moduleType: string) { query: stopsAndRoutes(namespace, routeId, stopId), variables: {namespace, routeId, stopId} })) - .then(data => dispatch(receivedStopsAndRoutes({feedId, results: data, moduleType}))) + .then(results => dispatch(receivedStopsAndRoutes({feedId, results, moduleType}))) }) return Promise.all(entityRequests) } From a55f78d0aa91f5e0577734ce68901f2f482d94db Mon Sep 17 00:00:00 2001 From: Landon Reed Date: Tue, 27 Nov 2018 15:57:12 -0500 Subject: [PATCH 003/324] fix(alerts): fix visibility filter action --- lib/alerts/actions/visibilityFilter.js | 5 ++++- lib/alerts/components/AlertsList.js | 2 +- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/lib/alerts/actions/visibilityFilter.js b/lib/alerts/actions/visibilityFilter.js index 7d7caaf68..1a59856d0 100644 --- a/lib/alerts/actions/visibilityFilter.js +++ b/lib/alerts/actions/visibilityFilter.js @@ -15,7 +15,10 @@ export const setAlertSort = createAction( type: string }) => payload ) -export const setVisibilityFilter = createVoidPayloadAction('SET_ALERT_VISIBILITY_FILTER') +export const setVisibilityFilter = createAction( + 'SET_ALERT_VISIBILITY_FILTER', + (payload: string) => payload +) export const setVisibilitySearchText = createAction( 'SET_ALERT_VISIBILITY_SEARCH_TEXT', (payload: string) => payload diff --git a/lib/alerts/components/AlertsList.js b/lib/alerts/components/AlertsList.js index 20a809927..af2094580 100644 --- a/lib/alerts/components/AlertsList.js +++ b/lib/alerts/components/AlertsList.js @@ -36,7 +36,7 @@ type Props = { searchTextChanged: string => void, sortChanged: ({direction: string, type: string}) => void, visibilityFilter: AlertFilter, - visibilityFilterChanged: any => void + visibilityFilterChanged: string => void } export default class AlertsList extends Component { From 41631e02a8bed4fd1dbe433a8d0bf3dbe2592015 Mon Sep 17 00:00:00 2001 From: Landon Reed Date: Tue, 27 Nov 2018 16:51:50 -0500 Subject: [PATCH 004/324] fix(gtfs-filter): fix check for toggling a feed on/off --- lib/gtfs/components/GtfsFilter.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/gtfs/components/GtfsFilter.js b/lib/gtfs/components/GtfsFilter.js index da62c48c7..0fbf745a5 100644 --- a/lib/gtfs/components/GtfsFilter.js +++ b/lib/gtfs/components/GtfsFilter.js @@ -33,7 +33,7 @@ export default class GtfsFilter extends Component { _onSelect = (feedId: string) => { const {activeFeeds, onAddFeed, onRemoveFeed} = this.props - if (activeFeeds.some(f => f.id === feedId)) onAddFeed(feedId) + if (!activeFeeds.find(f => f.id === feedId)) onAddFeed(feedId) else onRemoveFeed(feedId) } From d109dd7a27121f158d78f370feba675172203888 Mon Sep 17 00:00:00 2001 From: Landon Reed Date: Mon, 3 Dec 2018 16:42:17 -0500 Subject: [PATCH 005/324] fix(job-monitor): only start continuous job fetch if jobs exist --- lib/manager/actions/status.js | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/lib/manager/actions/status.js b/lib/manager/actions/status.js index 29868b865..85b1e5143 100644 --- a/lib/manager/actions/status.js +++ b/lib/manager/actions/status.js @@ -86,6 +86,7 @@ export function checkJobStatus () { // array if finished jobs have been handled, but that is the expected // behavior because these finished jobs will appear in a "retired" state. dispatch(receiveJobs(remainingJobs)) + return jobs }) } } @@ -210,11 +211,15 @@ export function startJobMonitor (showMonitor: boolean = true) { const timerFunction = () => dispatch(checkJobStatus()) // make an initial call right now timerFunction() - const timer = setInterval(timerFunction, 2000) - if (showMonitor) { - dispatch(setJobMonitorVisible(true)) - } - dispatch(setJobMonitorTimer(timer)) + .then(jobs => { + if (jobs.length > 0) { + // Set up a check for every two seconds if jobs are running. + const timer = setInterval(timerFunction, 2000) + dispatch(setJobMonitorTimer(timer)) + if (showMonitor) dispatch(setJobMonitorVisible(true)) + } + }) + .catch(err => console.warn('Error fetchings jobs', err)) } } From f391fd57aefeb0d0ba8f38436525fd66080a366b Mon Sep 17 00:00:00 2001 From: Landon Reed Date: Mon, 10 Dec 2018 16:50:30 -0500 Subject: [PATCH 006/324] style(lint): fix lint (unused import) --- lib/alerts/actions/visibilityFilter.js | 2 -- 1 file changed, 2 deletions(-) diff --git a/lib/alerts/actions/visibilityFilter.js b/lib/alerts/actions/visibilityFilter.js index 1a59856d0..2c2f8adb0 100644 --- a/lib/alerts/actions/visibilityFilter.js +++ b/lib/alerts/actions/visibilityFilter.js @@ -2,8 +2,6 @@ import {createAction, type ActionType} from 'redux-actions' -import {createVoidPayloadAction} from '../../common/actions' - export const setAlertAgencyFilter = createAction( 'SET_ALERT_AGENCY_FILTER', (payload: string) => payload From ece75a792952f0b1d74b093366487f54563ce4e0 Mon Sep 17 00:00:00 2001 From: Landon Reed Date: Tue, 11 Dec 2018 14:43:14 -0500 Subject: [PATCH 007/324] refactor(alerts): prefer stop_code when rendering affected stop entity --- lib/alerts/components/AffectedEntity.js | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) diff --git a/lib/alerts/components/AffectedEntity.js b/lib/alerts/components/AffectedEntity.js index 603571906..56780289b 100644 --- a/lib/alerts/components/AffectedEntity.js +++ b/lib/alerts/components/AffectedEntity.js @@ -30,20 +30,22 @@ export default class AffectedEntity extends Component { active: false } - _onRowClick = () => this.setState({active: !this.state.active}) + _onRowClick = () => this.setState({ active: !this.state.active }) _onClickDeleteEntity = () => this.props.onDeleteEntityClick(this.props.entity) getEntitySummary (entity: AlertEntity) { - const {feeds} = this.props + const { feeds } = this.props + const { stop } = entity const type = entity.type || 'AGENCY' const val = entity[type.toLowerCase()] let agencyName = '' + let stopName = entity.stop_id if (entity.agency) { agencyName = entity.agency.name - } else if (entity.stop) { + } else if (stop) { // FIXME feed_id? - const feed = getFeed(feeds, entity.stop.feed_id) + const feed = getFeed(feeds, stop.feed_id) agencyName = feed ? feed.name : 'Unknown agency' @@ -51,9 +53,10 @@ export default class AffectedEntity extends Component { const routeName = entity.route ? getRouteNameAlerts(entity.route) : entity.route_id - const stopName = entity.stop - ? `${entity.stop.stop_name} (${entity.stop.stop_id}) ${agencyName}` - : entity.stop_id + if (stop) { + const stopCode = stop.stop_code ? stop.stop_code : stop.stop_id + stopName = `${stop.stop_name} (${stopCode}) ${agencyName}` + } let summary = '' switch (type) { case 'AGENCY' : @@ -61,7 +64,7 @@ export default class AffectedEntity extends Component { {' '} {agencyName}
- + Note: this selection will apply to all stops and routes for {agencyName}. From ee51dea2df820c8421aaeaefdd734b2ecd922035 Mon Sep 17 00:00:00 2001 From: Landon Reed Date: Tue, 11 Dec 2018 15:42:11 -0500 Subject: [PATCH 008/324] fix(alerts): fix alert start/end time validation --- lib/alerts/components/AlertEditor.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/alerts/components/AlertEditor.js b/lib/alerts/components/AlertEditor.js index 453b9626e..b7159cee1 100644 --- a/lib/alerts/components/AlertEditor.js +++ b/lib/alerts/components/AlertEditor.js @@ -77,7 +77,7 @@ export default class AlertEditor extends Component { if (description && description.length > ALERT_DESCRIPTION_CHAR_LIMIT) { return window.alert(`Alert description must be ${ALERT_DESCRIPTION_CHAR_LIMIT} characters or less`) } - if (!momentEnd.isValid() || !momentStart.isValid()) { + if (!end || !start || !momentEnd.isValid() || !momentStart.isValid()) { return window.alert('Alert must have a valid start and end date') } if (end < start) { From 93f040ec153e42e4bb7bfb5007d622b7d9c8233c Mon Sep 17 00:00:00 2001 From: Landon Reed Date: Wed, 12 Dec 2018 17:09:53 -0500 Subject: [PATCH 009/324] refactor(project-access-settings): rename user project settings component and fix messages --- i18n/english.yml | 16 ++++++++-------- i18n/espanol.yml | 8 ++++++++ i18n/francais.yml | 8 ++++++++ ...ojectSettings.js => ProjectAccessSettings.js} | 14 +++++++------- lib/admin/components/UserSettings.js | 4 ++-- 5 files changed, 33 insertions(+), 17 deletions(-) rename lib/admin/components/{ProjectSettings.js => ProjectAccessSettings.js} (90%) diff --git a/i18n/english.yml b/i18n/english.yml index 3d1bed83c..0b5d4a7a8 100644 --- a/i18n/english.yml +++ b/i18n/english.yml @@ -352,6 +352,14 @@ components: high: High low: Low medium: Medium + ProjectAccessSettings: + admin: Admin + cannotFetchFeeds: Cannot fetch feeds + custom: Custom + feeds: Feed Sources + noAccess: No Access + permissions: Permissions + title: Project Settings for ProjectSettings: confirmDelete: Are you sure you want to delete this project? This action cannot be undone and all feed sources and their versions will be permanently deleted. deleteProject: Delete Project? @@ -603,14 +611,6 @@ components: admin: Organization administrator billing: Billing admin description: Organization administrators have full access to projects within the organization. - project: - admin: Admin - cannotFetchFeeds: Cannot fetch feeds - custom: Custom - feeds: Feed Sources - noAccess: No Access - permissions: Permissions - title: Project Settings for save: Save VersionButtonToolbar: confirmDelete: Are you sure you want to delete this version? This cannot be undone. diff --git a/i18n/espanol.yml b/i18n/espanol.yml index 084fd0570..f541a212c 100644 --- a/i18n/espanol.yml +++ b/i18n/espanol.yml @@ -348,6 +348,14 @@ components: high: High low: Low medium: Medium + ProjectAccessSettings: + admin: Admin + cannotFetchFeeds: Cannot fetch feeds + custom: Custom + feeds: Feed Sources + noAccess: No Access + permissions: Permissions + title: Project Settings for ProjectSettings: confirmDelete: Are you sure you want to delete this project? This action cannot be undone and all feed sources and their versions will be permanently deleted. deleteProject: Delete Project? diff --git a/i18n/francais.yml b/i18n/francais.yml index 35f5f005f..bb461f423 100644 --- a/i18n/francais.yml +++ b/i18n/francais.yml @@ -347,6 +347,14 @@ components: high: High low: Low medium: Medium + ProjectAccessSettings: + admin: Admin + cannotFetchFeeds: Cannot fetch feeds + custom: Custom + feeds: Feed Sources + noAccess: No Access + permissions: Permissions + title: Project Settings for ProjectSettings: confirmDelete: Are you sure you want to delete this project? This action cannot be undone and all feed sources and their versions will be permanently deleted. deleteProject: Delete Project? diff --git a/lib/admin/components/ProjectSettings.js b/lib/admin/components/ProjectAccessSettings.js similarity index 90% rename from lib/admin/components/ProjectSettings.js rename to lib/admin/components/ProjectAccessSettings.js index bcd7bf193..ab3429899 100644 --- a/lib/admin/components/ProjectSettings.js +++ b/lib/admin/components/ProjectAccessSettings.js @@ -40,8 +40,8 @@ const ACCESS_TYPES = [{ message: 'custom' }] -export default class ProjectSettings extends Component { - messages = getComponentMessages('ProjectSettings') +export default class ProjectAccessSettings extends Component { + messages = getComponentMessages('ProjectAccessSettings') state = { projectSettings: this.props.settings } @@ -94,7 +94,7 @@ export default class ProjectSettings extends Component { }) } return ( - + @@ -105,7 +105,7 @@ export default class ProjectSettings extends Component { key={a.type} onClick={this.setAccess} value={a.type}> - {this.messages(`project.${a.message}`)} + {this.messages(`${a.message}`)} ))} @@ -114,7 +114,7 @@ export default class ProjectSettings extends Component { {settings.access === 'custom' ? -

{this.messages('project.feeds')}

+

{this.messages('feeds')}

{feedSources ? feedSources.map((feed, i) => ( { {feed.name === '' ? '(unnamed feed)' : feed.name} )) - : this.messages('project.cannotFetchFeeds') + : this.messages('cannotFetchFeeds') } -

{this.messages('project.permissions')}

+

{this.messages('permissions')}

{allPermissions.map((permission, i) => ( { {orgProjects.map((project: Project, i: number) => { if (i !== this.state.currentProjectIndex) return null const settings = this.state.projectSettings[project.id] - return Date: Mon, 17 Dec 2018 08:26:45 -0500 Subject: [PATCH 010/324] refactor(isochrones): remove deprecated feed version isochrones from GtfsMap --- lib/gtfs/components/GtfsMap.js | 60 ------------------- lib/gtfs/containers/ActiveGtfsMap.js | 4 +- .../components/version/FeedVersionMap.js | 3 +- 3 files changed, 2 insertions(+), 65 deletions(-) diff --git a/lib/gtfs/components/GtfsMap.js b/lib/gtfs/components/GtfsMap.js index 88a7df07f..7117cd47c 100644 --- a/lib/gtfs/components/GtfsMap.js +++ b/lib/gtfs/components/GtfsMap.js @@ -7,7 +7,6 @@ import { FeatureGroup, GeoJSON, Map, Marker, Polyline, Rectangle, TileLayer } fr import {refreshGtfsElements} from '../actions/general' import {getFeedsBounds, convertToArrayBounds} from '../../common/util/geo' -import {fetchFeedVersionIsochrones} from '../../manager/actions/versions' import PatternGeoJson from './PatternGeoJson' import StopMarker from './StopMarker' @@ -29,7 +28,6 @@ type Props = { disableScroll?: boolean, entities: Array, feeds?: Array, - fetchIsochrones: typeof fetchFeedVersionIsochrones, height: number, // only px isochroneBand?: number, mapState: MapFilter, @@ -47,7 +45,6 @@ type Props = { shapes: {data: Array}, showAllRoutesOnMap: boolean, showBounds?: boolean, - showIsochrones?: boolean, showPatterns?: boolean, showStops?: boolean, sidebarExpanded: any, @@ -93,12 +90,6 @@ export default class GtfsMap extends Component { }, 500) } - mapClicked = (e: any) => { - if (this.props.showIsochrones) { - this.fetchIsochrones(e.latlng) - } - } - mapMoved = (e: any) => { const {map} = this.refs const {disableRefresh, updateMapState} = this.props @@ -116,7 +107,6 @@ export default class GtfsMap extends Component { feeds, height, searchFocus, - showIsochrones, stop, width } = this.props @@ -139,10 +129,6 @@ export default class GtfsMap extends Component { // If height or width changes, reset map this.resetMap() } - // recalculate isochrone if date/time changes - if (!shallowEqual(nextProps.dateTime, dateTime) && showIsochrones) { - this.state.lastClicked && this.fetchIsochrones(this.state.lastClicked) - } } /** @@ -184,12 +170,6 @@ export default class GtfsMap extends Component { return null } - fetchIsochrones (latlng: LatLng) { - const center = this.refs.map.leafletElement.getCenter() - this.props.fetchIsochrones(this.props.version, latlng.lat, latlng.lng, center.lat, center.lng) - this.setState({ lastClicked: latlng }) - } - _refreshGtfsElements (feeds?: Array, entities?: Array) { const {refreshGtfsElements} = this.props if (!this.refs.map) { @@ -204,41 +184,6 @@ export default class GtfsMap extends Component { } } - renderIsochrones (isochroneBand: ?number, version: ?FeedVersion) { - const comps = [] - const bandTime = isochroneBand || 60 * 60 - if (version && version.isochrones && version.isochrones.features) { - version.isochrones.features.forEach((iso, index) => { - if (iso.properties.time !== bandTime) return - /* FIXME: Math.random() key */ - comps.push( - - ) - }) - } - if (this.state && this.state.lastClicked) { - comps.push( - - ) - } - if (comps.length === 1) { - return comps[0] - } else if (comps.length > 1) { - return {comps} - } - return null - } - - _onMarkerDragEnd = (e: any) => this.fetchIsochrones(e.target.getLatLng()) - layerAddHandler = (e: any) => { const {stop, pattern} = this.props const {searchFocus} = this.state @@ -281,7 +226,6 @@ export default class GtfsMap extends Component { shapes, showAllRoutesOnMap, showBounds, - showIsochrones, showPatterns, showStops, sidebarExpanded, @@ -318,7 +262,6 @@ export default class GtfsMap extends Component { bounds={feedsBounds || mapState.bounds} zoom={mapState.zoom} scrollWheelZoom={!disableScroll} - onClick={this.mapClicked} onMoveEnd={this.mapMoved} onLayerAdd={this.layerAddHandler} className='Gtfs-Map'> @@ -404,9 +347,6 @@ export default class GtfsMap extends Component { newEntityId={newEntityId} popupAction={popupAction} /> } - {/* Isochrones from map click */} - {showIsochrones && this.renderIsochrones(isochroneBand, version)} - {/* Display all route patterns */} {showAllRoutesOnMap && shapes.data.map((shape, index) => diff --git a/lib/gtfs/containers/ActiveGtfsMap.js b/lib/gtfs/containers/ActiveGtfsMap.js index fe54eae73..01671268e 100644 --- a/lib/gtfs/containers/ActiveGtfsMap.js +++ b/lib/gtfs/containers/ActiveGtfsMap.js @@ -5,7 +5,6 @@ import {connect} from 'react-redux' import GtfsMap from '../components/GtfsMap' import {refreshGtfsElements} from '../actions/general' import {updateMapState} from '../actions/filter' -import {fetchFeedVersionIsochrones} from '../../manager/actions/versions' import {getFilteredStops} from '../../manager/selectors' import type {AppState} from '../../types/reducers' @@ -35,8 +34,7 @@ const mapStateToProps = (state: AppState, ownProps) => { const mapDispatchToProps = { updateMapState, - refreshGtfsElements, - fetchIsochrones: fetchFeedVersionIsochrones + refreshGtfsElements } const ActiveGtfsMap = connect( diff --git a/lib/manager/components/version/FeedVersionMap.js b/lib/manager/components/version/FeedVersionMap.js index 9a1564640..62a0dd3ae 100644 --- a/lib/manager/components/version/FeedVersionMap.js +++ b/lib/manager/components/version/FeedVersionMap.js @@ -79,8 +79,7 @@ export default class FeedVersionMap extends Component { disableScroll disablePopup renderTransferPerformance - showBounds={tab === 'feed' || tab === 'accessibility'} - showIsochrones={tab === 'accessibility'} + showBounds={tab === 'feed'} showPatterns={tab === 'stops' || tab === 'patterns' || tab === 'timetables'} showStops={tab === 'stops' || tab === 'timetables'} isochroneBand={isochroneBand} From c168f9ba926a65f731fea8d82a9da86f675e81d0 Mon Sep 17 00:00:00 2001 From: Landon Reed Date: Mon, 17 Dec 2018 08:27:29 -0500 Subject: [PATCH 011/324] fix(mtc-feed-publication): use published date to indicate whether a feed is awaiting publication refs conveyal/datatools-server#152 --- lib/manager/components/version/FeedVersionDetails.js | 4 ++-- lib/types/index.js | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/manager/components/version/FeedVersionDetails.js b/lib/manager/components/version/FeedVersionDetails.js index 9f9f7b21b..7887faea9 100644 --- a/lib/manager/components/version/FeedVersionDetails.js +++ b/lib/manager/components/version/FeedVersionDetails.js @@ -51,13 +51,13 @@ export default class FeedVersionDetails extends Component {

{isExtensionEnabled('mtc') ?