Browse Source

add rest

master
zeus 4 years ago
parent
commit
3693e732c7
  1. 11
      swarmlab-app/src/run/app.js

11
swarmlab-app/src/run/app.js

@ -240,7 +240,7 @@ async function getpipelines(token,pipelinename) {
// get user pipelines
// ***************************************************
async function getuserpipelines(token,user) {
async function getuserpipelines(token,user,swarmlabname) {
var pipelinename = user
const agent = new https.Agent({
rejectUnauthorized: false,
@ -261,14 +261,16 @@ async function getuserpipelines(token,user) {
var pipelines = {
"querytokenFilter":'uWr4FKRqrmpCRkJ9WLuI0DNuDWOGTkfcSzyZkJirZvJwwFDffLWrraqzzSPLeuQqL3TF9',
"filter":pipelinename
"filter":pipelinename,
swarmlabname:swarmlabname
}
//var params = {
// pipeline: pipelines
// }
var params = {
querytokenFilter:'uWr4FKRqrmpCRkJ9WLuI0DNuDWOGTkfcSzyZkJirZvJwwFDffLWrraqzzSPLeuQqL3TF9',
filter:pipelinename
filter:pipelinename,
swarmlabname:swarmlabname
}
var options = {
@ -355,6 +357,7 @@ cors(corsOptions), (req, res, next) => {
RES.token = req.query["token"]
RES.start = req.query["start"]
RES.end = req.query["end"]
RES.swarmlabname = req.query["swarmlabname"]
var isvalid = await checkToken(RES.token);
if(isvalid.action == 'ok'){
console.log("Authserver ok " + RES.token);
@ -364,7 +367,7 @@ cors(corsOptions), (req, res, next) => {
RES.error = 'no'
}
if(RES.error == 'ok'){
var resdata = await getuserpipelines(RES.token,isvalid.user)
var resdata = await getuserpipelines(RES.token,isvalid.user,RES.swarmlabname)
var mongourl = "mongodb://"+CONFIG.mongo.user+":"+CONFIG.mongo.password+"@ondemand_playground_mongo1:27017,ondemand_playground_mongo2:27017,ondemand_playground_mongo3:27017,ondemand_playground_mongo4:27017,ondemand_playground_mongo5:27017,ondemand_playground_mongo6:27017,ondemand_playground_mongo7:27017/fluent?replicaSet=rs1&authSource=swarmlabplaygroundstats"
const OPTS = {
useNewUrlParser: true,

Loading…
Cancel
Save