Skip to content

Commit

Permalink
0.8.0 Improve UI and UX when selecting the meta-key prefix
Browse files Browse the repository at this point in the history
  • Loading branch information
DrTom committed Jul 14, 2017
1 parent c183664 commit 7c68c91
Show file tree
Hide file tree
Showing 5 changed files with 69 additions and 28 deletions.
2 changes: 1 addition & 1 deletion app/dev/releases.json
Original file line number Diff line number Diff line change
@@ -1 +1 @@
[{"version_major":0,"version_minor":7,"version_patch":3,"version_pre":null,"version_build":null,"name":null,"description":"\nChanges\n=======\n\n* Rename from \"Madek Exporter\" to \"Madek-Exporter\"\n\nFixes\n=====\n\n* Fix sign in as API-client.\n* Extend auth-info with type, show auth-info when connected as ApiClient.\n* Hide secrets by default: do not show \"internal\" connection parameters\n (password etc) in connection panel.\n"},{"version_major":0,"version_minor":6,"version_patch":0,"version_pre":null,"version_build":null,"name":null,"description":"\nChanges\n=======\n\n* Improve the UX of the sign-in page: swapping tags deletes existing sign in info.\n\nFixes\n=====\n\n* Fix sign in with login and password.\n"},{"version_major":0,"version_minor":5,"version_patch":0,"version_pre":null,"version_build":null,"name":null,"description":"\nChanges\n=======\n\n* Rename the application from \"Madek APP\" to \"Madek Exporter\".\n* Include release info.\n\nFixes\n=====\n\n* Fix export of meta-data of the Type MetaDatum::TextType.\n* Disconnect on the connection page will now delete the saved token, too.\n* Fix spelling and unnecessary involved language in many places.\n"}]
[{"version_major":0,"version_minor":8,"version_patch":0,"version_pre":null,"version_build":null,"name":null,"description":"\nChanges\n=======\n\n* Improve UI and UI when selecting the meta-key prefix.\n"},{"version_major":0,"version_minor":7,"version_patch":3,"version_pre":null,"version_build":null,"name":null,"description":"\nChanges\n=======\n\n* Rename from \"Madek Exporter\" to \"Madek-Exporter\"\n\nFixes\n=====\n\n* Fix sign in as API-client.\n* Extend auth-info with type, show auth-info when connected as ApiClient.\n* Hide secrets by default: do not show \"internal\" connection parameters\n (password etc) in connection panel.\n"},{"version_major":0,"version_minor":6,"version_patch":0,"version_pre":null,"version_build":null,"name":null,"description":"\nChanges\n=======\n\n* Improve the UX of the sign-in page: swapping tags deletes existing sign in info.\n\nFixes\n=====\n\n* Fix sign in with login and password.\n"},{"version_major":0,"version_minor":5,"version_patch":0,"version_pre":null,"version_build":null,"name":null,"description":"\nChanges\n=======\n\n* Rename the application from \"Madek APP\" to \"Madek Exporter\".\n* Include release info.\n\nFixes\n=====\n\n* Fix export of meta-data of the Type MetaDatum::TextType.\n* Disconnect on the connection page will now delete the saved token, too.\n* Fix spelling and unnecessary involved language in many places.\n"}]
2 changes: 1 addition & 1 deletion app/prod/releases.json
Original file line number Diff line number Diff line change
@@ -1 +1 @@
[{"version_major":0,"version_minor":7,"version_patch":3,"version_pre":null,"version_build":null,"name":null,"description":"\nChanges\n=======\n\n* Rename from \"Madek Exporter\" to \"Madek-Exporter\"\n\nFixes\n=====\n\n* Fix sign in as API-client.\n* Extend auth-info with type, show auth-info when connected as ApiClient.\n* Hide secrets by default: do not show \"internal\" connection parameters\n (password etc) in connection panel.\n"},{"version_major":0,"version_minor":6,"version_patch":0,"version_pre":null,"version_build":null,"name":null,"description":"\nChanges\n=======\n\n* Improve the UX of the sign-in page: swapping tags deletes existing sign in info.\n\nFixes\n=====\n\n* Fix sign in with login and password.\n"},{"version_major":0,"version_minor":5,"version_patch":0,"version_pre":null,"version_build":null,"name":null,"description":"\nChanges\n=======\n\n* Rename the application from \"Madek APP\" to \"Madek Exporter\".\n* Include release info.\n\nFixes\n=====\n\n* Fix export of meta-data of the Type MetaDatum::TextType.\n* Disconnect on the connection page will now delete the saved token, too.\n* Fix spelling and unnecessary involved language in many places.\n"}]
[{"version_major":0,"version_minor":8,"version_patch":0,"version_pre":null,"version_build":null,"name":null,"description":"\nChanges\n=======\n\n* Improve UI and UI when selecting the meta-key prefix.\n"},{"version_major":0,"version_minor":7,"version_patch":3,"version_pre":null,"version_build":null,"name":null,"description":"\nChanges\n=======\n\n* Rename from \"Madek Exporter\" to \"Madek-Exporter\"\n\nFixes\n=====\n\n* Fix sign in as API-client.\n* Extend auth-info with type, show auth-info when connected as ApiClient.\n* Hide secrets by default: do not show \"internal\" connection parameters\n (password etc) in connection panel.\n"},{"version_major":0,"version_minor":6,"version_patch":0,"version_pre":null,"version_build":null,"name":null,"description":"\nChanges\n=======\n\n* Improve the UX of the sign-in page: swapping tags deletes existing sign in info.\n\nFixes\n=====\n\n* Fix sign in with login and password.\n"},{"version_major":0,"version_minor":5,"version_patch":0,"version_pre":null,"version_build":null,"name":null,"description":"\nChanges\n=======\n\n* Rename the application from \"Madek APP\" to \"Madek Exporter\".\n* Include release info.\n\nFixes\n=====\n\n* Fix export of meta-data of the Type MetaDatum::TextType.\n* Disconnect on the connection page will now delete the saved token, too.\n* Fix spelling and unnecessary involved language in many places.\n"}]
3 changes: 1 addition & 2 deletions electron_front/src/all/madek/app/front/connection.cljs
Original file line number Diff line number Diff line change
Expand Up @@ -234,5 +234,4 @@
[connect-form]
[continue-form])
[:div.clearfix]
[debug-component]
])
[debug-component]])
71 changes: 48 additions & 23 deletions electron_front/src/all/madek/app/front/download/step2.cljs
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,9 @@

(def download* (reaction (-> @state/jvm-main-db :download)))

(def vocabulary* (reaction
(-> @form-data* :vocabulary presence)))

(def set-value
(form-utils/create-update-form-data-setter
state/client-db
Expand Down Expand Up @@ -74,10 +77,7 @@
"This means that only the meta-data of media-entries or sets will be downloaded. " ]]])


;;; prefix ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

(def vocabulary* (reaction
(-> @form-data* :vocabulary presence)))
;;; prefix meta-key ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

(defn load-vocabulary-meta-keys []
(when-let [vocabulary @vocabulary*]
Expand All @@ -89,10 +89,18 @@
:callback (fn [resp]
(when (:success resp)
(set-value vocabulary
(conj (:body resp)
{:label "None"
:id nil
:vocabulary_id vocabulary }))))))))
(conj (->> (:body resp)
(filter #(= (:meta_datum_object_type %)
"MetaDatum::Text"))
(map #(assoc % :key (:id %)))
(sort-by :label)
(into []))
{:label "NO META-KEY PREFIX"
:id ""
:key ""
:vocabulary_id vocabulary
:meta_datum_object_type "MetaDatum::Text"
}))))))))

(add-watch vocabulary* :lazy-load-meta-keys-watch
(fn [_ _ _ vocabulary]
Expand All @@ -106,44 +114,60 @@
[:label "Meta-key:"]
[:select.form-control
{:on-change #(set-value :prefix_meta_key (.. % -target -value))
:default-value (or (-> @form-data* :prefix_meta_key) "")}
:value (-> @form-data* :prefix_meta_key)}
(for [option meta-keys-options]
[:option {:key (:id option) } (:id option)])]
[:option
{:key (:id option)
:value (:id option)}
(:label option)])]
[:p.help-block
"If the blank option is select neither prefix nor underscore will be present. "
"If the " [:code "NO META-KEY PREFIX"]
" option is select neither prefix nor underscore will be present. "
"This is probably a good choice for automatized post processing. "]
[:p.help-block
"If the value of the corresponding meta-key is plank or if there is no "
"If the value of the corresponding meta-key is blank or if there is no "
" such meta-key present for the entity "
" the id will be still prefixed with an underscore."]
[:p.help-block
"Only \"simple\" meta-keys, e.g. text based ones, should be used here." ]]))
" the id will be still prefixed with an underscore."]]))


;;; prefix vocabulary ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

(defn load-vocabularies []
(when-not (-> @form-data* :vocabularies)
(request/send-off
{:method :get
:path "/vocabularies/"}
{:title "Fetch Vocabularies"}
:callback (fn [req] (set-value :vocabularies (:body req))))))
:callback (fn [req] (set-value :vocabularies
(->> (:body req)
(map #(assoc % :key (:id %)))
(sort-by :label)))))))

(defn vocabulary-form-group-component []
[:div.form-group.vocabulary
[:label "Vocabulary:"]
[:select.form-control
{:on-change #(let [voc (.. % -target -value)]
(when-not (= voc (-> @form-data* :vocabulary))
(set-value :prefix_meta_key nil))
(set-value :prefix_meta_key ""))
(set-value :vocabulary voc))
:default-value (-> @form-data* :vocabulary)}
(for [option (or (->> @form-data* :vocabularies) {})]
[:option {:key (:id option)}(:id option)])]])
:value (-> @form-data* :vocabulary)}
(for [option (or (-> @form-data* :vocabularies) {})]
[:option
{:key (:id option)
:value (:id option)
:data-id (:id option)
:data-label (:label option)}
(:label option)])]])

(defn prefix-vocabulary-component []
(reagent/create-class
{:component-did-mount load-vocabularies
:render vocabulary-form-group-component}))


;;; prefix ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

(defn prefix-component []
[:div.prefix
[:h4 "Prefix"]
Expand All @@ -154,6 +178,7 @@
[prefix-meta-key-component]
])


;;; form ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

(defn form-component []
Expand Down Expand Up @@ -183,8 +208,7 @@
[:div.download-form
[:h2 "Step 2 - Set Advanced Options" ]
[form-component]
[debug-component]
])
[debug-component]])

(defn initialize-form-data []
(when-not (:vocabulary @form-data*)
Expand All @@ -194,7 +218,8 @@

(defn component []
(reagent/create-class
{:component-did-mount initialize-form-data
{;:component-will-mount #(swap! state/client-db assoc-in [:download :download-form] {})
:component-did-mount initialize-form-data
:render main-component }))


19 changes: 18 additions & 1 deletion releases.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,21 @@
##### 0.7.3 #######################################################################
###### 0.8.0 #######################################################################

- version_major: 0
version_minor: 8
version_patch: 0
version_pre: NULL
version_build: NULL
name: NULL

description: |
Changes
=======
* Improve UI and UI when selecting the meta-key prefix.
#### 0.7.3 #######################################################################

- version_major: 0
version_minor: 7
Expand Down

0 comments on commit 7c68c91

Please sign in to comment.