Skip to content

Commit c01e3c1

Browse files
committed
Update SelectPanel variant
1 parent 9e0a736 commit c01e3c1

4 files changed

Lines changed: 13 additions & 13 deletions

File tree

app/components/workflows/status_matrix_form_component.html.erb

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,14 @@ See COPYRIGHT and LICENSE files for more details.
5757
item_id: available_role.id
5858
)
5959
end
60+
panel.with_footer(show_divider: true) do
61+
render(
62+
Primer::Beta::Button.new(
63+
scheme: :primary,
64+
data: { action: "click->admin--workflow-role-select#apply" }
65+
)
66+
) { t(:button_save) }
67+
end
6068
end
6169
end
6270
end

frontend/src/stimulus/controllers/dynamic/admin/workflow-role-select.controller.ts

Lines changed: 3 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -45,15 +45,7 @@ export default class WorkflowRoleSelectController extends Controller {
4545
declare baseUrlValue:string;
4646
declare currentRoleIdsValue:unknown[];
4747

48-
connect() {
49-
this.element.addEventListener('panelClosed', this.handlePanelClosed);
50-
}
51-
52-
disconnect() {
53-
this.element.removeEventListener('panelClosed', this.handlePanelClosed);
54-
}
55-
56-
private handlePanelClosed = () => {
48+
apply() {
5749
const panel = this.element as HTMLElement as SelectPanelElement;
5850
const selectedIds = panel.items
5951
.filter((item) => panel.isItemChecked(item))
@@ -69,8 +61,8 @@ export default class WorkflowRoleSelectController extends Controller {
6961
if (selectedIds.slice().sort().join(',') === this.currentRoleIdsValue.slice().sort().join(',')) return;
7062

7163
this.navigateTo(this.buildUrl(selectedIds as string[]));
72-
};
73-
64+
}
65+
7466
private buildUrl(roleIds:string[]):string {
7567
const url = new URL(this.baseUrlValue, window.location.origin);
7668
roleIds.forEach((id) => url.searchParams.append('role_ids[]', id));

spec/features/workflows/edit_multi_role_spec.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -272,7 +272,7 @@
272272
click_button "2 roles selected"
273273
find("[data-item-id='#{role.id}']").click
274274
find("[data-item-id='#{role2.id}']").click
275-
page.send_keys :escape
275+
click_button "Save"
276276

277277
expect(page).to have_no_text("2 roles selected")
278278
expect(page).to have_button(role.name)

spec/support/workflows/edit_helpers.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ def switch_role_via_panel(from_role, to_role)
4545
click_button from_role.name
4646
find("[data-item-id='#{to_role.id}']").click
4747
find("[data-item-id='#{from_role.id}']").click
48-
page.send_keys :escape
48+
click_button "Save"
4949
end
5050

5151
def add_status_via_dialog(status)

0 commit comments

Comments
 (0)