From 6cae455d468f85bdaa65e7c3189f25cb810a3aa0 Mon Sep 17 00:00:00 2001 From: Sam Van Campenhout Date: Wed, 12 Mar 2025 16:52:01 +0100 Subject: [PATCH] Disable the secure cookie flag in development This makes it easier to test the dashboard locally. --- config/dispatcher/dispatcher.ex | 20 ++++ .../20250313103300-create-log-levels.sparql | 33 ++++++ .../20250313103900-create-log-source.sparql | 7 ++ config/resources/domain.lisp | 4 +- config/resources/file.json | 107 ++++++++++++++++++ config/resources/files-domain.lisp | 16 --- config/resources/harvest.json | 40 +++++++ config/resources/job.json | 5 + config/resources/log.json | 92 +++++++++++++++ docker-compose.dev.yml | 2 + 10 files changed, 309 insertions(+), 17 deletions(-) create mode 100644 config/migrations/2025/20250313103300-create-log-levels.sparql create mode 100644 config/migrations/2025/20250313103900-create-log-source.sparql create mode 100644 config/resources/file.json delete mode 100644 config/resources/files-domain.lisp create mode 100644 config/resources/harvest.json create mode 100644 config/resources/log.json diff --git a/config/dispatcher/dispatcher.ex b/config/dispatcher/dispatcher.ex index f647abf..55093c1 100644 --- a/config/dispatcher/dispatcher.ex +++ b/config/dispatcher/dispatcher.ex @@ -261,6 +261,26 @@ defmodule Dispatcher do Proxy.forward(conn, path, "http://resource/reports/") end + match "/log-entries/*path", %{accept: [:json], layer: :api} do + Proxy.forward(conn, path, "http://resource/log-entries/") + end + + match "/log-levels/*path", %{accept: [:json], layer: :api} do + Proxy.forward(conn, path, "http://resource/log-levels/") + end + + match "/status-codes/*path", %{accept: [:json], layer: :api} do + Proxy.forward(conn, path, "http://resource/status-codes/") + end + + match "/log-sources/*path", %{accept: [:json], layer: :api} do + Proxy.forward(conn, path, "http://resource/log-sources/") + end + + match "/remote-data-objects/*path", %{accept: [:json], layer: :api} do + Proxy.forward(conn, path, "http://resource/remote-data-objects/") + end + ############### # LOGIN ############### diff --git a/config/migrations/2025/20250313103300-create-log-levels.sparql b/config/migrations/2025/20250313103300-create-log-levels.sparql new file mode 100644 index 0000000..3f16043 --- /dev/null +++ b/config/migrations/2025/20250313103300-create-log-levels.sparql @@ -0,0 +1,33 @@ +INSERT DATA { + GRAPH { + a ; + "0986a9b6-b543-4629-8ef8-08928ae42430" ; + 1 ; + "TRACE" . + + a ; + "fe6473d5-ac83-450c-83f8-3546357c7117" ; + 2 ; + "DEBUG" . + + a ; + "6f92baad-b4a1-42ce-8bdf-e28218b27ff9" ; + 3 ; + "INFO" . + + a ; + "62d2516b-e6b8-4866-aad1-e8347f2cdc70" ; + 4 ; + "WARN" . + + a ; + "3af9ebe1-e6a8-495c-a392-16ced1f38ef1" ; + 5 ; + "ERROR" . + + a ; + "c679f915-1fdd-4b50-938d-6b565aa31278" ; + 6 ; + "FATAL" . + } +} \ No newline at end of file diff --git a/config/migrations/2025/20250313103900-create-log-source.sparql b/config/migrations/2025/20250313103900-create-log-source.sparql new file mode 100644 index 0000000..703f6ec --- /dev/null +++ b/config/migrations/2025/20250313103900-create-log-source.sparql @@ -0,0 +1,7 @@ +INSERT DATA { + GRAPH { + a ; + "c7806563-25a4-46c8-9be2-a0cdf0db1f98" ; + "Acmidm login service" . + } +} \ No newline at end of file diff --git a/config/resources/domain.lisp b/config/resources/domain.lisp index 18fb9c0..f2d2fd4 100644 --- a/config/resources/domain.lisp +++ b/config/resources/domain.lisp @@ -17,8 +17,10 @@ (read-domain-file "domain.json") (read-domain-file "auth.json") (read-domain-file "change-events.json") -(read-domain-file "files-domain.lisp") +(read-domain-file "file.json") (read-domain-file "dcat.json") (read-domain-file "privacy-centric-service.json") (read-domain-file "job.json") (read-domain-file "report.json") +(read-domain-file "log.json") +(read-domain-file "harvest.json") diff --git a/config/resources/file.json b/config/resources/file.json new file mode 100644 index 0000000..6c75fab --- /dev/null +++ b/config/resources/file.json @@ -0,0 +1,107 @@ +{ + "version": "0.1", + "prefixes": { + "adms": "http://www.w3.org/ns/adms#", + "dct": "http://purl.org/dc/terms/", + "dbpedia": "http://dbpedia.org/ontology/", + "nfo": "http://www.semanticdesktop.org/ontologies/2007/03/22/nfo#", + "nie": "http://www.semanticdesktop.org/ontologies/2007/01/19/nie#", + "rpioHttp": "http://redpencil.data.gift/vocabularies/http/", + "skos": "http://www.w3.org/2004/02/skos/core#", + "task": "http://redpencil.data.gift/vocabularies/tasks/" + }, + "resources": { + "files": { + "name": "file", + "class": "nfo:FileDataObject", + "attributes": { + "filename": { + "type": "string", + "predicate": "nfo:fileName" + }, + "format": { + "type": "string", + "predicate": "dct:format" + }, + "size": { + "type": "number", + "predicate": "nfo:fileSize" + }, + "extension": { + "type": "string", + "predicate": "dbpedia:fileExtension" + }, + "created": { + "type": "datetime", + "predicate": "nfo:fileCreated" + } + }, + "relationships": { + "download": { + "predicate": "nie:dataSource", + "target": "file", + "cardinality": "one", + "inverse": true + }, + "data-container": { + "predicate": "task:hasFile", + "target": "data-container", + "cardinality": "one", + "inverse": true + } + }, + "features": ["include-uri"], + "new-resource-base": "http://data.lblod.info/files/" + }, + "remote-data-objects": { + "name": "remote-data-object", + "class": "nfo:RemoteDataObject", + "attributes": { + "source": { + "type": "url", + "predicate": "nie:url" + }, + "created": { + "type": "datetime", + "predicate": "dct:created" + }, + "modified": { + "type": "datetime", + "predicate": "dct:modified" + }, + "request-header": { + "type": "url", + "predicate": "rpioHttp:requestHeader" + }, + "status": { + "type": "url", + "predicate": "adms:status" + }, + "comment": { + "type": "string", + "predicate": "skos:comment" + }, + "creator": { + "type": "url", + "predicate": "dct:creator" + } + }, + "relationships": { + "file": { + "predicate": "nie:dataSource", + "target": "file", + "cardinality": "one", + "inverse": true + }, + "harvesting-collection": { + "predicate": "dct:hasPart", + "target": "harvesting-collection", + "cardinality": "one", + "inverse": true + } + }, + "features": ["include-uri"], + "new-resource-base": "http://data.lblod.info/id/remote-data-objects/" + } + } +} \ No newline at end of file diff --git a/config/resources/files-domain.lisp b/config/resources/files-domain.lisp deleted file mode 100644 index 36589ef..0000000 --- a/config/resources/files-domain.lisp +++ /dev/null @@ -1,16 +0,0 @@ -(define-resource file () - :class (s-prefix "nfo:FileDataObject") - :properties `((:filename :string ,(s-prefix "nfo:fileName")) - (:format :string ,(s-prefix "dct:format")) - (:size :number ,(s-prefix "nfo:fileSize")) - (:extension :string ,(s-prefix "dbpedia:fileExtension")) - (:created :datetime ,(s-prefix "nfo:fileCreated"))) - :has-one `((file :via ,(s-prefix "nie:dataSource") - :inverse t - :as "download") - (data-container :via ,(s-prefix "task:hasFile") - :inverse t - :as "data-container")) - :resource-base (s-url "http://data.lblod.info/files/") - :features `(no-pagination-defaults include-uri) - :on-path "files") diff --git a/config/resources/harvest.json b/config/resources/harvest.json new file mode 100644 index 0000000..4115426 --- /dev/null +++ b/config/resources/harvest.json @@ -0,0 +1,40 @@ +{ + "version": "0.1", + "prefixes": { + "adms": "http://www.w3.org/ns/adms#", + "dct": "http://purl.org/dc/terms/", + "hrvst": "http://lblod.data.gift/vocabularies/harvesting/", + "task": "http://redpencil.data.gift/vocabularies/tasks/" + }, + "resources": { + "harvesting-collections": { + "name": "harvesting-collection", + "class": "hrvst:HarvestingCollection", + "attributes": { + "status": { + "type": "url", + "predicate": "adms:status" + }, + "creator": { + "type": "url", + "predicate": "dct:creator" + } + }, + "relationships": { + "remote-data-objects": { + "predicate": "dct:hasPart", + "target": "remote-data-object", + "cardinality": "many" + }, + "data-container": { + "predicate": "task:hasHarvestingCollection", + "target": "data-container", + "cardinality": "many", + "inverse": true + } + }, + "features": ["include-uri"], + "new-resource-base": "http://data.lblod.info/id/harvesting-collection/" + } + } +} \ No newline at end of file diff --git a/config/resources/job.json b/config/resources/job.json index dba13a1..5f8bbff 100644 --- a/config/resources/job.json +++ b/config/resources/job.json @@ -127,6 +127,11 @@ } }, "relationships": { + "harvesting-collections": { + "predicate": "task:hasHarvestingCollection", + "target": "harvesting-collection", + "cardinality": "many" + }, "result-from-tasks": { "predicate": "task:resultsContainer", "target": "task", diff --git a/config/resources/log.json b/config/resources/log.json new file mode 100644 index 0000000..963bcd4 --- /dev/null +++ b/config/resources/log.json @@ -0,0 +1,92 @@ +{ + "version": "0.1", + "prefixes": { + "dct": "http://purl.org/dc/terms/", + "ext": "http://mu.semte.ch/vocabularies/ext/", + "rlog": "http://persistence.uni-leipzig.org/nlp2rdf/ontologies/rlog#", + "skos": "http://www.w3.org/2004/02/skos/core#" + }, + "resources": { + "log-entries": { + "name": "log-entry", + "class": "rlog:Entry", + "attributes": { + "class-name": { + "type": "url", + "predicate": "rlog:className" + }, + "message": { + "type": "string", + "predicate": "rlog:message" + }, + "specific-information": { + "type": "string", + "predicate": "ext:specificInformation" + }, + "datetime": { + "type": "datetime", + "predicate": "rlog:date" + } + }, + "relationships": { + "log-level": { + "predicate": "rlog:level", + "target": "log-level", + "cardinality": "one" + }, + "status-code": { + "predicate": "rlog:hasCode", + "target": "status-code", + "cardinality": "one" + }, + "log-source": { + "predicate": "dct:source", + "target": "log-source", + "cardinality": "one" + } + }, + "features": ["include-uri"], + "new-resource-base": "http://data.lblod.info/id/log-entries/" + }, + "log-levels": { + "name": "log-level", + "class": "rlog:Level", + "attributes": { + "priority": { + "type": "number", + "predicate": "rlog:priority" + }, + "label": { + "type": "string", + "predicate": "skos:prefLabel" + } + }, + "features": ["include-uri"], + "new-resource-base": "http://data.lblod.info/id/log-levels/" + }, + "status-codes": { + "name": "status-code", + "class": "rlog:StatusCode", + "attributes": { + "code": { + "type": "number", + "predicate": "rlog:codeId" + } + }, + "features": ["include-uri"], + "new-resource-base": "http://data.lblod.info/id/status-codes/" + }, + "log-sources": { + "name": "log-source", + "class": "ext:LogSource", + "attributes": { + "label": { + "type": "string", + "predicate": "skos:prefLabel" + } + }, + "features": ["include-uri"], + "new-resource-base": "http://data.lblod.info/id/log-sources/" + } + } +} \ No newline at end of file diff --git a/docker-compose.dev.yml b/docker-compose.dev.yml index f9d2111..1b9a2a0 100644 --- a/docker-compose.dev.yml +++ b/docker-compose.dev.yml @@ -5,6 +5,8 @@ services: restart: "no" ports: - "80:80" + environment: + SESSION_COOKIE_SECURE: "off" dispatcher: restart: "no" triplestore: