A platform for community discussion. Free, open, simple.
UX: Minor improvements to upcoming change admin UI (#37371)
Martin Brennan98bb65f9bd80
diff --git a/app/assets/stylesheets/admin/upcoming-changes.scss b/app/assets/stylesheets/admin/upcoming-changes.scssindex 9f5dca896b1..91155cd1ed0 100644--- a/app/assets/stylesheets/admin/upcoming-changes.scss+++ b/app/assets/stylesheets/admin/upcoming-changes.scss@@ -116,9 +116,9 @@padding: var(--space-2) 0;}- &__permanent-notice {+ &__status-notice {font-size: var(--font-down-1);- color: var(--primary-medium);+ color: var(--danger);margin-top: var(--space-2);}}diff --git a/config/locales/client.en.yml b/config/locales/client.en.ymlindex 1113f2fff87..a269fd0fbbf 100644--- a/config/locales/client.en.yml+++ b/config/locales/client.en.yml@@ -5840,6 +5840,7 @@ en:change_enabled_for_success: "You have enabled this change for %{enabledFor}"change_disabled: "You have opted-out of this change"permanent_notice: "This change is now permanent and it will soon be removed. You are no longer able to opt-out."+ permanent_soon_notice: "This change will become permanent soon. You will no longer be able to opt-out."permanent_no_group_selection: "N/A, permanent changes apply to all groups."no_changes: "There are no upcoming changes at this time."preview: "Preview"@@ -5867,8 +5868,10 @@ en:search_placeholder: "Filter by name, description, or plugin..."no_results: "No upcoming changes match your filter"all: "All"- enabled_all: "Enabled or disabled"+ enabled_all: "All enabled states"enabled: "Enabled"+ enabled_for_staff: "Enabled for staff"+ enabled_for_specific_groups: "Enabled for specific groups"disabled: "Disabled"impact_type_all: "All impact types"impact_type_feature: "Feature"diff --git a/config/site_settings.yml b/config/site_settings.ymlindex 0e44bbde89f..c7644b41055 100644--- a/config/site_settings.yml+++ b/config/site_settings.yml@@ -4236,5 +4236,5 @@ experimental:hidden: trueclient: trueupcoming_change:- status: "experimental"+ status: "permanent"impact: "feature,staff"diff --git a/frontend/discourse/admin/components/admin-config-areas/upcoming-change-item.gjs b/frontend/discourse/admin/components/admin-config-areas/upcoming-change-item.gjsindex f8acb590743..2ce98ac9986 100644--- a/frontend/discourse/admin/components/admin-config-areas/upcoming-change-item.gjs+++ b/frontend/discourse/admin/components/admin-config-areas/upcoming-change-item.gjs@@ -237,6 +237,8 @@ export default class UpcomingChangeItem extends Component {}await this.saveGroups({ silenceToast: true });++ this.args.enabledForChanged?.(this.args.change.setting, newValue);} catch (error) {this.bufferedEnabledFor = oldValue;popupAjaxError(error);@@ -303,12 +305,19 @@ export default class UpcomingChangeItem extends Component {{{/if}}{{#if (eq @change.upcoming_change.status "permanent")}}- <div class="upcoming-change__permanent-notice">+ <div class="upcoming-change__status-notice">{{icon "triangle-exclamation"}}{{i18n "admin.upcoming_changes.permanent_notice"}}</div>{{/if}}+ {{#if (eq @change.upcoming_change.status "stable")}}+ <div class="upcoming-change__status-notice">+ {{icon "triangle-exclamation"}}+ {{i18n "admin.upcoming_changes.permanent_soon_notice"}}+ </div>+ {{/if}}+<div class="upcoming-change__badges"><spantitle={{i18ndiff --git a/frontend/discourse/admin/components/admin-config-areas/upcoming-changes.gjs b/frontend/discourse/admin/components/admin-config-areas/upcoming-changes.gjsindex 69af38fa3b0..d4f3845d18a 100644--- a/frontend/discourse/admin/components/admin-config-areas/upcoming-changes.gjs+++ b/frontend/discourse/admin/components/admin-config-areas/upcoming-changes.gjs@@ -1,5 +1,6 @@import Component from "@glimmer/component";import { array } from "@ember/helper";+import { action } from "@ember/object";import { TrackedObject } from "@ember-compat/tracked-built-ins";import AdminConfigAreaEmptyList from "discourse/admin/components/admin-config-area-empty-list";import UpcomingChangeItem from "discourse/admin/components/admin-config-areas/upcoming-change-item";@@ -111,7 +112,20 @@ export default class AdminConfigAreasUpcomingChanges extends Component {{label: i18n("admin.upcoming_changes.filter.enabled"),value: "enabled",- filterFn: (change) => change.value,+ filterFn: (change) =>+ change.upcoming_change.enabled_for === "everyone",+ },+ {+ label: i18n("admin.upcoming_changes.filter.enabled_for_staff"),+ value: "enabled_for_staff",+ filterFn: (change) => change.upcoming_change.enabled_for === "staff",+ },+ {+ label: i18n(+ "admin.upcoming_changes.filter.enabled_for_specific_groups"+ ),+ value: "enabled_for_specific_groups",+ filterFn: (change) => change.upcoming_change.enabled_for === "groups",},{label: i18n("admin.upcoming_changes.filter.disabled"),@@ -122,6 +136,13 @@ export default class AdminConfigAreasUpcomingChanges extends Component {};}+ @action+ enabledForChanged(changeSettingName, newEnabledFor) {+ this.upcomingChanges.find(+ (change) => change.setting === changeSettingName+ ).upcoming_change.enabled_for = newEnabledFor;+ }+<template><AdminFilterControls@array={{this.upcomingChanges}}@@ -152,7 +173,10 @@ export default class AdminConfigAreasUpcomingChanges extends Component {</thead><tbody class="d-table__body">{{#each upcomingChanges as |change|}}- <UpcomingChangeItem @change={{change}} />+ <UpcomingChangeItem+ @change={{change}}+ @enabledForChanged={{this.enabledForChanged}}+ />{{/each}}</tbody></table>