new visualisation namespace

integration-tests
Josha von Gizycki 6 years ago
parent df90b486af
commit eaeca7f8c3

@ -60,13 +60,19 @@
"header-content__link")])]
[:nav
(when authed?
[:section.schemas
[:h2 [:span.__icon "▤"] "Schemas"]
[:ul
(for [schema (:schemas session)]
[:li [:a {:href (path :instance-list
{:schema-uuid (:uuid schema)})}
(h (:name schema))]])]])]
(list
[:section.schemas
[:h2 [:span.__icon "▤"] "Schemas"]
[:ul
(for [schema (:schemas session)]
[:li [:a {:href (path :instance-list
{:schema-uuid (:uuid schema)})}
(h (:name schema))]])]]
[:section
[:h2 [:span.__icon "▤"] "Visualisation"]
[:ul
[:li [:a {:href ""}
"All Instances"]]]]))]
(into [:main
(for [msg (:flash request)]
(flash-error msg))]

@ -12,6 +12,7 @@
[wanijo.user.routes :as user-routes]
[wanijo.attribute.routes :as attr-routes]
[wanijo.instance.routes :as instance-routes]
[wanijo.visualisation.routes :as vis-routes]
[wanijo.framework.auth :as auth]
[wanijo.framework.devmode :as devmode]
[wanijo.framework.routing :refer [path]]))
@ -29,7 +30,8 @@
schema-routes/routes
user-routes/routes
attr-routes/routes
instance-routes/routes))
instance-routes/routes
vis-routes/routes))
(route/not-found "Not Found"))
(def app

@ -6,8 +6,7 @@
[wanijo.instance
[view :as view]
[domain :as domain]
[forms :as forms-inst]
[viz :as viz]]
[forms :as forms-inst]]
[wanijo.schema
[domain :as domain-schema]
[middleware :as middleware-schema]]
@ -119,11 +118,6 @@
(DELETE (register! :instance-delete "/instance/:uuid")
[uuid :as req]
(delete! uuid req))
(GET (register! :instance-link-viz
"/instance/:uuid/link/viz")
[uuid :as req]
{:body (viz/as-svg (instance! uuid))
:headers {"Content-Type" "image/svg+xml"}})
(GET (register! :instance-link-selection
"/instance/:uuid/link/:schema-uuid")
[uuid schema-uuid :as req]

@ -71,7 +71,7 @@
(seq (:links-in instance)))
[:section.visualisation
[:h2 "Visualisation"]
[:image {:src (path :instance-link-viz instance)
[:image {:src (path :vis-single-instance instance)
:alt "SVG Visualisation"}]])
(when (seq (:links-out instance))
[:section.links-out

@ -0,0 +1,14 @@
(ns wanijo.visualisation.routes
(:require [compojure.core :refer [defroutes wrap-routes
GET POST DELETE]]
[ring.util.response :as resp]
[wanijo.framework.routing :refer [register! path]]
[wanijo.instance.domain :as domain-instance]
[wanijo.visualisation.viz :as viz]))
(defroutes routes
(GET (register! :vis-single-instance "/visualisation/instance/:uuid")
[uuid]
{:body (viz/single-instance
(domain-instance/full-instance-by-uuid! uuid))
:headers {"Content-Type" "image/svg+xml"}}))

@ -1,9 +1,9 @@
(ns wanijo.instance.viz
(ns wanijo.visualisation.viz
(:require [dorothy
[core :as dot]
[jvm :as doro-jvm]]))
(defn as-svg [instance]
(defn single-instance [instance]
(let [out-nodes (map #(vector (-> % :target :uuid)
{:label (-> % :target :name)})
(:links-out instance))
Loading…
Cancel
Save