From 10c7c8bcc09721ae917dba6ef9f97524449da8de Mon Sep 17 00:00:00 2001 From: Keegan George Date: Fri, 18 Jun 2021 11:25:51 -0700 Subject: [PATCH] UX: Change info message when selecting a wizard in the submissions pane --- .../admin-wizards-submissions.js.es6 | 30 ++++++++++++++++++- .../templates/admin-wizards-submissions.hbs | 3 +- config/locales/client.en.yml | 1 + 3 files changed, 32 insertions(+), 2 deletions(-) diff --git a/assets/javascripts/discourse/controllers/admin-wizards-submissions.js.es6 b/assets/javascripts/discourse/controllers/admin-wizards-submissions.js.es6 index b5b9365a..7388a8d6 100644 --- a/assets/javascripts/discourse/controllers/admin-wizards-submissions.js.es6 +++ b/assets/javascripts/discourse/controllers/admin-wizards-submissions.js.es6 @@ -1,6 +1,34 @@ import Controller from "@ember/controller"; +import { default as discourseComputed } from "discourse-common/utils/decorators"; export default Controller.extend({ - messageKey: "select", documentationUrl: "https://thepavilion.io/t/2818", + + @discourseComputed("wizardId") + wizardName(wizardId) { + let currentWizard = this.wizardList.find( + (wizard) => wizard.id === wizardId + ); + if (currentWizard) { + return currentWizard.name; + } + }, + + @discourseComputed("wizardName") + messageOpts(wizardName) { + return { + wizardName, + }; + }, + + @discourseComputed("wizardId") + messageKey(wizardId) { + let key = "select"; + + if (wizardId) { + key = "viewing"; + } + + return key; + }, }); diff --git a/assets/javascripts/discourse/templates/admin-wizards-submissions.hbs b/assets/javascripts/discourse/templates/admin-wizards-submissions.hbs index 5a660790..07dd1682 100644 --- a/assets/javascripts/discourse/templates/admin-wizards-submissions.hbs +++ b/assets/javascripts/discourse/templates/admin-wizards-submissions.hbs @@ -1,4 +1,4 @@ -
+
{{combo-box value=wizardId content=wizardList @@ -10,6 +10,7 @@ {{wizard-message key=messageKey + opts=messageOpts url=documentationUrl component="submissions"}} diff --git a/config/locales/client.en.yml b/config/locales/client.en.yml index fa3a6c5d..31f10924 100644 --- a/config/locales/client.en.yml +++ b/config/locales/client.en.yml @@ -93,6 +93,7 @@ en: destroy_complete: Destruction complete submissions: select: "Select a wizard to see its submissions" + viewing: "You're viewing the logs of the %{wizardName}. Click 'Download' on the right to download them." documentation: "Check out the submissions documentation" editor: