Skip to content

Commit 2075474

Browse files
clean up labels
1 parent d6f5538 commit 2075474

File tree

4 files changed

+32
-5
lines changed

4 files changed

+32
-5
lines changed

lib/editor/actions/editor.js

+2
Original file line numberDiff line numberDiff line change
@@ -511,9 +511,11 @@ export function fetchBaseGtfs ({
511511
id
512512
from_leg_group_id
513513
to_leg_group_id
514+
fare_product_id
514515
}
515516
fare_leg_rule (limit: -1) {
516517
fare_product_id
518+
leg_group_id
517519
id
518520
}
519521
routes (limit: -1) {

lib/editor/util/gtfs.js

+18
Original file line numberDiff line numberDiff line change
@@ -244,7 +244,16 @@ export function getEntityName (entity: any): string {
244244
nameKey = 'description'
245245
} else if (typeof entity.fare_id !== 'undefined') {
246246
nameKey = 'fare_id'
247+
} else if (typeof entity.fare_product_id !== 'undefined' && typeof entity.fare_media_id !== 'undefined') {
248+
nameKey = 'fare_product_id'
249+
} else if (typeof entity.fare_media_id !== 'undefined') {
250+
nameKey = 'fare_media_id'
251+
} else if (typeof entity.from_leg_group_id !== 'undefined' && typeof entity.to_leg_group_id !== 'undefined' && entity.fare_product_id !== 'undefined') {
252+
nameKey = 'fare_transfer_rule_id' // FARE-TODO: fare_media_name? Some combo?
253+
} else if (typeof entity.fare_product_id !== 'undefined' && typeof entity.leg_group_id !== 'undefined') {
254+
nameKey = 'fare_leg_rule_id' // FARE-TODO: fare_media_name? Some combo?
247255
}
256+
248257
// FARE-TODO: what to do with fare_transfer_rules.txt?
249258
// FARE-TODO: what to do with fare_leg_rules.txt?
250259
if (typeof entity.exemplar !== 'undefined') {
@@ -281,6 +290,15 @@ export function getEntityName (entity: any): string {
281290
return `${serviceCalendar.service_id} ${serviceCalendar.description
282291
? `(${serviceCalendar.description})`
283292
: ''}`
293+
case 'fare_product_id':
294+
// FARE-TODO: type!
295+
return `${entity.fare_product_id} (${entity.fare_media_id})`
296+
case 'fare_transfer_rule_id':
297+
// FARE-TODO: type!
298+
return `${entity.from_leg_group_id} ➡️ ${entity.to_leg_group_id} (${entity.fare_product_id})`
299+
case 'fare_leg_rule_id':
300+
// FARE-TODO: type!
301+
return `${entity.fare_product_id} (${entity.leg_group_id})`
284302
default:
285303
const otherEntityType: any = entity
286304
return otherEntityType[nameKey] || NO_NAME

lib/editor/util/objects.js

+8-1
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,20 @@
11
// @flow
22
import {ENTITY} from '../constants'
33
import {camelCaseKeys, snakeCaseKeys} from '../../common/util/map-keys'
4-
54
import type {Entity} from '../../types'
65

76
export function componentToText (component: string): string {
87
switch (component) {
98
case 'scheduleexception':
109
return 'exception'
10+
case 'fareproduct':
11+
return 'product'
12+
case 'faremedia':
13+
return 'media'
14+
case 'faretransferrule':
15+
return 'transfer rule'
16+
case 'farelegrule':
17+
return 'leg rule'
1118
default:
1219
return component
1320
}

lib/editor/util/ui.js

+4-4
Original file line numberDiff line numberDiff line change
@@ -80,31 +80,31 @@ export const GTFS_ICONS = [
8080
icon: 'shopping-cart',
8181
addable: true,
8282
title: 'FARE PRODUCT TEST TITLE',
83-
label: 'FARE PRODUCT TEST LABEL'
83+
label: 'V2: Products'
8484
},
8585
{
8686
id: 'faremedia',
8787
tableName: 'faremedia',
8888
icon: 'id-card',
8989
addable: true,
9090
title: 'FARE MEDIA TEST TITLE',
91-
label: 'FARE MEDIA TEST LABEL'
91+
label: 'V2: Media'
9292
},
9393
{
9494
id: 'faretransferrule',
9595
tableName: 'faretransferrule',
9696
icon: 'link',
9797
addable: true,
9898
title: 'FARE TRANSFER RULE TEST TITLE',
99-
label: 'FARE TRANSFER RULE TEST LABEL'
99+
label: 'V2: Transfer Rules'
100100
},
101101
{
102102
id: 'farelegrule',
103103
tableName: 'farelegrule',
104104
icon: 'book',
105105
addable: true,
106106
title: 'FARE LEG RULE TEST TITLE',
107-
label: 'FARE LEG RULE TEST LABEL'
107+
label: 'V2: Leg Rules'
108108
}
109109
]
110110

0 commit comments

Comments
 (0)