EZP-23012: As a developer, I want to be able to extend the application view services #98
Conversation
Ready to be reviewed! |
@@ -16,7 +17,8 @@ module.exports = function(grunt) { | |||
], | |||
testFiles = [ | |||
"./Tests/js/*/*/*.js", | |||
"./Tests/js/*/*/*/*.js" | |||
"./Tests/js/*/*/*/*.js", | |||
"./Tests/js/*/*/*/*/*.js", |
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.
Why don't you use the following: ".Tests/js/*/.js" instead of these four lines above?
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.
good point and good question :-)
As far as I can remember, a former colleague had issues with that in Windows... But I guess, we can use this syntax now and see if someone shouts about it :-)
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.
I'm using the shorter syntax since I started to use Grunt and I have never had any problems with it, no matter what system I worked on.
What about adding view templates into shell.html.twig file? |
for the templates: it's planned but one step at a time :) The next step is to apply more or less the same system to others components (view, apps, model maybe, ...) and then the question about templates and CSS files will arise. |
} | ||
Y.Array.each(components, function (identifier) { | ||
plugins[identifier] = plugins[identifier] || []; | ||
plugins[identifier].push(constructor); |
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.
What is the reason you're checking whether the plugins[identifier]
is existing? As far as I can see in the Firebug, there I always assigned an empty array, so it could be just this: plugins[identifier] = [];
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.
no, if you do that you won't be able to register several plugins for a given component as the plugins array will be reseted. (there's a unit test for that and its fails with your suggestion)
+0 |
var ns1 = 'pluginNs1', | ||
ns2 = 'pluginNs2', | ||
plugin1 = _generatePlugin(ns1), | ||
plugin2 = _generatePlugin(ns2), |
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.
Nitpick: Wouldn't it be better to use _generatePlugin()
function once and accept an array as parameter?
Self note: |
Apart from the comments I made earlier: +1 |
EZP-23147: As a developer, I want to be able to write plugins for views
JIRA: https://jira.ez.no/browse/EZP-23012
Description
The idea is to make possible to extend view services (and later others types of components) with the YUI Plugin system. Basically, the developer will be able to register plugins for some components in a global registry and those plugins will be dynamically added. Together with the configuration system proposed in #95, this will allow to cleanly extend almost anything in the Platform UI App. This will also be useful for us to decouple components into smaller pieces.
View service plugins
The view service plugin can enhance the view service in the following ways:
parallelLoad
method in the plugin, it's possible to asynchronously load some data in parallel with the loading done by the view service (and others plugins)afterLoad
method in the plugin, it's possible to asynchronously load some data after the loading done by the view service (other the others plugin). For instance, the developer wants to fetch something by using what is loaded before.getViewParameters
implementationsIn addition, the view service plugins are normal YUI plugins so from a plugin you can subscribe to any event the service get (that's what is done in this PR in the content tree and object relation load plugins) and you can also enhance any method implemented by the service by adding your own behavior before or after the original method execution.
Tasks
if time, add the same concepts to others types of components (apps, views, ...)(will be implemented in EZP-23147)Tests
unit tests + manual tests