parent
df90b486af
commit
eaeca7f8c3
@ -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
|
(:require [dorothy
|
||||||
[core :as dot]
|
[core :as dot]
|
||||||
[jvm :as doro-jvm]]))
|
[jvm :as doro-jvm]]))
|
||||||
|
|
||||||
(defn as-svg [instance]
|
(defn single-instance [instance]
|
||||||
(let [out-nodes (map #(vector (-> % :target :uuid)
|
(let [out-nodes (map #(vector (-> % :target :uuid)
|
||||||
{:label (-> % :target :name)})
|
{:label (-> % :target :name)})
|
||||||
(:links-out instance))
|
(:links-out instance))
|
Loading…
Reference in new issue