-
Notifications
You must be signed in to change notification settings - Fork 8.6k
DEV: Add various APIs and outlets to the themes config area #33385
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
Conversation
@OsamaSayegh The test failures are legit. Can you have a look please? |
e8f2690
to
60d0d6d
Compare
This failure is quite interesting. So this PR adds a new plugin API to add custom cards to the themes grid. To make that work, we define a method in Not sure what the best way is to fix this, but for now I've moved the relevant files out of the admin bundle into the discourse bundle. |
* @param {AdminConfigAreaCard} adminConfigAreaCardComponent - The | ||
* `AdminConfigAreaCard` class from core to be optionally used as a container | ||
* for the card content. | ||
* @returns {Component} - A Glimmer component class for the card to be added |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think we return a Component
here but a function. I think we can just leave the return value blank here since nothing we return to the function caller is of use.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hmm I'm not following. What I'm trying to document here is what the callback function should return to us, not the return value of the addCardToAdminThemesGrid
method itself. We need the callback function to return a component that contains the card content.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ahh ok I thought the callback function is usually documented above the function’s params. Let me check tomorrow.
api.renderInOutlet( | ||
"admin-config-area-components-empty-list-bottom", | ||
class extends Component { | ||
<template> | ||
<div class="my-custom-empty-list"> | ||
Additional message shown at the bottom of the empty list. | ||
</div> | ||
</template> | ||
} | ||
); | ||
}); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
api.renderInOutlet( | |
"admin-config-area-components-empty-list-bottom", | |
class extends Component { | |
<template> | |
<div class="my-custom-empty-list"> | |
Additional message shown at the bottom of the empty list. | |
</div> | |
</template> | |
} | |
); | |
}); | |
api.renderInOutlet( | |
"admin-config-area-components-empty-list-bottom", | |
<template> | |
<div class="my-custom-empty-list"> | |
Additional message shown at the bottom of the empty list. | |
</div> | |
</template> | |
); | |
}); |
Can you confirm but I don't think we need to return a component here and can just return the template.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yup, we don't need a full blown component here, a template will work just fine.
* return class extends Component { | ||
* <template> | ||
* <adminConfigAreaCardComponent class="my-custom-card"> | ||
* <:content> | ||
* <!-- your custom card content goes here --> | ||
* </:content> | ||
* </adminConfigAreaCardComponent> | ||
* </template> | ||
* } | ||
* }); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we can simplify this example to return a <template>
based onhttps://github.com/discourse/discourse/blob/eef0b47b4393ab2f6af1d910a3dcf1f14427b797/app/assets/javascripts/discourse/app/lib/plugin-api.gjs#L1312?
No description provided.