File tree Expand file tree Collapse file tree
src/com/yetanalytics/lrs_admin_ui Expand file tree Collapse file tree Original file line number Diff line number Diff line change 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? )
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?
Original file line number Diff line number Diff line change 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
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 ))
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
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)}]))]
Original file line number Diff line number Diff line change 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
Original file line number Diff line number Diff line change 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."
Original file line number Diff line number Diff line change 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" ]
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
You can’t perform that action at this time.
0 commit comments