Skip to content

Commit

Permalink
Merge branch 'main' into remix-single-fetch
Browse files Browse the repository at this point in the history
  • Loading branch information
ssaegrov committed Dec 20, 2024
2 parents 639bb20 + cc9d4ac commit 9e57ef0
Show file tree
Hide file tree
Showing 184 changed files with 9,162 additions and 6,804 deletions.
6 changes: 4 additions & 2 deletions .env.example
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,8 @@ SANITY_PROJECT_ID=rt6o382n
SANITY_ACCESS_TOKEN=""
SANITY_DATASET=development

# Finn unleash token her https://dagpenger-unleash-web.nav.cloud.nais.io/admin/api
UNLEASH_SERVER_API_TOKEN=
FARO_URL="http://localhost:12347/collect"
GITHUB_SHA="local"

UNLEASH_SERVER_API_TOKEN="" # Finn token her https://dagpenger-unleash-web.iap.nav.cloud.nais.io/admin/api
UNLEASH_SERVER_API_URL=https://dagpenger-unleash-api.nav.cloud.nais.io/api
8 changes: 0 additions & 8 deletions .eslintrc.cjs

This file was deleted.

30 changes: 22 additions & 8 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
name: Bygg og deploy
on:
push:
# branches:
# - main


env:
IMAGE: ghcr.io/${{ github.repository }}:${{ github.sha }}
Expand All @@ -18,13 +17,13 @@ jobs:
packages: "write"
outputs:
image: ${{ steps.docker-build-push.outputs.image }}
version_tag: ${{ steps.version-tag.outputs.VERSION_TAG}}

steps:
- name: Checkout code
uses: actions/checkout@v4

- uses: actions/setup-node@v4
- name: Setup node
uses: actions/setup-node@v4
with:
node-version: "22.x"

Expand All @@ -41,6 +40,21 @@ jobs:
dockerfile: Dockerfile
docker_context: .

- name: Build static files
uses: docker/build-push-action@v6
with:
target: build-export
outputs: type=local,dest=build
secrets: NODE_AUTH_TOKEN=${{ secrets.READER_TOKEN }}

- name: Upload static files
uses: nais/deploy/actions/cdn-upload/v2@master
with:
team: teamdagpenger
source: ./build/client
destination: "/dp-saksbehandling-frontend/"
identity_provider: ${{ secrets.NAIS_WORKLOAD_IDENTITY_PROVIDER }}
project_id: ${{ vars.NAIS_MANAGEMENT_PROJECT_ID }}


playwright:
Expand Down Expand Up @@ -105,10 +119,10 @@ jobs:
runs-on: ubuntu-latest
environment:
name: Development
url: "https://dagpenger.ansatt.dev.nav.no/saksbehandling/"
url: "https://dagpenger.ansatt.dev.nav.no/saksbehandling"
steps:
- uses: actions/checkout@v4
- uses: nais/deploy/actions/deploy@v1
- uses: nais/deploy/actions/deploy@v2
env:
VAR: image=${{ needs.build.outputs.image }},githubSha=${{ github.sha }}
APIKEY: ${{ secrets.NAIS_DEPLOY_APIKEY }}
Expand All @@ -124,10 +138,10 @@ jobs:
runs-on: ubuntu-latest
environment:
name: Production
url: "https://dagpenger.ansatt.nav.no/saksbehandling/"
url: "https://dagpenger.ansatt.nav.no/saksbehandling"
steps:
- uses: actions/checkout@v4
- uses: nais/deploy/actions/deploy@v1
- uses: nais/deploy/actions/deploy@v2
env:
VAR: image=${{ needs.build.outputs.image }},githubSha=${{ github.sha }}
APIKEY: ${{ secrets.NAIS_DEPLOY_APIKEY }}
Expand Down
8 changes: 8 additions & 0 deletions .nais/nais.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,9 @@ spec:
path: "{{base_path}}api/internal/isReady"
initialDelay: 5
timeout: 1
prometheus:
enabled: true
path: "{{base_path}}/api/internal/metrics"
replicas:
min: 1
max: 2
Expand Down Expand Up @@ -87,6 +90,11 @@ spec:
- name: UNLEASH_SERVER_API_URL
value: {{unleash.url}}

- name: FARO_URL
value: {{faro_url}}
- name: GITHUB_SHA
value: {{githubSha}}

envFrom:
- secret: dp-saksbehandling-frontend-unleash-api-token

Expand Down
4 changes: 3 additions & 1 deletion .nais/vars-dev.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,15 @@ gosys_url: "https://gosys.dev.intern.nav.no/gosys/bruker/brukeroversikt.jsf"
modia_url: ""
meldekort_url: ""
inntektredigering_url: ""
grisen_url: "https://navno.sharepoint.com/:x:/r/sites/44/NAYDP/_layouts/15/Doc.aspx?sourcedoc=%7B91BEA3C7-B531-4509-BD57-194AEBA31314%7D&file=GRISEN-2022-30.06.22.xlsx&action=default&mobileredirect=true"
grisen_url: "https://navno.sharepoint.com/:x:/r/sites/44/NAYDP/_layouts/15/Doc.aspx?sourcedoc=%7B07D70AE2-B079-434E-9B24-379F9E77C1E3%7D&file=Regneark---dagpenger---01.11.24-til-bruk.xlsm&action=default&mobileredirect=true"
dagpenger-norge_url: "https://navno.sharepoint.com/:u:/r/sites/44/NAYDP/SitePages/CollabHome.aspx?csf=1&web=1&e=kfxUeP"

sanity_project_id: "rt6o382n"
sanity_access_token: ""
sanity_dataset: "production"

faro_url: "https://telemetry.ekstern.dev.nav.no/collect"

unleash:
url: https://dagpenger-unleash-api.nav.cloud.nais.io/api
environment: development
Expand Down
4 changes: 3 additions & 1 deletion .nais/vars-prod.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,15 @@ gosys_url: "https://gosys.intern.nav.no/gosys/bruker/brukeroversikt.jsf"
modia_url: ""
meldekort_url: ""
inntektredigering_url: ""
grisen_url: "https://navno.sharepoint.com/:x:/r/sites/44/NAYDP/_layouts/15/Doc.aspx?sourcedoc=%7B91BEA3C7-B531-4509-BD57-194AEBA31314%7D&file=GRISEN-2022-30.06.22.xlsx&action=default&mobileredirect=true"
grisen_url: "https://navno.sharepoint.com/:x:/r/sites/44/NAYDP/_layouts/15/Doc.aspx?sourcedoc=%7B07D70AE2-B079-434E-9B24-379F9E77C1E3%7D&file=Regneark---dagpenger---01.11.24-til-bruk.xlsm&action=default&mobileredirect=true"
dagpenger-norge_url: "https://navno.sharepoint.com/:u:/r/sites/44/NAYDP/SitePages/CollabHome.aspx?csf=1&web=1&e=kfxUeP"

sanity_project_id: "rt6o382n"
sanity_access_token: ""
sanity_dataset: "production"

faro_url: "https://telemetry.nav.no/collect"

unleash:
url: https://dagpenger-unleash-api.nav.cloud.nais.io/api
environment: production
Expand Down
5 changes: 5 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,11 @@ COPY ./package-lock.json ./
RUN npm ci --ignore-scripts --omit dev


# export build to filesystem (GitHub)
FROM scratch AS build-export
COPY --from=app-build /app/build ./


# runtime
FROM gcr.io/distroless/nodejs22-debian12 AS runtime
WORKDIR /app
Expand Down
19 changes: 0 additions & 19 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -41,25 +41,6 @@ matchende genererte tokenet.
[dp-saksbehandling](https://azure-token-generator.intern.dev.nav.no/api/obo?aud=dev-gcp.teamdagpenger.dp-saksbehandling),
[dp-behandling](https://azure-token-generator.intern.dev.nav.no/api/obo?aud=dev-gcp.teamdagpenger.dp-behandling),

## Tester

Vi har to testrammeverk som vi brukes til ulike formål.

### Vitest

Vitest brukes til unit testing av eksempelvis komponenter, loaders og actions.

```
// Kjør testene som vanlig
npm run test
// Generer test coverage
npm run test-coverage
// Kjør testene med watch
npm run test -- --watch
```

### Playwright

Playwright brukes til e2e (ende til ende) testing, og er et veldig fint verktøy for å teste flyt og samspillet mellom de
Expand Down
24 changes: 0 additions & 24 deletions app/components/FormattedDate.tsx

This file was deleted.

8 changes: 2 additions & 6 deletions app/components/RemixLink.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -46,14 +46,10 @@ function RemixLinkComponent(
variant={asButtonVariant}
loading={loading}
onClick={(event) => {
/* Dette er OK å ignorere, den klager på at det er feil type
(Anchor i stedet for Button), og siden vi alltid sender med
as="a" overstyrer vi dette til å være en anchor-tag. Typene
bakover i designsystemet gjenspeiler ikke dette. */
// @ts-ignore
// @ts-expect-error Dette er OK å ignorere, den klager på at det er feil type (Anchor i stedet for Button), og siden vi alltid sender med as="a" overstyrer vi dette til å være en anchor-tag. Typene bakover i designsystemet gjenspeiler ikke dette.
onClick?.(event);
if (!event.defaultPrevented) {
// @ts-ignore
// @ts-expect-error Se kommentar over
handleClick(event);
}
}}
Expand Down
1 change: 0 additions & 1 deletion app/components/coffee-loader/CoffeeLoader.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import React from "react";
import styles from "./CoffeeLoader.module.css";

export function CoffeeLoader() {
Expand Down
12 changes: 7 additions & 5 deletions app/components/dokument-oversikt/DokumentOversikt.tsx
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
import styles from "./DokumentOversikt.module.css";
import { JournalpostOversikt } from "~/components/journalpost-oversikt/JournalpostOversikt";
import { Alert, Heading } from "@navikt/ds-react";
import type { JournalpostQuery } from "../../../graphql/generated/saf/graphql";
import type { INetworkResponse } from "~/utils/types";
import { isNetworkResponseSuccess } from "~/utils/type-guards";

import { JournalpostOversikt } from "~/components/journalpost-oversikt/JournalpostOversikt";
import { useTypedRouteLoaderData } from "~/hooks/useTypedRouteLoaderData";
import { isNetworkResponseSuccess } from "~/utils/type-guards";
import type { INetworkResponse } from "~/utils/types";

import type { JournalpostQuery } from "../../../graphql/generated/saf/graphql";
import styles from "./DokumentOversikt.module.css";

export function DokumentOversikt() {
const { journalposterResponses } = useTypedRouteLoaderData("routes/oppgave.$oppgaveId");
Expand Down
6 changes: 4 additions & 2 deletions app/components/error-boundary/RootErrorBoundaryView.tsx
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
import { Alert, Heading, InternalHeader } from "@navikt/ds-react";
import { isRouteErrorResponse, Link } from "@remix-run/react";
import styles from "./RootErrorBoundaryView.module.css";
import type { JSX } from "react";

import styles from "./RootErrorBoundaryView.module.css";

interface IProps {
meta: JSX.Element;
links: JSX.Element;
Expand Down Expand Up @@ -31,8 +32,9 @@ export function RootErrorBoundaryView({ meta, links, error }: IProps) {
);
}

export function ErrorMessageComponent({ error }: any) {
export function ErrorMessageComponent({ error }: { error: unknown }) {
// Treffer Response errors, eks. throw new Response(), 401, 404, 500 errors

if (isRouteErrorResponse(error)) {
return (
<Alert variant="error">
Expand Down
4 changes: 3 additions & 1 deletion app/components/global-alert/GlobalAlerts.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
import { Alert, BodyLong, Heading } from "@navikt/ds-react";
import { useGlobalAlerts } from "~/hooks/useGlobalAlerts";
import classnames from "classnames";

import { useGlobalAlerts } from "~/hooks/useGlobalAlerts";

import styles from "./GlobalAlert.module.css";

export function GlobalAlerts() {
Expand Down
5 changes: 3 additions & 2 deletions app/components/halloween/Ghosts.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
import type { CustomCSSProperties } from "./GhostSvg";
import { GhostSvg } from "./GhostSvg";
import { useEffect, useState } from "react";

import styles from "./Ghosts.module.css";
import type { CustomCSSProperties } from "./GhostSvg";
import { GhostSvg } from "./GhostSvg";

const defaultGhostStyles: CustomCSSProperties[] = [
{
Expand Down
28 changes: 19 additions & 9 deletions app/components/header-meny/HeaderMeny.tsx
Original file line number Diff line number Diff line change
@@ -1,24 +1,31 @@
import { NavLink } from "@remix-run/react";
import classnames from "classnames";

import { Ghosts } from "~/components/halloween/Ghosts";
import { HeaderUtloggingMeny } from "~/components/header-meny/HeaderUtloggingMeny";
import { Adventslys } from "~/components/jul/Adventslys";
import { useTypedRouteLoaderData } from "~/hooks/useTypedRouteLoaderData";
import type { ISaksbehandler } from "~/models/saksbehandler.server";
import { oppgaverTilBehandlingDefaultParams } from "~/routes/_index";
import { alleOppgaverDefaultParams } from "~/routes/alle-oppgaver";
import { mineOppgaverDefaultParams } from "~/routes/mine-oppgaver";
import { convertToQueryParamString } from "~/utils/url.utils";

import { PersonSok } from "../person-sok/PersonSok";
import { Ghosts } from "~/components/halloween/Ghosts";
import classnames from "classnames";
import styles from "./HeaderMeny.module.css";

interface IProps {
saksbehandler: ISaksbehandler;
antallJegHarTilBehandling: number;
antallOppgaverJegHarTilBehandling: number;
}

export function HeaderMeny({ saksbehandler, antallJegHarTilBehandling }: IProps) {
export function HeaderMeny({ saksbehandler, antallOppgaverJegHarTilBehandling }: IProps) {
const { featureFlags } = useTypedRouteLoaderData("root");
return (
<div className={styles.container}>
<div className={styles.linkContainer}>
<NavLink
to={"/"}
to={`/?${convertToQueryParamString(oppgaverTilBehandlingDefaultParams)}`}
className={({ isActive }) =>
classnames(styles.linkItem, { [styles.linkItemActive]: isActive })
}
Expand All @@ -27,19 +34,21 @@ export function HeaderMeny({ saksbehandler, antallJegHarTilBehandling }: IProps)
</NavLink>

<NavLink
to={"/mine-oppgaver"}
to={`/mine-oppgaver?${convertToQueryParamString(mineOppgaverDefaultParams)}`}
className={({ isActive }) =>
classnames(styles.linkItem, { [styles.linkItemActive]: isActive })
}
>
Mine oppgaver
{antallJegHarTilBehandling > 0 && (
<span className={styles.antallOppgaverTilBehandling}>{antallJegHarTilBehandling}</span>
{antallOppgaverJegHarTilBehandling > 0 && (
<span className={styles.antallOppgaverTilBehandling}>
{antallOppgaverJegHarTilBehandling}
</span>
)}
</NavLink>

<NavLink
to={"/alle-oppgaver"}
to={`/alle-oppgaver?${convertToQueryParamString(alleOppgaverDefaultParams)}`}
className={({ isActive }) =>
classnames(styles.linkItem, { [styles.linkItemActive]: isActive })
}
Expand All @@ -49,6 +58,7 @@ export function HeaderMeny({ saksbehandler, antallJegHarTilBehandling }: IProps)
</div>

{featureFlags.halloween && <Ghosts />}
{featureFlags.jul && <Adventslys />}

<div className={styles.searchAndSaksbehandlerContainer}>
<PersonSok />
Expand Down
4 changes: 3 additions & 1 deletion app/components/header-meny/HeaderUtloggingMeny.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
import { Dropdown, InternalHeader } from "@navikt/ds-react";

import type { ISaksbehandler } from "~/models/saksbehandler.server";

import styles from "./HeaderMeny.module.css";
import { Dropdown, InternalHeader } from "@navikt/ds-react";

interface IProps {
saksbehandler: ISaksbehandler;
Expand Down
3 changes: 2 additions & 1 deletion app/components/info-card/InfoCard.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import type { PropsWithChildren } from "react";
import classnames from "classnames";
import type { PropsWithChildren } from "react";

import styles from "./InfoCard.module.css";

interface IProps {
Expand Down
3 changes: 2 additions & 1 deletion app/components/journalpost-oversikt/JournalpostOversikt.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { useState } from "react";
import { Button, List, Select } from "@navikt/ds-react";
import { useState } from "react";

import type { JournalpostQuery } from "../../../graphql/generated/saf/graphql";
import styles from "./JournalpostOversikt.module.css";

Expand Down
Loading

0 comments on commit 9e57ef0

Please sign in to comment.