Add title to background tasks and improve the UI, Lombiq Node.js Extensions - This week in Orchard (17/02/2023)
Add a title to background tasks and improve the UI, update Azure AD Docs, add hidden content type settings to allow hiding a content type from GraphQL Schema, and a demo about the Lombiq Node.js Extensions project! Check out our post for the details!
Orchard Core updates
Add a title to background tasks and improve the UI
Currently, the background task name/technical name is the full name of the C# class. This is not a user-friendly name for a UI. The long technical name (aka task Id) should not be visible to the UI. The improvement here is to add a user-friendly title to every background task. We can continue to use the current "name" in the URL, and locate the task.
So, here is a summary of the changes regarding the background tasks UI:
- A new search bar was added to the list page.
- The technical name is no longer visible. Instead, we show a title.
- The Create action was removed from the controller as we can never create a background task using a UI.
- The Edit action will now create a settings entry in the document if an entry does not exist.
The following screen shows you the before and after screens of the Background Tasks landing page and the Edit background task page.
Improve Azure AD Docs
The documentation of how to authenticate users with the Azure AD Account had a few errors and omissions, so after figuring out what needs to be configured to make login work, the documentation has been updated.
Add hidden content type settings to allow hiding a content type from GraphQL Schema
GraphQL exposes all content types to the user. A permission check is applied to filter out content types users can't view. There is no way to control which content types should be exposed to the API. Not everyone wants to expose every content type. For example, if we have a SitePage content type we want everyone to be able to view it, but we do not want anyone to query it from the API.
The solution was to simply add a content type setting to hide the content type like we do today for the content parts.
Lombiq Node.js Extensions
The Lombiq Node.js Extensions project is supposed to provide front-end asset pipelines as a reusable project where under the hood, we actually run some Node.js scripts. We tried to do that in a way that the consumer of this project doesn't really have to know much about how it works and doesn't really have to configure much or anything at all. And we also set out to make this available as a NuGet package. So that you can drop in a completely working, but also configurable Node.js front-end pipeline which means compiling/minifying and linting SCSS and JS files and things like that. One more thing to know is that we drop Gulp from the equation altogether because Gulp is officially not compatible with anything higher than Node.js 12. It does work on Node.js 14, but we had problems with upgrading to Node.js 16, which came out over a year ago, and now the current LTS version is Node.js 18, so we decided to drop Gulp from the whole pipeline and build the whole project just using npm scripts and some custom written node.js scripts.
Now let's see a quick example of how to utilize it! We will check it out in our Open-Source Orchard Core Extensions full Orchard Core solution. You will find our other useful Orchard Core-related open-source projects there, too. Here you can find a class library called Lombiq.NodeJs.Extensions.Samples where we added a configuration section called nodejsExtensions to the package.json file.
Here you can see we are looking for JS files in the CustomJsFolder and SCSS files in the NonDefaultScssFolder and rendering them into those target folders. We also have assets copying, which we do a lot in our modules where we copy files from node modules (for example, Bootstrap or other front-end libraries) into Webroot.
Then we also have Markdown linting with another sample package.json file in the Lombiq.NodeJs.Extensions.SolutionMarkdownAnalysis project. The markdown can be enabled by providing a source folder which can be any relative path.
And we have a lot to cover! If you want to know more about this new project, check out this recording!
News from the community
Orchard Dojo Newsletter
Lombiq's Orchard Dojo Newsletter has 400 subscribers! We have started this newsletter to inform the community around Orchard of the latest news about the platform. By subscribing to this newsletter, you will get an e-mail whenever a new post is published to Orchard Dojo, including This week in Orchard of course.
Do you know of other Orchard enthusiasts who would like to read our weekly articles? Tell them to subscribe here!