diff --git a/webapp/package.json b/webapp/package.json index cf4cf104..64cadd7e 100644 --- a/webapp/package.json +++ b/webapp/package.json @@ -1,6 +1,6 @@ { "name": "webapp", - "version": "1.32.1", + "version": "1.32.2", "scripts": { "ancient": "clojure -Sdeps '{:deps {com.github.liquidz/antq {:mvn/version \"RELEASE\"}}}' -m antq.core", "genversion": "npx genversion src/webapp/version.js", diff --git a/webapp/src/webapp/components/accordion.cljs b/webapp/src/webapp/components/accordion.cljs index f53e507b..7280ee00 100644 --- a/webapp/src/webapp/components/accordion.cljs +++ b/webapp/src/webapp/components/accordion.cljs @@ -47,8 +47,8 @@ [:div {:className "flex space-x-3 items-center"} (when show-icon? [status-icon status]) - - [:> ChevronRight {:size 16 :className "text-[--gray-12] transition-transform duration-300 group-data-[state=open]:rotate-90"}]]]] + [:> ChevronRight {:size 16 + :className "text-[--gray-12] transition-transform duration-300 group-data-[state=open]:rotate-90"}]]]] [:> (.-Content Accordion) [:> Box {:px "5" :py "7" :className "bg-white border-t border-[--gray-a6] rounded-b-6"} @@ -68,26 +68,36 @@ :show-icon? - Boolean, if true, displays a status icon (optional, default false) - id: A unique identifier for the accordion (optional) - - first-open?: Boolean, if true, the first item will be expanded by default (optional, default false) + - initial-open?: Boolean, if true, the first item will be expanded by default (optional) + - trigger-value: Value to trigger opening/closing of a specific accordion item (optional) Usage example: [accordion-root {:items [{:value \"item1\" - :title \"Title 1\" - :subtitle \"Subtitle 1\" - :content \"Content of item 1\"} - {:value \"item2\" - :title \"Title 2\" - :content \"Content of item 2\" - :show-icon? true}] + :title \"Title 1\" + :subtitle \"Subtitle 1\" + :content \"Content of item 1\"} + {:value \"item2\" + :title \"Title 2\" + :content \"Content of item 2\" + :show-icon? true}] :id \"my-accordion\" - :first-open? true}]" - [{:keys [items id first-open?]}] - [:> (.-Root Accordion) - {:className "w-full" - :id id - :defaultValue (when first-open? - (:value (first items))) - :type "single" - :collapsible true} - (for [{:keys [value] :as item} items] - ^{:key value} [accordion-item (merge item {:total-items (count items)})])]) + :initial-open? true + :trigger-value \"item2\"}]" + [{:keys [items initial-open?]}] + (let [current-value (r/atom nil)] + (when (and initial-open? (seq items) (nil? @current-value)) + (reset! current-value (-> items first :value))) + + (fn [{:keys [items id trigger-value]}] + (when (and trigger-value (not= trigger-value @current-value)) + (reset! current-value trigger-value)) + + [:> (.-Root Accordion) + {:className "w-full" + :id id + :value @current-value + :onValueChange #(reset! current-value %) + :type "single" + :collapsible true} + (for [{:keys [value] :as item} items] + ^{:key value} [accordion-item (merge item {:total-items (count items)})])]))) diff --git a/webapp/src/webapp/components/forms.cljs b/webapp/src/webapp/components/forms.cljs index 3b8c0ed9..81a96738 100644 --- a/webapp/src/webapp/components/forms.cljs +++ b/webapp/src/webapp/components/forms.cljs @@ -146,7 +146,7 @@ :id (or id "") :rows (or rows 5) :name (or name "") - :value value + :value (or value "") :autoFocus autoFocus :placeholder placeholder :on-change on-change diff --git a/webapp/src/webapp/connections/helpers.cljs b/webapp/src/webapp/connections/helpers.cljs new file mode 100644 index 00000000..4047e283 --- /dev/null +++ b/webapp/src/webapp/connections/helpers.cljs @@ -0,0 +1,135 @@ +(ns webapp.connections.helpers + "Helper functions for working with connections in the webapp. + Provides utilities for handling connection names, configurations, and data transformations." + (:require + ["unique-names-generator" :as ung] ; Library for generating unique names + [clojure.set :as set] + [clojure.string :as s] + [webapp.connections.constants :as constants])) + +(defn array->select-options + "Converts an array of values into a format suitable for select options. + + Takes an array of values and returns a vector of maps with :value and :label keys. + The label is lowercase with underscores replaced by spaces. + + Example: + (array->select-options [\"FOO_BAR\"]) + ;=> [{\"value\" \"FOO_BAR\" \"label\" \"foo bar\"}]" + [array] + (mapv #(into {} {"value" % "label" (s/lower-case (s/replace % #"_" " "))}) array)) + +(defn js-select-options->list + "Converts JavaScript select options into a list of values. + + Takes an array of objects with 'value' keys and returns a vector of just the values. + + Example: + (js-select-options->list [{\"value\" \"foo\"} {\"value\" \"bar\"}]) + ;=> [\"foo\" \"bar\"]" + [options] + (mapv #(get % "value") options)) + +(defn random-connection-name + "Generates a random connection name using animal names and Star Wars references. + + Returns a string in the format \"-<4 digits>\" + Example: \"wookie-1234\"" + [] + (let [numberDictionary (.generate ung/NumberDictionary #js{:length 4}) + characterName (ung/uniqueNamesGenerator #js{:dictionaries #js[ung/animals ung/starWars] + :style "lowerCase" + :length 1})] + (str characterName "-" numberDictionary))) + +(defn normalize-key + "Converts a key into a normalized keyword format. + + Takes a key and returns it as a lowercase keyword. + + Example: + (normalize-key :FOO_BAR) ;=> :foo_bar" + [k] + (keyword (clojure.string/lower-case (name k)))) + +(defn merge-by-key + "Merges two arrays of maps based on their :key values. + + Preserves required flags and placeholders from arr1 while merging with values from arr2. + Used to merge connection configuration templates with actual values." + [arr1 arr2] + (let [map1 (into {} (map (fn [x] [(normalize-key (:key x)) x]) arr1)) + map2 (into {} (map (fn [x] [(normalize-key (:key x)) x]) arr2)) + all-keys (set/union (set (keys map1)) (set (keys map2)))] + (mapv + (fn [k] + (let [val1 (:value (get map1 k)) + val2 (:value (get map2 k)) + required (:required (get map1 k)) + placeholder (:placeholder (get map1 k)) + hidden (:hidden (get map1 k)) + selected (cond + (and (not (empty? val1)) (empty? val2)) (get map1 k) + (and (empty? val1) (not (empty? val2))) (assoc (get map2 k) + :required required + :hidden hidden + :placeholder placeholder) + :else (if (nil? val1) (assoc (get map2 k) + :required required + :hidden hidden + :placeholder placeholder) (get map1 k)))] + selected)) + all-keys))) + +(defn get-config-keys + "Gets the required configuration keys for a given connection type. + + Takes a key and returns the corresponding configuration from constants/connection-configs-required." + [key] + (get constants/connection-configs-required key)) + +(defn config->json + "Converts configuration maps to a JSON format with prefixed keys. + + Takes a vector of config maps with :key and :value and a prefix string. + Returns a map with prefixed keys and base64 encoded values. + + Example: + (config->json [{:key \"foo\" :value \"bar\"}] \"envvar:\") + ;=> {\"envvar:FOO\" \"\"}" + [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)})) + (reduce into {}))) + +(defn json->config + "Converts a JSON configuration back into the internal config format. + + Takes a map of config key/values and returns a vector of maps with :key and :value keys. + + Example: + (json->config {\"FOO\" \"bar\"}) + ;=> [{:key \"FOO\" :value \"bar\"}]" + [configs] + (if (or (s/blank? configs) (nil? configs)) + {} + (->> configs + (mapv (fn [[key value]] {:key (name key) :value value}))))) + +(defn separate-values-from-config-by-prefix + "Separates configuration values by a given prefix (envvar: or filesystem:). + + Takes a config map and prefix string. Returns a new map with the prefixes stripped + and values base64 decoded." + [configs prefix] + (let [regex (if (= prefix "envvar") + #"envvar:" + #"filesystem:")] + (->> configs + (filter (fn [[k]] + (s/includes? (name k) prefix))) + (map (fn [[k v]] + {(keyword (s/replace (name k) regex "")) (js/atob v)})) + (reduce into {})))) diff --git a/webapp/src/webapp/connections/utilities.cljs b/webapp/src/webapp/connections/utilities.cljs deleted file mode 100644 index aea7d069..00000000 --- a/webapp/src/webapp/connections/utilities.cljs +++ /dev/null @@ -1,60 +0,0 @@ -(ns webapp.connections.utilities - (:require [clojure.set :as set] - [clojure.string :as s] - [webapp.connections.constants :as constants])) - -(defn normalize-key [k] - (keyword (clojure.string/lower-case (name k)))) - -(defn merge-by-key [arr1 arr2] - (let [map1 (into {} (map (fn [x] [(normalize-key (:key x)) x]) arr1)) - map2 (into {} (map (fn [x] [(normalize-key (:key x)) x]) arr2)) - all-keys (set/union (set (keys map1)) (set (keys map2)))] - (mapv - (fn [k] - (let [val1 (:value (get map1 k)) - val2 (:value (get map2 k)) - required (:required (get map1 k)) - placeholder (:placeholder (get map1 k)) - hidden (:hidden (get map1 k)) - selected (cond - (and (not (empty? val1)) (empty? val2)) (get map1 k) - (and (empty? val1) (not (empty? val2))) (assoc (get map2 k) - :required required - :placeholder placeholder) - :else (if (nil? val1) (assoc (get map2 k) - :required required - :placeholder placeholder) (get map1 k)))] - selected)) - all-keys))) - -(defn get-config-keys - [key] - (get constants/connection-configs-required key)) - -(defn config->json - [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)})) - (reduce into {}))) - -(defn json->config - [configs] - (if (or (s/blank? configs) (nil? configs)) - {} - (->> configs - (mapv (fn [[key value]] {:key (name key) :value value}))))) - -(defn separate-values-from-config-by-prefix - [configs prefix] - (let [regex (if (= prefix "envvar") - #"envvar:" - #"filesystem:")] - (->> configs - (filter (fn [[k]] - (s/includes? (name k) prefix))) - (map (fn [[k v]] - {(keyword (s/replace (name k) regex "")) (js/atob v)})) - (reduce into {})))) diff --git a/webapp/src/webapp/connections/views/create_update_connection/connection_details_form.cljs b/webapp/src/webapp/connections/views/create_update_connection/connection_details_form.cljs index b28fc635..e7abcd01 100644 --- a/webapp/src/webapp/connections/views/create_update_connection/connection_details_form.cljs +++ b/webapp/src/webapp/connections/views/create_update_connection/connection_details_form.cljs @@ -1,18 +1,17 @@ (ns webapp.connections.views.create-update-connection.connection-details-form - (:require ["@radix-ui/themes" :refer [Box Callout Flex Grid Link Switch Text]] - ["lucide-react" :refer [ArrowUpRight Star]] - [clojure.string :as s] - [webapp.components.forms :as forms] - [webapp.components.multiselect :as multi-select] - [webapp.connections.dlp-info-types :as dlp-info-types])) - -(defn array->select-options [array] - (mapv #(into {} {"value" % "label" (s/lower-case (s/replace % #"_" " "))}) array)) + (:require + ["@radix-ui/themes" :refer [Box Callout Flex Grid Link Switch Text]] + ["lucide-react" :refer [ArrowUpRight Star]] + [webapp.components.forms :as forms] + [webapp.components.multiselect :as multi-select] + [webapp.connections.dlp-info-types :as dlp-info-types] + [webapp.connections.helpers :as helpers])) (defn main [{:keys [user-groups free-license? connection-name + connection-subtype form-type reviews review-groups @@ -24,7 +23,9 @@ [:> Text {:size "4" :weight "bold" :class "text-gray-12"} "Connection information"] [:> Text {:size "3" :class "text-gray-11"} "Names are used to identify your connection and can't be changed."]] [:> Box {:class "space-y-radix-5" :grid-column "span 3 / span 3"} - [forms/input {:placeholder "mssql-armadillo-9696" + [forms/input {:placeholder (str (when @connection-subtype + (str @connection-subtype "-")) + (helpers/random-connection-name)) :label "Name" :required true :disabled (= form-type :update) @@ -63,7 +64,7 @@ "for individual query approvals.")] (when @reviews [:> Box {:mt "4"} - [multi-select/main {:options (array->select-options @user-groups) + [multi-select/main {:options (helpers/array->select-options @user-groups) :id "approval-groups-input" :name "approval-groups-input" :required? @reviews @@ -95,7 +96,7 @@ "upgrading your plan."]]]) (when @ai-data-masking [:> Box {:mt "4"} - [multi-select/main {:options (array->select-options dlp-info-types/options) + [multi-select/main {:options (helpers/array->select-options dlp-info-types/options) :id "data-masking-groups-input" :name "data-masking-groups-input" :disabled? (or (not @ai-data-masking) free-license?) diff --git a/webapp/src/webapp/connections/views/create_update_connection/connection_environment_form.cljs b/webapp/src/webapp/connections/views/create_update_connection/connection_environment_form.cljs index 443a1cf2..036a703b 100644 --- a/webapp/src/webapp/connections/views/create_update_connection/connection_environment_form.cljs +++ b/webapp/src/webapp/connections/views/create_update_connection/connection_environment_form.cljs @@ -1,14 +1,11 @@ (ns webapp.connections.views.create-update-connection.connection-environment-form - (:require ["@radix-ui/themes" :refer [Box Button Callout Flex Grid Link Text]] - ["lucide-react" :refer [ArrowUpRight Plus]] - [re-frame.core :as rf] - [reagent.core :as r] - [webapp.components.forms :as forms] - [webapp.connections.views.configuration-inputs :as config-inputs] - [webapp.connections.views.create-update-connection.hoop-run-instructions :as instructions])) - -(defn js-select-options->list [options] - (mapv #(get % "value") options)) + (:require + ["@radix-ui/themes" :refer [Box Button Callout Flex Grid Link Text]] + ["lucide-react" :refer [ArrowUpRight Plus]] + [webapp.components.forms :as forms] + [webapp.connections.helpers :as helpers] + [webapp.connections.views.configuration-inputs :as config-inputs] + [webapp.connections.views.create-update-connection.hoop-run-instructions :as instructions])) (defn main [] (fn [{:keys [agents @@ -178,6 +175,6 @@ [instructions/run-hoop-connection {:connection-name @connection-name :connection-subtype @connection-subtype :review? @reviews - :review-groups (js-select-options->list @review-groups) + :review-groups (helpers/js-select-options->list @review-groups) :data-masking? @ai-data-masking - :data-masking-fields (js-select-options->list @ai-data-masking-info-types)}]]])]))) + :data-masking-fields (helpers/js-select-options->list @ai-data-masking-info-types)}]]])]))) diff --git a/webapp/src/webapp/connections/views/create_update_connection/connection_type_form.cljs b/webapp/src/webapp/connections/views/create_update_connection/connection_type_form.cljs index 9f668d5e..58b5b889 100644 --- a/webapp/src/webapp/connections/views/create_update_connection/connection_type_form.cljs +++ b/webapp/src/webapp/connections/views/create_update_connection/connection_type_form.cljs @@ -1,10 +1,11 @@ (ns webapp.connections.views.create-update-connection.connection-type-form - (:require ["@radix-ui/themes" :refer [Avatar Box Card Flex Grid RadioGroup - Text]] - ["lucide-react" :refer [AppWindow Database SquareTerminal Workflow]] - [clojure.string :as str] - [reagent.core :as r] - [webapp.connections.utilities :as utils])) + (:require + ["@radix-ui/themes" :refer [Avatar Box Card Flex Grid RadioGroup Text]] + ["lucide-react" :refer [AppWindow Database SquareTerminal Workflow]] + [clojure.string :as str] + [reagent.core :as r] + [webapp.connections.constants :as constants] + [webapp.connections.helpers :as helpers])) (def connections-type [{:icon (r/as-element [:> Database {:size 16}]) @@ -45,24 +46,30 @@ connection-type connection-subtype config-file-name - database-schema?] + database-schema? + connection-command] (cond (= value "database") (do (reset! connection-type "database") (reset! connection-subtype nil) - (reset! database-schema? true)) + (reset! database-schema? true) + (reset! connection-command nil)) (= value "custom") (do (reset! connection-type "custom") - (reset! connection-subtype nil)) + (reset! connection-subtype nil) + (reset! connection-command nil)) (= value "ssh") (do (reset! connection-type "custom") (reset! connection-subtype "ssh") - (reset! config-file-name "SSH_PRIVATE_KEY")) + (reset! config-file-name "SSH_PRIVATE_KEY") + (reset! connection-command (get constants/connection-commands "ssh"))) (= value "tcp") (do (reset! connection-type "application") - (reset! connection-subtype "tcp")) + (reset! connection-subtype "tcp") + (reset! connection-command nil)) (= value "application") (do (reset! connection-type "application") - (reset! connection-subtype nil)))) + (reset! connection-subtype nil) + (reset! connection-command nil)))) (defn is-connection-type-selected [value connection-type connection-subtype] (cond @@ -80,7 +87,13 @@ (= value "application") (and (= value connection-type) (not= connection-subtype "tcp")))) -(defn main [{:keys [connection-type connection-subtype configs config-file-name database-schema?]}] +(defn main [{:keys [connection-type + connection-subtype + connection-name + configs + config-file-name + database-schema? + connection-command]}] [:> Flex {:direction "column" :gap "9" :class "px-20"} [:> Grid {:columns "5" :gap "7"} [:> Flex {:direction "column" :grid-column "span 2 / span 2"} @@ -100,8 +113,12 @@ connection-type connection-subtype config-file-name - database-schema?) - (reset! configs (utils/get-config-keys (keyword value))))} + database-schema? + connection-command) + (reset! configs (helpers/get-config-keys (keyword value))) + (reset! connection-name (str (when @connection-subtype + (str @connection-subtype "-")) + (helpers/random-connection-name))))} [:> Flex {:align "center" :gap "3"} [:> Avatar {:size "4" :class (when is-selected "dark") @@ -125,7 +142,10 @@ :required true :on-value-change (fn [value] (reset! connection-subtype value) - (reset! configs (utils/get-config-keys (keyword value))))} + (reset! configs (helpers/get-config-keys (keyword value))) + (reset! connection-name (str (when @connection-subtype + (str @connection-subtype "-")) + (helpers/random-connection-name))))} (doall (for [{:keys [value title]} (get connections-subtypes @connection-type)] ^{:key title} diff --git a/webapp/src/webapp/connections/views/create_update_connection/main.cljs b/webapp/src/webapp/connections/views/create_update_connection/main.cljs index 0519f88b..b146218e 100644 --- a/webapp/src/webapp/connections/views/create_update_connection/main.cljs +++ b/webapp/src/webapp/connections/views/create_update_connection/main.cljs @@ -1,23 +1,19 @@ (ns webapp.connections.views.create-update-connection.main - (:require ["@radix-ui/themes" :refer [Box Button Flex Heading Strong Text Link]] - ["lucide-react" :refer [ArrowLeft BadgeInfo GlobeLock SquareStack ShieldEllipsis]] - [clojure.string :as s] - [re-frame.core :as rf] - [reagent.core :as r] - [webapp.components.accordion :as accordion] - [webapp.connections.constants :as constants] - [webapp.connections.dlp-info-types :as ai-data-masking-info-types] - [webapp.connections.utilities :as utils] - [webapp.connections.views.create-update-connection.connection-details-form :as connection-details-form] - [webapp.connections.views.create-update-connection.connection-environment-form :as connection-environment-form] - [webapp.connections.views.create-update-connection.connection-advance-settings-form :as connection-advance-settings-form] - [webapp.connections.views.create-update-connection.connection-type-form :as connection-type-form])) - -(defn js-select-options->list [options] - (mapv #(get % "value") options)) - -(defn array->select-options [array] - (mapv #(into {} {"value" % "label" (s/lower-case (s/replace % #"_" " "))}) array)) + (:require + ["@radix-ui/themes" :refer [Box Button Flex Heading Link Strong Text]] + ["lucide-react" :refer [ArrowLeft BadgeInfo GlobeLock ShieldEllipsis + SquareStack]] + [clojure.string :as s] + [re-frame.core :as rf] + [reagent.core :as r] + [webapp.components.accordion :as accordion] + [webapp.connections.constants :as constants] + [webapp.connections.dlp-info-types :as ai-data-masking-info-types] + [webapp.connections.helpers :as helpers] + [webapp.connections.views.create-update-connection.connection-advance-settings-form :as connection-advance-settings-form] + [webapp.connections.views.create-update-connection.connection-details-form :as connection-details-form] + [webapp.connections.views.create-update-connection.connection-environment-form :as connection-environment-form] + [webapp.connections.views.create-update-connection.connection-type-form :as connection-type-form])) (defn- convertStatusToBool [status] (if (= status "enabled") @@ -88,7 +84,7 @@ connection-tags-input-value (r/atom "") review-groups (r/atom (if (= form-type :create) [{"value" "admin" "label" "admin"}] - (array->select-options + (helpers/array->select-options (:reviewers connection)))) enable-review? (r/atom (if (and (seq @review-groups) (= form-type :update)) @@ -96,8 +92,8 @@ false)) ai-data-masking-info-types (r/atom (if (= form-type :create) - (array->select-options ai-data-masking-info-types/options) - (array->select-options + (helpers/array->select-options ai-data-masking-info-types/options) + (helpers/array->select-options (:redact_types connection)))) ai-data-masking (r/atom (if (and (:redact_enabled connection) (= form-type :update)) @@ -117,15 +113,15 @@ true (convertStatusToBool (:access_mode_connect connection)))) configs (r/atom (if (empty? (:secret connection)) - (utils/get-config-keys (keyword @connection-subtype)) - (utils/merge-by-key - (utils/get-config-keys (keyword @connection-subtype)) - (utils/json->config - (utils/separate-values-from-config-by-prefix (:secret connection) "envvar"))))) + (helpers/get-config-keys (keyword @connection-subtype)) + (helpers/merge-by-key + (helpers/get-config-keys (keyword @connection-subtype)) + (helpers/json->config + (helpers/separate-values-from-config-by-prefix (:secret connection) "envvar"))))) config-key (r/atom "") config-value (r/atom "") - configs-file (r/atom (or (utils/json->config - (utils/separate-values-from-config-by-prefix + configs-file (r/atom (or (helpers/json->config + (helpers/separate-values-from-config-by-prefix (:secret connection) "filesystem")) [])) config-file-name (r/atom "") config-file-value (r/atom "") @@ -164,11 +160,11 @@ :subtype @connection-subtype :agent_id @agent-id :reviewers (if @enable-review? - (js-select-options->list @review-groups) + (helpers/js-select-options->list @review-groups) []) :redact_enabled true :redact_types (if @ai-data-masking - (js-select-options->list @ai-data-masking-info-types) + (helpers/js-select-options->list @ai-data-masking-info-types) []) :access_schema (if @database-schema? "enabled" @@ -183,20 +179,20 @@ "enabled" "disabled") :guardrail_rules (if (seq @guardrails) - (js-select-options->list @guardrails) + (helpers/js-select-options->list @guardrails) []) :tags (if (seq @connection-tags-value) - (js-select-options->list @connection-tags-value) + (helpers/js-select-options->list @connection-tags-value) nil) :secret (clj->js (merge - (utils/config->json (conj - @configs - {:key @config-key - :value @config-value}) - "envvar:") + (helpers/config->json (conj + @configs + {:key @config-key + :value @config-value}) + "envvar:") (when (and @config-file-value @config-file-name) - (utils/config->json + (helpers/config->json (conj @configs-file {:key @config-file-name @@ -293,11 +289,13 @@ :content [connection-type-form/main {:connection-type connection-type :connection-subtype connection-subtype + :connection-name connection-name :configs configs :config-file-name config-file-name - :database-schema? database-schema?}]}] + :database-schema? database-schema? + :connection-command connection-command}]}] :id "resource-type" - :first-open? true}]) + :initial-open? true}]) [accordion/root {:items [{:title "Define connection details" @@ -309,6 +307,7 @@ :content [connection-details-form/main {:user-groups user-groups :free-license? free-license? + :connection-subtype connection-subtype :connection-name connection-name :form-type form-type :reviews enable-review? @@ -316,8 +315,9 @@ :ai-data-masking ai-data-masking :ai-data-masking-info-types ai-data-masking-info-types}]}] :id "connection-details" - :first-open? (when (= form-type :update) - true)}] + :initial-open? (when (= form-type :update) true) + :trigger-value (when first-step-finished + "connection-details")}] [accordion/root {:items [{:title "Environment setup" @@ -352,7 +352,10 @@ (add-new-configs configs-file @config-file-name @config-file-value) (reset! config-file-name "") (reset! config-file-value ""))}]}] - :id "environment-setup"}] + :id "environment-setup" + :initial-open? second-step-finished + :trigger-value (when second-step-finished + "environment-setup")}] [accordion/root {:items [{:title "Advanced settings" :subtitle "Include additional configuration parameters." diff --git a/webapp/src/webapp/connections/views/select_connection_use_cases.cljs b/webapp/src/webapp/connections/views/select_connection_use_cases.cljs deleted file mode 100644 index 8c235f5f..00000000 --- a/webapp/src/webapp/connections/views/select_connection_use_cases.cljs +++ /dev/null @@ -1,75 +0,0 @@ -(ns webapp.connections.views.select-connection-use-cases - (:require [re-frame.core :as rf] - [webapp.components.headings :as h] - [webapp.config :as config])) - -(defn main [] - (rf/dispatch [:agents->get-agents]) - (fn [] - [:main {:class "lg:h-full bg-white flex lg:justify-center items-center flex-col gap-small px-4 lg:px-24 pb-64 pt-16"} - [:header - [:h1 {:class "mb-8 text-2xl font-bold text-gray-900"} - "What do you want to connect?"]] - [:section {:class "grid lg:grid-cols-2 gap-regular"} - [:div {:class "flex flex-col items-center border rounded-lg cursor-pointer hover:shadow p-4" - :on-click #(rf/dispatch - [:navigate - :create-hoop-connection - {} - :type "database"])} - [:figure {:class "w-full rounded-lg border mb-2"} - [:img {:class "w-full h-28 p-3" - :src (str config/webapp-url "/images/database-connections.svg")}]] - [:div {:class "flex flex-col justify-center items-center"} - [h/h4-md "Database"]]] - [:div {:class "col-span-2 flex items-center border rounded-lg cursor-pointer hover:shadow p-4" - :on-click #(rf/dispatch - [:navigate - :create-hoop-connection - {} - :type "custom"])} - [:figure {:class "rounded-lg border"} - [:img {:class "w-full p-3" - :src (str config/webapp-url "/images/custom-connections-small.svg")}]] - [:div {:class "flex flex-col pl-3 justify-center"} - [h/h4-md "Custom"] - [:span {:class "mt-2 text-sm text-center text-gray-500"} - "Advanced setup, ideal for some specific uses"]]] - [:div {:class "col-span-2 flex items-center border rounded-lg cursor-pointer hover:shadow p-4" - :on-click #(rf/dispatch - [:navigate - :create-hoop-connection - {} - :type "custom"])} - [:figure {:class "rounded-lg border"} - [:img {:class "w-full p-3" - :src (str config/webapp-url "/images/custom-connections-small.svg")}]] - [:div {:class "flex flex-col pl-3 justify-center"} - [h/h4-md "Shell"] - [:span {:class "mt-2 text-sm text-center text-gray-500"} - "Advanced setup, ideal for some specific uses"]]] - [:div {:class "col-span-2 flex items-center border rounded-lg cursor-pointer hover:shadow p-4" - :on-click #(rf/dispatch - [:navigate - :create-hoop-connection - {} - :type "custom"])} - [:figure {:class "rounded-lg border"} - [:img {:class "w-full p-3" - :src (str config/webapp-url "/images/custom-connections-small.svg")}]] - [:div {:class "flex flex-col pl-3 justify-center"} - [h/h4-md "TCP"] - [:span {:class "mt-2 text-sm text-center text-gray-500"} - "Advanced setup, ideal for some specific uses"]]] - [:div {:class "flex flex-col items-center border rounded-lg cursor-pointer hover:shadow p-4" - :on-click #(rf/dispatch - [:navigate - :create-hoop-connection - {} - :type "application"])} - [:figure {:class "w-full rounded-lg border mb-2"} - [:img {:class "w-full h-28 p-3" - :src (str config/webapp-url "/images/application-connections.svg")}]] - [:div {:class "flex flex-col justify-center items-center"} - [h/h4-md "Application"]]]]])) -