Adding new field/method similar to "Save as..."

Hi, I am very new to Javascript so excuse me if the question is obvious. I am working on Hue 4.9.0.

The functionality I want to add is sending saved queries to review.
To do that I added:

  • ko.observable field reviewTitle in the notebook/notebook.js and in editor/notebook.js.
  • sendToReview2 method in notebook/notebook.js which sends a post request handled in python.
  • sendToReview1 method in NotebookViewModel.js and EditorViewModel.js.
  • Another button right under “Save as…” named “Send to review”.
  • After that a popup window (structured like “Save as”) for inputting review title. Change applied to editor_components.mako.
  • In the popup window I set up a condition to check if the review title is not empty.
  • “Send” button in the popup window is bound to sendToReview1 method.

After pressing the button, sendToReview1 is not triggered, condition check is not working for reviewTitle as if the field is not recognized.
I get this error: “Unable to process binding “enable: function(){return $root.selectedNotebook().reviewTitle().length > 0 }”
Message: $root.selectedNotebook(…).reviewTitle is not a function”.

What could be the reason for a new field to not be recognized? Have I missed another file where I should add it?

I am not sure why it’s separated to Notebook/Editor for both ViewModel and Model classes - so I don’t know where exactly should I be adding new stuff.

Could you detail more the feature? If it is just sending, you could handle it in the save method of the Python API

So this is the flow for the feature that I want to achieve.

  1. User creates query
  2. User saves query (parallel to normal Hue save it saves query to other system)
  3. User want to get his queries accepted into production so he chooses one
  4. Chooses “Send to review” from the drop down menu near "Save as
  5. Window pops up to input review name and description
  6. Clicks “Send” and it triggers my function that sends query to review in that other system.

Sending to review should be a separate function. I am already doing more on the python side of save query.
Now I want to have the same flow of filling in fields in a pop up window and triggering python all the way from the UI.
And the part that connects my button to python is the most confusing one.