-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'main' into feature/formalisere-tiltakskoder
- Loading branch information
Showing
135 changed files
with
2,307 additions
and
2,049 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
36 changes: 36 additions & 0 deletions
36
frontend/mr-admin-flate/src/api/tiltaksgjennomforing/usePollTiltaksnummer.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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, | ||
}; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
21 changes: 15 additions & 6 deletions
21
frontend/mr-admin-flate/src/components/authActions/HarSkrivetilgang.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.