Skip to content

Commit 3e37707

Browse files
Merge branch 'dev' into build-with-vite
2 parents cfd058c + 33d3187 commit 3e37707

File tree

12 files changed

+192
-5
lines changed

12 files changed

+192
-5
lines changed

README.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,11 @@
22

33
[![Join the chat at https://matrix.to/#/#transit-data-tools:gitter.im](https://badges.gitter.im/repo.png)](https://matrix.to/#/#transit-data-tools:gitter.im)
44

5+
6+
> [!NOTE]
7+
> We are working on revamping our project, feed, and deployment manager. We are looking for input from the open source community. If you have questions, concerns, ideas, or would like to be part of the process, please join in the gitter.
8+
9+
510
The core application for IBI Group's TRANSIT-Data-Tools suite. This application provides GTFS editing, management, validation, and deployment to OpenTripPlanner.
611

712
## Quick Start

i18n/english.yml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -370,6 +370,8 @@ components:
370370
feedInfo: Feed Info
371371
issues: Issues
372372
latestVersion: Latest Version
373+
publishState:
374+
title: Publish State
373375
status: Status
374376
FeedSourceTableRow:
375377
dateFormat: MMM D, YYYY
@@ -1085,6 +1087,12 @@ components:
10851087
learnMore: Learn more about Data Tools
10861088
signInHere: sign in here
10871089
viewDashboard: View dashboard
1090+
PublishStatus:
1091+
canPublish: Can publish
1092+
no-version: No version
1093+
published: Published
1094+
publishDisabled: Publish blocked
1095+
publishingInProgress: In progress
10881096
RegionSearch:
10891097
placeholder: Search for regions or agencies
10901098
ReplaceFileFromString:

i18n/german.yml

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -407,6 +407,8 @@ components:
407407
feedInfo: Feed Info
408408
issues: Fehler
409409
latestVersion: Aktuellste Version
410+
publishState:
411+
title: Publish State
410412
status: Status
411413
FeedSourceTableRow:
412414
dateFormat: DD.MM.YYYY
@@ -419,13 +421,17 @@ components:
419421
status:
420422
active: Aktiv
421423
all: Alle
424+
canPublish: Can publish
422425
expired: Veraltet
423426
expiring-within-5-days: Veraltet in 5 Tagen
424427
expiring-within-20-days: Veraltet in 20 Tagen
425428
feedNotInDeployment: Feed nicht deployed
426429
feedNotPublished: Feed nicht veröffentlicht
427430
future: Zukunft
428431
no-version: Keine Version
432+
published: Published
433+
publishDisabled: Publish blocked
434+
publishingInProgress: In progress
429435
same-as-deployed: Entspricht deploytem
430436
same-as-published: Entspricht veröffentlichtem
431437
validFor: Gültig für weitere %duration%
@@ -1084,6 +1090,12 @@ components:
10841090
learnMore: Erfahre mehr über Daten-Werkzeuge
10851091
signInHere: hier anmelden
10861092
viewDashboard: Dashboard ansehen
1093+
PublishStatus:
1094+
canPublish: Can publish
1095+
no-version: No version
1096+
published: Published
1097+
publishDisabled: Publish blocked
1098+
publishingInProgress: In progress
10871099
RegionSearch:
10881100
placeholder: Suche nach Regionen oder Unternehmen
10891101
ReplaceFileFromString:

i18n/polish.yml

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -403,6 +403,8 @@ components:
403403
feedInfo: Feed Info
404404
issues: Issues
405405
latestVersion: Latest Version
406+
publishState:
407+
title: Publish State
406408
status: Status
407409
FeedSourceTableRow:
408410
dateFormat: MMM D, YYYY
@@ -414,13 +416,17 @@ components:
414416
status:
415417
active: Aktywny
416418
all: Wszystkie
419+
canPublish: Can publish
417420
expired: Wygasłe
418421
expiring-within-5-days: Wygasające w ciągu 5 dni
419422
expiring-within-20-days: Wygasające w ciągu 20 dni
420423
feedNotInDeployment: Kanały niebędące w wdrożeniu
421424
feedNotPublished: Kanały nieopublikowane
422425
future: W przyszłości
423426
no-version: Brak wersji
427+
published: Published
428+
publishDisabled: Publish blocked
429+
publishingInProgress: In progress
424430
same-as-deployed: Taki sam jak wdrożony
425431
same-as-published: Taki sam jak opublikowany
426432
validFor: Valid for another %duration%
@@ -1073,6 +1079,12 @@ components:
10731079
learnMore: Learn more about Data Tools
10741080
signInHere: sign in here
10751081
viewDashboard: View dashboard
1082+
PublishStatus:
1083+
canPublish: Can publish
1084+
no-version: No version
1085+
published: Published
1086+
publishDisabled: Publish blocked
1087+
publishingInProgress: In progress
10761088
RegionSearch:
10771089
placeholder: Search for regions or agencies
10781090
ReplaceFileFromString:

lib/manager/components/FeedSourceTable.js

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import Icon from '@conveyal/woonerf/components/icon'
44
import React, {PureComponent} from 'react'
55
import {Button, ListGroupItem, ListGroup, Panel} from 'react-bootstrap'
66

7-
import {getComponentMessages} from '../../common/util/config'
7+
import {isExtensionEnabled, getComponentMessages} from '../../common/util/config'
88
import FeedSourceTableRow from '../containers/FeedSourceTableRow'
99
import ProjectFeedListToolbar from '../containers/ProjectFeedListToolbar'
1010
import type {Props as ContainerProps} from '../containers/FeedSourceTable'
@@ -30,6 +30,7 @@ export default class FeedSourceTable extends PureComponent<Props> {
3030

3131
_renderTable = () => {
3232
const {comparisonColumn, filteredFeedSources, project} = this.props
33+
const latestVersionColSpan = isExtensionEnabled('mtc') ? 4 : 3
3334
return (
3435
<table className='feed-source-table'>
3536
<thead>
@@ -40,7 +41,7 @@ export default class FeedSourceTable extends PureComponent<Props> {
4041
<h4>{this.messages(`comparisonColumn.${comparisonColumn}`)}</h4>
4142
</th>
4243
}
43-
<th className='feed-version-column top-row' colSpan={3}>
44+
<th className='feed-version-column top-row' colSpan={latestVersionColSpan}>
4445
<h4>{this.messages('latestVersion')}</h4>
4546
</th>
4647
<th />
@@ -78,6 +79,14 @@ export default class FeedSourceTable extends PureComponent<Props> {
7879
{this.messages('issues')}
7980
</h4>
8081
</th>
82+
{isExtensionEnabled('mtc') &&
83+
<th className='feed-version-column'>
84+
<h4>
85+
<Icon type='upload' />
86+
{this.messages('publishState.title')}
87+
</h4>
88+
</th>
89+
}
8190
<th />
8291
</tr>
8392
</thead>

lib/manager/components/FeedSourceTableRow.js

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,8 @@ import type {
3030
ManagerUserState
3131
} from '../../types/reducers'
3232

33+
import { PublishStatus } from './PublishStatus'
34+
3335
type Props = ContainerProps & {
3436
comparisonColumn: FeedSourceTableComparisonColumns,
3537
comparisonValidationSummary: ?ValidationSummary,
@@ -164,6 +166,7 @@ export default class FeedSourceTableRow extends PureComponent<Props> {
164166
}
165167
}
166168

169+
// eslint-disable-next-line complexity
167170
render () {
168171
const {
169172
comparisonColumn,
@@ -236,6 +239,11 @@ export default class FeedSourceTableRow extends PureComponent<Props> {
236239
{currentVersionData.endDate}
237240
</td>
238241
<td className='feed-version-column'>{currentVersionData.errorCount}</td>
242+
{isExtensionEnabled('mtc') &&
243+
<td className='feed-version-column'>
244+
<PublishStatus publishState={feedSource.publishState != null ? feedSource.publishState : ''} latestSentToExternalPublisher={feedSource.latestSentToExternalPublisher != null ? feedSource.latestSentToExternalPublisher : 0} />
245+
</td>
246+
}
239247
<td>
240248
<FeedActionsDropdown {...this.props} />
241249
</td>
@@ -247,6 +255,7 @@ export default class FeedSourceTableRow extends PureComponent<Props> {
247255
class FeedInfo extends PureComponent<{ feedSource: Feed, project: Project, user: ManagerUserState }> {
248256
messages = getComponentMessages('FeedInfo')
249257

258+
/* eslint-disable complexity */
250259
render () {
251260
const { feedSource, project, user } = this.props
252261

Lines changed: 118 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,118 @@
1+
// @flow
2+
import Icon from '@conveyal/woonerf/components/icon'
3+
import humanizeDuration from 'humanize-duration'
4+
import moment from 'moment'
5+
import React, { PureComponent } from 'react'
6+
7+
import { getComponentMessages } from '../../common/util/config'
8+
9+
type Props = {
10+
latestSentToExternalPublisher?: number,
11+
publishState: string;
12+
};
13+
14+
type PublishStatusState = {
15+
elapsed: string
16+
}
17+
18+
export class PublishStatus extends PureComponent<Props, PublishStatusState> {
19+
messages = getComponentMessages('PublishStatus');
20+
_interval: ?IntervalID;
21+
22+
constructor (props: Props) {
23+
super(props)
24+
this.state = { elapsed: '' }
25+
this._interval = null
26+
}
27+
28+
componentDidMount () {
29+
if (this.props.publishState === 'PUBLISHING') {
30+
this.updateElapsed()
31+
this._interval = setInterval(this.updateElapsed, 10000)
32+
}
33+
}
34+
35+
componentDidUpdate (prevProps: Props) {
36+
const wasProcessing = prevProps.publishState === 'PUBLISHING'
37+
const isProcessingNow = this.props.publishState === 'PUBLISHING'
38+
if (!wasProcessing && isProcessingNow) {
39+
this.updateElapsed()
40+
this._interval = setInterval(this.updateElapsed, 10000)
41+
} else if (wasProcessing && !isProcessingNow && this._interval) {
42+
clearInterval(this._interval)
43+
this._interval = null
44+
this.setState({ elapsed: '' })
45+
}
46+
}
47+
48+
componentWillUnmount () {
49+
if (this._interval) clearInterval(this._interval)
50+
}
51+
52+
updateElapsed = () => {
53+
const ts = this.props.latestSentToExternalPublisher
54+
if (!ts) {
55+
this.setState({ elapsed: '' })
56+
return
57+
}
58+
// Normalize to milliseconds
59+
let ms = Number(ts)
60+
if (isNaN(ms)) {
61+
ms = +moment(ts)
62+
}
63+
if (!ms || isNaN(ms)) {
64+
this.setState({ elapsed: '' })
65+
return
66+
}
67+
const human = humanizeDuration(Date.now() - ms, { largest: 2, round: true })
68+
this.setState({ elapsed: human })
69+
};
70+
71+
render () {
72+
const { publishState } = this.props
73+
const { elapsed } = this.state
74+
75+
if (publishState === 'PUBLISHED') {
76+
return (
77+
<span className='feed-status status-active'>
78+
<Icon type='check-circle' />
79+
{this.messages('published')}
80+
</span>
81+
)
82+
} else if (publishState === 'PUBLISHING') {
83+
return (
84+
<>
85+
<span className='feed-status status-publishing'>
86+
<Icon type='spinner' />
87+
{this.messages('publishingInProgress')}
88+
</span>
89+
<p>
90+
{elapsed ? `Processing for ${elapsed}` : null}
91+
</p>
92+
</>
93+
)
94+
} else if (!publishState) {
95+
return (
96+
<span className='feed-status status-no-version'>
97+
<Icon type='minus-circle' />
98+
{this.messages('no-version')}
99+
</span>
100+
)
101+
} else if (publishState === 'PUBLISH_BLOCKED') {
102+
return (
103+
<span className='feed-status status-publish-disabled'>
104+
<Icon type='ban' />
105+
{this.messages('publishDisabled')}
106+
</span>
107+
)
108+
} else if (publishState === 'READY_TO_PUBLISH') {
109+
return (
110+
<span className='feed-status status-unpublished'>
111+
<Icon type='circle' />
112+
{this.messages('canPublish')}
113+
</span>
114+
)
115+
}
116+
return null
117+
}
118+
}

lib/manager/components/version/FeedVersionActionsMTC.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,7 @@ class FeedVersionActionsMTC extends Component<Props> {
8383

8484
_onClickPublish: (() => any) = () => this.props.publishFeedVersion(this.props.version)
8585

86+
// eslint-disable-next-line complexity
8687
render (): React$Element<"div"> {
8788
const {
8889
feedSource,

lib/manager/containers/FeedSourceTableRow.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@ import {
1212
import {uploadFeed} from '../actions/versions'
1313
import FeedSourceTableRow from '../components/FeedSourceTableRow'
1414
import {getVersionValidationSummaryByFilterStrategy} from '../util/version'
15-
1615
import type {Feed, Project} from '../../types'
1716
import type {AppState} from '../../types/reducers'
1817

lib/manager/util/index.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -412,7 +412,7 @@ export function projectHasAtLeastOneDeployment (project: ?Project): boolean {
412412
export function projectHasAtLeastOneFeedWithAPublishedVersion (project: ?Project): boolean {
413413
return !!project &&
414414
!!project.feedSources &&
415-
project.feedSources.some(feedSource => feedSource.publishedVersionId)
415+
project.feedSources.some(feedSource => feedSource.publishState === 'PUBLISHED')
416416
}
417417

418418
export function validationState (val: ?boolean): ?string {

0 commit comments

Comments
 (0)