-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added UI functionality to edit workflow executions
- Loading branch information
1 parent
a01a678
commit 32ced55
Showing
19 changed files
with
285 additions
and
13 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
<%= form_with( | ||
url: url, | ||
method: :get, | ||
class: "w-full" | ||
) do |form| %> | ||
|
||
<%= form.text_field input_name.to_sym, value: value, class: "form-control" %> | ||
<%= form.hidden_field :format, value: "turbo_stream" %> | ||
<% end %> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
# frozen_string_literal: true | ||
|
||
# Component to render activity | ||
class InlineEditComponent < Component | ||
attr_accessor :url, :input_name, :value | ||
|
||
def initialize(url:, input_name:, value:) | ||
@url = url | ||
@input_name = input_name | ||
@value = value | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
54 changes: 54 additions & 0 deletions
54
app/views/projects/workflow_executions/_edit_dialog.html.erb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
<%= viral_dialog(open: open,classes: ["overflow-visible"]) do |dialog| %> | ||
<%= dialog.with_header( | ||
title: | ||
t( | ||
"projects.workflow_executions.edit_dialog.title", | ||
workflow_execution_id: @workflow_execution.id, | ||
), | ||
) %> | ||
<%= dialog.with_section do %> | ||
|
||
<div class="mb-6 text-lg font-normal text-slate-500 dark:text-slate-400"> | ||
<p class="dark:text-slate-400"> | ||
<%= t( | ||
"projects.workflow_executions.edit_dialog.description", | ||
workflow_execution_id: @workflow_execution.id, | ||
) %> | ||
</p> | ||
</div> | ||
|
||
<div class="mb-4"> | ||
<%= turbo_frame_tag("edit_workflow_execution_error_alert") %> | ||
</div> | ||
|
||
<%= form_with(model: workflow_execution, url: namespace_project_workflow_execution_path, method: :patch, class: "grid gap-4") do |form| %> | ||
<div class="form-field"> | ||
<%= form.label :name %> | ||
<%= form.text_field :name, | ||
autofocus: true, | ||
value: @workflow_execution.name, | ||
placeholder: | ||
t("projects.workflow_executions.edit_dialog.name_placeholder") %> | ||
|
||
</div> | ||
|
||
<div class="mt-4"> | ||
<%= form.submit t("projects.workflow_executions.edit_dialog.submit_button"), | ||
class: | ||
"focus:outline-none text-sm text-white bg-primary-700 hover:bg-primary-800 focus:ring-0 rounded-md p-2 dark:text-white dark:bg-primary-600 dark:hover:bg-primary-700 cursor-pointer" %> | ||
|
||
<button | ||
type="button" | ||
class=" | ||
focus:outline-none text-sm text-slate-900 border border-slate-200 bg-white | ||
hover:bg-slate-100 hover:text-slate-950 focus:ring-0 rounded-md p-2 | ||
dark:text-white dark:bg-slate-600 dark:hover:bg-slate-700 | ||
" | ||
data-action="click->viral--dialog#close" | ||
> | ||
<%= t("projects.workflow_executions.edit_dialog.cancel_button") %> | ||
</button> | ||
</div> | ||
<% end %> | ||
<% end %> | ||
<% end %> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
<%= turbo_stream.update "edit_dialog", | ||
partial: "edit_dialog", | ||
locals: { | ||
open: true, | ||
workflow_execution: @workflow_execution, | ||
} %> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
<% unless @workflow_execution.errors.any? %> | ||
<%= turbo_stream.append "flashes" do %> | ||
<%= viral_flash(type:, data: message) %> | ||
<% end %> | ||
<% end %> | ||
|
||
<% if @updated %> | ||
<%= turbo_stream.update "edit_dialog", | ||
partial: "edit_dialog", | ||
locals: { | ||
open: @workflow_execution.errors.any?, | ||
workflow_execution: @workflow_execution, | ||
} %> | ||
|
||
<%= turbo_stream.update "we_name" do %> | ||
<%= @workflow_execution.name %> | ||
<% end %> | ||
<% else %> | ||
<%= turbo_stream.update "edit_workflow_execution_error_alert", | ||
viral_alert(type:, message:, classes: "mb-4") %> | ||
<% end %> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
<%= viral_dialog(open: open,classes: ["overflow-visible"]) do |dialog| %> | ||
<%= dialog.with_header(title: t("workflow_executions.edit_dialog.title")) %> | ||
<%= dialog.with_section do %> | ||
|
||
<div class="mb-6 text-lg font-normal text-slate-500 dark:text-slate-400"> | ||
<p class="dark:text-slate-400"> | ||
<%= t( | ||
"workflow_executions.edit_dialog.description", | ||
workflow_execution_id: @workflow_execution.id, | ||
) %> | ||
</p> | ||
</div> | ||
|
||
<div class="mb-4"> | ||
<%= turbo_frame_tag("edit_workflow_execution_error_alert") %> | ||
</div> | ||
|
||
<%= form_with(model: workflow_execution, url: workflow_execution_path, method: :patch, class: "grid gap-4") do |form| %> | ||
<div class="form-field"> | ||
<%= form.label :name %> | ||
<%= form.text_field :name, | ||
autofocus: true, | ||
value: @workflow_execution.name, | ||
placeholder: | ||
t("workflow_executions.edit_dialog.name_placeholder") %> | ||
|
||
</div> | ||
|
||
<div class="mt-4"> | ||
<%= form.submit t("workflow_executions.edit_dialog.submit_button"), | ||
class: | ||
"focus:outline-none text-sm text-white bg-primary-700 hover:bg-primary-800 focus:ring-0 rounded-md p-2 dark:text-white dark:bg-primary-600 dark:hover:bg-primary-700 cursor-pointer" %> | ||
|
||
<button | ||
type="button" | ||
class=" | ||
focus:outline-none text-sm text-slate-900 border border-slate-200 bg-white | ||
hover:bg-slate-100 hover:text-slate-950 focus:ring-0 rounded-md p-2 | ||
dark:text-white dark:bg-slate-600 dark:hover:bg-slate-700 | ||
" | ||
data-action="click->viral--dialog#close" | ||
> | ||
<%= t("workflow_executions.edit_dialog.cancel_button") %> | ||
</button> | ||
</div> | ||
<% end %> | ||
<% end %> | ||
<% end %> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
<%= turbo_stream.update "edit_dialog", | ||
partial: "edit_dialog", | ||
locals: { | ||
open: true, | ||
workflow_execution: @workflow_execution, | ||
} %> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
<% unless @workflow_execution.errors.any? %> | ||
<%= turbo_stream.append "flashes" do %> | ||
<%= viral_flash(type:, data: message) %> | ||
<% end %> | ||
<% end %> | ||
|
||
<% if @updated %> | ||
<%= turbo_stream.update "edit_dialog", | ||
partial: "edit_dialog", | ||
locals: { | ||
open: @workflow_execution.errors.any?, | ||
workflow_execution: @workflow_execution, | ||
} %> | ||
|
||
<%= turbo_stream.update "we_name" do %> | ||
<%= @workflow_execution.name %> | ||
<% end %> | ||
|
||
<%= turbo_stream.update "we_name_header" do %> | ||
<%= @workflow_execution.name %> | ||
<% end %> | ||
<% else %> | ||
<%= turbo_stream.update "edit_workflow_execution_error_alert", | ||
viral_alert(type:, message:, classes: "mb-4") %> | ||
<% end %> |
Oops, something went wrong.