This repository has been archived by the owner on Nov 1, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
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 dependabot/github_actions/docker/build-push-…
…action-5
- Loading branch information
Showing
53 changed files
with
20,565 additions
and
12,942 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,53 @@ | ||
import { Alert, Box, CopyButton, ExpansionCard, Link, Loader, Tooltip } from "@navikt/ds-react" | ||
import { JoinableView, useJoinableViewQuery } from "../../lib/schema/graphql" | ||
import { ExternalLink } from "@navikt/ds-icons" | ||
import LoaderSpinner from "../lib/spinner" | ||
import { useState } from "react" | ||
|
||
interface JoinableViewCardProps { | ||
joinableView: JoinableView | ||
} | ||
|
||
export const JoinableViewCardContent = ({ joinableViewId }: { joinableViewId: string }) => { | ||
const { data, loading, error } = useJoinableViewQuery({ variables: { id: joinableViewId } }) | ||
const urlComps = data?.joinableView.pseudoDatasources && data?.joinableView.pseudoDatasources.length | ||
? data?.joinableView.pseudoDatasources[0].bigqueryUrl.split('.') : ["", "", ""] | ||
const projectID = urlComps[0] | ||
const datasetID = urlComps[1] | ||
const bigQueryUrl = `https://console.cloud.google.com/bigquery?d=${datasetID}&p=${projectID}&page=dataset` | ||
|
||
return <div> | ||
{loading && <LoaderSpinner />} | ||
{error && <Alert variant="error">Klarte ikke hente data om views tilrettelagt for kobling</Alert>} | ||
{data && <> | ||
<Link href={bigQueryUrl}>{"Åpne BigQuery dataset i Google Cloud Console"}<ExternalLink /></Link> | ||
{data?.joinableView.pseudoDatasources.map((bqv, index) => <Box key={index} padding="1" className="w-[55rem]"> | ||
{bqv.deleted?<Tooltip content="Datasettet er slettet fra markedsplassen"><div className="flex flex-row items-center line-through">{bqv.bigqueryUrl}</div></Tooltip>: | ||
bqv.accessible? <div className="flex flex-row items-center bg-gray-200">{bqv.bigqueryUrl}<CopyButton copyText={bqv.bigqueryUrl}></CopyButton></div> | ||
: <Tooltip content="Har ikke tilgang til datasettet"><div className="flex flex-row items-center text-gray-200" >{bqv.bigqueryUrl}</div></Tooltip>} | ||
</Box>)} | ||
{data?.joinableView.expires && | ||
<div className="mt-3 italic"> | ||
BigQuery datasettet slettes {data?.joinableView.expires.split("T")[0]} | ||
</div> | ||
} | ||
</>} | ||
</div> | ||
} | ||
|
||
export const JoinableViewCard = ({ joinableView }: JoinableViewCardProps) => { | ||
const [expanded, setExpanded] = useState(false) | ||
|
||
return <div key={joinableView.id} className="w-[60rem]"> | ||
<ExpansionCard aria-label="default-demo" onToggle={open => setExpanded(open)}> | ||
<ExpansionCard.Header> | ||
<ExpansionCard.Title>{`${joinableView?.name} - ${joinableView?.created}`}</ExpansionCard.Title> | ||
<ExpansionCard.Description> | ||
<p>Klikk for å vise BigQuery dataset</p></ExpansionCard.Description> | ||
</ExpansionCard.Header> | ||
<ExpansionCard.Content> | ||
{expanded && <JoinableViewCardContent joinableViewId={joinableView.id} />} | ||
</ExpansionCard.Content> | ||
</ExpansionCard> | ||
</div> | ||
} |
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,19 @@ | ||
import { Alert, Heading, Link, ExpansionCard, CopyButton, Box } from "@navikt/ds-react" | ||
import { GET_JOINABLEVIEWS } from "../../lib/queries/pseudoView/joinableViews" | ||
import { useJoinableViewsQuery } from "../../lib/schema/graphql" | ||
import { ExternalLink } from "@navikt/ds-icons" | ||
import LoaderSpinner from "../lib/spinner" | ||
import { JoinableViewCard } from "./joinableViewCard" | ||
|
||
export const JoinableViewsList = () => { | ||
const joinableViews = useJoinableViewsQuery() | ||
return <div> | ||
{joinableViews.loading && <LoaderSpinner />} | ||
{joinableViews.error && <Alert variant="error">Kan ikke Hente sammenføybare viewer.</Alert>} | ||
{joinableViews.data && | ||
<div className="flex-col space-y-2"> | ||
{joinableViews.data.joinableViews?.map(it => <JoinableViewCard key={it.id} joinableView={it} />)} | ||
</div> | ||
} | ||
</div> | ||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,74 @@ | ||
import { ExpansionCard } from "@navikt/ds-react" | ||
import SearchResultLink from "../search/searchResultLink" | ||
|
||
interface Dataset { | ||
__typename?: 'Dataset' | undefined | ||
id: string | ||
dataproductID: string | ||
dataproduct: { | ||
name: string | ||
slug: string | ||
} | ||
name: string | ||
keywords: string[] | ||
slug: string | ||
owner: { __typename?: 'Owner' | undefined, group: string } | ||
} | ||
|
||
interface DataproductsListProps { | ||
datasets: Dataset[] | ||
} | ||
|
||
const groupDatasetsByDataproduct = (datasets: any[]) => { | ||
let dataproducts = new Map<string, Dataset[]>() | ||
|
||
datasets.forEach((dataset) => { | ||
dataproducts.set(dataset.dataproductID, dataproducts.get(dataset.dataproductID) || []) | ||
dataproducts.get(dataset.dataproductID)?.push(dataset) | ||
}) | ||
|
||
var datasetsGroupedByDataproduct: Array<Dataset[]> = []; | ||
dataproducts.forEach((datasets) => { | ||
datasetsGroupedByDataproduct.push(datasets) | ||
}) | ||
|
||
return datasetsGroupedByDataproduct | ||
} | ||
|
||
export const DataproductsList = ({ datasets }: DataproductsListProps) => { | ||
const groupedDatasets = groupDatasetsByDataproduct(datasets) | ||
return ( | ||
<> | ||
{groupedDatasets.map((datasets) => { | ||
return ( | ||
<> | ||
<div className="w-[60rem]"> | ||
<ExpansionCard key={datasets[0].dataproductID} aria-label="dataproduct-access"> | ||
<ExpansionCard.Header> | ||
<ExpansionCard.Title>{`Dataprodukt - ${datasets[0].dataproduct.name}`}</ExpansionCard.Title> | ||
<ExpansionCard.Description> | ||
<p>Klikk for å se datasettene du har tilgang til</p></ExpansionCard.Description> | ||
</ExpansionCard.Header> | ||
<ExpansionCard.Content className="text-center"> | ||
<> | ||
{datasets.map((dataset) => { | ||
return <SearchResultLink | ||
key={dataset.id} | ||
group={dataset.owner} | ||
name={dataset.name} | ||
type={'Dataset'} | ||
keywords={dataset.keywords} | ||
link={`/dataproduct/${dataset.dataproductID}/${dataset.dataproduct.slug}/${dataset.id}`} | ||
/> | ||
}) | ||
} | ||
</> | ||
</ExpansionCard.Content> | ||
</ExpansionCard> | ||
</div> | ||
</> | ||
) | ||
})} | ||
</> | ||
) | ||
} |
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.