Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -43,3 +43,4 @@ nohup.out
/src/main/python/portalusage/build/
/src/main/python/portalusage/*.spec
__pycache__/
/src/main/js/portal/.env.production.local
8 changes: 7 additions & 1 deletion build.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,13 @@ lazy val data = (project in file("."))
},
cpFrontendPublishCommand := {
val targetDir = (Compile / classDirectory).value.getAbsolutePath
s"""export SCALA_CLASS_DIR="${targetDir}" && npm run publish"""
val sentryUpload = sys.props.getOrElse("cp.deploy.sentryUpload", "false")
Seq(
s"""export SCALA_CLASS_DIR="${targetDir}""",
s"""export SENTRY_UPLOAD="${sentryUpload}""",
"""export RELEASE="$${RELEASE:-$$(git rev-parse --short=12 HEAD)}""",
"npm run publish"
).mkString(" && ")
},
cpFrontendJarImports := Seq(
JarResourceImport(metaCoreModule, "metacore.d.ts", cpFrontendCommonApp.value, "main/metacore.ts"),
Expand Down
5 changes: 4 additions & 1 deletion example.application.conf
Original file line number Diff line number Diff line change
@@ -1 +1,4 @@
cpdata.sentry.dsn = "https://<key>@<sentry-host>/<project-id>"
cpdata.sentry {
backendDsn = "https://<key>@<sentry-host>/<project-id>"
portalDsn = "https://<portal-key>@<sentry-host>/<portal-project-id>"
}
2 changes: 1 addition & 1 deletion project/plugins.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,6 @@ addSbtPlugin("io.spray" % "sbt-revolver" % "0.9.1")

addSbtPlugin("com.typesafe.play" % "sbt-twirl" % "1.6.0-RC2")

addSbtPlugin("se.lu.nateko.cp" % "icoscp-sbt-deploy" % "0.3.3")
addSbtPlugin("se.lu.nateko.cp" % "icoscp-sbt-deploy" % "0.4.2")

addSbtPlugin("se.lu.nateko.cp" % "icoscp-sbt-frontend" % "0.1.3")
2 changes: 2 additions & 0 deletions src/main/js/portal/.env.production.local.example
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# SENTRY_UPLOAD and RELEASE are set by sbt cpFrontendPublishCommand
SENTRY_AUTH_TOKEN="<sentry-auth-token>"
4 changes: 4 additions & 0 deletions src/main/js/portal/main/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ const additionalStationsGraphs: { [E in Envri]?: UrlStr[] } = {
}

const envriFilteringFromGraphs = [metaResourceGraph[envri]].concat(additionalStationsGraphs[envri] ?? [])
const sentryDsn = (window as any).sentryDsn ?? '';

const searchResultsCSVName = {
ICOS: 'Carbon Portal Search Result.csv',
Expand Down Expand Up @@ -186,6 +187,9 @@ export default {
exportCSVLimit: 20_000,
searchResultsCSVName,
features: featureFlags[envri],
sentry: {
dsn: sentryDsn,
},
doiBaseUrl: "https://doi.org/"
};

Expand Down
13 changes: 13 additions & 0 deletions src/main/js/portal/main/main.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
import React from 'react';
import * as Sentry from '@sentry/react';
import { createRoot } from 'react-dom/client';
import config from './config';
import Root from './containers/Root';

import './portal.scss';
Expand All @@ -9,6 +11,17 @@ import '../node_modules/react-widgets/scss/multiselect.scss';
import '../node_modules/ol/ol.css';
import 'react-datepicker/dist/react-datepicker.css';

if (config.sentry.dsn) {
const release = import.meta.env.VITE_SENTRY_RELEASE || undefined;
Sentry.init({
dsn: config.sentry.dsn,
release,
allowUrls: [
/^https:\/\/([a-z0-9-]+\.)+icos-cp\.eu\//i,
/^https:\/\/([a-z0-9-]+\.)+fieldsites\.se\//i,
],
});
}

const container = document.getElementById('main');
const root = createRoot(container!);
Expand Down
1 change: 1 addition & 0 deletions src/main/js/portal/main/vite-env.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
/// <reference types="vite/client" />
Loading
Loading