-
Notifications
You must be signed in to change notification settings - Fork 12.1k
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
Plugins: Add autoEnabled plugin JSON field to auto enable App plugins and add configuration link to menu by default #31354
Conversation
torkelo
commented
Feb 19, 2021
•
edited
Loading
edited
- App plugins no longer get a "Plugin Config" menu option added automatically
- If you navigate to the plugin via the Plugins list it will default to the config page (if it's an app and export a config ctrl)
- An app plugin that wants the Plugin Config to remain in the main menu can add it as an entry in the plugin.json (includes) like any plugin page
- New option plugin.json autoEnable option that makes the plugin be enabled by default (making plugins be auto-enabled requires a bit more changes so we can disable any plugin). Can wait for v8
pkg/plugins/app_plugin.go
Outdated
@@ -15,7 +15,8 @@ import ( | |||
|
|||
type AppPlugin struct { | |||
FrontendPluginBase | |||
Routes []*AppPluginRoute `json:"routes"` | |||
Routes []*AppPluginRoute `json:"routes"` | |||
NoConfig bool `json: "noConfig"` |
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.
Maybe noConfigPage
or noConfigPageInNav
instead? noConfig
feels very generic.
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.
yea had the same thought
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.
LGTM
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.
We should add an entry for the new field in docs/sources/developers/plugins/plugin.schema.json
.
Also just to confirm, we should still be able to visit the config page from the plugins list view? Does this change only remove it from the sidebar nav?
Oh i think this might need another change to auto enable the plugin , or maybe that exists already need to check |
@torkelo should we add this to the plugins platform project and set the milestone to 7.5? |
@natellium yes |
pkg/plugins/queries.go
Outdated
@@ -64,7 +64,10 @@ func GetEnabledPlugins(orgId int64) (*EnabledPlugins, error) { | |||
} | |||
|
|||
for pluginId, app := range Apps { | |||
if b, ok := pluginSettingMap[pluginId]; ok { | |||
if app.AutoEnabled { |
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.
This won't actually enable apps though correct? Or at least, it won't set the plugin data - It will just pin it in the nav, so maybe AutoPinned
/AutoPinnedToNav
is a better name?
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.
it will once I figured out how, at least that is the plan, but was harder than I expected
@@ -122,6 +122,14 @@ | |||
"hiddenQueries": { | |||
"type": "boolean" | |||
}, | |||
"noConfigPage": { | |||
"type": "boolean", | |||
"description": "For app plugins that have no config page" |
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.
A little bit confused by this - Does this mean that the app can't be configured at all?
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.
just means they don't have a default config page
Ugg -- for v8, can the sidebar menu be defined programatically? Why do we need it in plugin.json? Ideally we can remove all the sidemenu options from plugin.json |
@ryantxu I do not think the top level navigation items should require loading async external plugins during frontend rendering, that I think should be declaratively defined in the plugin.json along with user role permission restrictions . Otherwise the sidemenu will require some loading state and things plopping in after some plugin loading phase? feels bad |
@ryantxu I changed this a bit, so it's a bit more of a breaking change but I think it's ok.
what do you think? |
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.
This is much better! although we should still be open to more breaking changes in 8.
Open an issue |