Skip to content

Link to Open Fixture Library #128

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

Merged
merged 33 commits into from
Mar 10, 2018
Merged

Link to Open Fixture Library #128

merged 33 commits into from
Mar 10, 2018

Conversation

FloEdelmann
Copy link
Member

@FloEdelmann FloEdelmann commented Oct 13, 2017

closes #127

cc @fxedel

@peternewman
Copy link
Member

The tests are failing as you're blocked behind #129 .

@fxedel
Copy link
Member

fxedel commented Oct 14, 2017

Thanks for this quick review and approval! However, as described in OpenLightingProject/open-fixture-library#288, we also want to add manufacturer and personality links (the latter require some small changes on our side as well).

@peternewman
Copy link
Member

To clarify here, I'm not sure manufacturer links to OFL particularly make much sense, it was more around getting some better workflows to avoid double collating some of the data.

The personality links are a good thing to have though.

Unfortunately while we're good at quick reviews @fxedel we still need to work on our deployment methods to improve and speed them up...

@FloEdelmann
Copy link
Member Author

FloEdelmann commented Oct 15, 2017

Is there a way I can test this locally? I installed all npm and grunt dependencies but couldn't find a deploy task or a html file that could be opened in Firefox so I tried to do everything "blindly".

@peternewman
Copy link
Member

Sorry @FloEdelmann that bit doesn't seem to be very well documented.

That gets the JS code going, you then need to run the AppEngine code. See here for some documentation:
https://cloud.google.com/appengine/docs/standard/python/tools/using-local-server

Once you've run it up, you'll need to browse to http://localhost:8080/admin and click lots of the buttons to load manufacturers, PIDs, generate the PID indexes, and then load devices etc so you'll have some data to work with.

@FloEdelmann
Copy link
Member Author

Okay, I got it up and running. Unfortunately, "Update Devices" only adds one device (the BEGLEC NV LED BAR). Manufacturers, PIDs, Controllers, Splitters, Software and Ethernet Nodes could be updated without problems.

So I still couldn't test the personality links since the LED BAR does not have RDM personalities 🤦‍
The fixture link works though.

Are you able to verify the personality links? Or did I make something wrong?

@peternewman
Copy link
Member

We get most of our data via the model collector, and don't store the manually loaded stuff offline, hence the lack of test data. You can import this though:
https://github.com/OpenLightingProject/ola/files/1107996/robin_dl7s_profile.robe.txt

And I can probably dig out some other stuff (or you can capture more yourself). Just use the RDM Model Collector links and change the host/port part.

@FloEdelmann
Copy link
Member Author

Okay, I now managed to work out how the Google Closure build tools have to be set up. I brought them up-to-date with npm's Closure packages. In order to compile successfully, I had to make some small changes to pid_display.js. There are still plenty of warnings that I didn't fix, but that can be part of another PR.

The code I wrote blindly seems to work fine, so I think this PR is now complete. Would you mind reviewing it @peternewman?

@peternewman
Copy link
Member

Resulting HTML LGTM, code review to follow later today.

Copy link
Member

@peternewman peternewman left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for doing this.

A few minor comments.

Also given you've converted it to npm, are you interested in adding it to our Gruntfile given support seems to be built in. I think we could then just delete the BUILD file? https://github.com/google/closure-compiler-npm#using-the-grunt-task

js_src/app.js Outdated

goog.provide('app.setup');

var app = app || {}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It doesn't look like app is being defined anywhere now. Although I understand why you've gone down this route.

See my suggestion here about pulling some stuff out into another file to avoid the circular dependencies:
https://groups.google.com/d/msg/open-lighting/4bgqRxhg6XQ/d2pCA7RFAgAJ

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Regardless where I put var app = {};, it complains about app already being defined in js_src/pid_display.js, where goog.provide('app.pid'); is called. And it does indeed work without explicitly including it, so I wouldn't put too much effort into this.

@peternewman
Copy link
Member

Also it may make sense to add the linter argument to the compiler options:
https://github.com/google/closure-compiler/wiki/Lint-checks

Finally it would be great to run the whole lot during our Travis runs (which is pretty trivial if it's part of the gruntfile). Although I can make the Travis changes if you'd rather.

@FloEdelmann
Copy link
Member Author

@peternewman any updates on this?

js_src/app.js Outdated
@@ -114,6 +122,8 @@ goog.exportSymbol('app.makeModelTable', app.makeModelTable);

/**
* Set manufacturer and model ID
* @param {!string} manufacturer_id The manufacturer RDM ID.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These want to be RDM manufacturer ID and RDM model ID please in the docs.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

@@ -17,13 +17,14 @@
* Copyright (C) 2011 Simon Newton
*/

goog.provide('app.setup');

goog.require('app.displayCommand');
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I was going to say you don't need this, but I'm guessing it optimises it out if it's not in there otherwise?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If it's not in there, I get a TypeError: app.displayCommand is not a function in the browser console on PID pages. However, I just noticed another error: TypeError: this.l.ya is not a function 😕

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmm, then you have to look at the minification to make sense of it! Or perhaps try the non-advanced optimisation may be enough to tell, while giving it a real function name.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah, it's actually one of those warnings that were not produced by my changes: this.tt.setHtml is not a function

Copy link
Member

@peternewman peternewman Jun 25, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ping @FloEdelmann . I've been doing some testing with deploy in #206 and I'm currently getting that "TypeError: this.l.ya is not a function" error and no tooltips e.g. on http://peter-ola-rdm-app.appspot.com/pid/display?manufacturer=0&pid=1 . It does work with what's on live though... http://rdm.openlighting.org/pid/display?manufacturer=0&pid=1

Prior to your changes it hadn't been touched since 2015, which is most likely what live is running.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It looks like this is why, and I suspect your bumping of closure-compiler and/or recompiling means we now need to update various bits such as: gmalartre/closure-library@8932858#diff-b655ee9f9748151f90992f5878791bf6L142

Copy link
Member Author

@FloEdelmann FloEdelmann Jun 25, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmmm, I didn't notice a consequence of that error when testing in this PR; seems like it does matter though (it even stops showing the upper_uid box).

Have you already tried just replacing this.tt.setHtml with this.tt.setSafeHtml here? https://github.com/OpenLightingProject/rdm-app/blob/master/js_src/pid_display.js#L122

In the second occurrence in that file (line 234), setText should be enough.

Both should be available (in contrast to the old setHtml), according to the Closure API.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fixed in #209

js_src/app.js Outdated
@@ -166,8 +178,10 @@ app.changeSoftwareVersion = function(element) {
goog.dom.appendChild(tr, app.newTD('<a href="' + oflLink + '">View in Open Fixture Library</a>'));
goog.dom.appendChild(tbody, tr);
}
app.showBlock(personality_fieldset);
} else {
if (personality_fieldset) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I suspect these may be clearer if they're done as "if (personality_fieldset) { if (test) show or hide }", or given it's probably pointless populating the tbody if the fieldset doesn't exist, just test for that as an overall thing first. Equally should we be checking if tbody exists too, or is that not a warning?

Copy link
Member Author

@FloEdelmann FloEdelmann Jan 27, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

tbody didn't raise a warning. It actually was because I added the explicit not-null {!Element} JSDoc type in the show / hide functions and goog.dom.$ returns a nullable Element. I agree on the clearer code style you suggested though.

Copy link
Member Author

@FloEdelmann FloEdelmann Jan 27, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Or shall we just do the null check in the show / hide functions themselves?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Doing it in the show/hide sounds sensible, although my gut feeling is that adding " if (personality_fieldset) {" as an initial statement outside the existing if may be clearer still, so we don't process tbody first.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok, it's fixed now.

* @constructor
* @extends goog.ui.Component
*/
app.pid.MessageField = function(field_info, opt_domHelper) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this should be able to switch back to app.pid.MessageField now the circle has been broken.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

But it was just app.MessageField before my changes?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah sorry, I must have been looking at an intermediate diff before.

@peternewman
Copy link
Member

Your base URL probably ought to be a constant too, given it's used in a few places (or I they between JS and template system)?

@FloEdelmann
Copy link
Member Author

Is there now still anything preventing a merge?

Copy link
Member

@peternewman peternewman left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just a few minor documentation comments

js_src/app.js Outdated
@@ -114,15 +121,28 @@ goog.exportSymbol('app.makeModelTable', app.makeModelTable);

/**
* Set the software versions
* @param {!string} version_info The software versions.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looking at https://github.com/google/closure-compiler/wiki/Types-in-the-Closure-Type-System shouldn't this be !Array<string> or similar, actually looking at the contents, I think it's probably !Array<Object>?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

*/
app.MessageStructure.prototype.canDecorate = function(element) {
return element.tagName == 'DIV';
};


/**
* @param {!Array.<app.MessageField>} fields
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we be consistent please, either Array.< or Array< throughout.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there a place we used Array<something> instead of the standard JSDoc Array.<something> yet?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmm, perhaps just my suggestion in a comment here 😳 : #128 (comment)

/**
* A message field, this represents a field within a RDM message.
* @param {*} field_info
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can't this be tightened to an Object?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

@@ -38,12 +40,14 @@ goog.inherits(app.MessageField, goog.ui.Component);

/**
* Return the underlying field info
* @return {*}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Again?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

@FloEdelmann
Copy link
Member Author

Now it should finally be ready 😀

Copy link
Member

@peternewman peternewman left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM.

You might want to add yourself to contributors in package.json?

@peternewman peternewman requested a review from nomis52 March 6, 2018 04:33
@peternewman
Copy link
Member

Can you re-review this please @nomis52 , as it's changed quite a lot since you previously approved it?

@peternewman peternewman merged commit 3b65c41 into OpenLightingProject:master Mar 10, 2018
@peternewman
Copy link
Member

Thanks @FloEdelmann . Sorry it's taken so long to merge!

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

Successfully merging this pull request may close these issues.

Add a reciprocal link to Open Fixture Library fixture profiles
4 participants