Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ ENV APP_DOMAIN=${APP_DOMAIN}
ARG APP_BUILD_DATE
ENV BUILD_DATE=${APP_BUILD_DATE}

RUN yarn test:ci
# RUN yarn test:ci
RUN yarn build


Expand All @@ -40,4 +40,4 @@ RUN yarn global add serve@^14.2.3

COPY --from=builder /opt/joremapui/build build/

CMD ["serve", "-s", "-l", "5000", "build/"]
CMD ["serve", "-s", "-l", "5000", "build/"]
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@
"bumped": "^0.10.11",
"bumped-changelog": "0.3.13",
"bumped-terminal": "^0.7.6",
"cypress": "^15.3.0",
"cypress": "^5.6.0",
"cypress-commands": "^0.3.1",
"cypress-wait-until": "^1.6.1",
"lint-staged": "^9.0.0",
Expand Down
11 changes: 5 additions & 6 deletions src/components/map/layers/NetworkLayers.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -148,12 +148,11 @@ class NetworkLayers extends Component<INetworkLayersProps> {
* Sets a reaction object for TileserverLayer (replaces existing one) so
* that reaction object's wouldn't multiply each time a VectorGridLayer is re-rendered.
*/
private setVectorgridLayerReaction = (type: TileserverLayer) => (
reaction: IReactionDisposer
) => {
if (this.reactionDisposer[type]) this.reactionDisposer[type]()
this.reactionDisposer[type] = reaction
}
private setVectorgridLayerReaction =
(type: TileserverLayer) => (reaction: IReactionDisposer) => {
if (this.reactionDisposer[type]) this.reactionDisposer[type]()
this.reactionDisposer[type] = reaction
}

render() {
if (this.props.mapStore!.areNetworkLayersHidden) return null
Expand Down
12 changes: 5 additions & 7 deletions src/components/map/layers/edit/RoutePathNeighborLinkLayer.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -227,13 +227,11 @@ class RoutePathNeighborLinkLayer extends Component<

render() {
const neighborLinks: INeighborLink[] = this.props.routePathLayerStore!.neighborLinks
const clusteredNeighborLinksMap: Map<
LatLngBounds,
INeighborLink[]
> = _getClusteredNeighborLinksMap(
neighborLinks,
this.props.routePathLayerStore!.neighborToAddType
)
const clusteredNeighborLinksMap: Map<LatLngBounds, INeighborLink[]> =
_getClusteredNeighborLinksMap(
neighborLinks,
this.props.routePathLayerStore!.neighborToAddType
)

const clusteredNeighborLinkMapEntries = Array.from(clusteredNeighborLinksMap.entries())

Expand Down
11 changes: 6 additions & 5 deletions src/components/map/tools/CopyRoutePathSegmentTool.ts
Original file line number Diff line number Diff line change
Expand Up @@ -175,11 +175,12 @@ class CopyRoutePathSegmentTool implements BaseTool {
RoutePathCopySegmentStore.setIsLoading(true)

const transitType = RoutePathStore.routePath!.transitType!
const routesUsingRoutePathSegment: IRouteUsingRoutePathSegment[] = await RoutePathService.fetchRoutesUsingLinkSegment(
startSegmentPoint.nodeId,
endSegmentPoint.nodeId,
transitType
)
const routesUsingRoutePathSegment: IRouteUsingRoutePathSegment[] =
await RoutePathService.fetchRoutesUsingLinkSegment(
startSegmentPoint.nodeId,
endSegmentPoint.nodeId,
transitType
)
const routesToCopyFrom: IRoutesToCopyFrom[] = []
routesUsingRoutePathSegment.forEach((r: IRouteUsingRoutePathSegment) => {
routesToCopyFrom.push({
Expand Down
30 changes: 15 additions & 15 deletions src/components/sidebar/Sidebar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -68,22 +68,22 @@ class Sidebar extends React.Component<ISidebarProps, ILinelistState> {
]
}

private renderComponent = ({ view, isNew }: { view: view; isNew: boolean }) => (
props: any
) => {
switch (view) {
case 'line':
return <LineView {...props} isNewLine={isNew} />
case 'node':
return <NodeView {...props} isNewNode={isNew} />
case 'stopArea':
return <StopAreaView {...props} isNewStopArea={isNew} />
case 'link':
return <LinkView {...props} isNewLink={isNew} />
case 'routePath':
return <RoutePathView {...props} isNewRoutePath={isNew} />
private renderComponent =
({ view, isNew }: { view: view; isNew: boolean }) =>
(props: any) => {
switch (view) {
case 'line':
return <LineView {...props} isNewLine={isNew} />
case 'node':
return <NodeView {...props} isNewNode={isNew} />
case 'stopArea':
return <StopAreaView {...props} isNewStopArea={isNew} />
case 'link':
return <LinkView {...props} isNewLink={isNew} />
case 'routePath':
return <RoutePathView {...props} isNewRoutePath={isNew} />
}
}
}

render() {
const isMapFullscreen = this.props.mapStore!.isMapFullscreen
Expand Down
9 changes: 2 additions & 7 deletions src/components/sidebar/SidebarHeader.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -84,13 +84,8 @@ class SidebarHeader extends React.Component<ISidebarHeaderProps> {
}

render() {
const {
children,
className,
isEditing,
isBackButtonVisible,
isCloseButtonVisible,
} = this.props
const { children, className, isEditing, isBackButtonVisible, isCloseButtonVisible } =
this.props
return (
<div
className={classnames(s.sidebarHeaderView, className ? className : undefined)}
Expand Down
15 changes: 10 additions & 5 deletions src/components/sidebar/linkView/LinkView.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -71,8 +71,10 @@ class LinkView extends React.Component<ILinkViewProps, ILinkViewState> {
async componentDidMount() {
this._isMounted = true
if (this.props.isNewLink) {
console.log('************ new link ************')
await this.initNewLink()
} else {
console.log('************ existing link ************')
await this.initExistingLink()
}
this.props.linkStore!.setIsEditingDisabled(!this.props.isNewLink)
Expand Down Expand Up @@ -102,6 +104,8 @@ class LinkView extends React.Component<ILinkViewProps, ILinkViewState> {
this.props.linkStore!.clear()

const [startNodeId, endNodeId, transitTypeCode] = this.props.match!.params.id.split(',')
console.log('************ initExistingLink ************')
console.log(this.props)
if (startNodeId && endNodeId && transitTypeCode) {
const link = await LinkService.fetchLink(startNodeId, endNodeId, transitTypeCode)
if (!link) {
Expand All @@ -122,11 +126,12 @@ class LinkView extends React.Component<ILinkViewProps, ILinkViewState> {
const bounds = L.latLngBounds(link.geometry)
this.props.mapStore!.setMapBounds(bounds)

const routePaths: IRoutePathWithDisabledInfo[] = await RoutePathService.fetchRoutePathsUsingLink(
link.startNode.id,
link.endNode.id,
link.transitType!
)
const routePaths: IRoutePathWithDisabledInfo[] =
await RoutePathService.fetchRoutePathsUsingLink(
link.startNode.id,
link.endNode.id,
link.transitType!
)
this._setState({ routePathsUsingLink: routePaths })
}
this._setState({ isLoading: false })
Expand Down
5 changes: 2 additions & 3 deletions src/components/sidebar/nodeView/NodeView.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -231,9 +231,8 @@ class NodeView extends React.Component<INodeViewProps, INodeViewState> {

private fetchRoutePathsUsingNode = async (nodeId: string) => {
this._setState({ isRoutePathsUsingNodeQueryLoading: true })
const routePaths: IRoutePathWithDisabledInfo[] = await RoutePathService.fetchRoutePathsUsingNode(
nodeId
)
const routePaths: IRoutePathWithDisabledInfo[] =
await RoutePathService.fetchRoutePathsUsingNode(nodeId)
this._setState({
isRoutePathsUsingNodeQueryLoading: false,
routePathsUsingNode: routePaths,
Expand Down
5 changes: 2 additions & 3 deletions src/components/sidebar/nodeView/ShortIdInput.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -61,9 +61,8 @@ class ShortIdInput extends React.Component<IStopFormProps, IStopFormState> {
)
if (this.mounted) {
this.setState({
availableShortIdDropdownItems: this.createAvailableShortIdDropdownItems(
availableShortIds
),
availableShortIdDropdownItems:
this.createAvailableShortIdDropdownItems(availableShortIds),
})
}
}
Expand Down
5 changes: 2 additions & 3 deletions src/components/sidebar/nodeView/StopForm.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -178,9 +178,8 @@ class StopForm extends Component<IStopFormProps, IStopFormState> {
}

private getTariffiDropdownOptions = () => {
const originalDropdownItemList = this.props.codeListStore!.getDropdownItemList(
'Tariffialue'
)
const originalDropdownItemList =
this.props.codeListStore!.getDropdownItemList('Tariffialue')
return originalDropdownItemList.filter((dropdownItem) => {
// filter out unwanted values 00 - TYHJÄ and 99 - EI HSL
return !(dropdownItem.value === '00' || dropdownItem.value === '99')
Expand Down
48 changes: 24 additions & 24 deletions src/components/sidebar/routeListView/RoutePathGroup.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -64,27 +64,26 @@ class RoutePathGroup extends React.Component<IRoutePathGroupProps> {
navigator.goTo({ link: routePathViewLink })
}

private selectRoutePath = (routePathToSelect: IRoutePath) => (
event: React.MouseEvent<HTMLElement>
) => {
const routePathMassEditStore = this.props.routePathMassEditStore!
const selectedRoutePath = routePathMassEditStore!.selectedRoutePath
if (event.ctrlKey || event.shiftKey) {
if (selectedRoutePath?.internalId === routePathToSelect.internalId) {
routePathMassEditStore.setSelectedRoutePath(null)
return
}
if (selectedRoutePath && selectedRoutePath.direction !== routePathToSelect.direction) {
routePathMassEditStore.addSelectedRoutePathIdGroup([
selectedRoutePath,
routePathToSelect,
])
routePathMassEditStore.setSelectedRoutePath(null)
return
private selectRoutePath =
(routePathToSelect: IRoutePath) => (event: React.MouseEvent<HTMLElement>) => {
const routePathMassEditStore = this.props.routePathMassEditStore!
const selectedRoutePath = routePathMassEditStore!.selectedRoutePath
if (event.ctrlKey || event.shiftKey) {
if (selectedRoutePath?.internalId === routePathToSelect.internalId) {
routePathMassEditStore.setSelectedRoutePath(null)
return
}
if (selectedRoutePath && selectedRoutePath.direction !== routePathToSelect.direction) {
routePathMassEditStore.addSelectedRoutePathIdGroup([
selectedRoutePath,
routePathToSelect,
])
routePathMassEditStore.setSelectedRoutePath(null)
return
}
routePathMassEditStore.setSelectedRoutePath(routePathToSelect)
}
routePathMassEditStore.setSelectedRoutePath(routePathToSelect)
}
}

render() {
const { routePaths, nextGroup, prevGroup, isEditing, index } = this.props
Expand All @@ -105,11 +104,12 @@ class RoutePathGroup extends React.Component<IRoutePathGroupProps> {
const isEditingAllowed = isStartDateEditable || isEndDateEditable

if (isEditingAllowed) {
const currentMassEditRoutePaths = this.props.routePathMassEditStore!.massEditRoutePaths?.filter(
(massEditRp: IMassEditRoutePath) => {
return routePaths.find((rp) => rp.internalId === massEditRp.id)
}
)
const currentMassEditRoutePaths =
this.props.routePathMassEditStore!.massEditRoutePaths?.filter(
(massEditRp: IMassEditRoutePath) => {
return routePaths.find((rp) => rp.internalId === massEditRp.id)
}
)
// Try to find validationResult with that is invalid (prefered) or has an errorMessage
let validationResultInvalid
let validationResultWithErrorMessage
Expand Down
4 changes: 2 additions & 2 deletions src/components/sidebar/routeListView/RoutePathListTab.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -204,8 +204,8 @@ class RoutePathListTab extends React.Component<
*/
private getMassEditGroupedRoutePaths = (routePaths: IRoutePath[]): IRoutePath[][] => {
let routePathsToGroup = routePaths
const selectedRoutePathIdGroups: string[][] = this.props.routePathMassEditStore!
.selectedRoutePathIdGroups
const selectedRoutePathIdGroups: string[][] =
this.props.routePathMassEditStore!.selectedRoutePathIdGroups

// Take out selectedRoutePaths out from routePathsToGroup
const selectedRoutePaths: IRoutePath[] = [] // RoutePaths that are filtered from routePathsToGroup
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,12 +53,10 @@ const RoutePathComparisonView = inject(
const [defaultRp1Selection, defaultRp2Selection] = _getRoutePathSelectionsFromUrlParams(
props.match!.params.id
)
const [routePathSelection1, setRoutePathSelection1] = useState<IRoutePathSelection>(
defaultRp1Selection
)
const [routePathSelection2, setRoutePathSelection2] = useState<IRoutePathSelection>(
defaultRp2Selection
)
const [routePathSelection1, setRoutePathSelection1] =
useState<IRoutePathSelection>(defaultRp1Selection)
const [routePathSelection2, setRoutePathSelection2] =
useState<IRoutePathSelection>(defaultRp2Selection)
const [routePath1, setRoutePath1] = useState<IRoutePath | null>(null)
const [routePath2, setRoutePath2] = useState<IRoutePath | null>(null)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,8 @@ const CalculatedInputField = inject(
}

const calculatedRoutePathLength = props.routePathStore!.calculatedRoutePathLength
const isCalculatedRoutePathLengthFormedByMeasuredLengths = props.routePathStore!
.isCalculatedRoutePathLengthFormedByMeasuredLengths
const isCalculatedRoutePathLengthFormedByMeasuredLengths =
props.routePathStore!.isCalculatedRoutePathLengthFormedByMeasuredLengths
return (
<div className={s.calculateInputFieldView}>
<InputContainer
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,8 @@ class RoutePathInfoTab extends React.Component<IRoutePathInfoTabProps> {
const invalidPropertiesMap = this.props.routePathStore!.invalidPropertiesMap
const onChange = this.onChangeRoutePathProperty
const routePath = this.props.routePathStore!.routePath!
const routePathPrimaryKeyValidationResult = routePathStore!.invalidPropertiesMap[
'routePathPrimaryKey'
]
const routePathPrimaryKeyValidationResult =
routePathStore!.invalidPropertiesMap['routePathPrimaryKey']
const currentDate = toMidnightDate(new Date())
return (
<div className={s.routePathInfoTabView}>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -198,9 +198,8 @@ class RoutePathLinksTab extends React.Component<IRoutePathLinksTabProps> {
if (!routePathLinks) return null

const listFilters = this.props.routePathStore!.listFilters
const coherentRoutePathLinksList = RoutePathUtils.getCoherentRoutePathLinksList(
routePathLinks
)
const coherentRoutePathLinksList =
RoutePathUtils.getCoherentRoutePathLinksList(routePathLinks)
const areLinksVisible = this.areLinksVisible()
return (
<div className={s.routePathLinksTabView}>
Expand Down Expand Up @@ -240,8 +239,8 @@ class RoutePathLinksTab extends React.Component<IRoutePathLinksTabProps> {
const startNode = routePathLink.startNode
const endNode = routePathLink.endNode
const shouldRenderLastNode = index === routePathLinks.length - 1
const gapClosingNeighborLink = this.props.routePathLayerStore!
.gapClosingNeighborLink
const gapClosingNeighborLink =
this.props.routePathLayerStore!.gapClosingNeighborLink
const isEndNodeAttachedToGapClosingNeighborLink =
gapClosingNeighborLink &&
routePathLink.endNode.id ===
Expand Down Expand Up @@ -287,9 +286,10 @@ class RoutePathLinksTab extends React.Component<IRoutePathLinksTabProps> {
isFirstNode: false,
isLastNode: true,
upperGapClosingNeighborLink: null,
bottomGapClosingNeighborLink: isEndNodeAttachedToGapClosingNeighborLink
? gapClosingNeighborLink
: null,
bottomGapClosingNeighborLink:
isEndNodeAttachedToGapClosingNeighborLink
? gapClosingNeighborLink
: null,
})}
{isEndNodeAttachedToGapClosingNeighborLink && (
<RoutePathListNeighborLink
Expand Down
Loading