DEV: Refactor the Automation Plugin UI to match admin UI guidelines (#31060)

This change updates the Automation plugin to make use of the `use_new_show_route` plugin flag, as well as generally updating the UI to match current admin UI guidelines. Notable changes include:

- Moving template/router/controller files to make use of the `admin.adminPlugins.show` route.
- Changing the URIs from `/admin/plugins/discourse-automation` to `/admin/plugins/automation`, to match the `PLUGIN_NAME`.
- Adding UI wrappers around the New/Edit forms, and polishing the list of defined automations.
This commit is contained in:
Gary Pendergast
2025-02-05 14:34:15 +11:00
committed by GitHub
parent a2dbcedbd9
commit f439bf14cc
26 changed files with 432 additions and 421 deletions

View File

@ -4,7 +4,7 @@ module PageObjects
module Pages
class Automation < PageObjects::Pages::Base
def visit(automation)
super("/admin/plugins/discourse-automation/#{automation.id}")
super("/admin/plugins/automation/automation/#{automation.id}")
self
end
@ -34,7 +34,7 @@ module PageObjects
end
def form
@form ||= find(".discourse-automation-form.edit")
@form ||= find(".discourse-automation-edit")
end
end
end

View File

@ -4,7 +4,7 @@ module PageObjects
module Pages
class NewAutomation < PageObjects::Pages::Base
def visit
super("/admin/plugins/discourse-automation/new")
super("/admin/plugins/automation/automation/new")
self
end

View File

@ -21,7 +21,10 @@ describe "DiscourseAutomation | smoke test", type: :system do
after { DiscourseAutomation::Scriptable.remove("test") }
it "populate correctly" do
visit("/admin/plugins/discourse-automation")
visit("/admin/plugins/automation")
find(".admin-config-area-empty-list__cta-button").click
find(".admin-section-landing__header-filter").set("test")
find(".admin-section-landing-item__content", match: :first).click
fill_in("automation-name", with: "aaaaa")
@ -34,7 +37,9 @@ describe "DiscourseAutomation | smoke test", type: :system do
end
it "works" do
visit("/admin/plugins/discourse-automation")
visit("/admin/plugins/automation")
find(".admin-config-area-empty-list__cta-button").click
find(".admin-section-landing__header-filter").set("user group membership through badge")
find(".admin-section-landing-item__content", match: :first).click
@ -51,6 +56,6 @@ describe "DiscourseAutomation | smoke test", type: :system do
find(".automation-enabled input").click
find(".update-automation").click
expect(page).to have_css('[role="button"]', text: "aaaaa")
expect(page).to have_css(".automations__name", text: "aaaaa")
end
end