-
Notifications
You must be signed in to change notification settings - Fork 196
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
Visual annotations of resources #962
Comments
I like the idea of defining the resource's look and behavior using source code. I'll dump some thoughts here, not very curated... Referencing Nova, which is similar to Wing ConsoleLaravel Nova is kind of similar to the Wing Console. It's an admin panel that allows you to define how your Laravel models look and behave by using code. For every resource (ex, a User), Nova allows you to define the fields that are displayed and the actions you can take on it. It's an API similar to this: /**
* Get the fields displayed by the resource.
*
* @param \Laravel\Nova\Http\Requests\NovaRequest $request
* @return array
*/
public function fields(NovaRequest $request)
{
return [
ID::make()->sortable(),
Text::make('Name')->sortable(),
];
}
/**
* Get the actions available for the resource.
*
* @param \Laravel\Nova\Http\Requests\NovaRequest $request
* @return array
*/
public function actions(NovaRequest $request)
{
return [
new Actions\EmailAccountProfile
];
} It's all PHP code, no UI code. Nova will end up consuming whatever is defined in these resources and provide the UI for it. The Wing Console could do the same. (Complex) Ideas for resource customization in WingFor every Wing custom resource, we could allow defining the following:
Details that matter:
Let's see some pseudo code just to gather an idea of some interesting capabilities: Example with
|
@skyrpex this is great. I don't see strong need to add dedicated syntax for this. Let's start simple (and also with minimal APIs, Any objects? |
Congrats! 🚀 This was released in Wing 0.4.91. |
Summary
Add information to Wing resources that improve their visual representation in the Wing Console
Feature Spec
You can control how a Wing resource looks & behaves in the Wing Console using the
display
API:Let's look at an example:
Use Cases
The use case is to allow users (and us) to control how a resource looks and behaves in the Wing Console.
Initially, we will just support:
title
description
hidden
Future ideas:
But let's start simple.
Implementation Notes
This is mostly straightforward to implement. Sketch:
Display
class.display
property to the baseResource
class with these three getters/setters.Display
is initialized (this.display = new Display(this)
)tree.json
we include adisplay
section for each resource that includes this information.Consume the information in the Wing Console.
Component
SDK, Wing Console
The text was updated successfully, but these errors were encountered: