Skip to content

Commit

Permalink
SQL-211 add clause errors
Browse files Browse the repository at this point in the history
  • Loading branch information
milt committed Dec 5, 2023
1 parent 4e2f9b9 commit e1a8ef1
Showing 1 changed file with 20 additions and 0 deletions.
20 changes: 20 additions & 0 deletions src/com/yetanalytics/lrs_admin_ui/views/reactions.cljs
Original file line number Diff line number Diff line change
Expand Up @@ -389,11 +389,31 @@
(dispatch
[:reaction/delete-clause reaction-path]))])])

(defn- render-logic-errors
[clause-path]
(when-let [problems @(subscribe [:reaction/edit-spec-errors-in
clause-path])]
(let [pred-set (into #{}
(map :pred problems))]
(cond-> [:ul.reaction-error-list]
(pred-set
'com.yetanalytics.lrs-admin-ui.spec.reaction/valid-clause-path?)
(conj
[:li
"Incomplete path."])
(pred-set
'com.yetanalytics.lrs-admin-ui.spec.reaction/valid-like-val?)
(conj [:li
"The 'like' op only supports string values."])))))

(defn- render-logic
[mode reaction-path clause]
(let [{:keys [path op val ref]} clause]
[:div.clause.op
[clause-label mode reaction-path :logic]
(when (contains? #{:edit :new} mode)
[render-logic-errors
reaction-path])
(cond-> [:dl.op-list
[:dt "Path"]
[:dd
Expand Down

0 comments on commit e1a8ef1

Please sign in to comment.