Skip to content

Commit

Permalink
clj-viewer update test (saying test)
Browse files Browse the repository at this point in the history
  • Loading branch information
awb99 committed Oct 30, 2024
1 parent 605f1ca commit 28a9c8b
Show file tree
Hide file tree
Showing 6 changed files with 61 additions and 4 deletions.
1 change: 1 addition & 0 deletions demo/resources/ext/demo-rtable.edn
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@
demo.service.highcharts/highstock-static
demo.service.pixi/pixi-static
demo.service.rtable/rtable-data
demo.service.saying/saying
]}


Expand Down
13 changes: 12 additions & 1 deletion demo/src/demo/helper/daliclj.cljs
Original file line number Diff line number Diff line change
Expand Up @@ -16,4 +16,15 @@
(let [{:keys [fun args]} options]
(if fun
[clj-viewer {:fun fun :args args}]
[:div "error: option does not contain :fun key"]))))
[:div "error: option does not contain :fun key"]))))


(defmethod component-ui "saying" [{:keys [id state]}]
(fn [options]
[:div
"saying options (at request): " (pr-str options)
[clj-viewer {:fun 'demo.service.saying/saying
:args [options]}]

]
))
22 changes: 21 additions & 1 deletion demo/src/demo/page/layout.cljs
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,27 @@

:style {:border-radius "5px"
:border "1px solid lightgray"}}
"add algo"]]
"add algo"]

[:button
{:on-click #(add-node m {:component "saying"
:name "saying"
:id "saying1"
:options {:id 0}
:edit [{:type :select
:path :id,
:name "saying-id",
:spec
(into [] (range 20))}]})

:style {:border-radius "5px"
:border "1px solid lightgray"}}
"add saying"]



; end of top menu
]

[:div {:style {:display "flex"
:flex-grow "1"
Expand Down
25 changes: 25 additions & 0 deletions demo/src/demo/service/saying.clj
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
(ns demo.service.saying
(:require
[dali.plot.hiccup :refer [hiccup]]))

(defn saying [{:keys [id]}]
(println "serving saying id: " id)
(let [s (case id
0 "Peace to the world"
1 "The hottentotten are here"
2 "The sky is always blue"
3 "Biene Maya and Willy"
4 "Quot erum demunstrandum"
5 "The early bird catches the worm"
6 "Six Six Six"
7 "Seven Angles are here"
8 "8 means infinity "
9 "what is the secret of nine?"
nil)]
(hiccup [:div.bg-blue-300.w-100.h-100
[:h1 "Sayings Response"]
[:p "You entered: " id]
[:hr]
(if s
[:p.bg-green-500.p-5 s]
[:p.bg-red-500.p-5 "This saying does not exist: " id])])))
2 changes: 1 addition & 1 deletion deps.edn
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
; source code heavily modified, but based on this one:
;org.clojars.frozenlock/reagent-table {:mvn/version "0.1.6"}
io.helins/canvas {:mvn/version "2.0.0-beta0"}
org.pinkgorilla/dali {:mvn/version "0.1.21"}}
org.pinkgorilla/dali {:mvn/version "0.1.24"}}
:aliases
{; github ci
:build {:deps {io.github.clojure/tools.build {:mvn/version "0.9.6"}
Expand Down
2 changes: 1 addition & 1 deletion src/rtable/transform/highcharts/data.cljs
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@
_ (println "rows with signal: " (tmlds/row-count only-signal-ds))
data (->> (map #(flag v2style column %) rows)
(into []))]
(println "series data: " data)
;(println "series data: " data)
data))

; set series
Expand Down

0 comments on commit 28a9c8b

Please sign in to comment.