Skip to content

Commit

Permalink
[FIX]: General fixes (#572)
Browse files Browse the repository at this point in the history
* fix(connections list): add subtype to search

* fix(connection): add breakline when is filesystem SSH_PRIVATE_KEY
  • Loading branch information
rogefm authored Nov 27, 2024
1 parent 8e1f146 commit 27b483c
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 3 deletions.
10 changes: 9 additions & 1 deletion webapp/src/webapp/connections/helpers.cljs
Original file line number Diff line number Diff line change
Expand Up @@ -94,14 +94,22 @@
Takes a vector of config maps with :key and :value and a prefix string.
Returns a map with prefixed keys and base64 encoded values.
For filesystem:SSH_PRIVATE_KEY specifically, adds a newline character at the end
before base64 encoding, as SSH private keys require a trailing newline.
Example:
(config->json [{:key \"foo\" :value \"bar\"}] \"envvar:\")
;=> {\"envvar:FOO\" \"<base64 of bar>\"}"
[configs prefix]
(->> configs
(filter (fn [{:keys [key value]}]
(not (or (s/blank? key) (s/blank? value)))))
(map (fn [{:keys [key value]}] {(str prefix (s/upper-case key)) (js/btoa value)}))
(map (fn [{:keys [key value]}]
(let [prefixed-key (str prefix (s/upper-case key))
final-value (if (= prefixed-key "filesystem:SSH_PRIVATE_KEY")
(str value "\n")
value)]
{prefixed-key (js/btoa final-value)})))
(reduce into {})))

(defn json->config
Expand Down
2 changes: 1 addition & 1 deletion webapp/src/webapp/connections/views/connection_list.cljs
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@
[searchbox/main
{:options (:results @connections)
:display-key :name
:searchable-keys [:name :type :tags :status]
:searchable-keys [:name :type :subtype :tags :status]
:on-change-results-cb #(reset! searched-connections %)
:hide-results-list true
:placeholder "Search by connection name, type, status or anything"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
[searchbox/main {:options @all-connections
:meta-display-keys [:type]
:display-key :name
:searchable-keys [:name :review_type :redact :type :tags]
:searchable-keys [:name :review_type :redact :type :tags :subtype]
:on-change-results-cb #(reset! searched-connections-atom %)
:hide-results-list true
:placeholder "Search and go to your connection"
Expand Down

0 comments on commit 27b483c

Please sign in to comment.