New Locode v2 #54
mythz
announced in
Announcements
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
I wanted to give everyone early notice that Locode - the Auto UI for managing your AutoQuery APIs has been rewritten from the minimal & restrictive petite-vue to using the full Vue 3 in the latest v6.6+ on MyGet and GitHub Packages.
The new Locode Vue 3 should have complete feature parity with the old Petite Locode, but to minimize potential disruption we'll be temporarily including both UIs at the built-in routes below:
/locode/
- New Vue3 Locode/locode-v1/
- Old PetiteVue LocodeWhich is included in the Blazor Gallery App if you want to compare the old & new versions of Locode side-by-side:
As Vue3 Locode supports all existing C# UI declarative attributes that Locode (and Blazor AutoQueryGrid) component utilizes to customize its UI, we expect the only real friction will be to port any custom PetiteVue components you might've added into Vue 3 components.
Our plan is to remove the old Petite Vue UI in the release after next (i.e. v6.8) if we don't have any outstanding reported issues, so please let us know of any issues you find with new Locode UI now in the pre-release packages or during the next 6.7 release.
Other than being able to use full Vue 3 feature to create the UI and any custom components the primary difference is that it's also able to utilize the Vue 3 component library and its new AutoQueryGrid component which unlike Locode's PetiteVue Grid is highly customizable where you'll be able to easily include your own Customizable AutoQueryGrid components to customize its columns & forms, etc.
Customizing AutoQuery Pages
Previously if you needed to go beyond the available customizations in Locode you would need to start looking transitioning to a Bespoke App, but with Vue 3 locode you can completely change what each Data Model page does by registering a component with the
<DataModel>Page
which Locode will render instead, and because the<AutoQueryGrid/>
is highly customizable you should be able to reuse most of its functionality whilst customizing the parts you want to change.Custom components can be registered in your project at the following location:
Where instead of a PetiteVue HTML component you would register a Vue 3 component which should have the
.mjs
extension to signify it's a JavaScript Module. If you're unfamiliar with JS Modules or Vue 3 we recommend reading our Simple, Modern JavaScript blog post which describes how the vue-mjs template creates interactive Vue Apps without needing any npm build tools, which you'd typically adopt when registering custom components, (although you can register any Vue 3 component, e.g. a compiled Vue3 SFC if you prefer to configure your project with Vite+Vue3+tsc and register the output builds).We've added a custom component in Blazor Gallery at /wwwroot/modules/locode/components/BookingPage.mjs
What's nice about Vue 3 is that now your components are reusable where you'll be able to reuse them in any other Vue Apps or components you have, e.g:
Which changes the Bookings Locode page
https://blazor-gallery.servicestack.net/locode/QueryBookings
From the standard AutoQueryGrid displaying all standard columns:
To the custom implementation above which opens the Edit Form when clicking on the Booking Discount letting you manage both the Bookings and Coupons on the same page.
Components
Your custom components can utilize built in libraries embedded in ServiceStack.dll by importing by package name, e.g:
Where your components will have access to the latest Vue 3 reactive fx, @servicestack/client client library and Vue 3 Tailwind Component library.
As all package dependencies are written in TypeScript you can install them as dev dependencies to get static analysis from its TypeScript definitions at dev time:
Your components can access your Apps Typed DTOs directly from the ES6 Module DTO endpoint at
/types/mjs
, e.g:App functionality
Your components access to most of the App's functionality via the injected dependencies for functionality defined in app.mjs
app
is our wrapper component around Vue'screateApp
which lets you register components, providers, plugins, directives, props, onStart callbacks and events defined in core.mjsAutoQueryGrid
More documentation about the new
<AutoQueryGrid>
component will be available next release, it basically has all the features of Blazor's AutoQueryGrid component where you'll able to apply the same customizations as Vue's DataGrid component inside the component.In the meantime the best place to learn about it is from its implementation in AutoQueryGrid.vue which supports the following properties:
Emits the events:
and lets you inject custom components using available slots:
Other slots are passed down to its DataGrid component which lets you customize how each column and header is rendered.
Feel free to ask any questions about how to use or create custom Vue 3 components here.
Displaying Referential Data
AutoQuery is able to infer relationships from the POCO References of your Data Models where if your DataModel includes
[Reference]
data so that it's returned in your AutoQuery APIs, AutoQueryGrid uses it to render the Contacts Name and Icon instead of just the plain ContactId.This is visible in the JobApplications page where it renders the Job and Contact name instead of their ids, based on this DataModel DTO:
The original ids that are replaced can be seen by hovering over the Job & Contact labels.
As we're already showing the Contact & Job Info we can tell AutoQueryGrid to hide the complex data references columns using
[Format(FormatMethods.Hidden)]
.If not specified, AutoQuery will use the first string column for its label which can be customized with the
[Ref]
attribute or if you don't want the FK Ids replaced you can use[Ref(None=true}]
to disable any inference.Please let me know any feedback or questions you have about the new Locode UI in this thread.
Beta Was this translation helpful? Give feedback.
All reactions