From ecfff4b2da2529487a4c588d26c30481d1e0280a Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Sat, 14 Mar 2020 11:30:49 +0100 Subject: [PATCH 001/192] Bump acorn from 5.7.3 to 5.7.4 (#1684) Bumps [acorn](https://github.com/acornjs/acorn) from 5.7.3 to 5.7.4. - [Release notes](https://github.com/acornjs/acorn/releases) - [Commits](https://github.com/acornjs/acorn/compare/5.7.3...5.7.4) Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- package-lock.json | 30 +++++++++++++++--------------- 1 file changed, 15 insertions(+), 15 deletions(-) diff --git a/package-lock.json b/package-lock.json index 336713eb1..6d330bef2 100644 --- a/package-lock.json +++ b/package-lock.json @@ -2105,9 +2105,9 @@ } }, "acorn": { - "version": "7.1.0", - "resolved": "https://registry.npmjs.org/acorn/-/acorn-7.1.0.tgz", - "integrity": "sha512-kL5CuoXA/dgxlBbVrflsflzQ3PAas7RYZB52NOm/6839iVYJgKMJ3cQJD+t2i5+qFa8h3MDpEOJiS64E8JLnSQ==" + "version": "7.1.1", + "resolved": "https://registry.npmjs.org/acorn/-/acorn-7.1.1.tgz", + "integrity": "sha512-add7dgA5ppRPxCFJoAGfMDi7PIBXq1RtGo7BhbLaxwrXPOmw8gq48Y9ozT01hUKy9byMjlR20EJhu5zlkErEkg==" }, "acorn-globals": { "version": "4.3.4", @@ -2119,9 +2119,9 @@ }, "dependencies": { "acorn": { - "version": "6.4.0", - "resolved": "https://registry.npmjs.org/acorn/-/acorn-6.4.0.tgz", - "integrity": "sha512-gac8OEcQ2Li1dxIEWGZzsp2BitJxwkwcOm0zHAJLcPJaVvm58FRnk6RkuLRpU1EujipU2ZFODv2P9DLMfnV8mw==" + "version": "6.4.1", + "resolved": "https://registry.npmjs.org/acorn/-/acorn-6.4.1.tgz", + "integrity": "sha512-ZVA9k326Nwrj3Cj9jlh3wGFutC2ZornPNARZwsNYqQYgN0EsV2d53w5RN/co65Ohn4sUAUtb1rSUAOD6XN9idA==" } } }, @@ -8342,9 +8342,9 @@ }, "dependencies": { "acorn": { - "version": "6.4.0", - "resolved": "https://registry.npmjs.org/acorn/-/acorn-6.4.0.tgz", - "integrity": "sha512-gac8OEcQ2Li1dxIEWGZzsp2BitJxwkwcOm0zHAJLcPJaVvm58FRnk6RkuLRpU1EujipU2ZFODv2P9DLMfnV8mw==" + "version": "6.4.1", + "resolved": "https://registry.npmjs.org/acorn/-/acorn-6.4.1.tgz", + "integrity": "sha512-ZVA9k326Nwrj3Cj9jlh3wGFutC2ZornPNARZwsNYqQYgN0EsV2d53w5RN/co65Ohn4sUAUtb1rSUAOD6XN9idA==" }, "jsdom": { "version": "14.1.0", @@ -9734,9 +9734,9 @@ }, "dependencies": { "acorn": { - "version": "5.7.3", - "resolved": "https://registry.npmjs.org/acorn/-/acorn-5.7.3.tgz", - "integrity": "sha512-T/zvzYRfbVojPWahDsE5evJdHb3oJoQfFbsrKM7w5Zcs++Tr257tia3BmMP8XYVjp1S9RZXQMh7gao96BlqZOw==" + "version": "5.7.4", + "resolved": "https://registry.npmjs.org/acorn/-/acorn-5.7.4.tgz", + "integrity": "sha512-1D++VG7BhrtvQpNbBzovKNc1FLGGEE/oGe7b9xJm/RFHMBeUaUGpluV9RLjZa47YFdPcDAenEYuq9pQPcMdLJg==" } } }, @@ -17638,9 +17638,9 @@ }, "dependencies": { "acorn": { - "version": "6.4.0", - "resolved": "https://registry.npmjs.org/acorn/-/acorn-6.4.0.tgz", - "integrity": "sha512-gac8OEcQ2Li1dxIEWGZzsp2BitJxwkwcOm0zHAJLcPJaVvm58FRnk6RkuLRpU1EujipU2ZFODv2P9DLMfnV8mw==" + "version": "6.4.1", + "resolved": "https://registry.npmjs.org/acorn/-/acorn-6.4.1.tgz", + "integrity": "sha512-ZVA9k326Nwrj3Cj9jlh3wGFutC2ZornPNARZwsNYqQYgN0EsV2d53w5RN/co65Ohn4sUAUtb1rSUAOD6XN9idA==" }, "cacache": { "version": "12.0.3", From 02a4ce41c6ba4a8787df7859a377c720fd9a8353 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bj=C3=B8rn=20Reppen?= Date: Fri, 21 Aug 2020 10:31:54 +0200 Subject: [PATCH 002/192] Bruk test API i test (#1691) --- src/AppSettings/AppFunksjoner/fetchMeta.js | 2 +- src/Funksjoner/backend.js | 24 +++---------------- src/Funksjoner/config.js | 23 ++++++++++++++---- src/GjenbruksElement/Bildeavatar.js | 9 ++++--- .../Navigeringsliste/KartlagBarnElement.js | 4 ++-- .../Katalog/KatalogGradienter/Gradienter.js | 6 ++--- .../KatalogHeader/KatalogHeaderImage.js | 21 +++++++--------- .../scene/visualisering/openStreetMap.js | 7 ++++-- 8 files changed, 45 insertions(+), 51 deletions(-) diff --git a/src/AppSettings/AppFunksjoner/fetchMeta.js b/src/AppSettings/AppFunksjoner/fetchMeta.js index 921585c00..a9b097cef 100644 --- a/src/AppSettings/AppFunksjoner/fetchMeta.js +++ b/src/AppSettings/AppFunksjoner/fetchMeta.js @@ -12,7 +12,7 @@ export default function fetchMeta(location, place) { return; } if (!url || url.length !== 2 || !url[1]) return; - const path = url[1].replace(/katalog/i, ""); + const path = "/" + url[1]; place.downloadMeta(path).then(data => { if (!data) { place.setState({ searchFor: path }); diff --git a/src/Funksjoner/backend.js b/src/Funksjoner/backend.js index a4286e93a..2f5605b23 100644 --- a/src/Funksjoner/backend.js +++ b/src/Funksjoner/backend.js @@ -1,4 +1,3 @@ -import { wgs84ToUtm33 } from "Funksjoner/projection"; import config from "Funksjoner/config"; class Backend { @@ -19,16 +18,7 @@ class Backend { } static async søk(q) { - return this.getPromise(`https://lookup.artsdatabanken.no/v1/query?q=${q}`); - } - - static async hentStatistikk(kode, bounds) { - var ll = wgs84ToUtm33(bounds._southWest.lng, bounds._southWest.lat); - var ur = wgs84ToUtm33(bounds._northEast.lng, bounds._northEast.lat); - let bbox = `&bbox=${ll.x},${ll.y},${ur.x},${ur.y}`; - - const url = `https://ogapi.artsdatabanken.no/v1/StatKodetre?node=${kode}${bbox}`; - return this.getPromise(url); + return this.getPromise(`https://lookup.${config.domain}/v1/query?q=${q}`); } static async hentKodeMeta(path) { @@ -37,21 +27,13 @@ class Backend { static async hentPunkt(lng, lat) { return this.getPromise( - `https://punkt.artsdatabanken.no/v1/punkt?lng=${lng}&lat=${lat}` - ); - } - - /* DEN GAMLE INNTIL VIDERE */ - static async hentPunktGammel(lng, lat) { - return this.getPromise( - `https://vector.artsdatabanken.no/ogapi/codes/${lng}/${lat}` + `https://punkt.${config.domain}/v1/punkt?lng=${lng}&lat=${lat}` ); } - /* SLUTT */ static async hentStedsnavn(lng, lat) { return this.getPromise( - `https://stedsnavn.artsdatabanken.no/v1/punkt?lng=${lng}&lat=${lat}` + `https://stedsnavn.${config.domain}/v1/punkt?lng=${lng}&lat=${lat}` ); } diff --git a/src/Funksjoner/config.js b/src/Funksjoner/config.js index db81a6a37..cac79b1ef 100644 --- a/src/Funksjoner/config.js +++ b/src/Funksjoner/config.js @@ -1,9 +1,13 @@ +const host = window.location.hostname; +const isTest = host.indexOf("test") >= 0 || host === "localhost"; + class config { static feature = { comboSøk: false }; - static storageUrl = "https://data.artsdatabanken.no/"; + static domain = isTest ? "test.artsdatabanken.no" : "artsdatabanken.no"; + static storageUrl = "https://data." + config.domain; static createTileSource(relativePath, type, zoom, bbox) { const source = { @@ -27,15 +31,23 @@ class config { return source; } - static getFotoOmslag(url, width = 408, filtype = "jpg") { - if (url.indexOf("Datakilde") === 0) filtype = "png"; - return `${config.storageUrl}${url}/forside_${width}.${filtype}`; + static foto(url, width = 408, filtype = "jpg") { + if ( + url.indexOf("Datakilde") === 0 || + url.indexOf("Administrativ_grense") === 0 + ) + filtype = "png"; + return `${config.storageUrl}${url}/foto_${width}.${filtype}`; } static getFotoBanner(url, width = 408) { return `${config.storageUrl}${url}/banner_${width}.jpg`; } + static phylopic(url) { + return `${config.storageUrl}${url}/phylopic_48.png`; + } + static logo(url, width = 24) { return `${config.storageUrl}${url}/logo_${width}.png`; } @@ -54,7 +66,8 @@ class config { kode.indexOf("AO-TO-FL") === 0 || kode.indexOf("VV") === 0 || kode.indexOf("NN-NA-BS-3EL") === 0 || - kode.indexOf("NN-NA-LKM-BK") === 0 + kode.indexOf("NN-NA-LKM-BK") === 0 || + kode.indexOf("NN-NA-") === 0 ) return kode.split("-").pop(); if (kode.indexOf("NN-") !== 0) return kode; diff --git a/src/GjenbruksElement/Bildeavatar.js b/src/GjenbruksElement/Bildeavatar.js index 984a81342..c9cd07d0e 100644 --- a/src/GjenbruksElement/Bildeavatar.js +++ b/src/GjenbruksElement/Bildeavatar.js @@ -1,4 +1,5 @@ import React, { Component } from "react"; +import config from "../Funksjoner/config"; class BildeAvatar extends Component { /* @@ -14,12 +15,14 @@ class BildeAvatar extends Component { render() { const { url } = this.props; if (!url) return null; - let urlWithNoQueryString = - "https://data.artsdatabanken.no/" + url.split("?")[0] + "/logo_24.png"; let classes = "liste_ikon"; return ( - logo + logo ); } diff --git a/src/InformasjonsVisning/Katalog/KatalogBarneliste/Navigeringsliste/KartlagBarnElement.js b/src/InformasjonsVisning/Katalog/KatalogBarneliste/Navigeringsliste/KartlagBarnElement.js index 9d8a860b9..ce4c2c82f 100644 --- a/src/InformasjonsVisning/Katalog/KatalogBarneliste/Navigeringsliste/KartlagBarnElement.js +++ b/src/InformasjonsVisning/Katalog/KatalogBarneliste/Navigeringsliste/KartlagBarnElement.js @@ -3,6 +3,7 @@ import språk from "Funksjoner/språk"; import getSecondary from "./NavigeringslisteFunksjoner/getSecondary"; import kodeSuffix from "./NavigeringslisteFunksjoner/kodeSuffix"; import "style/NavMenu.scss"; +import config from "../../../../Funksjoner/config"; class KartlagBarnElement extends React.Component { render() { @@ -20,12 +21,11 @@ class KartlagBarnElement extends React.Component { let backgroundSize = "cover", borderSize = "0px", - new_url = "https://data.artsdatabanken.no/" + url + "/foto_408.jpg"; + new_url = config.foto(url, 408); if ( isDatakilde === "Datakilde" || new_url.indexOf("Administrativ_grense") !== -1 ) { - new_url = "https://data.artsdatabanken.no" + url + "/logo_408.png"; backgroundSize = "contain"; borderSize = "10px solid transparent"; } diff --git a/src/InformasjonsVisning/Katalog/KatalogGradienter/Gradienter.js b/src/InformasjonsVisning/Katalog/KatalogGradienter/Gradienter.js index faa9e904a..ccc3bc180 100644 --- a/src/InformasjonsVisning/Katalog/KatalogGradienter/Gradienter.js +++ b/src/InformasjonsVisning/Katalog/KatalogGradienter/Gradienter.js @@ -1,8 +1,8 @@ import React from "react"; import språk from "Funksjoner/språk"; +import config from "../../../Funksjoner/config"; const Gradienter = ({ gradient, onNavigate, title }) => { - //console.log(gradient); /// Gradient er navnet på noden /// Barna av gradient heter return ( @@ -18,8 +18,6 @@ const Gradienter = ({ gradient, onNavigate, title }) => {

{item.tittel.nb}

{gradientelement.map((item, index) => { let aktiv = item["på"]; - let img_url = - "https://data.artsdatabanken.no/" + item.url + "/foto_408.jpg"; return ( - - - - - - ); -}; - -export default Forvaltningsportalen; diff --git a/src/Forvaltningsportalen/ForvaltningsKartlag/ForvaltningsEkspanderTopp.js b/src/Forvaltningsportalen/ForvaltningsKartlag/ForvaltningsEkspanderTopp.js deleted file mode 100644 index 23ed368f4..000000000 --- a/src/Forvaltningsportalen/ForvaltningsKartlag/ForvaltningsEkspanderTopp.js +++ /dev/null @@ -1,52 +0,0 @@ -import React, { useState } from "react"; -import språk from "Funksjoner/språk"; -import { KeyboardArrowDown, KeyboardArrowUp } from "@material-ui/icons"; - -const ForvaltningsEkspanderTopp = ({ - kartlag, - erAktivtLag, - onUpdateLayerProp, - handleShowCurrent, - show_current -}) => { - let tittel = kartlag.tittel; - const kode = kartlag.kode; - const erSynlig = kartlag.erSynlig; - - const [expanded, setExpanded] = useState(false); - return ( -
- { - if (!erAktivtLag) { - onUpdateLayerProp(kode, "erSynlig", !erSynlig); - e.stopPropagation(); - } else { - handleShowCurrent(!show_current); - } - }} - checked={erSynlig ? "checked" : ""} - /> - - {språk(tittel)} -
-
- - - {/* The toggle button for this element */} - - -
- ); -}; - -export default ForvaltningsEkspanderTopp; diff --git a/src/Forvaltningsportalen/ForvaltningsKartlag/ForvaltningsKartlag.js b/src/Forvaltningsportalen/ForvaltningsKartlag/ForvaltningsKartlag.js deleted file mode 100644 index 99a0e51e1..000000000 --- a/src/Forvaltningsportalen/ForvaltningsKartlag/ForvaltningsKartlag.js +++ /dev/null @@ -1,88 +0,0 @@ -import React from "react"; -import { SettingsContext } from "SettingsContext"; -import AktivtKartlagElement from "Kartlag/AktiveKartlag/AktivtKartlagElement"; -import ForvaltningsEkspanderTopp from "./ForvaltningsEkspanderTopp"; -import { KeyboardArrowDown, KeyboardArrowUp } from "@material-ui/icons"; - -class Kartlag extends React.Component { - state = { - showKartlag: false - }; - render() { - const { aktiveLag, onFitBounds, onUpdateLayerProp, hidden } = this.props; - let koder = aktiveLag; - const keys = Object.keys(koder); - return ( - <> - {hidden && ( - - {context => ( - <> - - -
-
-
-
    - {keys.reverse().map(fkode => { - const kartlag = koder[fkode]; - return ( - fkode !== "bakgrunnskart" && ( - <> - - - ) - ); - })} -
-
-
-
    - -
-
-
-
- - )} -
- )} - - ); - } -} - -export default Kartlag; diff --git a/src/Forvaltningsportalen/Forvaltningsportalen.js b/src/Forvaltningsportalen/Forvaltningsportalen.js deleted file mode 100644 index 93daf7742..000000000 --- a/src/Forvaltningsportalen/Forvaltningsportalen.js +++ /dev/null @@ -1,51 +0,0 @@ -import React from "react"; -import "style/Forvaltningsportalen.scss"; -import ForvaltningsportalenLandingsside from "Forvaltningsportalen/ForvaltningsportalenLandingsside"; -import ForvaltningsKartlag from "Forvaltningsportalen/ForvaltningsKartlag/ForvaltningsKartlag"; -import ForvaltningsKartBokser from "Forvaltningsportalen/ForvaltningsKartBokser/ForvaltningsKartBokser"; - -const Forvaltningsportalen = props => { - const { - history, - path, - forvaltningsportalen, - aktiveLag, - show_current, - handleShowCurrent, - navigation_history, - handleFitBounds, - onUpdateLayerProp, - meta - } = props; - return ( - <> - {forvaltningsportalen === "true" && ( - <> - {path !== "/forvaltningsportalen/kart" ? ( - - ) : ( - <> - -