|
manager > FeedSourceTable should render with a project with feeds
|
- manager > FeedSourceTable should render with a project with feeds
(Aug 1, 2019)
-
+
|
- manager > FeedSourceTable should render with a project with feeds
Last updated 5 months ago
-
+
|
manager > FeedSourceTable should render with a project with feeds
>
78
|
-
+ |
Date: Tue, 6 Oct 2026 11:06:54 -0400
Subject: [PATCH 18/22] refactor(FeedSourceTableRow): Simplify vars
---
lib/manager/components/FeedSourceTableRow.js | 12 +++++++-----
1 file changed, 7 insertions(+), 5 deletions(-)
diff --git a/lib/manager/components/FeedSourceTableRow.js b/lib/manager/components/FeedSourceTableRow.js
index ea27af08e..9ce78e43b 100644
--- a/lib/manager/components/FeedSourceTableRow.js
+++ b/lib/manager/components/FeedSourceTableRow.js
@@ -226,21 +226,23 @@ export default class FeedSourceTableRow extends PureComponent {
// data for latest validation columns
const { latestActiveFeedValidation, latestActiveVersion, latestValidation, latestVersion } = feedSource
const { feedVersionId: latestVersionId } = latestValidation || {}
+ const defaultVersion = latestActiveVersion || latestVersion
+ const defaultValidation = latestActiveFeedValidation || latestValidation
+ const { feedVersionId: activeVersionId } = defaultValidation || {}
const latestVersionData = this.getVersionDisplayData(latestValidation)
const { endDate, feedVersionId: comparisonVersionId, startDate } = comparisonValidationSummary || {}
const hasComparisonDates = startDate && endDate
- const activeVersionData = this.getVersionDisplayData(latestActiveFeedValidation || latestValidation)
- const defaultVersion = latestActiveVersion || latestVersion
+ const activeVersionData = this.getVersionDisplayData(defaultValidation)
- if (latestVersionId && latestVersionId === comparisonVersionId) {
- activeVersionData.status = latestVersionData.status = comparisonColumn === 'DEPLOYED'
+ if (activeVersionId && activeVersionId === comparisonVersionId) {
+ activeVersionData.status = comparisonColumn === 'DEPLOYED'
? 'same-as-deployed'
: 'same-as-published'
}
- const hasPendingVersion = latestActiveVersion && latestActiveVersion.id !== latestVersionId
+ const hasPendingVersion = activeVersionId !== latestVersionId
const rowsRequired = hasPendingVersion ? 2 : 1
// Render the active or expired version first.
From 3c85fd1c8cda21da3644e0b058f0cbdbbd378149 Mon Sep 17 00:00:00 2001
From: binh-dam-ibigroup
Date: Tue, 6 Oct 2026 15:50:10 -0400
Subject: [PATCH 19/22] fix(FeedSourceTableRow): Display version last updated.
Update tests.
---
__tests__/test-utils/mock-data/manager.js | 4 +
lib/manager/components/FeedSourceTableRow.js | 21 +++---
.../__snapshots__/DeploymentsPanel.js.snap | 36 +++++++++
.../__snapshots__/FeedSourceTable.js.snap | 75 +++++++++++++++++++
4 files changed, 127 insertions(+), 9 deletions(-)
diff --git a/__tests__/test-utils/mock-data/manager.js b/__tests__/test-utils/mock-data/manager.js
index ac4fb3129..9f2d5c86e 100644
--- a/__tests__/test-utils/mock-data/manager.js
+++ b/__tests__/test-utils/mock-data/manager.js
@@ -153,6 +153,10 @@ export const mockFeedWithVersion = {
tripCount: 415
},
latestVersionId: 'mock-feed-version-id',
+ // Include version as sometimes, this object is used as a FeedSourceSummary too.
+ latestVersion: {
+ lastUpdated: 1543389038810
+ },
labelIds: [],
name: 'test feed with a version',
noteCount: 0,
diff --git a/lib/manager/components/FeedSourceTableRow.js b/lib/manager/components/FeedSourceTableRow.js
index 9ce78e43b..b578bb7e8 100644
--- a/lib/manager/components/FeedSourceTableRow.js
+++ b/lib/manager/components/FeedSourceTableRow.js
@@ -104,6 +104,13 @@ export default class FeedSourceTableRow extends PureComponent {
messages = getComponentMessages('FeedSourceTableRow')
dateFormat = this.messages('dateFormat')
+ getLastUpdateRelative (lastUpdated?: any) {
+ const lastVersionUpdate = !!lastUpdated && relativeDuration(lastUpdated)
+ return lastVersionUpdate
+ ? this.messages('lastUpdated').replace('%lastVersionUpdate%', lastVersionUpdate)
+ : ''
+ }
+
/**
* Get some UI data from a ValidationSummary
*/
@@ -140,11 +147,7 @@ export default class FeedSourceTableRow extends PureComponent {
*/
generateFeedSourceLabelRenderVars (feedSource: Feed, comparisonValidationSummary: ?ValidationSummary) {
// data for feed source info column
- let lastVersionUpdate = !!feedSource.lastUpdated &&
- relativeDuration(feedSource.lastUpdated)
- lastVersionUpdate = lastVersionUpdate
- ? this.messages('lastUpdated').replace('%lastVersionUpdate%', lastVersionUpdate)
- : ''
+ const lastVersionUpdate = this.getLastUpdateRelative(feedSource.lastUpdated)
// data for comparison column
const comparisonData = comparisonValidationSummary &&
@@ -175,7 +178,8 @@ export default class FeedSourceTableRow extends PureComponent {
}
}
- renderDetailCells (versionData: VersionData, lastVersionUpdate: any, publishedVersion?: FeedVersionSummary) {
+ renderDetailCells (versionData: VersionData, publishedVersion?: FeedVersionSummary) {
+ const lastVersionUpdate = this.getLastUpdateRelative(publishedVersion && publishedVersion.lastUpdated)
return (
<>
|
@@ -214,7 +218,6 @@ export default class FeedSourceTableRow extends PureComponent {
} = this.props
const {
- lastVersionUpdate,
comparisonSubtext,
comparisonData,
comparisonSubtextDate
@@ -274,14 +277,14 @@ export default class FeedSourceTableRow extends PureComponent {
}
|
}
- {this.renderDetailCells(activeVersionData, lastVersionUpdate, defaultVersion)}
+ {this.renderDetailCells(activeVersionData, defaultVersion)}
|
|
{hasPendingVersion &&