A platform for community discussion. Free, open, simple.
UX: Use 'unused' instead of 'active' for components (#32284)
Osama Sayegh0b8df4b83343
diff --git a/app/assets/javascripts/admin/addon/components/admin-config-areas/components.gjs b/app/assets/javascripts/admin/addon/components/admin-config-areas/components.gjsindex f5bcdab892f..da0c3775ac2 100644--- a/app/assets/javascripts/admin/addon/components/admin-config-areas/components.gjs+++ b/app/assets/javascripts/admin/addon/components/admin-config-areas/components.gjs@@ -31,14 +31,13 @@ const STATUS_FILTER_OPTIONS = [label: "admin.config_areas.themes_and_components.components.filter_by_all",},{- value: "active",- label:- "admin.config_areas.themes_and_components.components.filter_by_active",+ value: "used",+ label: "admin.config_areas.themes_and_components.components.filter_by_used",},{- value: "inactive",+ value: "unused",label:- "admin.config_areas.themes_and_components.components.filter_by_inactive",+ "admin.config_areas.themes_and_components.components.filter_by_unused",},{value: "updates_available",@@ -482,7 +481,7 @@ class ComponentRow extends Component {<div class="status-label-indicator"></div><div class="status-label-text">{{i18n- "admin.config_areas.themes_and_components.components.badge_inactive"+ "admin.config_areas.themes_and_components.components.badge_unused"}}</div></div>diff --git a/app/controllers/admin/config/customize_controller.rb b/app/controllers/admin/config/customize_controller.rbindex 76a48492d4f..5232e53a860 100644--- a/app/controllers/admin/config/customize_controller.rb+++ b/app/controllers/admin/config/customize_controller.rb@@ -22,9 +22,9 @@ class Admin::Config::CustomizeController < Admin::AdminControllerstatus_filter = params[:status].presenceif status_filtercase status_filter- when "active"+ when "used"components = components.joins(:parent_themes).distinct- when "inactive"+ when "unused"components = components.left_joins(:parent_themes).where(parent_themes: { id: nil })when "updates_available"components = components.joins(:remote_theme).where(remote_theme: { commits_behind: 1.. })diff --git a/config/locales/client.en.yml b/config/locales/client.en.ymlindex 87b7d4491c4..7502b453b41 100644--- a/config/locales/client.en.yml+++ b/config/locales/client.en.yml@@ -6252,8 +6252,8 @@ en:delete: "Delete"filter_by: "Filter by"filter_by_all: "All"- filter_by_active: "Active"- filter_by_inactive: "Inactive"+ filter_by_used: "Used"+ filter_by_unused: "Unused"filter_by_updates_available: "Updates available"search_components: "Type a component name"new_update_for_component: "New update available for %{name}!"@@ -6263,7 +6263,7 @@ en:deleted_successfully: '"%{name}" has been deleted successfully.'no_components: "No components installed."no_components_found: "No components match your filters."- badge_inactive: "Unused"+ badge_unused: "Unused"user_fields:field: "Field"type: "Type"diff --git a/spec/requests/admin/config/customize_controller_spec.rb b/spec/requests/admin/config/customize_controller_spec.rbindex 58a6b5f4980..e8ecced4a21 100644--- a/spec/requests/admin/config/customize_controller_spec.rb+++ b/spec/requests/admin/config/customize_controller_spec.rb@@ -5,7 +5,7 @@ RSpec.describe Admin::Config::CustomizeController dofab!(:parent_theme_1) { Fabricate(:theme) }fab!(:parent_theme_2) { Fabricate(:theme) }- fab!(:active_component) do+ fab!(:used_component) doFabricate(:theme,name: "AweSome comp",@@ -13,7 +13,7 @@ RSpec.describe Admin::Config::CustomizeController doparent_themes: [parent_theme_1, parent_theme_2],)end- fab!(:inactive_component) { Fabricate(:theme, name: "some comp", component: true) }+ fab!(:unused_component) { Fabricate(:theme, name: "some comp", component: true) }fab!(:remote_component) doFabricate(:theme,@@ -36,22 +36,22 @@ RSpec.describe Admin::Config::CustomizeController dobefore { sign_in(admin) }describe "#components" do- context "when filtering by `active`" do+ context "when filtering by `used`" doit "returns components that have a parent theme" do- get "/admin/config/customize/components.json", params: { status: "active" }+ get "/admin/config/customize/components.json", params: { status: "used" }expect(response.status).to eq(200)expect(response.parsed_body["components"].map { |c| c["id"] }).to contain_exactly(- active_component.id,+ used_component.id,)endend- context "when filtering by `inactive`" do+ context "when filtering by `unused`" doit "returns components that have no parent theme" do- get "/admin/config/customize/components.json", params: { status: "inactive" }+ get "/admin/config/customize/components.json", params: { status: "unused" }expect(response.status).to eq(200)expect(response.parsed_body["components"].map { |c| c["id"] }).to contain_exactly(- inactive_component.id,+ unused_component.id,remote_component.id,remote_component_with_update.id,)@@ -73,8 +73,8 @@ RSpec.describe Admin::Config::CustomizeController doget "/admin/config/customize/components.json", params: { status: "all" }expect(response.status).to eq(200)expect(response.parsed_body["components"].map { |c| c["id"] }).to contain_exactly(- active_component.id,- inactive_component.id,+ used_component.id,+ unused_component.id,remote_component.id,remote_component_with_update.id,)@@ -86,8 +86,8 @@ RSpec.describe Admin::Config::CustomizeController doget "/admin/config/customize/components.json"expect(response.status).to eq(200)expect(response.parsed_body["components"].map { |c| c["id"] }).to contain_exactly(- active_component.id,- inactive_component.id,+ used_component.id,+ unused_component.id,remote_component.id,remote_component_with_update.id,)@@ -98,8 +98,8 @@ RSpec.describe Admin::Config::CustomizeController doget "/admin/config/customize/components.json", params: { name: "SomE" }expect(response.status).to eq(200)expect(response.parsed_body["components"].map { |c| c["id"] }).to contain_exactly(- active_component.id,- inactive_component.id,+ used_component.id,+ unused_component.id,)enddiff --git a/spec/system/admin_customize_components_config_area_spec.rb b/spec/system/admin_customize_components_config_area_spec.rbindex 31b14626d6b..81bf0ceabc1 100644--- a/spec/system/admin_customize_components_config_area_spec.rb+++ b/spec/system/admin_customize_components_config_area_spec.rb@@ -83,14 +83,14 @@ describe "Admin Customize Themes Config Area Page", type: :system doit "can filter components by status" doconfig_area.visit- config_area.status_selector.select("active")+ config_area.status_selector.select("used")expect(config_area).to be_loadingexpect(config_area.components_shown).to contain_exactly(enabled_component.id,remote_component.id,)- config_area.status_selector.select("inactive")+ config_area.status_selector.select("unused")expect(config_area).to be_loadingexpect(config_area.components_shown).to contain_exactly(disabled_component.id,