Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DEV: Add more structure for admin plugin config nav #26707

Merged
merged 7 commits into from May 2, 2024

Conversation

martin-brennan
Copy link
Contributor

  • Simplify config nav link generation to always inject the Settings
    tab
  • Auto-redirect to the first non-settings config link (if there is one)
    when the user lands on /admin/plugins/:plugin_id
  • Add extras to admin plugin serializer so plugins can add more
    data on first load

* Simplify config nav link generation to always inject the Settings
  tab
* Auto-redirect to the first non-settings config link (if there is one)
  when the user lands on /admin/plugins/:plugin_id
* Add `extras` to admin plugin serializer so plugins can add more
  data on first load
martin-brennan added a commit to discourse/discourse-gamification that referenced this pull request Apr 23, 2024
Relies on discourse/discourse#26707 from core

TODO: Restyle the list page, delete any unnecessary route or template
files
@martin-brennan martin-brennan marked this pull request as ready for review May 1, 2024 01:13
Extracted from the CalendarDateTimePicker to make it more generic
@@ -0,0 +1,20 @@
import i18n from "discourse-common/helpers/i18n";
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You can do this? I thought you were supposed to export the template as a constant

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This works too, but it's better to do it with a constant so the component has a name (useful in debugging/exploring with the Ember Inspector)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh interesting, I was disappointed that ember inspector didn't give this a name, so I will do the const thing.

What happened here is that, I did something like:

export default <template>adssad</template>

And prettier autocorrected it to get rid of the export.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmm I still get unknownTemplateOnlyComponent in the ember extension, even though I changed it to export in the same way as another template component I have here https://github.com/discourse/discourse/blob/5495279fb7995d4ff6ad57363437ccae60471262/app/assets/javascripts/admin/addon/components/admin-plugins-list.gjs . Not a huge deal, just seems unexpected.

@martin-brennan martin-brennan merged commit 914f93b into main May 2, 2024
16 checks passed
@martin-brennan martin-brennan deleted the dev/add-more-structure-for-plugin-config-nav branch May 2, 2024 01:36
martin-brennan added a commit to discourse/discourse-ai that referenced this pull request May 2, 2024
The initial setup done in fb0d563
clashed with other plugins, I found this when trying to do the same
for Gamification. This uses a better routing setup and removes the
need to define the config nav link for Settings -- that is always inserted.

Relies on discourse/discourse#26707
martin-brennan added a commit to discourse/discourse-gamification that referenced this pull request May 2, 2024
This changes Gamification to follow the adminPlugins.show route convention
from core, which we are changing all plugins to use instead of their own custom
routes for advanced configuration. This moves some routes and paths around,
and moves additional data for the admin leaderboards routes into `extras` on
the plugin show API call.

It also adds some CSS classes to the templates, and a system spec for the admin
leaderboard functionality.

The next PR will redesign the leaderboards list to follow convention,
and refactor into components rather than just using route controllers + templates.

Relies on discourse/discourse#26707 from core
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
4 participants