This week in Orchard - 11/30/2019

Gábor Domonkos's avatar
Admin UI, Query, This week in Orchard

Fixing and improving Orchard Core for the upcoming 1.0 release. One of the main focuses is on every admin page that has a list with filters and/or bulk actions, use the same UI. With that, the users will get a better user experience by the unified UI. And don't forget to check out the Swagger demo!

On Orchard 1.x

Cannot insert duplicate key in object dbo.Settings_ShellFeatureStateRecord

The feature names are compared without ignoring the case in EnableFeatures (with 's') and DisabledFeatures (with 's'). It causes Violation of UNIQUE KEY constraint 'UC_SFSR_SSRId_Name'. Cannot insert duplicate key in object 'dbo.Settings_ShellFeatureStateRecord' error when there is a module that has the same name but lower case in Settings_ShellFeatureStateRecord table and/or Settings_ShellFeatureRecord.

featureState.Key.Id.Equals(fId, StringComparison.OrdinalIgnoreCase) has been used in the EnableFeature (without 's') so the fix is to use the same code for EnableFeatures and DisabledFeatures.

On Orchard Core

Register content definition models for Liquid

When using Liquid, you could do something like this: class="tags {{ Model.PartFieldDefinition.Name | html_class }}" But this returns nothing because the ContentPartFieldDefinition and other associated models haven't been registered for use with Liquid. The fix is to just register the missing models in the Startup.cs file of the OrchardCore.Liquid module.

Discarding the draft of a content item removes the published one from the indexes

We had a weird error in Orchard Core. Let's say you add and publish a blog post. Now edit and save it to have a published and a draft version too. Then do a DiscardDraft on it, so we only have the published version left. Now if you run the BlogPostsQuery (that comes from the Blog recipe) we can see that it is no more indexed. To fix this try to rebuild the index, but the blog post is still not indexed. The reason is that because when discarding a draft we trigger a removed event then if there is a published version we set it to be the latest and we set the context.NoActiveVersionLeft to false. Now it has been fixed.

Register missing Steps in Startup

You have to implement the IRecipeStepHandler interface if you want your recipe step to be processed. Each implementation is responsible for processing only the steps that it targets. After you can use the AddRecipeExecutionStep extension method to register your implementation to the DI. We have recipe steps for the GitHub authentication settings, Facebook, Twitter and Microsoft Account settings too. These interfaces haven't registered to DI, so now, if you check one of the startup files, you will see the new lines in each file.

New Indices UI

If you have the OrchardCore.Lucene feature enabled, you can head to Search -> Indexing -> Lucene Indices page, where you will meet with a brand new UI for indices.

New Users UI

Now the Users page also supports bulk actions. Here you can see that you can select multiple users at a time and approve or delete them in a bulk.

Workflows UI and Bulk Actions

As you can see, the goal is to unify the admin pages in Orchard Core. In the Workflows page you can now also have the ability to do bulk actions: select two or more workflows then delete them in just one click using the Actions dropdown!

Elsa Workflows 1.1.3 released

Elsa Core is a workflows library that enables workflow execution in any .NET Core application. Workflows can be defined not only using code but also as JSON, YAML or XML. Last week Elsa Core 1.1.3 released including the classical MassTransit ShoppingCart example, implemented as an Elsa Workflow (with MT activities).

Both Orchard and Orchard Core ship with a powerful workflow module and both are awesome. In fact, Elsa Workflows is taken & adapted from Orchard Core's Workflows module. Elsa uses a similar model, but there are some differences:

  • Elsa Workflows is completely decoupled from the web, whereas Orchard Core Workflows is coupled to not only the web but also the Orchard Core Framework itself.
  • Elsa Workflows can execute in any .NET Core application without taking a dependency on any Orchard Core packages.

Demos

Swagger module for Orchard Core

When you navigate to Configuration -> Features you will see two new modules:

  • OrchardCore OpenApi documentation generation: enables OpenApi documentation generation of the OrchardCore APIs.
  • Swagger OpenApi documentation: enables the Swagger endpoint for displaying OpenApi documentation.

When you enable the first one you will have the OpenApi documentation generation for the APIs of Orchard Core. Swagger is a set of open-source tools built around the OpenAPI Specification that can help you design, build, document and consume REST APIs. If you enable the second module too, you could Swagger by just simply using the /swagger URL in your Orchard Core site.

If you want to see the full demo about how to use Swagger with Orchard Core check out the video too!

This feature is under development and you can see the current state of the module if you check out on this branch.

On Lombiq

Orchard Dojo Newsletter

Now we have 106 subscribers of the Lombiq's Orchard Dojo Newsletter! We have started this newsletter to inform the community around Orchard with the latest news about the platform. By subscribing to this newsletter, you will get an e-mail whenever a new post published to Orchard Dojo, including This week in Orchard of course.

Do you know of other Orchard enthusiasts who you think would like to read our weekly articles? Tell them to subscribe here!

If you are interested in more news around Orchard and the details of the topics above, don't forget to check out the recording of this week's Orchard meeting!

No Comments

Add a Comment