Skip to content

Commit ba49770

Browse files
Merge branch 'mtc-deploy' into mtc-deploy-with-dev
2 parents 0a43db2 + 249dca9 commit ba49770

File tree

2 files changed

+16
-3
lines changed

2 files changed

+16
-3
lines changed

lib/manager/components/version/FeedVersionActionsMTC.js

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,11 @@ import moment from 'moment'
55
import React, { Component } from 'react'
66
import { Button, ButtonToolbar, MenuItem } from 'react-bootstrap'
77
import { Link } from 'react-router'
8+
import { connect } from 'react-redux'
89

910
import * as versionsActions from '../../actions/versions'
1011
import { BLOCKING_ERROR_TYPES } from '../../util/version'
11-
import type { Feed, FeedVersion, FeedVersionSummary, GtfsPlusValidation } from '../../../types'
12+
import type { Feed, FeedVersion, FeedVersionSummary, GtfsPlusValidation, ServerJob } from '../../../types'
1213
import type { ManagerUserState } from '../../../types/reducers'
1314

1415
import VersionRetrievalBadge from './VersionRetrievalBadge'
@@ -17,6 +18,7 @@ import VersionSelectorDropdown from './VersionSelectorDropdown'
1718
export type Props = {
1819
feedSource: Feed,
1920
gtfsPlusValidation: GtfsPlusValidation,
21+
jobs?: Array<ServerJob>,
2022
mergeVersions: typeof versionsActions.mergeVersions,
2123
publishFeedVersion: typeof versionsActions.publishFeedVersion,
2224
user: ManagerUserState,
@@ -72,7 +74,7 @@ function checkBlockingIssue (version: FeedVersion): boolean {
7274
!!(errorCounts.find(ec => BLOCKING_ERROR_TYPES.indexOf(ec.type) !== -1))
7375
}
7476

75-
export default class FeedVersionActionsMTC extends Component<Props> {
77+
class FeedVersionActionsMTC extends Component<Props> {
7678
_handleMergeVersion: ((versionId: string) => void) = (versionId: string) => {
7779
// Note: service period feed merge has only been extensively tested with
7880
// MTC-specific logic.
@@ -85,6 +87,7 @@ export default class FeedVersionActionsMTC extends Component<Props> {
8587
const {
8688
feedSource,
8789
gtfsPlusValidation,
90+
jobs,
8891
user,
8992
version
9093
} = this.props
@@ -106,6 +109,8 @@ export default class FeedVersionActionsMTC extends Component<Props> {
106109
const end = +moment(summary.endDate)
107110
const expired = end < now
108111

112+
const jobsProcessingThisVersion = jobs && jobs.some(job => job.feedVersionId === version.id)
113+
109114
const publishButtonDisabled = !gtfsPlusValidation ||
110115
hasGtfsPlusBlockingIssue ||
111116
!gtfsPlusValidation.published ||
@@ -115,7 +120,8 @@ export default class FeedVersionActionsMTC extends Component<Props> {
115120
hasBlockingIssue ||
116121
isPublished ||
117122
processing ||
118-
!userCanManageFeed(user, version)
123+
!userCanManageFeed(user, version) ||
124+
jobsProcessingThisVersion
119125

120126
let publishWarningMessage
121127
if (hasBlockingIssue || hasGtfsPlusBlockingIssue) {
@@ -185,3 +191,9 @@ export default class FeedVersionActionsMTC extends Component<Props> {
185191
)
186192
}
187193
}
194+
195+
const mapStateToProps = state => ({
196+
jobs: state.status.jobMonitor.jobs
197+
})
198+
199+
export default connect(mapStateToProps)(FeedVersionActionsMTC)

lib/types/index.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1077,6 +1077,7 @@ export type MergeFeedsResult = {
10771077
export type ServerJob = {
10781078
deploymentId: ?string,
10791079
feedSourceId: ?string,
1080+
feedVersionId: ?string,
10801081
instanceId: ?string,
10811082
jobId: string,
10821083
mergeFeedsResult?: MergeFeedsResult,

0 commit comments

Comments
 (0)