+ <%= if @select_secret_ref do %>
+
+
+
+ Choose a secret
+
+
+ <%= for secret <- @secrets do %>
+ <.choice_button
+ active={secret.name == @preselect_name}
+ value={secret.name}
+ phx-target={@myself}
+ phx-click="select_secret"
+ class={
+ if secret.name == @preselect_name,
+ do: "text-xs rounded-full",
+ else: "text-xs rounded-full text-gray-700 hover:bg-gray-200"
+ }
+ >
+ <%= secret.name %>
+
+ <% end %>
+ <%= if @secrets == [] do %>
+
+ <.remix_icon icon="folder-lock-line" class="align-middle text-2xl" />
+
+ Secrets not found.
Add to see them here.
+
+
+ <% end %>
+
- <%= text_input(f, :name,
- value: @data["name"],
- class: "input",
- autofocus: !@prefill_secret_name,
- spellcheck: "false"
- ) %>
-
- <.input_wrapper form={f} field={:value}>
-
Value
- <%= text_input(f, :value,
- value: @data["value"],
- class: "input",
- autofocus: !!@prefill_secret_name || unavailable_secret?(@preselect_name, @secrets),
- spellcheck: "false"
- ) %>
-
-
-
- <%= live_patch("Cancel", to: @return_to, class: "button-base button-outlined-gray") %>
-
-
- <%= if @select_secret_ref do %>
-
- Select secret
-
+ <% end %>
<.form
- let={_}
- for={:secrets}
- phx-submit="save_secret"
- phx-change="select_secret"
+ let={f}
+ for={:data}
+ phx-submit="save"
+ phx-change="validate"
+ autocomplete="off"
phx-target={@myself}
+ errors={data_errors(@data)}
+ class="basis-1/2 grow"
>
- <.select name="secret" selected={@preselect_name} options={secret_options(@secrets)} />
+
+ <%= if @select_secret_ref do %>
+
+ Add new secret
+
+ <% end %>
+ <.input_wrapper form={f} field={:name}>
+
+ Name (alphanumeric and underscore)
+
+ <%= text_input(f, :name,
+ value: @data["name"],
+ class: "input",
+ autofocus: !@prefill_secret_name,
+ spellcheck: "false"
+ ) %>
+
+ <.input_wrapper form={f} field={:value}>
+
Value
+ <%= text_input(f, :value,
+ value: @data["value"],
+ class: "input",
+ autofocus: !!@prefill_secret_name || unavailable_secret?(@preselect_name, @secrets),
+ spellcheck: "false"
+ ) %>
+
+
+
+ <%= live_patch("Cancel", to: @return_to, class: "button-base button-outlined-gray") %>
+
+
- <% end %>
+