Skip to content

Commit

Permalink
Merge pull request #3461 from navikt/feature/tenor-personsoek
Browse files Browse the repository at this point in the history
Feature/tenor personsoek
  • Loading branch information
betsytraran authored Apr 10, 2024
2 parents 41f0832 + 95bc909 commit 1e5a320
Show file tree
Hide file tree
Showing 54 changed files with 2,125 additions and 114 deletions.
1 change: 1 addition & 0 deletions apps/dolly-frontend/config.idporten.yml
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ spec:
- application: testnav-person-service
- application: generer-navn-service
- application: testnav-kodeverk-service
- application: testnav-tenor-search-service
external:
- host: testnav-pensjon-testdata-facade-proxy.dev-fss-pub.nais.io
- host: testnav-sigrunstub-proxy.dev-fss-pub.nais.io
Expand Down
1 change: 1 addition & 0 deletions apps/dolly-frontend/config.test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ spec:
- application: testnav-person-service
- application: generer-navn-service
- application: testnav-kodeverk-service
- application: testnav-tenor-search-service
external:
- host: testnav-pensjon-testdata-facade-proxy.dev-fss-pub.nais.io
- host: testnav-sigrunstub-proxy.dev-fss-pub.nais.io
Expand Down
1 change: 1 addition & 0 deletions apps/dolly-frontend/config.unstable.yml
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ spec:
- application: testnav-adresse-service
- application: testnorge-tilbakemelding-api
- application: testnav-kodeverk-service
- application: testnav-tenor-search-service
external:
- host: testnav-pensjon-testdata-facade-proxy.dev-fss-pub.nais.io
- host: testnav-sigrunstub-proxy.dev-fss-pub.nais.io
Expand Down
1 change: 1 addition & 0 deletions apps/dolly-frontend/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ spec:
- application: testnav-adresse-service
- application: testnorge-tilbakemelding-api
- application: testnav-kodeverk-service
- application: testnav-tenor-search-service
external:
- host: testnav-pensjon-testdata-facade-proxy.dev-fss-pub.nais.io
- host: testnav-sigrunstub-proxy.dev-fss-pub.nais.io
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,7 @@ public RouteLocator customRouteLocator(RouteLocatorBuilder builder) {
.route(createRoute(consumers.getTestnavPersonService(), "person-service"))
.route(createRoute(consumers.getGenererNavnService()))
.route(createRoute(consumers.getTestnavKodeverkService()))
.route(createRoute(consumers.getTestnavTenorSearchService()))
.build();
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,4 +61,6 @@ public class Consumers {
private ServerProperties testnavVarslingerService;
private ServerProperties testnorgeProfilApi;
private ServerProperties testnorgeTilbakemeldingApi;
private ServerProperties testnavTenorSearchService;

}
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ public RouterFunction<ServerResponse> htmlRouter(@Value("classpath:/static/index
.andRoute(RequestPredicates.GET("/login/**"), indexHandler)
.andRoute(RequestPredicates.GET("/bruker/**"), indexHandler)
.andRoute(RequestPredicates.GET("/team/**"), indexHandler)
.andRoute(RequestPredicates.GET("/dollysoek/**"), indexHandler);
.andRoute(RequestPredicates.GET("/dollysoek/**"), indexHandler)
.andRoute(RequestPredicates.GET("/tenor/**"), indexHandler);
}
}
58 changes: 58 additions & 0 deletions apps/dolly-frontend/src/main/js/cypress/e2e/TenorSoek.cy.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
import { CypressSelector } from '../mocks/Selectors'
import {
responseFalse,
responseTrue,
tenorSoekOversiktMock,
tenorSoekTestdataMock,
} from '../mocks/BasicMocks'

describe('Tenor-søk testing', () => {
const tenorSoekOversikt = new RegExp(
/testnav-tenor-search-service\/api\/v1\/tenor\/testdata\/oversikt\?antall=10&side=0/,
)
const tenorSoekTestdata = new RegExp(
/testnav-tenor-search-service\/api\/v1\/tenor\/testdata\?kilde=FREG&type=AlleFelter/,
)
const dollyBackendFinnesTrue = new RegExp(/dolly-backend\/api\/v1\/ident\/finnes\/12345678912/)
const dollyBackendFinnesFalse = new RegExp(/dolly-backend\/api\/v1\/ident\/finnes\/98765432198/)

it('passes', () => {
cy.visit('')

cy.intercept({ method: 'POST', url: tenorSoekOversikt }, tenorSoekOversiktMock)
cy.intercept({ method: 'POST', url: tenorSoekTestdata }, tenorSoekTestdataMock)
cy.intercept({ method: 'GET', url: dollyBackendFinnesTrue }, responseTrue)
cy.intercept({ method: 'GET', url: dollyBackendFinnesFalse }, responseFalse)

// Naviger til Tenor-soek og gjoer et soek
cy.dollyGet(CypressSelector.BUTTON_HEADER_FINNPERSON).click()
cy.dollyGet(CypressSelector.BUTTON_HEADER_TENOR).click()
cy.get('h1').contains('Søk etter personer i Tenor').should('exist')
cy.dollyGet(CypressSelector.CHECKBOX_TENORSOEK).click()
cy.wait(1000)

// Velg person som ikke ligger i Dolly og start import av personen
cy.get('div').contains('TIGER ULV').click()
cy.get('h2').contains('TIGER ULV').should('exist')
cy.dollyGet(CypressSelector.BUTTON_IMPORTER_PERSONER).click()
cy.wait(500)
cy.get('h1').contains('Importer person').should('exist')
cy.dollyGet(CypressSelector.BUTTON_IMPORTER).click()
cy.wait(500)
cy.get('.bestillingsveileder').should('exist')
cy.dollyGet(CypressSelector.BUTTON_AVBRYT).click()
cy.wait(500)
cy.dollyGet(CypressSelector.BUTTON_BEKREFT).click()
cy.wait(1000)
cy.get('h1').contains('Søk etter personer i Tenor').should('exist')

// Naviger til foerste person som ligger i Dolly
cy.dollyGet(CypressSelector.BUTTON_VIS_I_GRUPPE).first().click()
cy.wait(500)
cy.get('h1').contains('Testytest').should('exist')

// Gaa til soek fra gruppe
cy.dollyGet(CypressSelector.BUTTON_IMPORTER_PERSONER).click()
cy.get('h1').contains('Søk etter personer i Tenor').should('exist')
})
})
6 changes: 0 additions & 6 deletions apps/dolly-frontend/src/main/js/cypress/e2e/Test-Norge.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,5 @@ describe('Test-Norge søk testing', () => {
cy.wait(200)

cy.get('.skjemaelement__feilmelding').should('not.exist')

cy.dollyGet(CypressSelector.BUTTON_HEADER_PERSONER).click()
cy.get('div').contains('Testytest').click()
cy.dollyGet(CypressSelector.BUTTON_IMPORTER_PERSONER).click()

cy.dollyGet(CypressSelector.TITLE_TESTNORGE).should('exist')
})
})
69 changes: 69 additions & 0 deletions apps/dolly-frontend/src/main/js/cypress/mocks/BasicMocks.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -1882,3 +1882,72 @@ export const bestillingFragmentNavigerMock = {
bestillingNavigerTil: 1,
sidetall: 0,
}

export const tenorSoekOversiktMock = {
status: 'OK',
data: {
treff: 2,
rader: 2,
offset: 0,
nesteSide: null,
seed: 1111,
personer: [
{
id: '12345678912',
fornavn: 'TESTYTEST',
etternavn: 'CAFE',
tenorRelasjoner: ['Freg'],
},
{
id: '98765432198',
fornavn: 'TIGER',
etternavn: 'ULV',
tenorRelasjoner: ['Freg'],
},
],
},
query: 'legitimasjonsdokument:*',
error: null,
}

export const tenorSoekTestdataMock = {
status: 'OK',
data: {
treff: 2,
rader: 2,
offset: 0,
nesteSide: null,
seed: 1111,
dokumentListe: [
{
foedselsdato: '1992-06-04',
identifikator: ['12345678912'],
kjoenn: 'kvinne',
personstatus: 'midlertidig',
sivilstand: 'gift',
tenorMetadata: {
kildedata: '{}',
},
visningnavn: 'TESTYTEST CAFE',
},
{
foedselsdato: '1974-02-02',
identifikator: ['98765432198'],
kjoenn: 'kvinne',
personstatus: 'bosatt',
sivilstand: 'ugift',
tenorMetadata: {
kildedata: '{}',
},
visningnavn: 'TIGER ULV',
},
],
fasetter: {},
},
query: '',
error: null,
}

export const responseTrue = { body: true }

export const responseFalse = { body: false }
7 changes: 7 additions & 0 deletions apps/dolly-frontend/src/main/js/cypress/mocks/Selectors.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ export enum CypressSelector {
INPUT_MINSIDE_SOEK_MAL = 'input-minside-mal',
INPUT_DOLLY_SOEK = 'input-dolly-soek',
INPUT_TESTNORGE_FNR = 'input-testnorge-fnr',
INPUT_TENORSOEK_FNR = 'input-tenorsoek-fnr',
INPUT_NAVN = 'input-navn',
INPUT_NY_GRUPPE_NAVN = 'input-ny-gruppe-navn',
INPUT_NY_GRUPPE_HENSIKT = 'input-ny-gruppe-hensikt',
Expand Down Expand Up @@ -44,6 +45,8 @@ export enum CypressSelector {
BUTTON_FJERN_ALLE = 'button-fjern-alle',
BUTTON_VIDERE = 'button-videre',
BUTTON_TILBAKE = 'button-tilbake',
BUTTON_AVBRYT = 'button-avbryt',
BUTTON_BEKREFT = 'button-bekreft',
BUTTON_FLYTT_PERSONER = 'button-flytt-personer',
BUTTON_FLYTT_PERSONER_AVBRYT = 'button-flytt-personer-avbryt',
BUTTON_VARSLING_LUKK = 'button-varsling-lukk',
Expand All @@ -55,13 +58,15 @@ export enum CypressSelector {
BUTTON_HEADER_FINNPERSON = 'button-header-finnperson',
BUTTON_HEADER_DOLLYSOEK = 'button-header-dollysoek',
BUTTON_HEADER_TESTNORGE = 'button-header-testnorge',
BUTTON_HEADER_TENOR = 'button-header-tenor',
BUTTON_HEADER_ENDRINGSMELDING = 'button-header-endringsmelding',
BUTTON_PROFIL = 'button-minside',
BUTTON_PROFIL_MINSIDE = 'button-profil-minside',
BUTTON_SEND_FORBEDRINGSOENSKE = 'button-send-forbedringsoenske',
BUTTON_FULLFOER_BESTILLING = 'button-fullfoer-bestilling',
BUTTON_AVBRYT_BESTILLING = 'button-avbryt-bestilling',
BUTTON_IMPORTER_PERSONER = 'button-importer-personer',
BUTTON_IMPORTER = 'button-importer',
BUTTON_MINSIDE_ENDRE_MALNAVN = 'button-minside-endre-malnavn',
BUTTON_MINSIDE_LAGRE_MALNAVN = 'button-minside-lagre-malnavn',
BUTTON_LUKK_BESTILLING_RESULTAT = 'button-lukk-bestilling-resultat',
Expand All @@ -82,10 +87,12 @@ export enum CypressSelector {
BUTTON_GJENOPPRETT_GRUPPE = 'button-gjenopprett-gruppe',
BUTTON_REDIGER_GRUPPE = 'button-rediger-gruppe',
BUTTON_TIDLIGEREBESTILLINGER_NAVIGER = 'button-tidligerebestillinger-naviger',
BUTTON_PERSON_TENORSOEK = 'button-person-tenorsoek',
SELECT_PERSON_SEARCH = 'select-person-search',
SELECT_TAGS = 'select-tags',
HOVER_MILJOE = 'hover-miljoe',
CHECKBOX_FORBEDRING_ANONYM = 'checkbox-forbedring-anonym',
CHECKBOX_TENORSOEK = 'checkbox-tenorsoek',
ERROR_MESSAGE_NAVIGERING = 'error-message-navigering',
EXPANDABLE_PERSONINFORMASJON = 'expandable-personinformasjon',
CONTAINER_VALGTE_PERSONER = 'container-valgte-personer',
Expand Down
5 changes: 5 additions & 0 deletions apps/dolly-frontend/src/main/js/proxy-routes.json
Original file line number Diff line number Diff line change
Expand Up @@ -223,5 +223,10 @@
"target": "http://localhost:8020",
"changeOrigin": true,
"secure": false
},
"/testnav-tenor-search-service/api": {
"target": "http://localhost:8020",
"changeOrigin": true,
"secure": false
}
}
4 changes: 3 additions & 1 deletion apps/dolly-frontend/src/main/js/src/allRoutes.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ const UI = lazy(() => import('@/pages/ui/index'))
const TestnorgePage = lazy(() => import('@/pages/testnorgePage/index'))
const Endringsmelding = lazy(() => import('@/pages/endringsmelding/Endringsmelding'))
const DollySoekPage = lazy(() => import('@/pages/dollySoek/DollySoekPage'))
const TenorSoekPage = lazy(() => import('@/pages/tenorSoek/TenorSoekPage'))

const GruppeBreadcrumb = (props) => <span>Gruppe #{props.match?.params?.gruppeId}</span>

Expand Down Expand Up @@ -45,8 +46,9 @@ const allRoutes = [
},
{ path: '/minside', breadcrumb: 'Min side', element: () => <MinSide /> },
{ path: '/ui', breadcrumb: 'UI demo', element: () => <UI /> },
{ path: '/testnorge', breadcrumb: 'Søk i Test-Norge', element: () => <TestnorgePage /> },
{ path: '/dollysoek', breadcrumb: 'Søk i Dolly', element: () => <DollySoekPage /> },
{ path: '/testnorge', breadcrumb: 'Søk i Test-Norge', element: () => <TestnorgePage /> },
{ path: '/tenor', breadcrumb: 'Søk i Tenor', element: () => <TenorSoekPage /> },
{
path: '/importer',
breadcrumb: 'Importer',
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ export const BestillingsveilederHeader = () => {
const opts = useContext(BestillingsveilederContext)
const ident = getLeggTilIdent(opts.personFoerLeggTil, opts.identMaster)
const importFra = opts.is.leggTil && opts.identMaster === 'PDL' ? 'Test-Norge' : undefined
const { gruppe } = useGruppeById(opts?.gruppeId)
const { gruppe } = useGruppeById(opts?.gruppeId || opts?.gruppe?.id)

if (opts.is.nyOrganisasjon || opts.is.nyStandardOrganisasjon || opts.is.nyOrganisasjonFraMal) {
const titleValue = opts.is.nyStandardOrganisasjon ? 'Standard organisasjon' : 'Organisasjon'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ export const AlderspensjonForm = () => {
const foedselListe = opts?.importPersoner?.flatMap(
(person) => person?.data?.hentPerson?.foedsel,
)
if (foedselListe?.some((f) => f.foedselsaar < 1944 && !f.metadata?.historisk)) {
if (foedselListe?.some((f) => f?.foedselsaar < 1944 && !f?.metadata?.historisk)) {
ugyldigFoedselsaar = true
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ export const isEmpty = (attributt, excludeList = []) => {
}
return result
}

return (
attributt?.empty ||
Object.values(flattenData(attributt)).every((x) => x === null || x === '' || x === false)
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
import React from 'react'
import Loading from '@/components/ui/loading/Loading'
import Icon from '@/components/ui/icon/Icon'
import { TitleValue } from '@/components/ui/titleValue/TitleValue'

type SkatteetatenVisningProps = {
data: {
tenorRelasjoner: string[]
}
loading: boolean
}

// Midlertidig visning av daglig leder-rolle fra Tenor. Skrives om naar det er behov for aa vise flere Tenor-data.
export const SkatteetatenVisning = ({ data, loading }: SkatteetatenVisningProps) => {
if (loading) {
return <Loading label="Laster Tenor-data ..." />
}

const harDagligLederRolle = data?.tenorRelasjoner?.includes('BrregErFr')

if (!data || !harDagligLederRolle) {
return null
}

return (
<div style={{ marginTop: '15px' }}>
<div className="sub-overskrift" style={{ backgroundColor: '#4B797A', color: '#fff' }}>
<Icon fontSize={'1.5rem'} kind="tenor" />
<h3>Data fra Tenor</h3>
</div>
<h4 style={{ margin: '10px 0' }}>Enhetsregisteret og Foretaksregisteret</h4>
<div className="person-visning_content">
<TitleValue title="Roller" value="Daglig leder" />
</div>
</div>
)
}
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,14 @@ export const FinnPersonDropdown = () => {
<Icon kind="search" fontSize="1.5rem" />
Søk i Test-Norge
</Dropdown.Menu.List.Item>
<Dropdown.Menu.List.Item
data-cy={CypressSelector.BUTTON_HEADER_TENOR}
onClick={() => navigate('/tenor')}
style={{ color: '#212529' }}
>
<Icon kind="search" fontSize="1.5rem" />
Søk i Tenor
</Dropdown.Menu.List.Item>
</Dropdown.Menu.List>
</Dropdown.Menu>
</Dropdown>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import DollyModal from '@/components/ui/modal/DollyModal'
import Icon from '@/components/ui/icon/Icon'

import './AvbrytModal.less'
import { CypressSelector } from '../../../../../cypress/mocks/Selectors'

type Props = {
action: Function
Expand All @@ -16,7 +17,7 @@ export const AvbrytButton = ({ action, children }: Props) => {

return (
<React.Fragment>
<NavButton variant={'danger'} onClick={openModal}>
<NavButton data-cy={CypressSelector.BUTTON_AVBRYT} variant={'danger'} onClick={openModal}>
Avbryt
</NavButton>
<DollyModal isOpen={modalIsOpen} closeModal={closeModal} width="fit-content" overflow="auto">
Expand All @@ -31,6 +32,7 @@ export const AvbrytButton = ({ action, children }: Props) => {
Nei
</NavButton>
<NavButton
data-cy={CypressSelector.BUTTON_BEKREFT}
onClick={() => {
closeModal()
return action()
Expand Down
Loading

0 comments on commit 1e5a320

Please sign in to comment.