Skip to content

Commit

Permalink
ISA-615: Only use CQL endpoint for layers with CQL controls
Browse files Browse the repository at this point in the history
  • Loading branch information
Joshua Groombridge committed Oct 28, 2024
1 parent 5ef245f commit d1b1165
Showing 1 changed file with 10 additions and 8 deletions.
18 changes: 10 additions & 8 deletions frontend/src/cljs/imas_seamap/map/events.cljs
Original file line number Diff line number Diff line change
Expand Up @@ -764,14 +764,16 @@
[:map.rich-layer/get-cql-filter-values rich-layer]) ; then get them
[:maybe-autosave]]})

(defn rich-layer-get-cql-filter-values [{:keys [db]} [_ {:keys [id] :as rich-layer}]]
{:http-xhrio
{:method :get
:uri (get-in db [:config :urls :cql-filter-values-url])
:params {:rich-layer-id id}
:response-format (ajax/json-response-format)
:on-success [:map.rich-layer/get-cql-filter-values-success rich-layer]
:on-failure [:ajax/default-err-handler]}})
(defn rich-layer-get-cql-filter-values [{:keys [db]} [_ {:keys [id controls] :as rich-layer}]]
(if (seq controls)
{:http-xhrio
{:method :get
:uri (get-in db [:config :urls :cql-filter-values-url])
:params {:rich-layer-id id}
:response-format (ajax/json-response-format)
:on-success [:map.rich-layer/get-cql-filter-values-success rich-layer]
:on-failure [:ajax/default-err-handler]}}
{:dispatch [:map.rich-layer/get-cql-filter-values-success rich-layer {"values" {} "filter_combinations" []}]}))

(defn rich-layer-get-cql-filter-values-success [db [_ {:keys [id] :as _rich-layer} {:strs [values filter_combinations]}]]
(let [values (keywordize-keys values)]
Expand Down

0 comments on commit d1b1165

Please sign in to comment.