nasa / openmct

A web based mission control framework.
https://nasa.github.io/openmct/
Other
11.97k stars 1.24k forks source link

ToDo Tutorial Outdated? #1475

Closed kb1lqc closed 6 years ago

kb1lqc commented 7 years ago

I tried following the ToDo Tutorial but it does not make sense. I saw that #1309 was closed in December but the code appears to have been updated even since then. This comment tried to get the new API described but it too appears to not be valid anymore.

Tutorial index.html Code of Interest

image

Latest Master index.html Code of Interest

image

The "Function" JavaScript has been replaced with a "forEach" and it's not clear how to proceed. This is the initial experience someone has when trying to understand how to develop for openMCT and it would be beneficial to have a smooth start. I'm sure once I get the hang of it I could use intuition to figure this out but this stops me in my tracks really before I get started. Any suggestions?

kb1lqc commented 7 years ago

OK I made progress on this. I was tripped up by the formatting and missed the function code.

image

This results in the plugin apparently loading: image

However this is contrary to the suggestion where openmct.install(todoPlugin); actually causes an error for me.

akhenry commented 7 years ago

@kb1lqc Sorry about the problems you've had with the tutorials. We are in the process of rewriting our public API, and this has resulted in some refactoring of the platform, which has from time to time rendered our tutorials out of date. They should currently be functional, and we will be gradually replacing them with tutorials that reflect the new API.

The advice in the comment you referenced is the correct way of registering new plugins, however the bundle registration mechanism in the tutorials reflects a slightly archaic style that is still supported for legacy reasons. The tutorials should be updated to reflect the new plugin registration mechanism, including using the new builtin plugins for MyItems, LocalStorage, etc.

akhenry commented 7 years ago

@kb1lqc Hi! I don't know whether you got the point of trying to integrate Open MCT with a telemetry data source, but we have recently published a new telemetry tutorial that should make the task easier - https://github.com/nasa/openmct-tutorial

It actually replaces the previous Telemetry tutorial and uses the new public API. If you do get Open MCT integrated with Faraday, we'd love to hear about it.

kb1lqc commented 7 years ago

@akhenry Thanks for the update! I'll have to check it out. I have not had a chance to look into this as we needed to deliver something for the Rose-Hulman Institute of Technology which is flying our hardware on a high altitude balloon very soon. So we implemented a SimpleUI. No frills and half-decent at being an example of how to pass data between python and javascript over localhost.

Not sure if my next task will be to keep doing UI. I will add this tutorial to our OpenMCT ticket to make sure and have it available when we do!

calvinhuang commented 7 years ago

@akhenry So is a "plugin" basically the new "bundle" in the new API?

I had previously started building multiple plugins and installing them inside a bundle like this:

// massive/bundle.js
define([
    './macesTelemetry/plugin',
    './supro/plugin',
    // ...
], function (
    MacesTelemetryPlugin,
    SuproPlugin,
    // ...
) {
    var massive = (openmct) => {
        for (let prop in massive.plugins) {
          massive.plugins[prop](openmct);
        }
    };
    massive.plugins = {
        MacesTelemetry: MacesTelemetryPlugin
    };
    return massive;
});
// index.html
require(['openmct', 'massive/bundle'], function (openmct, massive) {
    // ...
    openmct.install(massive);
    openmct.start();
});

I'm guessing this is incorrect and should just be a single plugin instead?

VWoeltjen commented 7 years ago

@calvinhuang - Your plugin registration code looks up-to-date. Whether you split up the functionality into one or many plugin functions is up to you.

For clarification, the "bundle" abstraction was a declarative plugin syntax inspired by OSGi and is non-standard to JS; we've dropped that concept from our public API due to the extra learning curve it imposed.

larkin commented 6 years ago

Closing as wontfix, this tutorial will be rewritten at a later date.