Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Frontend] Added env variable for sisu url and changed to use that instead of hardcoded sisu urls #4711

Merged
merged 3 commits into from
Jan 9, 2025
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
1 change: 1 addition & 0 deletions docker-compose.fd.ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ services:
SENTRY_DSN: ''
SERVICE_PROVIDER: fd
LANGUAGE_CENTER_VIEW_ENABLED: 'false' # currently no intention to be enabled
SIS_URL: 'https://sis-qa.funidata.fi'
NODE_ENV: production
image: ${DOCKER_OODIKONE_NAMESPACE:-637423527834.dkr.ecr.eu-north-1.amazonaws.com/oodikone}/oodikone-frontend:${DOCKER_IMAGE_TAG:-dev}

Expand Down
1 change: 1 addition & 0 deletions docker-compose.fd.yml
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@ services:
environment:
REACT_APP_SERVICE_PROVIDER: fd
REACT_APP_LANGUAGE_CENTER_VIEW_ENABLED: 'false'
REACT_APP_SIS_URL: 'https://sis-qa.funidata.fi'
volumes:
- ./services/frontend/src/:/opt/app-root/src/src
- ./services/shared/:/opt/app-root/src/src/shared
Expand Down
3 changes: 3 additions & 0 deletions services/frontend/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,9 @@ ENV REACT_APP_SERVICE_PROVIDER=$SERVICE_PROVIDER
ARG LANGUAGE_CENTER_VIEW_ENABLED
ENV REACT_APP_LANGUAGE_CENTER_VIEW_ENABLED=$LANGUAGE_CENTER_VIEW_ENABLED

ARG SIS_URL
ENV REACT_APP_SIS_URL=$SIS_URL

COPY ./frontend/package* ./
RUN npm ci --include=dev
COPY ./frontend .
Expand Down
3 changes: 2 additions & 1 deletion services/frontend/src/components/common/SisuLinkItem.tsx
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
import { Icon, Item } from 'semantic-ui-react'
import { sisUrl } from '@/conf'

interface SisuLinkItemProps {
id: string
}

export const SisuLinkItem = ({ id }: SisuLinkItemProps) => (
<div data-cy="sisulink">
<Item as="a" href={`https://sisu.helsinki.fi/tutor/role/staff/student/${id}/basic/basic-info`} target="_blank">
<Item as="a" href={`${sisUrl}/tutor/role/staff/student/${id}/basic/basic-info`} target="_blank">
<Icon name="external alternate" />
Sisu
</Item>
Expand Down
7 changes: 2 additions & 5 deletions services/frontend/src/components/material/StudentInfoItem.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { Person as PersonIcon } from '@mui/icons-material'
import { IconButton, Stack } from '@mui/material'
import { Link } from 'react-router'

import { sisUrl } from '@/conf'
import { ExternalLink } from './Footer/ExternalLink'

export const StudentInfoItem = ({ sisPersonId, studentNumber }: { sisPersonId: string; studentNumber: string }) => (
Expand All @@ -11,10 +11,7 @@ export const StudentInfoItem = ({ sisPersonId, studentNumber }: { sisPersonId: s
<IconButton component={Link} sx={{ padding: 0 }} target="_blank" to={`/students/${studentNumber}`}>
<PersonIcon color="primary" fontSize="small" />
</IconButton>
<ExternalLink
href={`https://sisu.helsinki.fi/tutor/role/staff/student/${sisPersonId}/basic/basic-info`}
text="Sisu"
/>
<ExternalLink href={`${sisUrl}/tutor/role/staff/student/${sisPersonId}/basic/basic-info`} text="Sisu" />
</Stack>
</Stack>
)
3 changes: 3 additions & 0 deletions services/frontend/src/conf.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,3 +28,6 @@ export const serviceProvider = process.env.REACT_APP_SERVICE_PROVIDER
export const languageCenterViewEnabled = !process.env.REACT_APP_LANGUAGE_CENTER_VIEW_ENABLED
? true
: process.env.REACT_APP_LANGUAGE_CENTER_VIEW_ENABLED === 'true'

// SISU url
export const sisUrl = process.env.REACT_APP_SIS_URL ? process.env.REACT_APP_SIS_URL : 'https://sisu.helsinki.fi'
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import { Card, CardContent, Typography, Button, Stack } from '@mui/material'
import { callApi } from '@/apiConnection'
import { ExternalLink } from '@/components/material/Footer/ExternalLink'
import { useStudentNameVisibility } from '@/components/StudentNameVisibilityToggle'
import { sisUrl } from '@/conf'
import { DISPLAY_DATE_FORMAT, DISPLAY_DATE_FORMAT_DEV } from '@/constants/date'
import { useGetAuthorizedUserQuery } from '@/redux/auth'
import { reformatDate } from '@/util/timeAndDate'
Expand Down Expand Up @@ -31,7 +32,7 @@ export const StudentInfoCard = ({ student }) => {
</Typography>
<ExternalLink
cypress="sisu-link"
href={`https://sisu.helsinki.fi/tutor/role/staff/student/${student.sis_person_id}/basic/basic-info`}
href={`${sisUrl}/tutor/role/staff/student/${student.sis_person_id}/basic/basic-info`}
text="Sisu"
variant="h6"
/>
Expand Down
Loading