-
Notifications
You must be signed in to change notification settings - Fork 10
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
Conversation
The tests are failing as you're blocked behind #129 . |
Thanks for this quick review and approval! However, as described in OpenLightingProject/open-fixture-library#288, we also want to add |
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... |
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". |
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: 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. |
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 🤦 Are you able to verify the personality links? Or did I make something wrong? |
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: 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. |
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 The code I wrote blindly seems to work fine, so I think this PR is now complete. Would you mind reviewing it @peternewman? |
Resulting HTML LGTM, code review to follow later today. |
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.
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 || {} |
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.
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
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.
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.
Also it may make sense to add the linter argument to the compiler options: 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. |
@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. |
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.
These want to be RDM manufacturer ID and RDM model ID please in the docs.
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.
Done
@@ -17,13 +17,14 @@ | |||
* Copyright (C) 2011 Simon Newton | |||
*/ | |||
|
|||
goog.provide('app.setup'); | |||
|
|||
goog.require('app.displayCommand'); |
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 was going to say you don't need this, but I'm guessing it optimises it out if it's not in there otherwise?
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.
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
😕
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.
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.
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.
Ah, it's actually one of those warnings that were not produced by my changes: this.tt.setHtml is not a function
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.
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.
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.
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
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.
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.
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.
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) { |
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 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?
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.
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.
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.
Or shall we just do the null check in the show / hide functions themselves?
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.
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.
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.
Ok, it's fixed now.
js_src/pid_display.js
Outdated
* @constructor | ||
* @extends goog.ui.Component | ||
*/ | ||
app.pid.MessageField = function(field_info, opt_domHelper) { |
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 think this should be able to switch back to app.pid.MessageField now the circle has been broken.
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.
But it was just app.MessageField
before my changes?
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.
Ah sorry, I must have been looking at an intermediate diff before.
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)? |
in Python, since this is the only way I can create new variables that can be passed to both the template engine and the client side JavaScript
this simplifies the whole process a lot
Is there now still anything preventing a merge? |
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.
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. |
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.
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>
?
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.
Done
*/ | ||
app.MessageStructure.prototype.canDecorate = function(element) { | ||
return element.tagName == 'DIV'; | ||
}; | ||
|
||
|
||
/** | ||
* @param {!Array.<app.MessageField>} fields |
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.
Can we be consistent please, either Array.< or Array< throughout.
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.
Is there a place we used Array<something>
instead of the standard JSDoc Array.<something>
yet?
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.
Hmm, perhaps just my suggestion in a comment here 😳 : #128 (comment)
js_src/pid_display.js
Outdated
/** | ||
* A message field, this represents a field within a RDM message. | ||
* @param {*} field_info |
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.
Can't this be tightened to an Object?
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.
Done
js_src/pid_display.js
Outdated
@@ -38,12 +40,14 @@ goog.inherits(app.MessageField, goog.ui.Component); | |||
|
|||
/** | |||
* Return the underlying field info | |||
* @return {*} |
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.
Again?
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.
Done
Now it should finally be ready 😀 |
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.
LGTM.
You might want to add yourself to contributors in package.json?
Can you re-review this please @nomis52 , as it's changed quite a lot since you previously approved it? |
Thanks @FloEdelmann . Sorry it's taken so long to merge! |
closes #127
cc @fxedel