From b0c7055fa1e0f8d7534a6212c756c42fdee7ea39 Mon Sep 17 00:00:00 2001 From: Josha von Gizycki Date: Thu, 17 Jan 2019 10:29:18 +0100 Subject: [PATCH] show incoming links, make node in viz more visible --- src/wanijo/instance/view.clj | 39 ++++++++++++++++++++++++++++-------- src/wanijo/instance/viz.clj | 3 ++- 2 files changed, 33 insertions(+), 9 deletions(-) diff --git a/src/wanijo/instance/view.clj b/src/wanijo/instance/view.clj index 4a46674..23536fc 100644 --- a/src/wanijo/instance/view.clj +++ b/src/wanijo/instance/view.clj @@ -67,8 +67,14 @@ [:div {:class (str "instance-content " "attr-type-" type)} (render-fn (:value prop))]))]) + (when (or (seq (:links-out instance)) + (seq (:links-in instance))) + [:section.visualisation + [:h2 "Visualisation"] + [:image {:src (path :instance-link-viz instance) + :alt "SVG Visualisation"}]]) (when (seq (:links-out instance)) - [:section.links + [:section.links-out [:h2 "Outgoing Links"] [:table [:thead @@ -90,12 +96,29 @@ {:schema-uuid (:uuid schema)})} (h (:name schema))]] [:td (prettify-dt (:created_at link))]])]]]) - (when (or (seq (:links-out instance)) - (seq (:links-in instance))) - [:section.visualisation - [:h2 "Visualisation"] - [:image {:src (path :instance-link-viz instance) - :alt "SVG Visualisation"}]])])) + (when (seq (:links-in instance)) + [:section.links-in + [:h2 "Incoming Links"] + [:table + [:thead + [:tr + [:th "Name"] + [:th "Instance"] + [:th "Schema"] + [:th "Created"]]] + [:tbody + (for [{:keys [link source schema]} (:links-in instance) + :let [name (:name link) + empty (empty? name) + name (if empty [:i "empty"] (h name))]] + [:tr + [:td name] + [:td [:a {:href (path :instance-show source)} + (h (:name source))]] + [:td [:a {:href (path :instance-list + {:schema-uuid (:uuid schema)})} + (h (:name schema))]] + [:td (prettify-dt (:created_at link))]])]]])])) (defn edit! [instance form form-data schemas req] (view/layout! @@ -120,7 +143,7 @@ (anti-forgery-field) (view/delete-btn)) (when (seq (:links-out instance)) - [:section.links + [:section.links-out [:h2 "Outgoing Links"] [:table [:thead diff --git a/src/wanijo/instance/viz.clj b/src/wanijo/instance/viz.clj index e88711f..48e9a35 100644 --- a/src/wanijo/instance/viz.clj +++ b/src/wanijo/instance/viz.clj @@ -18,7 +18,8 @@ [(:uuid source) :> (:uuid instance) {:label (:name link)}]) (:links-in instance))] - (-> [[(:uuid instance) {:label (:name instance)}]] + (-> [[(:uuid instance) {:label (:name instance) + :shape "cylinder"}]] (into out-nodes) (into in-nodes) (into relationships-out)