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

To do list tutorial out of date - bundle not registered on 'Create' list #1309

Closed
temecom opened this issue Nov 2, 2016 · 9 comments
Closed
Assignees

Comments

@temecom
Copy link

temecom commented Nov 2, 2016

Following the Tutorial for the 'To Do list' fails at the registration:

  • Registration is not defined in main.js any more (main.js does mot exist)
    -- now defaultRegistry.js
  • Adding the entry to defaultRegistry.js does not create an additional entry in the Create list
    -- It shows up in a debug session in legacyRegistry array but does not register as a 'creation' type
    -- Evidently something is missing
    -- Tried adding bundles.json (suggested in root README) but could not get the path correct
    --- It looks for tutorials/todo/bundle.json
  • I am volunteering to update the tutorial and README if someone can point me in the right direction as far as creating a new registry bundle.
@temecom
Copy link
Author

temecom commented Nov 2, 2016

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();
});

@chandrusuresh
Copy link

Did adding the new tutorials/todo bundle to index.html help?
I still do not see todo entry in the create list.

@temecom
Copy link
Author

temecom commented Nov 4, 2016

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
#1309 (comment),
or mute the thread
https://github.com/notifications/unsubscribe-auth/AFqXKbL9lbMPDtGSDRA9zFoGbA58M_vuks5q6iYDgaJpZM4Km3IY.

@larkin
Copy link
Contributor

larkin commented Nov 4, 2016

@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!

@larkin larkin self-assigned this Nov 4, 2016
@temecom
Copy link
Author

temecom commented Nov 4, 2016

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:

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!


You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
#1309 (comment),
or mute the thread
https://github.com/notifications/unsubscribe-auth/AFqXKXp5EQEpZBSt9_MG6ctNCbvr1PHZks5q62G0gaJpZM4Km3IY.

@larkin
Copy link
Contributor

larkin commented Nov 4, 2016

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?

@chandrusuresh
Copy link

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.

@allambyjd
Copy link

Thanks @temecom. I wasn't able to get the todo object working till I read your comments,

@akhenry
Copy link
Contributor

akhenry commented Dec 1, 2016

Issues with the tutorials have been resolved by #1339.

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

5 participants