Skip to content

Commit 44807e7

Browse files
committed
refactor(transformation results): show new transform results
1 parent d605d34 commit 44807e7

File tree

5 files changed

+49
-11
lines changed

5 files changed

+49
-11
lines changed

i18n/english.yml

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1300,6 +1300,17 @@ components:
13001300
title: Timetable editor keyboard shortcuts
13011301
TimezoneSelect:
13021302
placeholder: Select timezone...
1303+
TransformationsViewer:
1304+
columnsAdded: "Custom columns added: %columns%"
1305+
noTransformationApplied: No transformations applied.
1306+
rowsAdded: "Rows added: %rows%"
1307+
rowsDeleted: "Rows deleted: %rows%"
1308+
rowsUpdated: "Rows updated: %rows%"
1309+
tableModified: Table Modified
1310+
tableAdded: Table Added
1311+
tableReplaced: Table Replaced
1312+
tableDeleted: TableDeleted
1313+
transformationsTitle: Transformations
13031314
TripSeriesModal:
13041315
close: Close
13051316
createTripSeriesBody: Enter the start and end time for the trip series (24 hour time) and headway between trips. Click generate to create the series of trips.

i18n/german.yml

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1322,6 +1322,17 @@ components:
13221322
title: Abfahrtszeiten-Editor Tastatur-Shortcuts
13231323
TimezoneSelect:
13241324
placeholder: Zeitzone auswählen...
1325+
TransformationsViewer:
1326+
columnsAdded: "Custom columns added: %columns%"
1327+
noTransformationApplied: No transformations applied.
1328+
rowsAdded: "Rows added: %rows%"
1329+
rowsDeleted: "Rows deleted: %rows%"
1330+
rowsUpdated: "Rows updated: %rows%"
1331+
tableModified: Table Modified
1332+
tableAdded: Table Added
1333+
tableReplaced: Table Replaced
1334+
tableDeleted: TableDeleted
1335+
transformationsTitle: Transformations
13251336
UserAccount:
13261337
account:
13271338
title: Konto

i18n/polish.yml

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1298,6 +1298,17 @@ components:
12981298
title: Timetable editor keyboard shortcuts
12991299
TimezoneSelect:
13001300
placeholder: Select timezone...
1301+
TransformationsViewer:
1302+
columnsAdded: "Custom columns added: %columns%"
1303+
noTransformationApplied: No transformations applied.
1304+
rowsAdded: "Rows added: %rows%"
1305+
rowsDeleted: "Rows deleted: %rows%"
1306+
rowsUpdated: "Rows updated: %rows%"
1307+
tableModified: Table Modified
1308+
tableAdded: Table Added
1309+
tableReplaced: Table Replaced
1310+
tableDeleted: TableDeleted
1311+
transformationsTitle: Transformations
13011312
UserAccount:
13021313
account:
13031314
title: Account

lib/manager/components/TransformationsViewer.js

Lines changed: 15 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -4,23 +4,25 @@ import React, { Component } from 'react'
44
import Icon from '@conveyal/woonerf/components/icon'
55
import { Col, ListGroup, Panel, Row, ListGroupItem, Label as BsLabel } from 'react-bootstrap'
66

7+
import { getComponentMessages } from '../../common/util/config'
78
import type { FeedVersion, TableTransformResult } from '../../types'
89

910
type Props = {
1011
version: FeedVersion,
1112
}
1213

1314
export default class TransformationsViewer extends Component<Props> {
15+
messages = getComponentMessages('TransformationsViewer')
1416
_getBadge (transformResult: TableTransformResult) {
1517
switch (transformResult.transformType) {
1618
case 'TABLE_MODIFIED':
17-
return <BsLabel bsStyle='primary'>Table Modified</BsLabel>
19+
return <BsLabel bsStyle='primary'>{this.messages('tableModified')}</BsLabel>
1820
case 'TABLE_ADDED':
19-
return <BsLabel bsStyle='success'>Table Added</BsLabel>
21+
return <BsLabel bsStyle='success'>{this.messages('tableAdded')}</BsLabel>
2022
case 'TABLE_REPLACED':
21-
return <BsLabel bsStyle='warning'>Table Replaced</BsLabel>
23+
return <BsLabel bsStyle='warning'>{this.messages('tableReplaced')}</BsLabel>
2224
case 'TABLE_DELETED':
23-
return <BsLabel bsStyle='danger'>Table Deleted</BsLabel>
25+
return <BsLabel bsStyle='danger'>{this.messages('tableDeleted')}</BsLabel>
2426
}
2527
}
2628

@@ -34,26 +36,28 @@ export default class TransformationsViewer extends Component<Props> {
3436
const transformContent = tableTransformResults.map(res => {
3537
const badge = this._getBadge(res)
3638
return (
37-
<ListGroupItem key={res.tableName} style={{maxWidth: '720px'}}>
39+
<ListGroupItem key={res.tableName}>
3840
<h4 style={{marginTop: '5px'}}>{res.tableName} {badge}</h4>
39-
<Row style={{textAlign: 'center'}}>
40-
<Col xs={4}><Icon type='plus-square' />Rows added: {res.addedCount}</Col>
41-
<Col xs={4}><Icon type='minus-square' />Rows deleted: {res.deletedCount}</Col>
42-
<Col xs={4}><Icon type='exchange' />Rows updated: {res.updatedCount}</Col>
41+
<Row style={{maxWidth: '950px', textAlign: 'center'}}>
42+
{/* Use toString on numbers to make flow happy */}
43+
<Col xs={3}><Icon type='plus-square' />{this.messages('rowsAdded').replace('%rows%', res.addedCount.toString())}</Col>
44+
<Col xs={3}><Icon type='minus-square' />{this.messages('rowsDeleted').replace('%rows%', res.deletedCount.toString())}</Col>
45+
<Col xs={3}><Icon type='exchange' />{this.messages('rowsUpdated').replace('%rows%', res.updatedCount.toString())}</Col>
46+
<Col xs={3}><Icon type='user-plus' />{this.messages('columnsAdded').replace('%columns%', res.customColumnsAdded.toString())}</Col>
4347
</Row>
4448
</ListGroupItem>
4549
)
4650
})
4751
return (
4852
<Panel>
49-
<Panel.Heading><Panel.Title componentClass='h3'>Transformations</Panel.Title></Panel.Heading>
53+
<Panel.Heading><Panel.Title componentClass='h3'>{this.messages('transformationsTitle')}</Panel.Title></Panel.Heading>
5054
<ListGroup>
5155
{transformContent}
5256
</ListGroup>
5357
</Panel>
5458
)
5559
} else {
56-
return <h3>No transformations applied.</h3>
60+
return <h3>{this.messages('noTransformationApplied')}</h3>
5761
}
5862
}
5963
}

lib/types/index.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -509,6 +509,7 @@ export type SummarizedFeedVersion = {
509509

510510
export type TableTransformResult = {
511511
addedCount: number,
512+
customColumnsAdded: number,
512513
deletedCount: number,
513514
tableName: string,
514515
transformType: 'TABLE_ADDED' | 'TABLE_REPLACED' | 'TABLE_DELETED' | 'TABLE_MODIFIED',

0 commit comments

Comments
 (0)