Skip to content

Commit

Permalink
Merge branch 'master' into feature/vise-type-bestilling
Browse files Browse the repository at this point in the history
# Conflicts:
#	apps/dolly-frontend/src/main/js/package-lock.json
  • Loading branch information
stigus committed Mar 5, 2024
2 parents 9619a9a + a8bd28a commit b28e03d
Show file tree
Hide file tree
Showing 31 changed files with 185 additions and 489 deletions.
2 changes: 1 addition & 1 deletion apps/adresse-service/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ spec:
limits:
memory: 2048Mi
requests:
cpu: 300m
cpu: 200m
memory: 1024Mi
accessPolicy:
inbound:
Expand Down
7 changes: 7 additions & 0 deletions apps/bruker-service/config.test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,13 @@ metadata:
spec:
image: "{{image}}"
port: 8080
azure:
application:
enabled: true
tenant: nav.no
claims:
groups:
- id: 9c7efec1-1599-4216-a67e-6fd53a6a951c
tokenx:
enabled: true
accessPolicy:
Expand Down
7 changes: 7 additions & 0 deletions apps/bruker-service/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,13 @@ metadata:
spec:
image: "{{image}}"
port: 8080
azure:
application:
enabled: true
tenant: nav.no
claims:
groups:
- id: 9c7efec1-1599-4216-a67e-6fd53a6a951c
tokenx:
enabled: true
accessPolicy:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
@RequiredArgsConstructor
public class ArbeidsplassenPutCVCommand implements Callable<Flux<ArbeidsplassenCVStatusDTO>> {

private static final String ARBEIDSPLASSEN_CV_URL = "/rest/v2/cv";
private static final String ARBEIDSPLASSEN_CV_URL = "/rest/v3/cv";
private static final String FNR = "fnr";

private final WebClient webClient;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@
import no.nav.dolly.domain.resultset.dolly.DollyPerson;
import no.nav.dolly.errorhandling.ErrorStatusDecoder;
import no.nav.dolly.util.TransactionHelperService;
import no.nav.testnav.libs.data.pdlforvalter.v1.SikkerhetstiltakDTO;
import no.nav.testnav.libs.data.tpsmessagingservice.v1.SpraakDTO;
import no.nav.testnav.libs.data.tpsmessagingservice.v1.TpsMeldingResponseDTO;
import org.apache.commons.lang3.StringUtils;
Expand All @@ -26,7 +25,6 @@
import java.util.List;
import java.util.Map;
import java.util.Objects;
import java.util.Optional;
import java.util.stream.Collectors;
import java.util.stream.Stream;

Expand Down Expand Up @@ -98,15 +96,7 @@ public Flux<ClientFuture> gjenopprett(RsDollyUtvidetBestilling bestilling, Dolly
sendEgenansattSlett(bestilling, dollyPerson.getIdent())
.map(respons -> Map.of("Egenansatt_slett", respons)),
sendEgenansatt(bestilling, dollyPerson.getIdent())
.map(respons -> Map.of("Egenansatt_opprett", respons)),
sendSikkerhetstiltakSlett(personer.stream()
.filter(personBolk -> personBolk.getIdent().equals(dollyPerson.getIdent()))
.findFirst())
.map(respons -> Map.of("Sikkerhetstiltak_slett", respons)),
sendSikkerhetstiltakOpprett(personer.stream()
.filter(personBolk -> personBolk.getIdent().equals(dollyPerson.getIdent()))
.findFirst())
.map(respons -> Map.of("Sikkerhetstiltak_opprett", respons))
.map(respons -> Map.of("Egenansatt_opprett", respons))
))
.map(respons -> respons.entrySet().stream()
.map(entry -> getStatus(entry.getKey(), entry.getValue()))
Expand All @@ -127,8 +117,7 @@ private boolean isTpsMessage(RsDollyUtvidetBestilling bestilling) {
nonNull(bestilling.getSkjerming()) ||

(nonNull(bestilling.getPdldata()) &&
nonNull(bestilling.getPdldata().getPerson()) &&
!bestilling.getPdldata().getPerson().getSikkerhetstiltak().isEmpty());
nonNull(bestilling.getPdldata().getPerson()));
}

private ClientFuture futurePersist(DollyPerson dollyPerson, BestillingProgress progress, String status) {
Expand Down Expand Up @@ -178,30 +167,6 @@ private Flux<PdlPersonBolk.PersonBolk> getPersonData(List<String> identer) {
.filter(personBolk -> nonNull(personBolk.getPerson()));
}

private Mono<List<TpsMeldingResponseDTO>> sendSikkerhetstiltakSlett(Optional<PdlPersonBolk.PersonBolk> personBolk) {

return personBolk.isPresent() && !personBolk.get().getPerson().getSikkerhetstiltak().isEmpty() ?

tpsMessagingConsumer.deleteSikkerhetstiltakRequest(
personBolk.get().getIdent(), null)
.collectList() :

Mono.just(emptyList());
}

private Mono<List<TpsMeldingResponseDTO>> sendSikkerhetstiltakOpprett(Optional<PdlPersonBolk.PersonBolk> personBolk) {

return personBolk.isPresent() && !personBolk.get().getPerson().getSikkerhetstiltak().isEmpty() ?

tpsMessagingConsumer.sendSikkerhetstiltakRequest(
personBolk.get().getIdent(), null,
personBolk.get().getPerson().getSikkerhetstiltak()
.stream().findFirst().orElse(new SikkerhetstiltakDTO()))
.collectList() :

Mono.just(emptyList());
}

private Mono<List<TpsMeldingResponseDTO>> sendSpraakkode(RsDollyUtvidetBestilling bestilling, String ident) {

return nonNull(bestilling.getTpsMessaging()) && nonNull(bestilling.getTpsMessaging().getSpraakKode()) ?
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
import no.nav.dolly.bestilling.tpsmessagingservice.command.EgenansattDeleteCommand;
import no.nav.dolly.bestilling.tpsmessagingservice.command.EgenansattPostCommand;
import no.nav.dolly.bestilling.tpsmessagingservice.command.PersonGetCommand;
import no.nav.dolly.bestilling.tpsmessagingservice.command.SikkerhetstiltakDeleteCommand;
import no.nav.dolly.bestilling.tpsmessagingservice.command.TpsMessagingPostCommand;
import no.nav.dolly.config.Consumers;
import no.nav.dolly.metrics.Timed;
Expand All @@ -33,7 +32,6 @@ public class TpsMessagingConsumer implements ConsumerStatus {
private static final String BASE_URL = "/api/v1/personer/{ident}";
private static final String UTENLANDSK_BANKKONTO_URL = BASE_URL + "/bankkonto-utenlandsk";
private static final String NORSK_BANKKONTO_URL = BASE_URL + "/bankkonto-norsk";
private static final String SIKKERHETSTILTAK_URL = BASE_URL + "/sikkerhetstiltak";
private static final String SPRAAKKODE_URL = BASE_URL + "/spraakkode";

private final WebClient webClient;
Expand Down Expand Up @@ -71,21 +69,6 @@ public Flux<TpsMeldingResponseDTO> sendNorskBankkontoRequest(String ident, List<
new TpsMessagingPostCommand(webClient, ident, miljoer, body, NORSK_BANKKONTO_URL, token.getTokenValue()).call());
}

@Timed(name = "providers", tags = {"operation", "tps_messaging_deleteSikkerhetstiltak"})
public Flux<TpsMeldingResponseDTO> deleteSikkerhetstiltakRequest(String ident, List<String> miljoer) {

return tokenService.exchange(serverProperties)
.flatMapMany(token -> new SikkerhetstiltakDeleteCommand(webClient, ident, miljoer, token.getTokenValue()).call());
}

@Timed(name = "providers", tags = {"operation", "tps_messaging_createSikkerhetstiltak"})
public Flux<TpsMeldingResponseDTO> sendSikkerhetstiltakRequest(String ident, List<String> miljoer, Object body) {

return tokenService.exchange(serverProperties)
.flatMapMany(token ->
new TpsMessagingPostCommand(webClient, ident, miljoer, body, SIKKERHETSTILTAK_URL, token.getTokenValue()).call());
}

@Timed(name = "providers", tags = {"operation", "tps_messaging_createSkjerming"})
public Flux<TpsMeldingResponseDTO> sendEgenansattRequest(String ident, List<String> miljoer, LocalDate fraOgMed) {

Expand Down

This file was deleted.

2 changes: 1 addition & 1 deletion apps/dolly-frontend/config.idporten.yml
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ spec:
path: /internal/metrics
resources:
requests:
cpu: 1000m
cpu: 250m
memory: 1024Mi
limits:
memory: 2048Mi
Expand Down
2 changes: 1 addition & 1 deletion apps/dolly-frontend/config.test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ spec:
path: /internal/metrics
resources:
requests:
cpu: 1000m
cpu: 500m
memory: 1024Mi
limits:
memory: 2048Mi
Expand Down
2 changes: 1 addition & 1 deletion apps/dolly-frontend/config.unstable.yml
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ spec:
path: /internal/metrics
resources:
requests:
cpu: 1000m
cpu: 100m
memory: 1024Mi
limits:
memory: 2048Mi
Expand Down
2 changes: 1 addition & 1 deletion apps/dolly-frontend/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ spec:
path: /internal/metrics
resources:
requests:
cpu: 1000m
cpu: 500m
memory: 1024Mi
limits:
memory: 2048Mi
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -129,4 +129,4 @@ private Function<PredicateSpec, Buildable<Route>> createRoute(String segment, St
.filters(filter, addUserJwtHeaderFilter())
).uri(host);
}
}
}
24 changes: 22 additions & 2 deletions apps/dolly-frontend/src/main/js/src/RootComponent.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,9 @@ import {
ReactIntegration,
ReactRouterVersion,
} from '@grafana/faro-react'
import { useRouteError } from 'react-router'
import { AppError } from '@/components/ui/appError/AppError'
import { navigateToLogin } from '@/components/utlogging/navigateToLogin'

initializeFaro({
paused: window.location.hostname.includes('localhost'),
Expand All @@ -46,6 +49,23 @@ initializeFaro({
],
})

const ErrorView = () => {
console.error('Applikasjonen har støtt på en feil')
const error: any = useRouteError()
console.error(error)

const errors = [
'Failed to fetch dynamically imported module',
'Unable to preload CSS',
"Cannot destructure property of 'register'",
]

if (errors.some((e) => error?.message?.includes(e))) {
navigateToLogin(error?.message)
}
return <AppError error={error} stackTrace={error.stackTrace} />
}

export const RootComponent = () => (
<Provider store={store}>
<Router history={history}>
Expand All @@ -57,9 +77,9 @@ export const RootComponent = () => (
}}
>
<FaroRoutes>
<Route path="/bruker" element={<BrukerPage />} />
<Route path="/login" element={<LoginPage />} />
<Route path="*" element={<App />} />
<Route errorElement={<ErrorView />} path="/bruker" element={<BrukerPage />} />
<Route errorElement={<ErrorView />} path="*" element={<App />} />
</FaroRoutes>
</SWRConfig>
</ErrorBoundary>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,14 @@ describe('<AppError />', () => {
)
})
})

describe('<AppError />', () => {
it('renders', () => {
cy.mount(
<AppError
error={'Failed to fetch dynamically imported module'}
stackTrace={'Dynamic import feilet'}
/>,
)
})
})
Loading

0 comments on commit b28e03d

Please sign in to comment.