-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
[for Discussion] More hooks for admin ui #2156
Conversation
🦋 Changeset is good to goLatest commit: 9d325c6 We got this. Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
@@ -57,6 +57,7 @@ function readAdminMeta() { | |||
let hooks = {}; | |||
if (typeof hookView === 'function') { | |||
[hooks] = readViews([hookView]); | |||
adminMeta.hooks = hooks; |
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 can be used to consume components for all list pages
@@ -15,6 +15,7 @@ export default class List { | |||
constructor(config, adminMeta, views, listHooks = {}) { | |||
this.config = config; | |||
this.adminMeta = adminMeta; | |||
this.hooks = listHooks; |
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.
list level hooks (with components)
@gautamsi not sure we need additional list level hooks. Why not simply use the existing adminUI hooks?
|
only way I can think of having a flat key value pair in hooks is which it can be provided to list's
import {customViews, customHooks} from 'keystone-contrib-packages'
export default = {
pages: {.....pages},
...customViews, // exports certain views for fields used in list plugins
...customHooks, // adds list config for custom hooks entry point in admin ui
emailField: require('./views/emailViewField'),
emailCell: require('./views/emailViewCell'),
myAction2: require('./actions/exportList'),
} this can be used in list config const { customPlugins } = require('keystone-contrib-packages');
//...... other things
keystone.createList('SomeList', {
fields: {
email: {type: Text, field: 'emailViewField', cell: 'emailViewCell'},
},
adminConfig: {
listActions: ['myAction2'],
},
plugins: [
customPlugins(keystone), // this is from 'keystone-contrib-packages' which sets up custom actions for admin ui.
]
}); Also need to document each entryPoint in the admin ui like this (#1739 (comment))
if above entry points are found as key in hooks config, then we can assume it applies for all lists. Any other config in the list's I may sound against your idea of single place for all config (in |
Will this cover #1452 ? |
7f7735e
to
9913f44
Compare
9913f44
to
9d325c6
Compare
fixed merge conflicts |
I think I missed the changes done to ItemTitle.js in #2279 I should really have extended upon that rather than this PR. closing now. |
another POC based on hooks implementation and extending #2155 (includes commits from #2155)
with following config and component I am able to recreate #1724 (item page title button for duplicate)
hooks config
component
discuss here or ping slack :)