Skip to content

Commit 628db48

Browse files
committed
spark joy
1 parent 398baef commit 628db48

5 files changed

Lines changed: 12 additions & 18 deletions

File tree

src/com/yetanalytics/lrs_admin_ui/db.cljs

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -191,15 +191,12 @@
191191
(s/coll-of (s/keys :req-un [:statements-upload-error/message])))
192192

193193
(s/def ::statements-upload-manual-errors
194-
(s/keys :req-un [:statements-upload/xapi
195-
:statements-upload/json]))
194+
(s/keys :req-un [:statements-upload-error/xapi
195+
:statements-upload-error/json]))
196196

197197
(s/def ::statements-upload-file
198198
(s/nilable #(instance? js/File %)))
199199

200-
(s/def ::statements-upload-file-name
201-
(s/nilable string?))
202-
203200
(s/def ::statements-upload-editor-contents string?)
204201

205202
(s/def ::statements-upload-analyzed? boolean?)
@@ -289,7 +286,7 @@
289286
::statements-upload-manual-errors
290287
::statements-upload-editor-contents
291288
::statements-upload-analyzed?
292-
::statements-upload-file-name
289+
::statements-upload-file
293290
::dialog-ref
294291
::dialog-data
295292
::no-val?

src/com/yetanalytics/lrs_admin_ui/handlers.cljs

Lines changed: 5 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -701,8 +701,6 @@
701701
:else {:fx [[:dispatch [:statements-upload/set-editor-contents text]]]
702702
:db (-> db (assoc ::db/statements-upload-file
703703
file
704-
::db/statements-upload-filename
705-
(.-name file)
706704
::db/statements-upload-statements-count
707705
(if json-errors
708706
0
@@ -714,7 +712,7 @@
714712
:statements-upload/manual-upload-click
715713
(fn [{{[credential] ::db/credentials
716714
text ::db/statements-upload-editor-contents
717-
:as db} :db :as _cofx} [_event-name]]
715+
:as _db} :db :as _cofx} [_event-name]]
718716
(if credential
719717
(let [parsed (try (.parse js/JSON text)
720718
(catch :default _e nil))
@@ -778,11 +776,8 @@
778776

779777
(re-frame/reg-event-fx
780778
:statements-upload/error-handler
781-
(fn [{{file ::db/statements-upload-file
782-
:as db} :db}
783-
[_ result]]
784-
(let [
785-
precursor (str "Failed to upload statements: ")
779+
(fn [{db :db :as _cofx} [_ result]]
780+
(let [precursor "Failed to upload statements: "
786781
msg (cond (#{0 -1} (:status result))
787782
"Couldn't reach server"
788783
:else
@@ -804,8 +799,8 @@
804799
:statements-upload/set-editor-contents
805800
(fn [{db :db
806801
:as _cofx} [_ text]]
807-
(let [json-errors (try (do (js/JSON.parse text)
808-
nil)
802+
(let [json-errors (try (js/JSON.parse text)
803+
nil
809804
(catch js/Error e
810805
[{:message "Invalid JSON Syntax"
811806
:details (str e)}]))]

src/com/yetanalytics/lrs_admin_ui/subs.cljs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
[com.yetanalytics.lrs-admin-ui.spec.csv-download]
88
[com.yetanalytics.lrs-admin-ui.spec.reaction-edit]
99
[clojure.spec.alpha :as s :include-macros true]
10+
[clojure.string]
1011
[xapi-schema.spec :as xs]))
1112

1213
(reg-sub

src/com/yetanalytics/lrs_admin_ui/views/browser.cljs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
[com.yetanalytics.lrs-admin-ui.views.util.json :refer [json-viewer]]
1212
[com.yetanalytics.lrs-admin-ui.views.util.table :refer [data-table]]
1313
[com.yetanalytics.lrs-admin-ui.views.util.langmap :refer [langmap]]
14-
[com.yetanalytics.lrs-admin-ui.views.form.editor :refer [editor manual-json-editor]]))
14+
[com.yetanalytics.lrs-admin-ui.views.form.editor :refer [manual-json-editor]]))
1515

1616
(defn actor-display
1717
"Actor IFI progressive resolution to a display string."

src/com/yetanalytics/lrs_admin_ui/views/form/editor.cljs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
(ns com.yetanalytics.lrs-admin-ui.views.form.editor
22
(:require [re-codemirror.core :as cm]
33
[clojure.data :as data]
4+
[clojure.string]
45
[reagent.core :as r]
56
[com.yetanalytics.lrs-admin-ui.views.form.validation :as v]
67
["codemirror/mode/javascript/javascript"]
@@ -173,7 +174,7 @@
173174
"
174175
[{:keys [buffer
175176
set-json]}]
176-
(let [{:keys [json status errors]} @buffer]
177+
(let [{:keys [json]} @buffer]
177178
[:div
178179
(when (not (clojure.string/blank? json))
179180
[raw-text-upload-validation-display

0 commit comments

Comments
 (0)