|
|
|
@ -10,6 +10,32 @@
|
|
|
|
|
[markdown.core :as md]
|
|
|
|
|
[wanijo.visualisation.viz :as viz]))
|
|
|
|
|
|
|
|
|
|
(defn links-table [heading direction instance]
|
|
|
|
|
[:section.links-in
|
|
|
|
|
[:h2 (h heading)]
|
|
|
|
|
[:table
|
|
|
|
|
[:thead
|
|
|
|
|
[:tr
|
|
|
|
|
[:th "Name"]
|
|
|
|
|
[:th "Instance"]
|
|
|
|
|
[:th "Schema"]
|
|
|
|
|
[:th "Created"]]]
|
|
|
|
|
[:tbody
|
|
|
|
|
(for [{:keys [link source schema target] :as row} (direction instance)
|
|
|
|
|
:let [name (:name link)
|
|
|
|
|
empty (empty? name)
|
|
|
|
|
name (if empty [:i "empty"] (h name))
|
|
|
|
|
other (or source target)]]
|
|
|
|
|
[:tr
|
|
|
|
|
[:td name
|
|
|
|
|
(view-instance/tags-for-search row)]
|
|
|
|
|
[:td [:a {:href (path :instance-show other)}
|
|
|
|
|
(h (:name other))]]
|
|
|
|
|
[:td [:a {:href (path :instance-list
|
|
|
|
|
{:schema-uuid (:uuid schema)})}
|
|
|
|
|
(h (:name schema))]]
|
|
|
|
|
[:td (prettify-dt (:created_at link))]])]]])
|
|
|
|
|
|
|
|
|
|
(defn show [instance schemas req]
|
|
|
|
|
(view/layout
|
|
|
|
|
:request req
|
|
|
|
@ -61,55 +87,9 @@
|
|
|
|
|
[:h2 "Visualisation"]
|
|
|
|
|
[:p (viz/single-instance instance)]])
|
|
|
|
|
(when (seq (:links-out instance))
|
|
|
|
|
[:section.links-out
|
|
|
|
|
[:h2 "Outgoing Links"]
|
|
|
|
|
[:table
|
|
|
|
|
[:thead
|
|
|
|
|
[:tr
|
|
|
|
|
[:th "Name"]
|
|
|
|
|
[:th "Instance"]
|
|
|
|
|
[:th "Schema"]
|
|
|
|
|
[:th "Created"]]]
|
|
|
|
|
[:tbody
|
|
|
|
|
(for [{:keys [link target schema] :as row} (:links-out instance)
|
|
|
|
|
:let [name (:name link)
|
|
|
|
|
empty (empty? name)
|
|
|
|
|
name (if empty [:i "empty"] (h name))]]
|
|
|
|
|
[:tr
|
|
|
|
|
[:td
|
|
|
|
|
name
|
|
|
|
|
(view-instance/tags-for-search row)]
|
|
|
|
|
[:td [:a {:href (path :instance-show target)}
|
|
|
|
|
(h (:name target))]]
|
|
|
|
|
[:td [:a {:href (path :instance-list
|
|
|
|
|
{:schema-uuid (:uuid schema)})}
|
|
|
|
|
(h (:name schema))]]
|
|
|
|
|
[:td (prettify-dt (:created_at link))]])]]])
|
|
|
|
|
(links-table "Outgoing links" :links-out instance))
|
|
|
|
|
(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] :as row} (:links-in instance)
|
|
|
|
|
:let [name (:name link)
|
|
|
|
|
empty (empty? name)
|
|
|
|
|
name (if empty [:i "empty"] (h name))]]
|
|
|
|
|
[:tr
|
|
|
|
|
[:td
|
|
|
|
|
name
|
|
|
|
|
(view-instance/tags-for-search row)]
|
|
|
|
|
[: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))]])]]])
|
|
|
|
|
(links-table "Incoming links" :links-in instance))
|
|
|
|
|
[:section.quick-edits
|
|
|
|
|
[:h2 "Quick edits"]
|
|
|
|
|
[:section.link-instance
|
|
|
|
|