Skip to content

Commit b7e2d79

Browse files
Ensure the default environment is always dev (#4270) (#4285)
* Ensure the default environment is always dev (#4270) * remove environment field from the create sandbox form and keep default env as dev * update CHANGELOG.md * little settings page tweak --------- Co-authored-by: Muhammad Ali <muhammadmullah16@gmail.com>
1 parent ee132a8 commit b7e2d79

File tree

5 files changed

+14
-15
lines changed

5 files changed

+14
-15
lines changed

CHANGELOG.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,9 @@ and this project adheres to
1515

1616
## [Unreleased]
1717

18+
- Remove Environment input from Sandbox form
19+
[#3954](https://github.com/OpenFn/lightning/issues/3954)
20+
1821
### Added
1922

2023
### Changed

lib/lightning_web/live/project_live/concurrency_input_component.ex

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ defmodule LightningWeb.ProjectLive.ConcurrencyInputComponent do
1818
<span class="ml-3 text-sm" id="concurrency-description">
1919
<span class="font-medium text-gray-900">Disable parallel execution</span>
2020
<span class="text-gray-500">
21-
(No more than one run at a time.)
21+
(No more than one run at a time)
2222
</span>
2323
</span>
2424
</div>

lib/lightning_web/live/project_live/settings.html.heex

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -97,6 +97,9 @@
9797
disabled={!@can_edit_project}
9898
label="Project environment"
9999
/>
100+
<small class="mt-2 block text-xs text-gray-600">
101+
Credentials will be loaded with values from this environment.
102+
</small>
100103
</div>
101104
</div>
102105
<div class="grid grid-cols gap-6">
@@ -109,7 +112,7 @@
109112
class="mt-1 focus:ring-primary-500 focus:border-primary-500 block w-full shadow-xs sm:text-sm border-secondary-300 rounded-md"
110113
/>
111114
<small class="mt-2 block text-xs text-gray-600">
112-
A short description of a project [max 240 characters]
115+
A short description of a project (max 240 characters)
113116
</small>
114117
</div>
115118
</div>

lib/lightning_web/live/sandbox_live/form_component.ex

Lines changed: 5 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,10 @@ defmodule LightningWeb.SandboxLive.FormComponent do
8282
}
8383
} = socket
8484
) do
85-
attrs = build_sandbox_attrs(params)
85+
attrs =
86+
params
87+
|> build_sandbox_attrs()
88+
|> Map.put(:env, "dev")
8689

8790
with :ok <- ProjectLimiter.limit_new_sandbox(parent.id),
8891
{:ok, sandbox} <- Projects.provision_sandbox(parent, actor, attrs) do
@@ -232,14 +235,6 @@ defmodule LightningWeb.SandboxLive.FormComponent do
232235
<% end %>
233236
</div>
234237
235-
<.input
236-
type="text"
237-
field={f[:env]}
238-
label="Environment"
239-
placeholder="staging"
240-
autocomplete="off"
241-
/>
242-
243238
<Components.color_palette id="sandbox-color-picker" field={f[:color]} />
244239
</div>
245240
@@ -276,7 +271,6 @@ defmodule LightningWeb.SandboxLive.FormComponent do
276271
%{
277272
"name" => sandbox.name,
278273
"raw_name" => sandbox.name,
279-
"env" => sandbox.env,
280274
"color" => sandbox.color
281275
}
282276
end
@@ -320,8 +314,7 @@ defmodule LightningWeb.SandboxLive.FormComponent do
320314
defp build_sandbox_attrs(params) do
321315
%{
322316
name: params["name"],
323-
color: params["color"],
324-
env: params["env"]
317+
color: params["color"]
325318
}
326319
end
327320

test/lightning_web/live/sandbox_live/form_component_test.exs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -199,7 +199,7 @@ defmodule LightningWeb.SandboxLive.FormComponentTest do
199199
assert user_arg.id == user.id
200200

201201
name = attrs[:name] || attrs["name"]
202-
env = attrs[:env] || attrs["env"]
202+
env = attrs[:env] || attrs["env"] || current_sb.env
203203
color = attrs[:color] || attrs["color"]
204204

205205
if name in [nil, ""] do

0 commit comments

Comments
 (0)