diff --git a/apps/dolly-frontend/src/main/js/src/components/fagsystem/pdlf/form/partials/identifikasjon/falskIdentitet/FalskIdentitet.tsx b/apps/dolly-frontend/src/main/js/src/components/fagsystem/pdlf/form/partials/identifikasjon/falskIdentitet/FalskIdentitet.tsx
index 89dd4ab513a..19361de3e94 100644
--- a/apps/dolly-frontend/src/main/js/src/components/fagsystem/pdlf/form/partials/identifikasjon/falskIdentitet/FalskIdentitet.tsx
+++ b/apps/dolly-frontend/src/main/js/src/components/fagsystem/pdlf/form/partials/identifikasjon/falskIdentitet/FalskIdentitet.tsx
@@ -4,16 +4,16 @@ import { SelectOptionsManager as Options } from '@/service/SelectOptions'
import { DollySelect, FormikSelect } from '@/components/ui/form/inputs/select/Select'
import { FormikDatepicker } from '@/components/ui/form/inputs/datepicker/Datepicker'
import { getPlaceholder, setNavn } from '../../utils'
-import { SelectOptionsOppslag } from '@/service/SelectOptionsOppslag'
import { FormikDollyFieldArray } from '@/components/ui/form/fieldArray/DollyFieldArray'
import { AvansertForm } from '@/components/fagsystem/pdlf/form/partials/avansert/AvansertForm'
import { initialFalskIdentitetValues } from '@/components/fagsystem/pdlf/form/initialValues'
import { PdlEksisterendePerson } from '@/components/fagsystem/pdlf/form/partials/pdlPerson/PdlEksisterendePerson'
import { useGenererNavn } from '@/utils/hooks/useGenererNavn'
+import { SelectOptionsFormat } from '@/service/SelectOptionsFormat'
export const FalskIdentitet = ({ formikBag }) => {
- const { navnInfo , loading} = useGenererNavn()
- const navnOptions = SelectOptionsOppslag.formatOptions('personnavn', navnInfo)
+ const { navnInfo, loading } = useGenererNavn()
+ const navnOptions = SelectOptionsFormat.formatOptions('personnavn', navnInfo)
const settIdentitetType = (e, path, advancedValues) => {
if (!e) {
diff --git a/apps/dolly-frontend/src/main/js/src/components/fagsystem/pdlf/form/partials/kontaktinformasjonForDoedsbo/Kontakt.tsx b/apps/dolly-frontend/src/main/js/src/components/fagsystem/pdlf/form/partials/kontaktinformasjonForDoedsbo/Kontakt.tsx
index 0ad05cbbbe9..ca4fa5bc947 100644
--- a/apps/dolly-frontend/src/main/js/src/components/fagsystem/pdlf/form/partials/kontaktinformasjonForDoedsbo/Kontakt.tsx
+++ b/apps/dolly-frontend/src/main/js/src/components/fagsystem/pdlf/form/partials/kontaktinformasjonForDoedsbo/Kontakt.tsx
@@ -2,7 +2,6 @@ import { SelectOptionsManager as Options } from '@/service/SelectOptions'
import { Kategori } from '@/components/ui/form/kategori/Kategori'
import { DollySelect, FormikSelect } from '@/components/ui/form/inputs/select/Select'
import { FormikDatepicker } from '@/components/ui/form/inputs/datepicker/Datepicker'
-import { SelectOptionsOppslag } from '@/service/SelectOptionsOppslag'
import { getPlaceholder, setNavn } from '../utils'
import * as _ from 'lodash-es'
import {
@@ -17,6 +16,7 @@ import { PdlEksisterendePerson } from '@/components/fagsystem/pdlf/form/partials
import { useEffect } from 'react'
import { DatepickerWrapper } from '@/components/ui/form/inputs/datepicker/DatepickerStyled'
import { useGenererNavn } from '@/utils/hooks/useGenererNavn'
+import { SelectOptionsFormat } from '@/service/SelectOptionsFormat'
interface KontaktValues {
formikBag: FormikProps
@@ -59,7 +59,7 @@ export const Kontakt = ({ formikBag, path, eksisterendeNyPerson = null }: Kontak
}
const { navnInfo, loading } = useGenererNavn()
- const navnOptions = SelectOptionsOppslag.formatOptions('personnavn', navnInfo)
+ const navnOptions = SelectOptionsFormat.formatOptions('personnavn', navnInfo)
useEffect(() => {
if (!_.get(formikBag.values, `${path}.kontaktType`)) {
diff --git a/apps/dolly-frontend/src/main/js/src/components/fagsystem/pdlf/form/partials/navn/Navn.tsx b/apps/dolly-frontend/src/main/js/src/components/fagsystem/pdlf/form/partials/navn/Navn.tsx
index 4906f2a45a4..67910233152 100644
--- a/apps/dolly-frontend/src/main/js/src/components/fagsystem/pdlf/form/partials/navn/Navn.tsx
+++ b/apps/dolly-frontend/src/main/js/src/components/fagsystem/pdlf/form/partials/navn/Navn.tsx
@@ -2,7 +2,7 @@ import { FormikDollyFieldArray } from '@/components/ui/form/fieldArray/DollyFiel
import { initialNavn } from '@/components/fagsystem/pdlf/form/initialValues'
import { AvansertForm } from '@/components/fagsystem/pdlf/form/partials/avansert/AvansertForm'
import { FormikCheckbox } from '@/components/ui/form/inputs/checbox/Checkbox'
-import { Option, SelectOptionsOppslag } from '@/service/SelectOptionsOppslag'
+import { Option } from '@/service/SelectOptionsOppslag'
import { FormikSelect } from '@/components/ui/form/inputs/select/Select'
import * as _ from 'lodash-es'
import { FormikProps } from 'formik'
@@ -14,6 +14,7 @@ import styled from 'styled-components'
import { DatepickerWrapper } from '@/components/ui/form/inputs/datepicker/DatepickerStyled'
import { FormikDatepicker } from '@/components/ui/form/inputs/datepicker/Datepicker'
import { useGenererNavn } from '@/utils/hooks/useGenererNavn'
+import { SelectOptionsFormat } from '@/service/SelectOptionsFormat'
type NavnTypes = {
formikBag: FormikProps<{}>
@@ -28,7 +29,7 @@ const concatNavnMedTidligereValgt = (type, navnInfo, selectedNavn) => {
if (!navnInfo) {
return []
}
- const navnOptions = SelectOptionsOppslag.formatOptions(type, navnInfo)
+ const navnOptions = SelectOptionsFormat.formatOptions(type, navnInfo)
.concat(
selectedNavn?.map((navn) => ({
value: navn,
diff --git a/apps/dolly-frontend/src/main/js/src/components/fagsystem/pdlf/form/partials/pdlPerson/PdlPersonUtenIdentifikator.tsx b/apps/dolly-frontend/src/main/js/src/components/fagsystem/pdlf/form/partials/pdlPerson/PdlPersonUtenIdentifikator.tsx
index f55940cb8e0..053cd859dd4 100644
--- a/apps/dolly-frontend/src/main/js/src/components/fagsystem/pdlf/form/partials/pdlPerson/PdlPersonUtenIdentifikator.tsx
+++ b/apps/dolly-frontend/src/main/js/src/components/fagsystem/pdlf/form/partials/pdlPerson/PdlPersonUtenIdentifikator.tsx
@@ -3,10 +3,10 @@ import { SelectOptionsManager as Options } from '@/service/SelectOptions'
import { FormikDatepicker } from '@/components/ui/form/inputs/datepicker/Datepicker'
import { AdresseKodeverk } from '@/config/kodeverk'
import * as React from 'react'
-import { SelectOptionsOppslag } from '@/service/SelectOptionsOppslag'
import { FormikProps } from 'formik'
import * as _ from 'lodash-es'
import { useGenererNavn } from '@/utils/hooks/useGenererNavn'
+import { SelectOptionsFormat } from '@/service/SelectOptionsFormat'
interface PdlPersonUtenIdentifikatorValues {
formikBag: FormikProps<{}>
@@ -19,11 +19,11 @@ export const PdlPersonUtenIdentifikator = ({
}: PdlPersonUtenIdentifikatorValues) => {
const { navnInfo, loading } = useGenererNavn()
//@ts-ignore
- const fornavnOptions = SelectOptionsOppslag.formatOptions('fornavn', navnInfo)
+ const fornavnOptions = SelectOptionsFormat.formatOptions('fornavn', navnInfo)
//@ts-ignore
- const mellomnavnOptions = SelectOptionsOppslag.formatOptions('mellomnavn', navnInfo)
+ const mellomnavnOptions = SelectOptionsFormat.formatOptions('mellomnavn', navnInfo)
//@ts-ignore
- const etternavnOptions = SelectOptionsOppslag.formatOptions('etternavn', navnInfo)
+ const etternavnOptions = SelectOptionsFormat.formatOptions('etternavn', navnInfo)
const { fornavn, mellomnavn, etternavn } = _.get(formikBag?.values, `${path}.navn`)
diff --git a/apps/dolly-frontend/src/main/js/src/components/fagsystem/sigrunstub/form/partials/enkeltinntektForm.tsx b/apps/dolly-frontend/src/main/js/src/components/fagsystem/sigrunstub/form/partials/enkeltinntektForm.tsx
index b8abb8774c7..23a92ce1800 100644
--- a/apps/dolly-frontend/src/main/js/src/components/fagsystem/sigrunstub/form/partials/enkeltinntektForm.tsx
+++ b/apps/dolly-frontend/src/main/js/src/components/fagsystem/sigrunstub/form/partials/enkeltinntektForm.tsx
@@ -19,7 +19,7 @@ export const EnkeltinntektForm = ({
const { kodeverk: tekniskNavnOptions } = useKodeverk(SigrunKodeverk[tjeneste])
const getFilteredTekniskNavnOptions = () => {
- return tekniskNavnOptions?.koder?.filter((item) => {
+ return tekniskNavnOptions?.filter((item) => {
return getYear(new Date(item?.gyldigFra)) <= inntektsaar
})
}
diff --git a/apps/dolly-frontend/src/main/js/src/components/fagsystem/sykdom/form/partials/DetaljertSykemelding.tsx b/apps/dolly-frontend/src/main/js/src/components/fagsystem/sykdom/form/partials/DetaljertSykemelding.tsx
index 464a9478002..5e1da51496e 100644
--- a/apps/dolly-frontend/src/main/js/src/components/fagsystem/sykdom/form/partials/DetaljertSykemelding.tsx
+++ b/apps/dolly-frontend/src/main/js/src/components/fagsystem/sykdom/form/partials/DetaljertSykemelding.tsx
@@ -73,7 +73,7 @@ export const DetaljertSykemelding = ({ formikBag }: SykemeldingForm) => {
}
const { kodeverk: yrker } = useKodeverk(ArbeidKodeverk.Yrker)
- const randomYrke = getRandomValue(yrker?.koder)
+ const randomYrke = getRandomValue(yrker)
useEffect(() => {
const yrkePath = 'sykemelding.detaljertSykemelding.arbeidsgiver.yrkesbetegnelse'
diff --git a/apps/dolly-frontend/src/main/js/src/components/ui/background/Background.tsx b/apps/dolly-frontend/src/main/js/src/components/ui/background/Background.tsx
index c7fb579746b..a210c2fef8a 100644
--- a/apps/dolly-frontend/src/main/js/src/components/ui/background/Background.tsx
+++ b/apps/dolly-frontend/src/main/js/src/components/ui/background/Background.tsx
@@ -28,23 +28,27 @@ const day = new Date().getDate()
const weekDay = new Date().getDay()
const isHalloween = (month === 9 && day > 14) || (month === 10 && day === 0)
+const isSpring = month >= 2 && month <= 4
+const isSummer = month >= 5 && month <= 7
+const isFall = month >= 8 && month <= 10
const isWinter = month === 0 || month === 1
const isChristmas = month === 11
const isEaster = (month === 2 && day > 21) || (month === 3 && day === 1)
+const isFaarikaal = month === 8 && day > 23 && weekDay === 4
const DefaultBackground = styled.div`
background-image: url(${() => {
if (isEaster) {
return Paaske
- } else if (month >= 2 && month <= 4) {
+ } else if (isSpring) {
return Spring
- } else if (month >= 5 && month <= 7) {
+ } else if (isSummer) {
return Sommer
} else if (isHalloween) {
return Halloween
- } else if (month === 8 && day > 23 && weekDay === 4) {
+ } else if (isFaarikaal) {
return Faarikaal
- } else if (month >= 8 && month <= 10) {
+ } else if (isFall) {
return Fall
} else if (isWinter) {
return Winter
diff --git a/apps/dolly-frontend/src/main/js/src/components/ui/button/Tags/TagsButton.tsx b/apps/dolly-frontend/src/main/js/src/components/ui/button/Tags/TagsButton.tsx
index f309537c574..1e2bca94783 100644
--- a/apps/dolly-frontend/src/main/js/src/components/ui/button/Tags/TagsButton.tsx
+++ b/apps/dolly-frontend/src/main/js/src/components/ui/button/Tags/TagsButton.tsx
@@ -10,6 +10,7 @@ import { DollySelect } from '@/components/ui/form/inputs/select/Select'
import { SelectOptionsOppslag } from '@/service/SelectOptionsOppslag'
import { REGEX_BACKEND_GRUPPER, useMatchMutate } from '@/utils/hooks/useMutate'
import { Alert } from '@navikt/ds-react'
+import { SelectOptionsFormat } from '@/service/SelectOptionsFormat'
type Props = {
action: Function
@@ -28,7 +29,7 @@ export const TagsButton = ({ action, loading, gruppeId, eksisterendeTags }: Prop
}
const tagsFraDolly = SelectOptionsOppslag.hentTagsFraDolly()
- const tagOptions = SelectOptionsOppslag.formatOptions('tags', tagsFraDolly)
+ const tagOptions = SelectOptionsFormat.formatOptions('tags', tagsFraDolly)
return (
diff --git a/apps/dolly-frontend/src/main/js/src/components/ui/form/fieldArray/DollyFieldArray.tsx b/apps/dolly-frontend/src/main/js/src/components/ui/form/fieldArray/DollyFieldArray.tsx
index 41dc0641606..4b050f002e8 100644
--- a/apps/dolly-frontend/src/main/js/src/components/ui/form/fieldArray/DollyFieldArray.tsx
+++ b/apps/dolly-frontend/src/main/js/src/components/ui/form/fieldArray/DollyFieldArray.tsx
@@ -75,17 +75,21 @@ export const DollyFaBlokk = ({
children,
showDeleteButton,
number,
-}) => (
-
-
-
-
{header}
- {hjelpetekst &&
{hjelpetekst}}
- {showDeleteButton &&
}
+ whiteBackground,
+}) => {
+ const className = whiteBackground ? 'dfa-blokk-white' : 'dfa-blokk'
+ return (
+
+
+
+
{header}
+ {hjelpetekst && {hjelpetekst}}
+ {showDeleteButton && }
+
+
{children}
-
{children}
-
-)
+ )
+}
export const DollyFaBlokkOrg = ({
header,
@@ -177,6 +181,7 @@ export const DollyFieldArray = ({
idx={idx}
getHeader={getHeader ? getHeader : () => header}
data={curr}
+ whiteBackground={whiteBackground}
>
{children(curr, idx)}
@@ -188,6 +193,7 @@ export const DollyFieldArray = ({
idx={idx}
header={getHeader ? getHeader(curr) : header}
hjelpetekst={hjelpetekst}
+ whiteBackground={whiteBackground}
>
{children(curr, idx)}
diff --git a/apps/dolly-frontend/src/main/js/src/components/ui/form/fieldArray/ExpandableBlokk.tsx b/apps/dolly-frontend/src/main/js/src/components/ui/form/fieldArray/ExpandableBlokk.tsx
index 60270de503a..2eacce5084b 100644
--- a/apps/dolly-frontend/src/main/js/src/components/ui/form/fieldArray/ExpandableBlokk.tsx
+++ b/apps/dolly-frontend/src/main/js/src/components/ui/form/fieldArray/ExpandableBlokk.tsx
@@ -22,12 +22,14 @@ export default function ExpandableBlokk
({
idx,
children,
data,
+ whiteBackground,
}: ExpandableBlokkProps) {
const [isExpanded, setIsExpanded] = useState(false)
- const headerClass = cn('dfa-blokk_header', { clickable: true })
+ const className = whiteBackground ? 'dfa-blokk-white' : 'dfa-blokk'
+ const headerClass = cn(`${className}_header`, { clickable: true })
return (
-
+
setIsExpanded(!isExpanded)}>
{getHeader(data)}
@@ -37,7 +39,7 @@ export default function ExpandableBlokk({
onClick={() => setIsExpanded(!isExpanded)}
/>
- {isExpanded &&
{children}
}
+ {isExpanded &&
{children}
}
)
}
diff --git a/apps/dolly-frontend/src/main/js/src/components/ui/form/fieldArray/dollyFieldArray.less b/apps/dolly-frontend/src/main/js/src/components/ui/form/fieldArray/dollyFieldArray.less
index 5077a093e89..e252132f936 100644
--- a/apps/dolly-frontend/src/main/js/src/components/ui/form/fieldArray/dollyFieldArray.less
+++ b/apps/dolly-frontend/src/main/js/src/components/ui/form/fieldArray/dollyFieldArray.less
@@ -46,6 +46,16 @@
.dfa-header-og-content();
}
+.dfa-blokk-white {
+ padding: 0 10px 10px;
+ margin-bottom: 10px;
+ width: 100%;
+ border-left: 2px solid @blokk_border;
+ background-color: @blokk_bg;
+ background-color: white;
+ .dfa-header-og-content();
+}
+
.dfa-blokk-org-odd {
padding: 0 10px 10px;
margin-bottom: 10px;
diff --git a/apps/dolly-frontend/src/main/js/src/components/ui/form/inputs/select/Select.tsx b/apps/dolly-frontend/src/main/js/src/components/ui/form/inputs/select/Select.tsx
index 5adf5d7d8c2..69b75febb4a 100644
--- a/apps/dolly-frontend/src/main/js/src/components/ui/form/inputs/select/Select.tsx
+++ b/apps/dolly-frontend/src/main/js/src/components/ui/form/inputs/select/Select.tsx
@@ -5,11 +5,11 @@ import { Vis } from '@/components/bestillingsveileder/VisAttributt'
import { Label } from '@/components/ui/form/inputs/label/Label'
import { InputWrapper } from '@/components/ui/form/inputWrapper/InputWrapper'
import { fieldError, SyntEvent } from '@/components/ui/form/formUtils'
-import KodeverkConnector from '@/components/kodeverk/KodeverkConnector'
import './Select.less'
import MenuList from '@/components/ui/form/inputs/select/MenuList'
import Option from '@/components/ui/form/inputs/select/Option'
import * as _ from 'lodash-es'
+import { useKodeverk } from '@/utils/hooks/useKodeverk'
type SelectProps = {
id?: string
@@ -55,8 +55,8 @@ export const Select = ({
...rest
}: SelectProps) => {
let _value = isMulti
- ? options.filter((o) => value?.some((el) => el === o.value))
- : options.filter((o) => o.value === value)
+ ? options?.filter?.((o) => value?.some((el) => el === o.value))
+ : options?.filter?.((o) => o.value === value)
return (
{
+ const { kodeverk: kodeverkResult, loading } = useKodeverk(kodeverk)
const getSortedKodeverk = (kodeverkVerdier) => {
if (label === 'Bostedskommune') {
const kodeverkClone = _.cloneDeep(kodeverkVerdier)
@@ -97,15 +98,11 @@ export const SelectMedKodeverk = ({ kodeverk, label, isLoading, ...rest }: Selec
}
return (
-
- {(kodeverkVerdier) => (
-
- )}
-
+
)
}
diff --git a/apps/dolly-frontend/src/main/js/src/components/ui/miljoTabs/MiljoTabs.tsx b/apps/dolly-frontend/src/main/js/src/components/ui/miljoTabs/MiljoTabs.tsx
index cbb06dca827..91bb662d817 100644
--- a/apps/dolly-frontend/src/main/js/src/components/ui/miljoTabs/MiljoTabs.tsx
+++ b/apps/dolly-frontend/src/main/js/src/components/ui/miljoTabs/MiljoTabs.tsx
@@ -1,7 +1,6 @@
import { Alert, Tabs } from '@navikt/ds-react'
import styled from 'styled-components'
import React, { useState } from 'react'
-import { random } from 'lodash'
const StyledTabs = styled(Tabs)`
margin-top: -10px;
@@ -36,11 +35,11 @@ export const MiljoTabs = ({ bestilteMiljoer, errorMiljoer = [], forsteMiljo, dat
return (
- {data.map((miljoData) => {
+ {data.map((miljoData, idx: number) => {
if (errorMiljoer?.includes(miljoData?.miljo)) {
return (
@@ -49,7 +48,7 @@ export const MiljoTabs = ({ bestilteMiljoer, errorMiljoer = [], forsteMiljo, dat
if (bestilteMiljoer?.includes(miljoData?.miljo)) {
return (
@@ -57,15 +56,15 @@ export const MiljoTabs = ({ bestilteMiljoer, errorMiljoer = [], forsteMiljo, dat
}
return (
)
})}
- {data.map((miljoData) => (
-
+ {data.map((miljoData, idx: number) => (
+
{!miljoData?.data ||
miljoData?.data?.length < 1 ||
miljoData?.data?.inntekter?.length === 0 ? (
diff --git a/apps/dolly-frontend/src/main/js/src/ducks/bestillingStatus/index.tsx b/apps/dolly-frontend/src/main/js/src/ducks/bestillingStatus/index.tsx
index a132075ee13..16b41647051 100644
--- a/apps/dolly-frontend/src/main/js/src/ducks/bestillingStatus/index.tsx
+++ b/apps/dolly-frontend/src/main/js/src/ducks/bestillingStatus/index.tsx
@@ -14,7 +14,7 @@ export const {
gjenopprettOrganisasjonBestilling: DollyApi.gjenopprettOrganisasjonBestilling,
},
'removeNyBestillingStatus',
- { prefix: 'bestillingStatus' }
+ { prefix: 'bestillingStatus' },
)
// Henter alle bestillinger som er gjort på en ident
diff --git a/apps/dolly-frontend/src/main/js/src/pages/gruppe/PersonVisning/PersonVisning.tsx b/apps/dolly-frontend/src/main/js/src/pages/gruppe/PersonVisning/PersonVisning.tsx
index 40ee93de4b1..4a4046f3abb 100644
--- a/apps/dolly-frontend/src/main/js/src/pages/gruppe/PersonVisning/PersonVisning.tsx
+++ b/apps/dolly-frontend/src/main/js/src/pages/gruppe/PersonVisning/PersonVisning.tsx
@@ -56,6 +56,7 @@ import {
harArenaBestilling,
harDokarkivBestilling,
harHistarkBestilling,
+ harInntektsmeldingBestilling,
harInstBestilling,
harMedlBestilling,
harPoppBestilling,
@@ -135,6 +136,9 @@ export default ({
harAaregBestilling(bestillingerFagsystemer) || ident?.master === 'PDL',
)
+ const visArbeidsforhold =
+ ident?.master !== 'PDL' || arbeidsforhold?.some((miljodata) => miljodata?.data?.length > 0)
+
const { loading: loadingAmelding, ameldinger } = useAmeldinger(
ident.ident,
harAaregBestilling(bestillingerFagsystemer) || ident?.master === 'PDL',
@@ -150,9 +154,6 @@ export default ({
harUdistubBestilling(bestillingerFagsystemer) || ident?.master === 'PDL',
)
- const visArbeidsforhold =
- ident?.master !== 'PDL' || arbeidsforhold?.some((miljodata) => miljodata?.data?.length > 0)
-
const { loading: loadingTpData, tpData } = useTpData(
ident.ident,
harTpBestilling(bestillingerFagsystemer),
@@ -215,6 +216,17 @@ export default ({
const sykemeldingBestilling = SykemeldingVisning.filterValues(bestillingListe, ident.ident)
+ const { loading: loadingInntektsmeldingData, data: inntektsmeldingData } = useTransaksjonIdData(
+ ident.ident,
+ 'INNTKMELD',
+ harInntektsmeldingBestilling(bestillingerFagsystemer),
+ )
+
+ const inntektsmeldingBestilling = InntektsmeldingVisning.filterValues(
+ bestillingListe,
+ ident.ident,
+ )
+
const getGruppeIdenter = () => {
return useAsync(async () => DollyApi.getGruppeById(gruppeId), [DollyApi.getGruppeById])
}
@@ -421,8 +433,13 @@ export default ({
/>
+ foreldreansvar: Array
+}
+export const SelectOptionsFormat = {
+ formatOptions: (type: string, data: any, loading?: boolean) => {
+ if (loading || data?.loading) {
+ return []
+ }
+ if (!data?.value && _.isEmpty(data)) {
+ console.error('Fant ingen kodeverk for type: ' + type)
+ return []
+ }
+ const kodeverk = data?.value?.data || data
+ if (type === 'personnavn') {
+ const persondata: any[] = kodeverk || []
+ const options: Option[] = []
+ persondata?.length > 0 &&
+ persondata.forEach((personInfo) => {
+ if (!_.isNil(personInfo.fornavn)) {
+ const mellomnavn = !_.isNil(personInfo.mellomnavn) ? ' ' + personInfo.mellomnavn : ''
+ const navn = personInfo.fornavn + mellomnavn + ' ' + personInfo.etternavn
+ options.push({ value: personInfo.fornavn.toUpperCase(), label: navn.toUpperCase() })
+ }
+ })
+ return options
+ } else if (type === 'fornavn' || type === 'mellomnavn' || type === 'etternavn') {
+ const navnData = kodeverk || []
+ const options: { value: string; label: string }[] = []
+ navnData?.length > 0 &&
+ navnData.forEach((navn: { [x: string]: any }) => {
+ options.push({ value: navn[type], label: navn[type] })
+ })
+ return options
+ } else if (type === 'navnOgFnr') {
+ const persondata = kodeverk.liste || kodeverk || []
+ const options: Option[] = []
+ persondata?.length > 0 &&
+ persondata.forEach(
+ (personInfo: { fornavn: string; mellomnavn: string; etternavn: string; fnr: string }) => {
+ if (!_.isNil(personInfo.fornavn)) {
+ const mellomnavn = !_.isNil(personInfo.mellomnavn) ? ' ' + personInfo.mellomnavn : ''
+ const navnOgFnr =
+ (personInfo.fornavn + mellomnavn + ' ' + personInfo.etternavn).toUpperCase() +
+ ': ' +
+ personInfo.fnr
+ options.push({ value: personInfo.fnr, label: navnOgFnr })
+ }
+ },
+ )
+ return options
+ } else if (type === 'arbeidsforholdstyper') {
+ const options = kodeverk || []
+ options?.length > 0 &&
+ options.forEach((option: Option) => {
+ if (option.value === 'frilanserOppdragstakerHonorarPersonerMm') {
+ option.label = 'Frilansere/oppdragstakere, honorar, m.m.'
+ }
+ if (option.value === 'pensjonOgAndreTyperYtelserUtenAnsettelsesforhold') {
+ option.label = 'Pensjoner og andre typer ytelser uten ansettelsesforhold'
+ }
+ })
+ return options
+ } else if (type === 'understatuser') {
+ const statuser = kodeverk ? Object.entries(kodeverk) : []
+ const options: Option[] = []
+ statuser.forEach((status) => {
+ options.push({ value: parseInt(status[0]), label: `${status[0]}: ${status[1]}` })
+ })
+ return options
+ } else if (type === 'roller') {
+ const roller = kodeverk ? Object.entries(kodeverk) : []
+ const options: Option[] = []
+ roller.forEach((rolle: [string, string]) => {
+ options.push({ value: rolle[0], label: rolle[1] })
+ })
+ return options
+ } else if (type === 'sdpLeverandoer') {
+ const leverandoerer = kodeverk ? Object.entries(kodeverk) : []
+ const options: Option[] = []
+ leverandoerer.forEach((leverandoer: [string, any]) => {
+ data = leverandoer[1]
+ options.push({ value: parseInt(data.id), label: data.navn })
+ })
+ return options
+ } else if (type === 'tags') {
+ const tags = kodeverk ? Object.entries(kodeverk) : []
+ const options: Option[] = []
+ tags.forEach((leverandoer) => {
+ data = leverandoer[1]
+ options.push({ value: data.tag, label: data.beskrivelse })
+ })
+ return options
+ } else if (type === 'fullmaktOmraader') {
+ const omraader = kodeverk ? Object.entries(kodeverk?.koder) : []
+ const ugyldigeKoder = ['BII', 'KLA', 'KNA', 'KOM', 'LGA', 'MOT', 'OVR']
+ const options: Option[] = []
+ options.push({ value: '*', label: '* (Alle)' })
+ omraader
+ .filter((omr: [string, Option]) => {
+ return !ugyldigeKoder.includes(omr[1].value)
+ })
+ .forEach((omraade: [string, Data]) => {
+ data = omraade[1]
+ options.push({ value: data.value, label: data.label })
+ })
+ return options
+ } else {
+ return kodeverk
+ }
+ },
+}
diff --git a/apps/dolly-frontend/src/main/js/src/service/SelectOptionsOppslag.tsx b/apps/dolly-frontend/src/main/js/src/service/SelectOptionsOppslag.tsx
index a176a657156..3f331ac34a1 100644
--- a/apps/dolly-frontend/src/main/js/src/service/SelectOptionsOppslag.tsx
+++ b/apps/dolly-frontend/src/main/js/src/service/SelectOptionsOppslag.tsx
@@ -1,7 +1,6 @@
import { useAsync } from 'react-use'
import { BrregstubApi, DollyApi, KrrApi, PdlforvalterApi } from '@/service/Api'
import Api from '@/api'
-import * as _ from 'lodash-es'
import { Person, PersonData } from '@/components/fagsystem/pdlf/PdlTypes'
import { getAlder } from '@/ducks/fagsystem'
@@ -107,107 +106,4 @@ export const SelectOptionsOppslag = {
hentTagsFraDolly: () => {
return useAsync(async () => DollyApi.getTags(), [DollyApi.getTags])
},
-
- formatOptions: (type: string, data: any) => {
- if (!data?.value) {
- if (!data?.loading) {
- console.error('Fant ingen kodeverk for type: ' + type)
- }
- return []
- }
- if (type === 'personnavn') {
- const persondata: any[] = data?.value?.data || []
- const options: Option[] = []
- persondata?.length > 0 &&
- persondata.forEach((personInfo) => {
- if (!_.isNil(personInfo.fornavn)) {
- const mellomnavn = !_.isNil(personInfo.mellomnavn) ? ' ' + personInfo.mellomnavn : ''
- const navn = personInfo.fornavn + mellomnavn + ' ' + personInfo.etternavn
- options.push({ value: personInfo.fornavn.toUpperCase(), label: navn.toUpperCase() })
- }
- })
- return options
- } else if (type === 'fornavn' || type === 'mellomnavn' || type === 'etternavn') {
- const navnData = data?.value?.data || []
- const options: { value: string; label: string }[] = []
- navnData?.length > 0 &&
- navnData.forEach((navn: { [x: string]: any }) => {
- options.push({ value: navn[type], label: navn[type] })
- })
- return options
- } else if (type === 'navnOgFnr') {
- const persondata = data.value && data.value.data ? data.value.data.liste : []
- const options: Option[] = []
- persondata?.length > 0 &&
- persondata.forEach(
- (personInfo: { fornavn: string; mellomnavn: string; etternavn: string; fnr: string }) => {
- if (!_.isNil(personInfo.fornavn)) {
- const mellomnavn = !_.isNil(personInfo.mellomnavn) ? ' ' + personInfo.mellomnavn : ''
- const navnOgFnr =
- (personInfo.fornavn + mellomnavn + ' ' + personInfo.etternavn).toUpperCase() +
- ': ' +
- personInfo.fnr
- options.push({ value: personInfo.fnr, label: navnOgFnr })
- }
- },
- )
- return options
- } else if (type === 'arbeidsforholdstyper') {
- const options = data.value ? data.value.data.koder : []
- options?.length > 0 &&
- options.forEach((option: Option) => {
- if (option.value === 'frilanserOppdragstakerHonorarPersonerMm') {
- option.label = 'Frilansere/oppdragstakere, honorar, m.m.'
- }
- if (option.value === 'pensjonOgAndreTyperYtelserUtenAnsettelsesforhold') {
- option.label = 'Pensjoner og andre typer ytelser uten ansettelsesforhold'
- }
- })
- return options
- } else if (type === 'understatuser') {
- const statuser = data.value ? Object.entries(data.value.data) : []
- const options: Option[] = []
- statuser.forEach((status) => {
- options.push({ value: parseInt(status[0]), label: `${status[0]}: ${status[1]}` })
- })
- return options
- } else if (type === 'roller') {
- const roller = data.value ? Object.entries(data.value.data) : []
- const options: Option[] = []
- roller.forEach((rolle: [string, string]) => {
- options.push({ value: rolle[0], label: rolle[1] })
- })
- return options
- } else if (type === 'sdpLeverandoer') {
- const leverandoerer = data.value ? Object.entries(data.value.data) : []
- const options: Option[] = []
- leverandoerer.forEach((leverandoer: [string, any]) => {
- data = leverandoer[1]
- options.push({ value: parseInt(data.id), label: data.navn })
- })
- return options
- } else if (type === 'tags') {
- const tags = data.value ? Object.entries(data.value.data) : []
- const options: Option[] = []
- tags.forEach((leverandoer) => {
- data = leverandoer[1]
- options.push({ value: data.tag, label: data.beskrivelse })
- })
- return options
- } else if (type === 'fullmaktOmraader') {
- const omraader = data.value ? Object.entries(data.value.data.koder) : []
- const ugyldigeKoder = ['BII', 'KLA', 'KNA', 'KOM', 'LGA', 'MOT', 'OVR']
- const options: Option[] = []
- options.push({ value: '*', label: '* (Alle)' })
- omraader
- .filter((omr: [string, Option]) => {
- return !ugyldigeKoder.includes(omr[1].value)
- })
- .forEach((omraade: [string, Data]) => {
- data = omraade[1]
- options.push({ value: data.value, label: data.label })
- })
- return options
- }
- },
}
diff --git a/apps/dolly-frontend/src/main/js/src/service/services/dolly/Utils.tsx b/apps/dolly-frontend/src/main/js/src/service/services/dolly/Utils.tsx
index 7cb33b185a5..0f234175a55 100644
--- a/apps/dolly-frontend/src/main/js/src/service/services/dolly/Utils.tsx
+++ b/apps/dolly-frontend/src/main/js/src/service/services/dolly/Utils.tsx
@@ -1,5 +1,10 @@
+import * as _ from 'lodash'
+
// Specialbehov for modifisering og sortering av kodeverk
export const SortKodeverkArray = (data) => {
+ if (!data || _.isEmpty(data.koder)) {
+ return []
+ }
const kodeverk = data.koder
if (data.name === 'Språk') {
const spesKoder = ['ES', 'EN', 'NN', 'NB']
@@ -75,21 +80,6 @@ export const SortKodeverkArray = (data) => {
spesKoder.map((yrke) => kodeverk.unshift(yrke))
}
- if (data.name === 'Arbeidsforholdstyper') {
- // Kodeverket for arbeidsforholdstyper har en type som AAREG per i dag ikke støtter
- return kodeverk
- .filter((kode) => kode.value !== 'pensjonOgAndreTyperYtelserUtenAnsettelsesforhold')
- .map((kode) => {
- if (kode.value === 'frilanserOppdragstakerHonorarPersonerMm') {
- return {
- ...kode,
- label: 'Frilansere/oppdragstakere, honorar, m.m.',
- }
- }
- return kode
- })
- }
-
if (data.name === 'Landkoder') {
// Filtrerer bort land som har begrenset gyldighet. Fjernes hvis det oppstår behov for test med nye land.
const spesKoder = [
diff --git a/apps/dolly-frontend/src/main/js/src/styles/main.less b/apps/dolly-frontend/src/main/js/src/styles/main.less
index c935edfebae..316a854e399 100644
--- a/apps/dolly-frontend/src/main/js/src/styles/main.less
+++ b/apps/dolly-frontend/src/main/js/src/styles/main.less
@@ -60,6 +60,10 @@ a {
margin-bottom: 6px;
}
+.navds-checkbox--medium > .navds-checkbox__input + .navds-checkbox__label > .navds-checkbox__icon {
+ margin-top: 2px;
+}
+
.navds-checkboxes {
margin-bottom: 1rem;
}
diff --git a/apps/dolly-frontend/src/main/js/src/utils/DataFormatter.tsx b/apps/dolly-frontend/src/main/js/src/utils/DataFormatter.tsx
index 54b8bb7a6fb..f4cc3c24426 100644
--- a/apps/dolly-frontend/src/main/js/src/utils/DataFormatter.tsx
+++ b/apps/dolly-frontend/src/main/js/src/utils/DataFormatter.tsx
@@ -188,7 +188,7 @@ export const showLabel = (optionsGruppe, value) => {
optionsGruppe.includes('barn') && (copyOptionsGruppe = optionsGruppe.replace('barn_', ''))
const obj = Options(copyOptionsGruppe).filter(
- (options) => options.value.toUpperCase() === value.toUpperCase()
+ (options) => options.value.toUpperCase() === value.toUpperCase(),
)
if (_.get(obj, 'label') || _.get(obj, '[0].label')) {
@@ -209,7 +209,7 @@ export const showKodeverkLabel = (kodeverkNavn, value) => {
if (loading || error) {
return value
}
- return kodeverk?.koder?.find((kode) => kode?.value === value)?.label
+ return kodeverk?.find((kode) => kode?.value === value)?.label
}
export const getYearRangeOptions = (start, stop) => {
diff --git a/apps/dolly-frontend/src/main/js/src/utils/SjekkBestillingFagsystem.tsx b/apps/dolly-frontend/src/main/js/src/utils/SjekkBestillingFagsystem.tsx
index 3d59400a674..dbef5048242 100644
--- a/apps/dolly-frontend/src/main/js/src/utils/SjekkBestillingFagsystem.tsx
+++ b/apps/dolly-frontend/src/main/js/src/utils/SjekkBestillingFagsystem.tsx
@@ -127,3 +127,13 @@ export const harSykemeldingBestilling = (bestillingerFagsystemer) => {
})
return sykemelding
}
+
+export const harInntektsmeldingBestilling = (bestillingerFagsystemer) => {
+ let inntektsmelding = false
+ bestillingerFagsystemer?.forEach((i) => {
+ if (i.inntektsmelding) {
+ inntektsmelding = true
+ }
+ })
+ return inntektsmelding
+}
diff --git a/apps/dolly-frontend/src/main/js/src/utils/hooks/useFagsystemer.tsx b/apps/dolly-frontend/src/main/js/src/utils/hooks/useFagsystemer.tsx
index 7ec19fc9802..4d1d05906e1 100644
--- a/apps/dolly-frontend/src/main/js/src/utils/hooks/useFagsystemer.tsx
+++ b/apps/dolly-frontend/src/main/js/src/utils/hooks/useFagsystemer.tsx
@@ -40,17 +40,28 @@ const arenaUrl = (miljoer) =>
miljo: miljoe,
}))
-const journalpostUrl = (transaksjonsid, miljoer) =>
- miljoer?.map((miljoe) => {
- const journalpostId = transaksjonsid?.find((id) => id.miljoe === miljoe)?.transaksjonId
- ?.journalpostId
- return {
- url: journalpostId
- ? `/testnav-joark-dokument-service/api/v2/journalpost/${journalpostId}`
- : null,
- miljo: miljoe,
+const journalpostUrl = (transaksjonsid, miljoer) => {
+ const urlListe = []
+ miljoer.forEach((miljoe) => {
+ const journalpostId = transaksjonsid
+ ?.filter((id) => id.miljoe === miljoe)
+ ?.map((filtrertId) => filtrertId?.transaksjonId?.journalpostId)
+ if (journalpostId && journalpostId?.length > 0) {
+ journalpostId?.forEach((journalpost) => {
+ urlListe.push({
+ url: `/testnav-joark-dokument-service/api/v2/journalpost/${journalpost}`,
+ miljo: miljoe,
+ })
+ })
+ } else {
+ urlListe.push({
+ url: null,
+ miljo: miljoe,
+ })
}
})
+ return urlListe
+}
const histarkUrl = (transaksjonsid: string) =>
transaksjonsid ? `/testnav-histark-proxy/api/saksmapper/${transaksjonsid}` : null
diff --git a/apps/dolly-frontend/src/main/js/src/utils/hooks/useJoarkDokument.tsx b/apps/dolly-frontend/src/main/js/src/utils/hooks/useJoarkDokument.tsx
new file mode 100644
index 00000000000..bfa10665899
--- /dev/null
+++ b/apps/dolly-frontend/src/main/js/src/utils/hooks/useJoarkDokument.tsx
@@ -0,0 +1,26 @@
+import useSWR from 'swr'
+import { fetcher } from '@/api'
+
+const joarkUrl = '/testnav-joark-dokument-service/api/v2/journalpost/'
+
+export const useDokument = (
+ journalpostId: number,
+ dokumentInfoId: number,
+ miljo: string,
+ dokumentType: string,
+) => {
+ const { data, isLoading, error } = useSWR(
+ [
+ journalpostId && dokumentInfoId && dokumentType
+ ? `${joarkUrl}${journalpostId}/dokumenter/${dokumentInfoId}?dokumentType=${dokumentType}`
+ : null,
+ { miljo: miljo },
+ ],
+ ([url, headers]) => fetcher(url, headers),
+ )
+ return {
+ dokument: data,
+ loading: isLoading,
+ error: error,
+ }
+}
diff --git a/apps/dolly-frontend/src/main/js/src/utils/hooks/useKodeverk.tsx b/apps/dolly-frontend/src/main/js/src/utils/hooks/useKodeverk.tsx
index c18f7707c8e..03e403aa774 100644
--- a/apps/dolly-frontend/src/main/js/src/utils/hooks/useKodeverk.tsx
+++ b/apps/dolly-frontend/src/main/js/src/utils/hooks/useKodeverk.tsx
@@ -1,25 +1,50 @@
import useSWR from 'swr'
import { fetcher } from '@/api'
+import * as _ from 'lodash'
+import { toLower } from 'lodash'
+import { SelectOptionsFormat } from '@/service/SelectOptionsFormat'
+import { SortKodeverkArray } from '@/service/services/dolly/Utils'
type KodeverkListe = {
koder: Array
+ land?: string
+ landkode?: string
+ valuta?: string
+ valutakode?: string
}
type KodeverkType = {
- label: string
- value: string
+ label?: string
+ value?: string
}
-const getKodeverkUrl = (kodeverkNavn) => `/dolly-backend/api/v1/kodeverk/${kodeverkNavn}`
+const getKodeverkUrl = (kodeverkNavn) =>
+ kodeverkNavn.includes('Valuta')
+ ? `/testnav-kontoregister-person-proxy/api/system/v1/hent-valutakoder`
+ : `/dolly-backend/api/v1/kodeverk/${kodeverkNavn}`
export const useKodeverk = (kodeverkNavn) => {
const { data, isLoading, error } = useSWR(
- getKodeverkUrl(kodeverkNavn),
- fetcher
+ [
+ getKodeverkUrl(kodeverkNavn),
+ { accept: 'application/json', 'Content-Type': 'application/json' },
+ ],
+ ([url, headers]) => fetcher(url, headers),
)
+ const koder =
+ (_.isArray(data) &&
+ data[0]?.valutakode &&
+ data.map((kode) => ({
+ label: kode.valuta + ` (${kode.valutakode})`,
+ value: kode.valutakode,
+ }))) ||
+ _.cloneDeep(data?.koder)
+
+ const kodeverkSortert = SortKodeverkArray({ koder: koder, name: kodeverkNavn })
+
return {
- kodeverk: data,
+ kodeverk: SelectOptionsFormat.formatOptions(toLower(kodeverkNavn), kodeverkSortert, isLoading),
loading: isLoading,
error: error,
}
diff --git a/apps/dolly-frontend/src/main/js/src/utils/hooks/useTransaksjonsid.tsx b/apps/dolly-frontend/src/main/js/src/utils/hooks/useTransaksjonsid.tsx
index 37ae1faaaad..af278d04f0b 100644
--- a/apps/dolly-frontend/src/main/js/src/utils/hooks/useTransaksjonsid.tsx
+++ b/apps/dolly-frontend/src/main/js/src/utils/hooks/useTransaksjonsid.tsx
@@ -23,7 +23,7 @@ export const useTransaksjonsid = (system, ident, bestillingsid = null) => {
const { data, isLoading, error } = useSWR(
getTransaksjonsidUrl(system, ident, bestillingsid),
- fetcher
+ fetcher,
)
return {
diff --git a/apps/endringsmelding-frontend/src/main/java/no/nav/testnav/apps/endringsmeldingfrontend/EndringsmeldingFrontendApplicationStarter.java b/apps/endringsmelding-frontend/src/main/java/no/nav/testnav/apps/endringsmeldingfrontend/EndringsmeldingFrontendApplicationStarter.java
index 389734bd344..3687476c9d4 100644
--- a/apps/endringsmelding-frontend/src/main/java/no/nav/testnav/apps/endringsmeldingfrontend/EndringsmeldingFrontendApplicationStarter.java
+++ b/apps/endringsmelding-frontend/src/main/java/no/nav/testnav/apps/endringsmeldingfrontend/EndringsmeldingFrontendApplicationStarter.java
@@ -1,8 +1,7 @@
package no.nav.testnav.apps.endringsmeldingfrontend;
import lombok.RequiredArgsConstructor;
-import no.nav.testnav.apps.endringsmeldingfrontend.credentials.EndringsmeldingServiceProperties;
-import no.nav.testnav.apps.endringsmeldingfrontend.credentials.ProfilApiServiceProperties;
+import no.nav.testnav.apps.endringsmeldingfrontend.config.Consumers;
import no.nav.testnav.libs.reactivecore.config.CoreConfig;
import no.nav.testnav.libs.reactivefrontend.config.FrontendConfig;
import no.nav.testnav.libs.reactivefrontend.filter.AddAuthenticationHeaderToRequestGatewayFilterFactory;
@@ -32,24 +31,15 @@
@RequiredArgsConstructor
public class EndringsmeldingFrontendApplicationStarter {
- private final EndringsmeldingServiceProperties endringsmeldingServiceProperties;
- private final ProfilApiServiceProperties profilApiServiceProperties;
+ private final Consumers consumers;
private final TokenExchange tokenExchange;
@Bean
public RouteLocator customRouteLocator(RouteLocatorBuilder builder) {
return builder
.routes()
- .route(createRoute(
- "endringsmelding-service",
- endringsmeldingServiceProperties.getUrl(),
- addAuthenticationHeaderFilterFrom(endringsmeldingServiceProperties)
- ))
- .route(createRoute(
- "testnorge-profil-api",
- profilApiServiceProperties.getUrl(),
- addAuthenticationHeaderFilterFrom(profilApiServiceProperties)
- ))
+ .route(createRoute(consumers.getEndringsmeldingService()))
+ .route(createRoute(consumers.getTestnorgeProfilApi()))
.build();
}
@@ -66,7 +56,10 @@ private GatewayFilter addAuthenticationHeaderFilterFrom(ServerProperties serverP
});
}
- private Function> createRoute(String segment, String host, GatewayFilter filter) {
+ private Function> createRoute(ServerProperties serverProperties) {
+ var segment = serverProperties.getName();
+ var host = serverProperties.getUrl();
+ var filter = addAuthenticationHeaderFilterFrom(serverProperties);
return spec -> spec
.path("/" + segment + "/**")
.filters(filterSpec -> filterSpec
@@ -74,4 +67,5 @@ private Function> createRoute(String segment, St
.filter(filter)
).uri(host);
}
+
}
\ No newline at end of file
diff --git a/apps/endringsmelding-frontend/src/main/java/no/nav/testnav/apps/endringsmeldingfrontend/config/Consumers.java b/apps/endringsmelding-frontend/src/main/java/no/nav/testnav/apps/endringsmeldingfrontend/config/Consumers.java
new file mode 100644
index 00000000000..a9e4219a8bd
--- /dev/null
+++ b/apps/endringsmelding-frontend/src/main/java/no/nav/testnav/apps/endringsmeldingfrontend/config/Consumers.java
@@ -0,0 +1,30 @@
+package no.nav.testnav.apps.endringsmeldingfrontend.config;
+
+import lombok.Getter;
+import lombok.NoArgsConstructor;
+import lombok.Setter;
+import no.nav.testnav.libs.securitycore.domain.ServerProperties;
+import org.springframework.boot.context.properties.ConfigurationProperties;
+import org.springframework.context.annotation.Configuration;
+
+import static lombok.AccessLevel.PACKAGE;
+
+/**
+ * Samler alle placeholders for ulike {@code consumers.*}-konfigurasjon her, dvs. subklasser av {@code ServerProperties}.
+ *
+ * Husk at Spring Boot bruker relaxed binding
+ * mellom configuration properties og field names.
+ *
+ * @see ServerProperties
+ */
+@Configuration
+@ConfigurationProperties(prefix = "consumers")
+@NoArgsConstructor(access = PACKAGE)
+@Getter
+@Setter(PACKAGE)
+public class Consumers {
+
+ private ServerProperties endringsmeldingService;
+ private ServerProperties testnorgeProfilApi;
+
+}
diff --git a/apps/endringsmelding-frontend/src/main/java/no/nav/testnav/apps/endringsmeldingfrontend/credentials/EndringsmeldingServiceProperties.java b/apps/endringsmelding-frontend/src/main/java/no/nav/testnav/apps/endringsmeldingfrontend/credentials/EndringsmeldingServiceProperties.java
deleted file mode 100644
index 7a17f8e230e..00000000000
--- a/apps/endringsmelding-frontend/src/main/java/no/nav/testnav/apps/endringsmeldingfrontend/credentials/EndringsmeldingServiceProperties.java
+++ /dev/null
@@ -1,12 +0,0 @@
-package no.nav.testnav.apps.endringsmeldingfrontend.credentials;
-
-import org.springframework.boot.context.properties.ConfigurationProperties;
-import org.springframework.context.annotation.Configuration;
-
-import no.nav.testnav.libs.securitycore.domain.ServerProperties;
-
-
-@Configuration
-@ConfigurationProperties(prefix = "consumers.endringsmelding-service")
-public class EndringsmeldingServiceProperties extends ServerProperties {
-}
\ No newline at end of file
diff --git a/apps/endringsmelding-frontend/src/main/java/no/nav/testnav/apps/endringsmeldingfrontend/credentials/ProfilApiServiceProperties.java b/apps/endringsmelding-frontend/src/main/java/no/nav/testnav/apps/endringsmeldingfrontend/credentials/ProfilApiServiceProperties.java
deleted file mode 100644
index 904251d09c8..00000000000
--- a/apps/endringsmelding-frontend/src/main/java/no/nav/testnav/apps/endringsmeldingfrontend/credentials/ProfilApiServiceProperties.java
+++ /dev/null
@@ -1,12 +0,0 @@
-package no.nav.testnav.apps.endringsmeldingfrontend.credentials;
-
-import org.springframework.boot.context.properties.ConfigurationProperties;
-import org.springframework.context.annotation.Configuration;
-
-import no.nav.testnav.libs.securitycore.domain.ServerProperties;
-
-
-@Configuration
-@ConfigurationProperties(prefix = "consumers.testnorge-profil-api")
-public class ProfilApiServiceProperties extends ServerProperties {
-}
\ No newline at end of file
diff --git a/apps/endringsmelding-service/src/main/java/no/nav/testnav/endringsmeldingservice/config/Consumers.java b/apps/endringsmelding-service/src/main/java/no/nav/testnav/endringsmeldingservice/config/Consumers.java
new file mode 100644
index 00000000000..0b633903ee0
--- /dev/null
+++ b/apps/endringsmelding-service/src/main/java/no/nav/testnav/endringsmeldingservice/config/Consumers.java
@@ -0,0 +1,30 @@
+package no.nav.testnav.endringsmeldingservice.config;
+
+import lombok.Getter;
+import lombok.NoArgsConstructor;
+import lombok.Setter;
+import no.nav.testnav.libs.securitycore.domain.ServerProperties;
+import org.springframework.boot.context.properties.ConfigurationProperties;
+import org.springframework.context.annotation.Configuration;
+
+import static lombok.AccessLevel.PACKAGE;
+
+/**
+ * Samler alle placeholders for ulike {@code consumers.*}-konfigurasjon her, dvs. subklasser av {@code ServerProperties}.
+ *
+ * Husk at Spring Boot bruker relaxed binding
+ * mellom configuration properties og field names.
+ *
+ * @see ServerProperties
+ */
+@Configuration
+@ConfigurationProperties(prefix = "consumers")
+@NoArgsConstructor(access = PACKAGE)
+@Getter
+@Setter(PACKAGE)
+public class Consumers {
+
+ private ServerProperties tpsForvalterenProxy;
+ private ServerProperties tpsMessagingService;
+
+}
diff --git a/apps/endringsmelding-service/src/main/java/no/nav/testnav/endringsmeldingservice/config/credentias/TpsForvalterenProxyServiceProperties.java b/apps/endringsmelding-service/src/main/java/no/nav/testnav/endringsmeldingservice/config/credentias/TpsForvalterenProxyServiceProperties.java
deleted file mode 100644
index ab57ecdd23a..00000000000
--- a/apps/endringsmelding-service/src/main/java/no/nav/testnav/endringsmeldingservice/config/credentias/TpsForvalterenProxyServiceProperties.java
+++ /dev/null
@@ -1,12 +0,0 @@
-package no.nav.testnav.endringsmeldingservice.config.credentias;
-
-import org.springframework.boot.context.properties.ConfigurationProperties;
-import org.springframework.context.annotation.Configuration;
-
-import no.nav.testnav.libs.securitycore.domain.ServerProperties;
-
-
-@Configuration
-@ConfigurationProperties(prefix = "consumers.tps-forvalteren-proxy")
-public class TpsForvalterenProxyServiceProperties extends ServerProperties {
-}
\ No newline at end of file
diff --git a/apps/endringsmelding-service/src/main/java/no/nav/testnav/endringsmeldingservice/config/credentias/TpsMessagingServiceProperties.java b/apps/endringsmelding-service/src/main/java/no/nav/testnav/endringsmeldingservice/config/credentias/TpsMessagingServiceProperties.java
deleted file mode 100644
index 6122e2dc0ba..00000000000
--- a/apps/endringsmelding-service/src/main/java/no/nav/testnav/endringsmeldingservice/config/credentias/TpsMessagingServiceProperties.java
+++ /dev/null
@@ -1,11 +0,0 @@
-package no.nav.testnav.endringsmeldingservice.config.credentias;
-
-import no.nav.testnav.libs.securitycore.domain.ServerProperties;
-import org.springframework.boot.context.properties.ConfigurationProperties;
-import org.springframework.context.annotation.Configuration;
-
-
-@Configuration
-@ConfigurationProperties(prefix = "consumers.tps-messaging-service")
-public class TpsMessagingServiceProperties extends ServerProperties {
-}
\ No newline at end of file
diff --git a/apps/endringsmelding-service/src/main/java/no/nav/testnav/endringsmeldingservice/consumer/TpsForvalterConsumer.java b/apps/endringsmelding-service/src/main/java/no/nav/testnav/endringsmeldingservice/consumer/TpsForvalterConsumer.java
index 6ca5ce7490d..c35e4f060e6 100644
--- a/apps/endringsmelding-service/src/main/java/no/nav/testnav/endringsmeldingservice/consumer/TpsForvalterConsumer.java
+++ b/apps/endringsmelding-service/src/main/java/no/nav/testnav/endringsmeldingservice/consumer/TpsForvalterConsumer.java
@@ -1,7 +1,7 @@
package no.nav.testnav.endringsmeldingservice.consumer;
import com.fasterxml.jackson.databind.ObjectMapper;
-import no.nav.testnav.endringsmeldingservice.config.credentias.TpsForvalterenProxyServiceProperties;
+import no.nav.testnav.endringsmeldingservice.config.Consumers;
import no.nav.testnav.endringsmeldingservice.consumer.command.SendDoedsmeldingCommand;
import no.nav.testnav.endringsmeldingservice.consumer.command.SendFoedselsmeldingCommand;
import no.nav.testnav.endringsmeldingservice.consumer.dto.DoedsmeldingDTO;
@@ -27,11 +27,11 @@ public class TpsForvalterConsumer {
private final TokenExchange accessTokenService;
public TpsForvalterConsumer(
- TpsForvalterenProxyServiceProperties serverProperties,
+ Consumers consumers,
TokenExchange tokenExchange,
ObjectMapper objectMapper) {
- this.serverProperties = serverProperties;
+ serverProperties = consumers.getTpsForvalterenProxy();
this.accessTokenService = tokenExchange;
ExchangeStrategies jacksonStrategy = ExchangeStrategies.builder()
diff --git a/apps/endringsmelding-service/src/main/java/no/nav/testnav/endringsmeldingservice/consumer/TpsMessagingConsumer.java b/apps/endringsmelding-service/src/main/java/no/nav/testnav/endringsmeldingservice/consumer/TpsMessagingConsumer.java
index 303dcad5d2d..dbed99e80e6 100644
--- a/apps/endringsmelding-service/src/main/java/no/nav/testnav/endringsmeldingservice/consumer/TpsMessagingConsumer.java
+++ b/apps/endringsmelding-service/src/main/java/no/nav/testnav/endringsmeldingservice/consumer/TpsMessagingConsumer.java
@@ -1,7 +1,7 @@
package no.nav.testnav.endringsmeldingservice.consumer;
import com.fasterxml.jackson.databind.ObjectMapper;
-import no.nav.testnav.endringsmeldingservice.config.credentias.TpsMessagingServiceProperties;
+import no.nav.testnav.endringsmeldingservice.config.Consumers;
import no.nav.testnav.endringsmeldingservice.consumer.command.GetIdentEnvironmentsCommand;
import no.nav.testnav.libs.data.tpsmessagingservice.v1.PersonMiljoeDTO;
import no.nav.testnav.libs.reactivesecurity.exchange.TokenExchange;
@@ -21,11 +21,11 @@ public class TpsMessagingConsumer {
private final TokenExchange accessTokenService;
public TpsMessagingConsumer(
- TpsMessagingServiceProperties serverProperties,
+ Consumers consumers,
TokenExchange tokenExchange,
ObjectMapper objectMapper) {
- this.serverProperties = serverProperties;
+ serverProperties = consumers.getTpsMessagingService();
this.accessTokenService = tokenExchange;
ExchangeStrategies jacksonStrategy = ExchangeStrategies.builder()
diff --git a/apps/faste-data-frontend/src/main/java/no/nav/testnav/apps/fastedatafrontend/FasteDataFrontendApplicationStarter.java b/apps/faste-data-frontend/src/main/java/no/nav/testnav/apps/fastedatafrontend/FasteDataFrontendApplicationStarter.java
index cc6f50d6253..dc508c8cdaa 100644
--- a/apps/faste-data-frontend/src/main/java/no/nav/testnav/apps/fastedatafrontend/FasteDataFrontendApplicationStarter.java
+++ b/apps/faste-data-frontend/src/main/java/no/nav/testnav/apps/fastedatafrontend/FasteDataFrontendApplicationStarter.java
@@ -2,11 +2,7 @@
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
-import no.nav.testnav.apps.fastedatafrontend.credentials.OrganisasjonFasteDataServiceProperties;
-import no.nav.testnav.apps.fastedatafrontend.credentials.OrganisasjonServiceProperties;
-import no.nav.testnav.apps.fastedatafrontend.credentials.PersonFasteDataServiceProperties;
-import no.nav.testnav.apps.fastedatafrontend.credentials.PersonServiceProperties;
-import no.nav.testnav.apps.fastedatafrontend.credentials.ProfilApiServiceProperties;
+import no.nav.testnav.apps.fastedatafrontend.config.Consumers;
import no.nav.testnav.libs.reactivecore.config.CoreConfig;
import no.nav.testnav.libs.reactivefrontend.config.FrontendConfig;
import no.nav.testnav.libs.reactivefrontend.filter.AddAuthenticationHeaderToRequestGatewayFilterFactory;
@@ -37,42 +33,18 @@
@RequiredArgsConstructor
public class FasteDataFrontendApplicationStarter {
- private final ProfilApiServiceProperties profilApiServiceProperties;
- private final OrganisasjonServiceProperties organisasjonServiceProperties;
- private final OrganisasjonFasteDataServiceProperties organisasjonFasteDataServiceProperties;
- private final PersonServiceProperties personServiceProperties;
- private final PersonFasteDataServiceProperties personFasteDataServiceProperties;
+ private final Consumers consumers;
private final TokenExchange tokenExchange;
@Bean
public RouteLocator customRouteLocator(RouteLocatorBuilder builder) {
return builder
.routes()
- .route(createRoute(
- "testnav-organisasjon-service",
- organisasjonServiceProperties.getUrl(),
- addAuthenticationHeaderFilterFrom(organisasjonServiceProperties)
- ))
- .route(createRoute(
- "testnav-organisasjon-faste-data-service",
- organisasjonFasteDataServiceProperties.getUrl(),
- addAuthenticationHeaderFilterFrom(organisasjonFasteDataServiceProperties)
- ))
- .route(createRoute(
- "testnorge-profil-api",
- profilApiServiceProperties.getUrl(),
- addAuthenticationHeaderFilterFrom(profilApiServiceProperties)
- ))
- .route(createRoute(
- "testnav-person-service",
- personServiceProperties.getUrl(),
- addAuthenticationHeaderFilterFrom(personServiceProperties)
- ))
- .route(createRoute(
- "testnav-person-faste-data-service",
- personFasteDataServiceProperties.getUrl(),
- addAuthenticationHeaderFilterFrom(personFasteDataServiceProperties)
- ))
+ .route(createRoute(consumers.getTestnavOrganisasjonService()))
+ .route(createRoute(consumers.getTestnavOrganisasjonFasteDataService()))
+ .route(createRoute(consumers.getTestnorgeProfilApi()))
+ .route(createRoute(consumers.getTestnavPersonService()))
+ .route(createRoute(consumers.getTestnavPersonFasteDataService()))
.build();
}
@@ -89,7 +61,10 @@ private GatewayFilter addAuthenticationHeaderFilterFrom(ServerProperties serverP
});
}
- private Function> createRoute(String segment, String host, GatewayFilter filter) {
+ private Function> createRoute(ServerProperties serverProperties) {
+ var segment = serverProperties.getName();
+ var host = serverProperties.getUrl();
+ var filter = addAuthenticationHeaderFilterFrom(serverProperties);
log.info("Redirect fra segment {} til host {}.", segment, host);
return spec -> spec
.path("/" + segment + "/**")
@@ -98,4 +73,5 @@ private Function