Skip to content

Commit

Permalink
Merge branch 'main' into feature/formalisere-tiltakskoder
Browse files Browse the repository at this point in the history
  • Loading branch information
fredrikpe committed Feb 29, 2024
2 parents 5e51e04 + 55ad0c8 commit 702ffd8
Show file tree
Hide file tree
Showing 135 changed files with 2,307 additions and 2,049 deletions.
38 changes: 38 additions & 0 deletions .github/workflows/deploy-bigquery-views.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
name: Deploy BigQuery Views

on:
push:
paths:
- iac/bigquery-views/**
- .github/workflows/deploy-views.yaml
workflow_dispatch:
inputs:
environment:
type: choice
description: Environment
required: true
default: dev
options:
- dev
- dev_and_prod

jobs:
deploy-dev-views:
if: github.event_name == 'push' && github.ref_name == 'main' || github.event_name == 'workflow_dispatch'
permissions:
id-token: write # Needed for `nais/deploy/actions/deploy`
uses: ./.github/workflows/deploy-views.yaml
secrets: inherit
with:
cluster: dev-gcp
project: team-mulighetsrommet-dev-a2d7

deploy-prod-views:
if: github.event_name == 'push' && github.ref_name == 'main' || github.event_name == 'workflow_dispatch' && github.event.inputs.environment == 'dev_and_prod'
permissions:
id-token: write # Needed for `nais/deploy/actions/deploy`
uses: ./.github/workflows/deploy-views.yaml
secrets: inherit
with:
cluster: prod-gcp
project: team-mulighetsrommet-prod-5492
6 changes: 4 additions & 2 deletions .github/workflows/deploy-views.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Deploy BigQuery Views
name: Deploy BigQuery Views - template
on:
workflow_call:
inputs:
Expand All @@ -18,6 +18,8 @@ jobs:
env:
APIKEY: ${{ secrets.NAIS_DEPLOY_APIKEY }}
CLUSTER: ${{ inputs.cluster }}
RESOURCE: iac/bigquery-views/tiltakstyper.yaml
RESOURCE: iac/bigquery-views/tiltakstyper.yaml,iac/bigquery-views/tiltaksgjennomforing.yaml
VAR: project=${{ inputs.project }}
PRINT_PAYLOAD: true


22 changes: 0 additions & 22 deletions .github/workflows/mr-api.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -75,17 +75,6 @@ jobs:
RESOURCE: mulighetsrommet-api/.nais/nais-dev.yaml
VAR: image=${{ needs.ci.outputs.image }}

deploy-dev-views:
needs: [ deploy-dev ]
if: github.ref == 'refs/heads/main'
permissions:
id-token: write # Needed for `nais/deploy/actions/deploy`
uses: ./.github/workflows/deploy-views.yaml
secrets: inherit
with:
cluster: dev-gcp
project: team-mulighetsrommet-dev

deploy-prod:
name: Deploy (prod)
runs-on: ubuntu-latest
Expand All @@ -102,14 +91,3 @@ jobs:
CLUSTER: prod-gcp
RESOURCE: mulighetsrommet-api/.nais/nais-prod.yaml
VAR: image=${{ needs.ci.outputs.image }}

deploy-prod-views:
needs: [ deploy-prod ]
if: github.ref == 'refs/heads/main'
permissions:
id-token: write # Needed for `nais/deploy/actions/deploy`
uses: ./.github/workflows/deploy-views.yaml
secrets: inherit
with:
cluster: prod-gcp
project: team-mulighetsrommet-prod
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,13 @@ import kotlinx.serialization.Serializable
enum class Gruppetiltak {
AVKLARING,
OPPFOLGING,
GRUPPE_AMO,
GRUPPE_ARBEIDSMARKEDSTILTAK,
JOBBKLUBB,
DIGITAL_JOBBKLUBB,
DIGITALT_OPPFOLGINGSTILTAK,
ARBEIDSFORBEREDENDE_TRENING,
FAG_OG_YRKE_OPPLAERING,
FAG_OG_YRKESOPPLAERING,
ARBEIDSRETTET_REHABILITERING,
VARIG_TILRETTELAGT_ARBEID,
VARIG_TILRETTELAGT_ARBEID_SKJERMET,
}

object Tiltakskoder {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
package no.nav.mulighetsrommet.domain.dbo

import kotlinx.serialization.Serializable
import no.nav.mulighetsrommet.domain.constants.ArenaMigrering
import no.nav.mulighetsrommet.domain.dto.Avtaletype
import no.nav.mulighetsrommet.domain.serializers.LocalDateSerializer
import no.nav.mulighetsrommet.domain.serializers.UUIDSerializer
Expand All @@ -24,6 +23,5 @@ data class ArenaAvtaleDbo(
val arenaAnsvarligEnhet: String?,
val avtaletype: Avtaletype,
val avslutningsstatus: Avslutningsstatus,
val opphav: ArenaMigrering.Opphav,
val prisbetingelser: String?,
)
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
package no.nav.mulighetsrommet.domain.dbo

import kotlinx.serialization.Serializable
import no.nav.mulighetsrommet.domain.constants.ArenaMigrering
import no.nav.mulighetsrommet.domain.serializers.LocalDateSerializer
import no.nav.mulighetsrommet.domain.serializers.UUIDSerializer
import java.time.LocalDate
Expand All @@ -27,6 +26,5 @@ data class ArenaTiltaksgjennomforingDbo(
@Serializable(with = UUIDSerializer::class)
val avtaleId: UUID?,
val oppstart: TiltaksgjennomforingOppstartstype,
val opphav: ArenaMigrering.Opphav,
val deltidsprosent: Double,
)
6 changes: 3 additions & 3 deletions frontend/arena-adapter-manager/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,11 @@
"react-router-dom": "6.22.1"
},
"devDependencies": {
"@types/react": "18.2.56",
"@types/react": "18.2.58",
"@types/react-dom": "18.2.19",
"@typescript-eslint/eslint-plugin": "7.0.1",
"@typescript-eslint/eslint-plugin": "7.0.2",
"@vitejs/plugin-react": "4.2.1",
"eslint": "8.56.0",
"eslint": "8.57.0",
"eslint-plugin-react-hooks": "4.6.0",
"eslint-plugin-react-refresh": "0.4.5",
"typescript": "5.3.3",
Expand Down
3 changes: 3 additions & 0 deletions frontend/frontend-common/components/SokeSelect.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import Select from "react-select/base";
export interface SelectOption<T = string> {
value: T;
label: string;
isDisabled?: boolean;
}

export interface SelectProps<T> {
Expand Down Expand Up @@ -121,6 +122,7 @@ export const SokeSelect = <T,>(
}}
styles={customStyles(readOnly, Boolean(error))}
options={options}
isOptionDisabled={(option) => !!option.isDisabled}
className={className}
theme={(theme) => ({
...theme,
Expand All @@ -141,6 +143,7 @@ export const SokeSelect = <T,>(
style={{
marginTop: "8px",
color: "#c30000",
fontSize: size === "small" ? "16px" : "18px",
}}
>
<b>{error.message}</b>
Expand Down
2 changes: 1 addition & 1 deletion frontend/frontend-common/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
"dependencies": {
"react-router-dom": "6.22.1",
"react-select": "^5.8.0",
"@navikt/ds-react": "5.18.1"
"@navikt/ds-react": "6.1.0"
},
"repository": {
"type": "git",
Expand Down
24 changes: 12 additions & 12 deletions frontend/mr-admin-flate/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,21 +22,21 @@
},
"dependencies": {
"@eik/rollup-plugin": "4.0.62",
"@grafana/faro-web-sdk": "1.3.8",
"@grafana/faro-web-sdk": "1.3.9",
"@hookform/resolvers": "3.3.4",
"@navikt/aksel-icons": "5.18.1",
"@navikt/ds-css": "5.18.1",
"@navikt/ds-react": "5.18.1",
"@navikt/aksel-icons": "6.1.0",
"@navikt/ds-css": "6.1.0",
"@navikt/ds-react": "6.1.0",
"@portabletext/react": "3.0.11",
"@portabletext/types": "2.0.8",
"@tanstack/react-query": "5.21.7",
"@tanstack/react-query-devtools": "5.21.7",
"@tanstack/react-query": "5.24.1",
"@tanstack/react-query-devtools": "5.24.1",
"@types/is-url": "1.2.32",
"classnames": "2.5.1",
"debounce": "2.0.0",
"eslint": "8.56.0",
"eslint": "8.57.0",
"is-url": "1.2.4",
"jotai": "2.6.4",
"jotai": "2.6.5",
"mulighetsrommet-api-client": "*",
"mulighetsrommet-frontend-common": "*",
"react": "18.2.0",
Expand All @@ -49,7 +49,7 @@
"slate": "0.102.0",
"slate-history": "^0.100.0",
"slate-react": "^0.102.0",
"tiny-invariant": "1.3.1",
"tiny-invariant": "1.3.3",
"use-deep-compare-effect": "1.8.1",
"uuid": "9.0.1",
"zod": "3.22.4"
Expand All @@ -58,9 +58,9 @@
"@axe-core/playwright": "4.8.5",
"@playwright/test": "1.41.2",
"@rollup/plugin-terser": "0.4.4",
"@types/react": "18.2.56",
"@types/react": "18.2.58",
"@types/react-dom": "18.2.19",
"@typescript-eslint/eslint-plugin": "7.0.1",
"@typescript-eslint/eslint-plugin": "7.0.2",
"@vitejs/plugin-react": "4.2.1",
"axe-core": "4.8.4",
"cross-env": "7.0.3",
Expand All @@ -76,7 +76,7 @@
"msw": "2.2.1",
"typescript": "5.3.3",
"vite": "5.0.12",
"vitest": "1.3.0"
"vitest": "1.3.1"
},
"msw": {
"workerDirectory": "public"
Expand Down
2 changes: 1 addition & 1 deletion frontend/mr-admin-flate/public/mockServiceWorker.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
/* tslint:disable */

/**
* Mock Service Worker (2.1.3).
* Mock Service Worker (2.2.1).
* @see https://github.com/mswjs/msw
* - Please do NOT modify this file.
* - Please do NOT serve this file on production.
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
import { useQuery } from "@tanstack/react-query";
import { mulighetsrommetClient } from "../clients";

const FANT_IKKE_TILTAKSNUMMER_MESSAGE = "Fant ikke tiltaksnummer";

const RETRY_COUNT = 10;

const RETRY_DELAY = 3000;

export function usePollTiltaksnummer(id: string) {
const tiltaksnummer = useQuery({
queryKey: ["tiltakgjennomforing", id, "tiltaksnummer"],
async queryFn() {
const tiltaksnummer = await mulighetsrommetClient.tiltaksgjennomforinger.getTiltaksnummer({
id,
});

if (!tiltaksnummer) {
throw Error(FANT_IKKE_TILTAKSNUMMER_MESSAGE);
}

return tiltaksnummer;
},
retry(retryCount, error) {
return retryCount < RETRY_COUNT && error.message === FANT_IKKE_TILTAKSNUMMER_MESSAGE;
},
retryDelay: RETRY_DELAY,
throwOnError: false,
});

return {
isError: tiltaksnummer.isError,
isLoading: tiltaksnummer.isLoading,
data: tiltaksnummer.data,
};
}
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,9 @@ export function useMigrerteTiltakstyper() {
queryFn: () => mulighetsrommetClient.tiltakstyper.getMigrerteTiltakstyper(),
});
}

export function useMigrerteTiltakstyperForAvtaler() {
const { data = [], ...rest } = useMigrerteTiltakstyper();

return { data: data?.concat("VASV", "ARBFORB"), ...rest };
}
Original file line number Diff line number Diff line change
@@ -1,21 +1,30 @@
import { ReactNode } from "react";
import { useHentAnsatt } from "../../api/ansatt/useHentAnsatt";
import { NavAnsattRolle } from "mulighetsrommet-api-client";
import { NavAnsatt, NavAnsattRolle } from "mulighetsrommet-api-client";

interface Props {
children: ReactNode;
ressurs: "Avtale" | "Tiltaksgjennomføring";
condition?: boolean;
}

export function HarSkrivetilgang({ ressurs, children }: Props) {
const { data } = useHentAnsatt();
export function HarSkrivetilgang({ ressurs, children, condition }: Props) {
const { data: ansatt } = useHentAnsatt();

if (ressurs === "Avtale" && data?.roller.includes(NavAnsattRolle.AVTALER_SKRIV)) {
if (!ansatt || condition === false) {
return null;
} else if (ressurs === "Avtale" && harRolle(ansatt, NavAnsattRolle.AVTALER_SKRIV)) {
return children;
} else if (
ressurs === "Tiltaksgjennomføring" &&
data?.roller.includes(NavAnsattRolle.TILTAKSGJENNOMFORINGER_SKRIV)
harRolle(ansatt, NavAnsattRolle.TILTAKSGJENNOMFORINGER_SKRIV)
) {
return children;
} else return null;
} else {
return null;
}
}

function harRolle(ansatt: NavAnsatt, rolle: NavAnsattRolle) {
return ansatt.roller.includes(rolle);
}
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Avtaletype, Opphav, TiltakskodeArena } from "mulighetsrommet-api-client";
import { Avtaletype, TiltakskodeArena } from "mulighetsrommet-api-client";
import z from "zod";

const GyldigUrlHvisVerdi = z.union([
Expand Down Expand Up @@ -33,7 +33,7 @@ export const AvtaleSchema = z.object({
startDato: z.string({ required_error: "En avtale må ha en startdato" }),
sluttDato: z.string({ required_error: "En avtale må ha en sluttdato" }),
})
.refine((data) => !data.startDato || !data.sluttDato || data.sluttDato > data.startDato, {
.refine((data) => !data.startDato || !data.sluttDato || data.sluttDato >= data.startDato, {
message: "Startdato må være før sluttdato",
path: ["startDato"],
}),
Expand All @@ -59,7 +59,6 @@ export const AvtaleSchema = z.object({
{ required_error: "Det redaksjonelle innholdet må settes på avtalen" },
)
.nullable(),
opphav: z.nativeEnum(Opphav),
});

export type InferredAvtaleSchema = z.infer<typeof AvtaleSchema>;
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ import {
NavAnsatt,
NavEnhet,
NavEnhetType,
Opphav,
Virksomhet,
} from "mulighetsrommet-api-client";
import { DeepPartial } from "react-hook-form";
Expand Down Expand Up @@ -67,6 +66,5 @@ export function defaultAvtaleData(
prisbetingelser: avtale?.prisbetingelser ?? undefined,
beskrivelse: avtale?.beskrivelse ?? null,
faneinnhold: avtale?.faneinnhold ?? null,
opphav: avtale?.opphav ?? Opphav.MR_ADMIN_FLATE,
};
}
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,6 @@ export function AvtaleSkjemaContainer({
: null,
beskrivelse: data.beskrivelse,
faneinnhold: data.faneinnhold,
opphav: data.opphav,
leverandorKontaktpersonId: data.leverandorKontaktpersonId ?? null,
};

Expand Down
Loading

0 comments on commit 702ffd8

Please sign in to comment.