Skip to content
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

Plugin Architecture #185

Closed
dboskovic opened this issue Feb 19, 2014 · 5 comments
Closed

Plugin Architecture #185

dboskovic opened this issue Feb 19, 2014 · 5 comments

Comments

@dboskovic
Copy link

@JedWatson @bladey @JossMackison

I'm absolutely loving working with Keystone. I'd be very interested in helping to develop out a plugin API and directory. This would open up Keystone to user-contributed admin functionality.

I noticed a transition to modularizing the different field's UI files... Is this something you're planning? If so, are you interested in my contribution to help expedite it? If not, let's discuss it here further to decide on a pattern and I can work on it and then issue a PR.

@blindMoe
Copy link

Would love to see this happen as well. Let me know if there is anything I can do to help out.

@AlexAndrascu
Copy link

++

@JedWatson
Copy link
Member

Thanks for the offer guys, we're definitely planning to open up Keystone with a plugin architecture and help on this would be great.

@dboskovic you're right, that's exactly why we transitioned to modular field UI files.

The top three things we'd like to make available are:

  • Allow custom field types to be added (and published as separate npm packages)
  • Allow creation of custom views in the Admin UI (e.g. a reporting screen)
  • Allow embedding custom templates and actions in the Item Details screen (e.g. so you could put a 'Send forgotten password email' button on the User Details screen)

Would definitely appreciate help getting it expedited, and happy for suggestions on how best to get it done. I'll put some more thought into what needs to be done too and post it here soon too.

On a related note, I'd also like to follow up on #165 and implement generic stores behind the file and image fields so we don't end up with a whole lot of duplicate code, which we will if each storage system / service has its own field types.

@danielmahon
Copy link
Contributor

@JedWatson Have you given more thought to a plugin architecture? Im looking for some guidance before I continue working on some modules/features Ive been extending into Keystone for my own projects such as 2-factor authentication, better wysiwyg image upload/management, reports, etc.

Ive been playing with different ways of doing this but Im still rather new to Keystone so I know they aren't addressing the big picture. I be willing to spend some time implementing plugins If I had a better idea of how you expect to extend/override the core Keystone object.

I have tried a simple integration here, but its obviously sloppy and doesnt cover all the bases. Though it does give access to the keystone object and setting up routes:

    // Pre-route middleware

    this._pre.routes.forEach(function(fn) {
        try {
            app.use(fn);
        }
        catch(e) {
            if (keystone.get('logger')) {
                console.log('Invalid pre-route middleware provided');
            }
            throw e;
        }
    });

    // Plugins go here

    if (this.get('plugins').length) {
        console.log('Loading plugins...');
        this.get('plugins').forEach(function (plugin) {
            var options = {};
            if (typeof plugin !== 'string') {
                options = plugin.options || {};
                plugin = plugin.name;
            }
            try {
                require(plugin)(keystone, options);
            } catch(e) {
                console.log('Invalid plugin configured or not installed, please check.');
                throw e;
            }
        });
    }

    // Route requests

    app.use(app.router);

Let me know your thoughts and if you have anything already started I can help expand upon.

Thanks for your hard work!

@estilles
Copy link

Continuing discussion on issue #912 ...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants