Skip to content
This repository has been archived by the owner on Jun 27, 2019. It is now read-only.

Commit

Permalink
Show the FBP name that is running or last that was last ran
Browse files Browse the repository at this point in the history
It is good to let know what is running right now in the device or what
was running. This will give more control of what is happening/happened
in the device.

Signed-off-by: Bruno Bottazzini <bruno.bottazzini@intel.com>
  • Loading branch information
Bruno Bottazzini committed Oct 26, 2015
1 parent 39c0d0c commit 9b809cb
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 0 deletions.
2 changes: 2 additions & 0 deletions client/js/controllers/editor.js
Original file line number Diff line number Diff line change
Expand Up @@ -281,13 +281,15 @@
});
} else if ($scope.fbpType === true && $scope.buttonSyncDisabled === false) {
var fbpCode = editor.getSession().getValue();
var fbpName = $scope.fileName;
$scope.newFile = true;
var conf = $scope.selectConfigPath;
if (conf === "none") {
conf = null;
}
$http.post('/api/fbp/run',
{params: {
"fbp_name": fbpName,
"code": fbpCode,
"conf": conf
}
Expand Down
8 changes: 8 additions & 0 deletions server/routes.js
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@
require('./configuration.js')();

var jConf = getConfigurationJson();
var runningFBPName;

/* GET home page. */
router.get('/', function(req, res) {
Expand Down Expand Up @@ -90,6 +91,9 @@
});
child.on('close', function(code) {
stdout = stdout.replace(/Active:/, '').trim();
if (runningFBPName) {
stdout = runningFBPName + " - " + stdout;
}
res.send(stdout);
});
} else {
Expand Down Expand Up @@ -199,6 +203,7 @@
router.post('/api/fbp/run', function(req, res) {
if (jConf.run_fbp_access === true) {
var exec = require('child_process').exec;
var name = req.body.params.fbp_name;
var code = req.body.params.code;
var conf = req.body.params.conf;
if (!code) {
Expand Down Expand Up @@ -228,6 +233,9 @@
});
child.on('close', function(code) {
console.log('closing code: ' + code);
if (name) {
runningFBPName = name;
}
res.sendStatus(code);
});
});
Expand Down

0 comments on commit 9b809cb

Please sign in to comment.