Express routes in jobs cannot update widget

Issue #127 resolved
sytone created an issue

I want to have a route added on the init of a job, if it gets called then have the dashboard update the widget.

having the ability to call jobCallback in the init function would solve this, I saw something alluding to it but cannot find anything to support this.

Comments (4)

  1. Andres Colodrero

    Hi, same issue for me. did you find a solution?

    i tried that: onInit: function (config, dependencies, job_callback) { dependencies.logger.info('adding routes...'); dependencies.app.route("/jobs/mycustomroute") .get(function (req, res) {

          job_callback(null, {title: "this is the time", text: "testing"});
        });
    

    },

  2. David Yang

    Problem fixed. Just use the pushUpdate() method to update the widget.

    var jobWorker = this;
    dependencies.app.route('jobs/mycustomroute').get(function(req, res) {
       jobWorker.pushUpdate({title: "my title", text: "some text"})
    });
    
  3. Log in to comment