Skip to content

Commit

Permalink
IGNITE-4678 Web Console: Implemented demo load as service.
Browse files Browse the repository at this point in the history
  • Loading branch information
nva committed Feb 10, 2017
1 parent 3bf880c commit a600caf
Show file tree
Hide file tree
Showing 11 changed files with 897 additions and 459 deletions.
34 changes: 34 additions & 0 deletions modules/web-console/backend/app/agent.js
Expand Up @@ -581,6 +581,40 @@ module.exports.factory = function(_, fs, path, JSZip, socketio, settings, mongo,

return this.executeRest(cmd);
}

/**
* Collect service information.
* @param {Boolean} demo Is need run command on demo node.
* @param {String} nid Node ID.
* @returns {Promise}
*/
services(demo, nid) {
const cmd = new Command(demo, 'exe')
.addParam('name', 'org.apache.ignite.internal.visor.compute.VisorGatewayTask')
.addParam('p1', nid)
.addParam('p2', 'org.apache.ignite.internal.visor.service.VisorServiceTask')
.addParam('p3', 'java.lang.Void');

return this.executeRest(cmd);
}

/**
* Cancel service with specified name.
* @param {Boolean} demo Is need run command on demo node.
* @param {String} nid Node ID.
* @param {String} name Name of service to cancel.
* @returns {Promise}
*/
serviceCancel(demo, nid, name) {
const cmd = new Command(demo, 'exe')
.addParam('name', 'org.apache.ignite.internal.visor.compute.VisorGatewayTask')
.addParam('p1', nid)
.addParam('p2', 'org.apache.ignite.internal.visor.service.VisorCancelServiceTask')
.addParam('p3', 'java.lang.String')
.addParam('p4', name);

return this.executeRest(cmd);
}
}

/**
Expand Down
26 changes: 26 additions & 0 deletions modules/web-console/backend/app/browser.js
Expand Up @@ -455,6 +455,32 @@ module.exports.factory = (_, socketio, agentMgr, configure) => {
.catch((err) => cb(_errorToJson(err)));
});

// Collect service information from grid.
socket.on('service:collect', (nid, cb) => {
agentMgr.findAgent(accountId())
.then((agent) => agent.services(demo, nid))
.then((data) => {
if (data.finished)
return cb(null, data.result);

cb(_errorToJson(data.error));
})
.catch((err) => cb(_errorToJson(err)));
});

// Collect service information from grid.
socket.on('service:cancel', (nid, name, cb) => {
agentMgr.findAgent(accountId())
.then((agent) => agent.serviceCancel(demo, nid, name))
.then((data) => {
if (data.finished)
return cb(null, data.result);

cb(_errorToJson(data.error));
})
.catch((err) => cb(_errorToJson(err)));
});

const count = agentMgr.addAgentListener(user._id, socket);

socket.emit('agent:count', {count});
Expand Down
2 changes: 1 addition & 1 deletion modules/web-console/frontend/package.json
Expand Up @@ -46,7 +46,7 @@
"angular-touch": "~1.5.9",
"angular-translate": "~2.13.1",
"angular-tree-control": "~0.2.26",
"angular-ui-grid": "~3.2.9",
"angular-ui-grid": "~4.0.0",
"angular-ui-router": "~0.3.1",
"bootstrap-sass": "~3.3.6",
"brace": "~0.8.0",
Expand Down

0 comments on commit a600caf

Please sign in to comment.