diff --git a/.dockerignore b/.dockerignore index 8ade29a35..7f6dd6088 100644 --- a/.dockerignore +++ b/.dockerignore @@ -1,6 +1,4 @@ Dockerfile*.* -.dockerignore -node_modules yarn-error.log README.md .env @@ -8,4 +6,5 @@ README.md .env.test .env.development .yarnrc -__ENV.js \ No newline at end of file +__ENV.js +.git diff --git a/.env.local.example b/.env.local.example index dbad6f893..7dcf03ed3 100644 --- a/.env.local.example +++ b/.env.local.example @@ -2,9 +2,6 @@ PORT=3000 HOST=http://localhost:$PORT REACT_APP_RUNTIME_ENV=dev -# Screen9 token for video player. -REACT_APP_SCREEN9_API_TOKEN=secret - LOGFILE_PATH=dataportal.log LOGGING_LEVELS=warn,error,info HEALTHCHECK_SECRET=1234 @@ -14,6 +11,9 @@ HTTP_PROXY=http://proxy.digg.se:8080 HTTP_PROXY_USER=secretuser HTTP_PROXY_PASS=secretpass +# Screen9 token for video player. +REACT_APP_SCREEN9_API_TOKEN=secret + ## Connect to a local backend. #APOLLO_URL=http://localhost:1301 #REACT_APP_APOLLO_URL=http://localhost:1301 @@ -26,12 +26,6 @@ HTTP_PROXY_PASS=secretpass #IMAGE_DOMAIN=localhost #REACT_APP_MEDIA_BASE_URL=http://127.0.0.1:1337 -## Connect to production backend (dataportal.se). -#APOLLO_URL=https://graphql.digg.se/ -#REACT_APP_APOLLO_URL=https://graphql.digg.se/ -#IMAGE_DOMAIN=graphql.digg.se -#REACT_APP_MEDIA_BASE_URL=https://graphql.digg.se/assets/dataportal_v1 - ## Connect to production backend (beta.dataportal.se). APOLLO_URL=https://graphql.digg.se/ REACT_APP_APOLLO_URL=https://graphql.digg.se/ diff --git a/.github/workflows/github.yml b/.github/workflows/github.yml index 5dafd8b03..a4e05fa32 100644 --- a/.github/workflows/github.yml +++ b/.github/workflows/github.yml @@ -21,7 +21,7 @@ jobs: - uses: actions/checkout@v3 - name: Build image - run: docker build . --file Dockerfile --tag $IMAGE_NAME --label "runnumber=${GITHUB_RUN_ID}" --build-arg delete_file="middleware.ts" + run: docker build . --file Dockerfile --tag $IMAGE_NAME --label "runnumber=${GITHUB_RUN_ID}" - name: Log in to registry run: echo "${{ secrets.GITHUB_TOKEN }}" | docker login ghcr.io -u $ --password-stdin diff --git a/.github/workflows/gitlab-sync.yml b/.github/workflows/gitlab-sync.yml new file mode 100644 index 000000000..e694cc360 --- /dev/null +++ b/.github/workflows/gitlab-sync.yml @@ -0,0 +1,21 @@ +name: PushRepoToGitlab +on: [push] +jobs: + pushtogitlab: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + with: + fetch-depth: 0 + - name: Branch name + run: echo running on branch ${GITHUB_REF_NAME} + - name: Push To Gitlab + env: + token: ${{ secrets.GITLABTOKEN }} + gitlabrepo: ${{ secrets.GITLABREPO }} + run: | + echo Starting to push repo to gitlab + git config user.name "GitHub" + git config user.email "git@digitalist.github.com" + git remote set-url origin "https://oauth2:${token}@${gitlabrepo}" + git push origin ${GITHUB_REF_NAME} diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml new file mode 100644 index 000000000..177f94f6c --- /dev/null +++ b/.gitlab-ci.yml @@ -0,0 +1,71 @@ +image: docker:20.10.16 +workflow: + rules: + - if: $CI_COMMIT_BRANCH + - if: $CI_COMMIT_TAG +variables: + DOCKER_HOST: tcp://docker:2376 + DOCKER_TLS_CERTDIR: "/certs" + DOCKER_TLS_VERIFY: 1 + DOCKER_CERT_PATH: "$DOCKER_TLS_CERTDIR/client" + TAG: $CI_COMMIT_REF_SLUG-$CI_COMMIT_SHORT_SHA + IMAGE_NAME: "$IMAGE:$TAG" + DOCKER_IMAGE: "$IMAGE_NAME" + KANIKO_CACHE_ARGS: "" + +stages: + - build + - deploy +image:build:release: + stage: build + cache: + key: ${CI_COMMIT_REF_SLUG} + paths: + - node_modules/ + - .next/cache/ + rules: + - if: $CI_COMMIT_BRANCH == "beta" + image: + name: gcr.io/kaniko-project/executor:debug + entrypoint: [""] + script: + - mkdir -p /kaniko/.docker + - cat $DOCKER_AUTH_CONFIG > /kaniko/.docker/config.json + - /kaniko/executor --context $CI_PROJECT_DIR --dockerfile Dockerfile --destination $IMAGE:$TAG + +image:build:tagged: + stage: build + cache: + key: ${CI_COMMIT_REF_SLUG} + paths: + - node_modules/ + - .next/cache/ + rules: + - if: $CI_COMMIT_TAG + image: + name: gcr.io/kaniko-project/executor:debug + entrypoint: [""] + script: + - mkdir -p /kaniko/.docker + - cat $DOCKER_AUTH_CONFIG > /kaniko/.docker/config.json + - /kaniko/executor --context $CI_PROJECT_DIR --dockerfile Dockerfile --destination $IMAGE:$CI_COMMIT_TAG + +deploy:branch: + rules: + - if: '$CI_COMMIT_BRANCH == "beta"' + variables: + IMAGE_DATAPORTAL_WEB: $IMAGE:$TAG + stage: deploy + trigger: + project: digg/deploy-dataportal + branch: main + +deploy:tag: + rules: + - if: $CI_COMMIT_TAG + variables: + IMAGE_DATAPORTAL_WEB: $IMAGE:$CI_COMMIT_TAG + stage: deploy + trigger: + project: digg/deploy-dataportal + branch: main diff --git a/README.md b/README.md index aff74aa21..e887e9197 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -![Swedish data portal](https://www.dataportal.se/images/svdp-favicon-64.png) +![Swedish data portal](https://www.dataportal.se/images/svdp-favicon-64.png) # The Swedish data portal web client – [dataportal.se](https://www.dataportal.se) Sweden´s national data portal gathers and shares data for re-use to make it easier for users to find and explore it across sectors and domains.The portal only contains information about datasets, i.e. metadata. The actual datasets are retrieved via links for download or requested by the respective organization responsible for their own datasets. The Agency for Digital Government (DIGG) is responsible for Sweden's national data portal. @@ -15,33 +15,39 @@ EntryScape Registry is a solution for managing a registry of data catalogs and r ![nextjs-current](https://img.shields.io/badge/nextjs-13.0.2-green) ## Development -Start by creating an ```.env.local``` file. Use the ```.env.local.example``` as template. +Start by creating an `.env.local` file. Use the `.env.local.example` as template. (Environment variables and tokens in .env.local.example that has placeholder value of "secret" is not available here and needs to be changed to a valid value). ### Run application in development mode + Starts the application in development mode with hot-code reloading, error reporting, and more. See [Nextjs Development](https://nextjs.org/docs/app/api-reference/next-cli#development) for more information. Run: -```sh + +```sh yarn yarn dev # If you are having issues connecting to your localhost port for apollo: export NODE_OPTIONS=--dns-result-order=ipv4first ``` + Visit [http://localhost:3000](http://localhost:3000) in the browser. ### Run application in production mode Builds the application for production usage. See [Nextjs production build](https://nextjs.org/docs/app/api-reference/next-cli#build) for more info. And Start the Next.js production server. See [Nextjs start production](https://nextjs.org/docs/app/api-reference/next-cli#production) for more info. Run: + ```sh yarn yarn build yarn start ``` + Visit [http://localhost:3000](http://localhost:3000) in the browser. ### Run application with Docker Run the following to start the application with docker. + ```sh #build image docker build . -t dataportal-web @@ -65,13 +71,12 @@ No cache, Do a request to content backend with startpage query. ## Notes ### Stack -- [![Nextjs](https://badgen.net/badge/Nextjs/JS%20framework/blue)](https://nextjs.org/) +- [![Nextjs](https://badgen.net/badge/Nextjs/JS%20framework/blue)](https://nextjs.org/) - [![TypeScript](https://badgen.net/badge/TypeScript/For%20static%20types/blue)](https://www.typescriptlang.org/) - [![React](https://badgen.net/badge/React/For%20UI/blue)](https://reactjs.org/) - [![Emotion](https://badgen.net/badge/Emotion/For%20styling/blue)](https://emotion.sh) - [![Apollo Client](https://badgen.net/badge/Apollo%20Client/For%20federated%20content/blue)](https://www.apollographql.com/docs/react/) - ### Content backend The Swedish Dataportal consumes news and content via a GraphQL proxy. The content is rendered with Apollo GraphQl and React. The proxy is not published on Github. @@ -85,3 +90,10 @@ The package is published via NMP under [`@digg/design-system`](https://www.npmjs Display of video is done via [screen9](https://screen9.com/). To be able to display videos an account from screen9 is needed and an API key. The key for this frontend application has read access only to DIGG screen9 account. + +### Sandbox editera +To test locally in the sandbox environment, set the sandbox.editera URL on lines 6, 7, and 12 in Settings.Dev.ts + +Line 6: ENTRYSCAPE_SPECS_PATH="sandbox.editera.dataportal.se" +Line 7: ENTRYSCAPE_TERMS_PATH="sandbox.editera.dataportal.se" +Line 12: ENTRYSCAPE_CONCEPT_STATS_URL="https://sandbox.editera.dataportal.se/stats/entityData.json" diff --git a/assets/logos/europeiskaunionen.png b/assets/logos/europeiskaunionen.png new file mode 100644 index 000000000..44d6d55ec Binary files /dev/null and b/assets/logos/europeiskaunionen.png differ diff --git a/components/content/ContainerPage/index.tsx b/components/content/ContainerPage/index.tsx index 2c3bd4b44..2dde4fac2 100644 --- a/components/content/ContainerPage/index.tsx +++ b/components/content/ContainerPage/index.tsx @@ -146,6 +146,7 @@ export const ContainerPage: React.FC = ({ {hasRelatedContent && ( )} + {!image && heading && ( = ({ )} -
-

{checkLang(preamble)}

- {blocks && blocks.length > 0 && } -
- {menuItems.length > 2 && ( )} + +
+

{checkLang(preamble)}

+ {blocks && blocks.length > 0 && } +
); diff --git a/components/content/FormPage/index.tsx b/components/content/FormPage/index.tsx index 495cdec67..b3df8a497 100644 --- a/components/content/FormPage/index.tsx +++ b/components/content/FormPage/index.tsx @@ -221,7 +221,10 @@ export const FormPage: FC = ({ elements, module }) => { return ( {formDataArray[0] && ( -
+
{page !== 0 && formSteps.length > 0 && ( = ({ id={filterKey} name={filterKey} placeholder={t("search$filtersearch")} - className="border-none hover:outline-0 focus-visible:outline-0" + className="focus--in border-none" value={filter[filterKey] || ""} onChange={(e) => ( clearCurrentScrollPos(), @@ -314,6 +314,7 @@ export const SearchFilters: React.FC = ({ {searchMode == "datasets" && (
= ({ }} />