Skip to content
This repository was archived by the owner on Nov 1, 2024. It is now read-only.

Commit 9570b52

Browse files
committed
merge
2 parents 7a78d8f + e5a5860 commit 9570b52

15 files changed

+666
-351
lines changed

Dockerfile

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
FROM node:21.6.0-alpine AS node-with-deps
1+
FROM node:21.6.2-alpine AS node-with-deps
22

33
WORKDIR /usr/app
44

components/dataproducts/dataset/piiForm.tsx

+1-2
Original file line numberDiff line numberDiff line change
@@ -57,8 +57,7 @@ export const PiiForm = ({
5757
<Radio value={'sensitive'}>
5858
Ja, inneholder personopplysninger
5959
</Radio>
60-
{/* Pseudonymization */}
61-
{false && showAnnotateDatasetTable &&
60+
{showAnnotateDatasetTable &&
6261
<div className="flex items-center gap-x-1">
6362
<Switch onChange={e=>{
6463
setcreatePseudoynimizedView(e.target.checked)

components/dataproducts/dataset/viewDataset.tsx

+3-3
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ const ViewDataset = ({
7474
onClose={() => setAccessRequested(false)}
7575
className="max-w-full md:max-w-3xl"
7676
>
77-
<Modal.Body className="h-full">
77+
<Modal.Body>
7878
<NewAccessRequestForm setModal={setShowNewAccess} dataset={dataset} />
7979
</Modal.Body>
8080
</Modal>
@@ -84,7 +84,7 @@ const ViewDataset = ({
8484
onClose={() => setShowNewAccess(false)}
8585
className="max-w-full md:max-w-3xl px-8"
8686
>
87-
<Modal.Body className="h-full">
87+
<Modal.Body>
8888
<NewDatasetAccess
8989
dataset={dataset}
9090
setShowNewAccess={setShowNewAccess}
@@ -97,7 +97,7 @@ const ViewDataset = ({
9797
onClose={() => setShowAnonymisation(false)}
9898
className="max-w-full md:max-w-3xl md:px-8"
9999
>
100-
<Modal.Body className="h-full">
100+
<Modal.Body>
101101
<Heading level="1" size="large" className="pb-8">
102102
Metodebeskrivelse
103103
</Heading>

components/dataproducts/explore.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ const Explore = ({ dataproductId, dataset, isOwner }: ExploreProps) => {
4343
}
4444

4545
const datasource = dataset.datasource
46-
const metabaseUrl = dataset.meatabaseUrl
46+
const metabaseUrl = dataset.metabaseUrl
4747
const mappings = dataset.mappings
4848
const bigQueryUrl = `https://console.cloud.google.com/bigquery?d=${datasource.dataset}&t=${datasource.table}&p=${datasource.projectID}&page=table`
4949

components/header/user.tsx

+1-2
Original file line numberDiff line numberDiff line change
@@ -46,8 +46,7 @@ export default function User() {
4646
>
4747
Legg til nytt innsiktsprodukt
4848
</Dropdown.Menu.GroupedList.Item>
49-
{/* Pseudonymization */}
50-
{false && <Dropdown.Menu.GroupedList.Item
49+
{<Dropdown.Menu.GroupedList.Item
5150
className="text-base flex gap-1 items-center"
5251
onClick={async () =>
5352
await router.push('/dataProc/joinableView/new')

components/lib/MoveModal.tsx

+1-4
Original file line numberDiff line numberDiff line change
@@ -42,11 +42,8 @@ export const MoveModal = ({
4242
if (search.loading || !search.data?.search) return <LoaderSpinner />
4343

4444
return (
45-
<Modal open={open} onClose={onCancel}>
45+
<Modal open={open} onClose={onCancel} header={{heading: "Flytt datasett"}}>
4646
<Modal.Body className="flex flex-col gap-4">
47-
<Heading level="2" size="large">
48-
Flytt datasett
49-
</Heading>
5047
<p>Velg hvilket dataprodukt datasett skal flyttes til.</p>
5148
<p>
5249
(Du kan kun flytte datasett til dataprodukter som hører til samme

components/lib/deleteModal.tsx

+1-4
Original file line numberDiff line numberDiff line change
@@ -18,11 +18,8 @@ export const DeleteModal = ({
1818
resource,
1919
}: DeleteModalProps) => {
2020
return (
21-
<Modal open={open} onClose={onCancel}>
21+
<Modal open={open} onClose={onCancel} header={{heading: "Slett"}}>
2222
<Modal.Body className="flex flex-col gap-4">
23-
<Heading level="2" size="large" className='mr-12'>
24-
Slette {resource}
25-
</Heading>
2623
<p>Er du sikker på at du vil slette {name}?</p>
2724
<div className="flex flex-row gap-3">
2825
<Button variant="secondary" onClick={onCancel}>

components/productArea/productAreaMobileMenu.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ interface MobileMenuProps {
1515
const ProductAreaMobileMenu = ({ open, setOpen, productAreaItems, setCurrentItem, productAreas, selectProductArea }: MobileMenuProps) => {
1616
const [selected, setSelected] = useState<string | null>(null)
1717

18-
return <Modal className="w-screen h-screen py-8" open={open} onClose={() => setOpen(false)}>
18+
return <Modal className="w-screen h-screen py-8" open={open} onClose={() => setOpen(false)} header={{heading: ""}}>
1919
{!selected && <div className="flex flex-col mt-14 gap-2 mx-2">
2020
{productAreas.map((area, idx) =>
2121
<>

components/user/nadaTokens.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ const NadaTokensForUser = ({ nadaTokens }: { nadaTokens: Array<NadaToken> }) =>
1818
{nadaTokens.map((token, i) =>
1919
<Table.Row key={i}>
2020
<Table.HeaderCell className="w-96" scope="row">{token.team}</Table.HeaderCell>
21-
<TokenCell token={token.token} />
21+
<TokenCell token={token.token} team={token.team}/>
2222
</Table.Row>
2323
)}
2424
</Table.Body>

components/user/tokenCell.tsx

+59-3
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,78 @@
11
import { EyeFilled, EyeScreenedFilled } from "@navikt/ds-icons"
2-
import { Table } from "@navikt/ds-react"
2+
import { Button, Heading, Modal, Table } from "@navikt/ds-react"
33
import { useState } from "react"
4+
import { ArrowsCirclepathIcon } from '@navikt/aksel-icons';
5+
import { apiUrl } from '../../lib/rest/restApi';
6+
import { useRouter } from "next/navigation";
47

5-
const TokenCell = ({token}: {token: string}) => {
8+
const TokenCell = ({token, team}: {token: string, team: string}) => {
69
const [hidden, setHidden] = useState(true)
10+
const [showRotateModal, setShowRotateModal] = useState(false)
11+
const router = useRouter()
12+
13+
const rotateTeamToken = (team: string) => {
14+
fetch(`${apiUrl()}/user/token?team=${team}`, {
15+
method: 'PUT',
16+
credentials: "include",
17+
headers: {
18+
'Content-type': 'application/json'
19+
}
20+
})
21+
.catch(err => {
22+
console.log("err", err)
23+
})
24+
setShowRotateModal(false)
25+
router.refresh()
26+
}
727

828
return (
29+
<>
30+
<Modal
31+
open={showRotateModal}
32+
aria-label="Roter nada token"
33+
onClose={() => setShowRotateModal(false)}
34+
className="max-w-full md:max-w-3xl px-8 h-[20rem]"
35+
>
36+
<Modal.Body className="h-full">
37+
<div className="flex flex-col gap-8">
38+
<Heading level="1" size="medium">
39+
Er du sikker på at du vil rotere tokenet for team {team}?
40+
</Heading>
41+
<div>
42+
Dette vil innebære at du må oppdatere til nytt token i all kode der dette brukes for å autentisere seg mot datamarkedsplassen.
43+
</div>
44+
<div className="flex flex-row gap-4">
45+
<Button
46+
onClick={() => rotateTeamToken(team)}
47+
variant="primary"
48+
size="small"
49+
>
50+
Roter
51+
</Button>
52+
<Button
53+
onClick={() => setShowRotateModal(false)}
54+
variant="secondary"
55+
size="small"
56+
>
57+
Avbryt
58+
</Button>
59+
</div>
60+
</div>
61+
</Modal.Body>
62+
</Modal>
963
<Table.DataCell className="flex flex-row gap-2 items-center w-full">
1064
<div>
1165
{hidden
1266
? (<EyeFilled className="cursor-pointer" onClick={() => setHidden(!hidden)} />)
1367
: (<EyeScreenedFilled className="cursor-pointer" onClick={() => setHidden(!hidden)} />)}
1468
</div>
1569
<span>{hidden
16-
? "*********"
70+
? "*********"
1771
: token
1872
}</span>
73+
<ArrowsCirclepathIcon className="cursor-pointer" title="roter token" fontSize="1.2rem" onClick={() => setShowRotateModal(true)}/>
1974
</Table.DataCell>
75+
</>
2076
)
2177
}
2278

lib/rest/restApi.ts

+5-5
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
const isServer = typeof window === 'undefined'
22

3-
const apiUrl = () => {
4-
if (process.env.NEXT_PUBLIC_ENV === 'development') {
5-
return 'http://localhost:8080/api'
6-
}
7-
return isServer ? 'http://nada-backend/api' : '/api'
3+
export const apiUrl = () => {
4+
if (process.env.NEXT_PUBLIC_ENV === 'development') {
5+
return 'http://localhost:8080/api'
6+
}
7+
return isServer ? 'http://nada-backend/api' : '/api'
88
}
99

1010
export const getDataproductUrl = (id: string) => `${apiUrl()}/dataproducts/${id}`

0 commit comments

Comments
 (0)