diff --git a/src/wanijo/infrastructure/view.clj b/src/wanijo/infrastructure/view.clj index 7d1ef53..8592371 100644 --- a/src/wanijo/infrastructure/view.clj +++ b/src/wanijo/infrastructure/view.clj @@ -83,7 +83,12 @@ [:h2 "Visualisation"] [:ul [:li [:a {:href (path :vis-all-instances)} - "All Instances"]]]]))] + "All Instances"]]]] + [:section + [:h2 "Triology"] + [:ul + [:li [:a {:href (path :public-index)} + "Public"]]]]))] (into [:main (for [msg (:flash request)] (flash-error msg))] diff --git a/src/wanijo/public/db.clj b/src/wanijo/public/db.clj index 3c0a5c8..e84880b 100644 --- a/src/wanijo/public/db.clj +++ b/src/wanijo/public/db.clj @@ -1,10 +1,26 @@ (ns wanijo.public.db (:require [wanijo.infrastructure.neo4j :as neo4j])) -(def key-mapping - {"dev" "Development" - "req" "Projekte" - "prk" "Requirements Engineering"}) +(def schema-uuids + {:coc "4f7b561c-51d2-4332-895f-cd583946dcab" + :role "f87b5810-b8c2-4420-91ae-87f0e02af88a" + :level "4ce60c8f-3864-4528-9e63-7c862cb8644a" + :module "574b1813-5366-4e48-9034-9c1bce52d455" + :component "439856be-85be-49c1-b58b-4594741f37b3"}) -(neo4j/defquery roles - "MATCH (i:instance {name:{name}})") +(def coc-instance-uuids + {"dev" "6348f1ab-1771-4bef-b101-eb76ec236646" + "req" "44b02979-7e78-491c-8631-fc49a47b799d" + "prk" "318ee72d-8a8b-42c5-aa90-d5efc1787d22"}) + +(neo4j/defquery roles-of-coc + "MATCH (coc:instance {uuid:{coc_uuid}}), + (coc)--(:link)--(role:instance), + (role)-[:of]->(rschema:schema {uuid:{roleschema_uuid}}) + RETURN role + ORDER BY role.name") +(defn roles-of-coc! [coc-key] + (map :role + (neo4j/exec-query! roles-of-coc + {:coc_uuid (get coc-instance-uuids coc-key) + :roleschema_uuid (:role schema-uuids)}))) diff --git a/src/wanijo/public/routes.clj b/src/wanijo/public/routes.clj index ba82b93..5cebdc0 100644 --- a/src/wanijo/public/routes.clj +++ b/src/wanijo/public/routes.clj @@ -1,13 +1,15 @@ (ns wanijo.public.routes (:require [compojure.core :refer [defroutes wrap-routes GET]] [wanijo.infrastructure.routing :refer [register!]] + [wanijo.public.db :as db-public] [wanijo.public.view :as view-public])) (defn index [] (view-public/index)) (defn show-coc [coc] - (view-public/show-coc coc)) + (view-public/show-coc coc + (db-public/roles-of-coc! coc))) (defroutes routes (GET (register! :public-index "/public") [] (index)) diff --git a/src/wanijo/public/view.clj b/src/wanijo/public/view.clj index d98d95d..0ac9e40 100644 --- a/src/wanijo/public/view.clj +++ b/src/wanijo/public/view.clj @@ -1,5 +1,6 @@ (ns wanijo.public.view (:require [hiccup.page :refer [html5 include-js include-css]] + [hiccup.core :refer [h]] [wanijo.infrastructure.routing :refer [path]])) (defn layout [content] @@ -49,6 +50,14 @@ "Dann gestalte selbst deinen Weg bei der TRIO und sprich" "deinen Vorgesetzten an"]])) -(defn show-coc [coc] +(defn show-coc [coc roles] (layout - [[:h1 "CoC " coc]])) + [[:h1 "CoC " coc] + [:table.table + [:thead + [:tr + [:th "Name"]]] + [:tbody + (for [role roles] + [:tr + [:td (h (:name role))]])]]]))