Closed temecom closed 7 years ago
I found that I needed to add the bundle to index.html in the openmct script section: require(['openmct'], function (openmct) { [ 'example/imagery', 'example/eventGenerator', 'example/generator', 'tutorials/todo', 'platform/features/my-items' ].forEach( openmct.legacyRegistry.enable.bind(openmct.legacyRegistry) ); openmct.start(); });
Did adding the new tutorials/todo bundle to index.html help? I still do not see todo entry in the create list.
You have to add it in 2 places...
index.html defaultRegistry.js
Here is my modified docs/src/tutorials/index.md so far.
https://github.com/temecom/openmct/blob/open1309/docs/src/tutorials/index.md
It works up to the view: the default view shows up and the tasks aren't listed - I am looking into that now.
Chris
On 11/03/2016 11:20 AM, Chandrasekar Sureshkumar wrote:
Did adding the new tutorials/todo bundle to index.html help? I still do not see todo entry in the create list.
— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/nasa/openmct/issues/1309#issuecomment-258230174, or mute the thread https://github.com/notifications/unsubscribe-auth/AFqXKbL9lbMPDtGSDRA9zFoGbA58M_vuks5q6iYDgaJpZM4Km3IY.
@temecom thanks for your work in open1309 to fix the tutorials. As you've noticed, we've changed how one would install new plugins, but defaultRegistry is not something we would expect people to be modifying. I wanted to give you a few pointers on how we plan to use the new APIs, and in the short term, how we're using them to support old-style bundles but with a slight change to how those bundles are installed.
In short, to adapt an old-style bundle to a new style plugin:
bundle.js should return a function that receives a single argument,
openmct
, and when invoked, this function should register the bundle
on the openmct
application like so:
define([], function () {
return function TodoTutorial(openmct) {
openmct.legacyRegistry.register("tutorials/todo", {
"name": "To-do Plugin",
"description": "Allows creating and editing to-do lists.",
"extensions": { /*... extensions as normal */ }
});
openmct.legacyRegistry.enable("tutorials/todo");
};
});
in index.html, you should require your new plugin and install it in openmct:
require([
'openmct',
'tutorials/todo/bundle'
], function (
openmct,
todoPlugin
) {
openmct.install(todoPlugin);
openmct.start();
});
We'll be phasing out the legacyRegistry and general "extension" category in favor of clearly documented public APIs, which are starting to take shape in API.md. We'll be converting tutorials to the new API as we work through the process, but if you'd like to update the tutorials to use the new bundle registration strategy that would be much appreciated and a useful stopgap.
Let me know if you have any questions!
Pete,
Thanks for the feedback. I guess it depends on how long the next release will take to roll out. If it is greater than a month or two then it would make sense to have a stop-gap measure so that we don't lose developers interested in using the platform as is.
I found it pretty difficult to get a new bundle up (I still don't have it fully operational) given the unstable state of the latest master branch. An alternative would be to declare a stable release branch/tag in the README.md that is before the registry change so that new developers can use it to get started and keep master as the bleeding edge. This is a little contrary to 'normal' development where your master is the latest stable and the development streams merge into it at release time.
Chris
On 11/04/2016 09:47 AM, Pete Richards wrote:
@temecom https://github.com/temecom thanks for your work in open1309 to fix the tutorials. As you've noticed, we've changed how one would install new plugins, but defaultRegistry is not something we would expect people to be modifying. I wanted to give you a few pointers on how we plan to use the new APIs, and in the short term, how we're using them to support old-style bundles but with a slight change to how those bundles are installed.
In short, to adapt an old-style bundle to a new style plugin:
1.
bundle.js should return a function that receives a single argument, |openmct|, and when invoked, this function should register the bundle on the |openmct| application like so: define([],function () { return function TodoTutorial(openmct) { openmct.legacyRegistry.register("tutorials/todo", { "name": "To-do Plugin", "description": "Allows creating and editing to-do lists.", "extensions": {/*... extensions as normal */ } }); openmct.legacyRegistry.enable("tutorials/todo"); }; });
2.
in index.html, you should require your new plugin and install it in openmct: require([ 'openmct', 'tutorials/todo/bundle' ],function ( openmct, todoPlugin ) { openmct.install(todoPlugin); openmct.start(); });
We'll be phasing out the legacyRegistry and general "extension" category in favor of clearly documented public APIs, which are starting to take shape in API.md. We'll be converting tutorials to the new API as we work through the process, but if you'd like to update the tutorials to use the new bundle registration strategy that would be much appreciated and a useful stopgap.
Let me know if you have any questions!
— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/nasa/openmct/issues/1309#issuecomment-258485028, or mute the thread https://github.com/notifications/unsubscribe-auth/AFqXKXp5EQEpZBSt9_MG6ctNCbvr1PHZks5q62G0gaJpZM4Km3IY.
Hi Chris-- thanks for your insights.
It's been a tough undertaking to rewrite the API while maintaining our existing production developments and as such we have let our documentation get out of date during the transition. The latest master branch is considered stable, but there is missing documentation.
What I suggested above is the main change we have made to bundle loading, which I thought was the only difference between the tutorials and master branch, but in reviewing the tutorials myself I see that is not true. Some portions of the API have changed enough that parts of the tutorials simply aren't valid any more.
We're planning to release tutorials and documentation for the new API by the end of the year. We've already got a headstart on these new tutorials; we wrote them for the new API when we prototyped it. Now we're finalizing our implementation of the new API; we just have a few small tweaks to make to the new tutorials before we can release them.
Do you mind if we touch base in a few weeks and solicit your feedback on our new tutorials?
Thanks @temecom and @larkin for your response. I'm trying to get this up and running as well, but I will try to contribute as much as I can to update the tutorials as well.
Thanks @temecom. I wasn't able to get the todo object working till I read your comments,
Issues with the tutorials have been resolved by #1339.
Following the Tutorial for the 'To Do list' fails at the registration: