Commit 8332270f authored by fred's avatar fred
Browse files

zerogw fix

parent 64dea881
......@@ -1797,32 +1797,34 @@ void Http_admin::admin_payloads_get(QxtWebRequestEvent* event)
QDateTime timestamp;
timestamp.setTime_t(payload.getField("timestamp").Number());
BSONObj steps = payload.getField("steps").Obj();
list <BSONElement> list_steps;
steps.elems(list_steps);
BSONObj l_step;
list<be>::iterator i;
QString li_step;
if (payload.hasField("steps"))
{
BSONObj steps = payload.getField("steps").Obj();
list <BSONElement> list_steps;
steps.elems(list_steps);
BSONObj l_step;
list<be>::iterator i;
li_step.append("<table class=\"table\">");
li_step.append("<table class=\"table\">");
for(i = list_steps.begin(); i != list_steps.end(); ++i) {
l_step = (*i).embeddedObject ();
//std::cout << "l_step => " << l_step << std::endl;
li_step.append("<tr>");
for(i = list_steps.begin(); i != list_steps.end(); ++i) {
l_step = (*i).embeddedObject ();
//std::cout << "l_step => " << l_step << std::endl;
li_step.append("<tr>");
li_step.append("<td>" + QString::fromStdString(l_step.getField("action").str()) + "</td>");
li_step.append("<td>" + QString::fromStdString(l_step.getField("name").str()) + "</td>");
li_step.append("<td>" + QString::number(l_step.getField("order").Number()) + "</td>");
li_step.append("<td>" + QString::fromStdString(l_step.getField("data").str()) + "</td>");
li_step.append("<td>" + QString::fromStdString(l_step.getField("action").str()) + "</td>");
li_step.append("<td>" + QString::fromStdString(l_step.getField("name").str()) + "</td>");
li_step.append("<td>" + QString::number(l_step.getField("order").Number()) + "</td>");
li_step.append("<td>" + QString::fromStdString(l_step.getField("data").str()) + "</td>");
li_step.append("</tr>");
li_step.append("</tr>");
}
li_step.append("</table>");
}
li_step.append("</table>");
output.append("<tr class=\"" + trclass + "\"><td><input type=\"checkbox\" class=\"checkbox\" name=\"id_" + QString::number(counter) + "\" value=\"" + QString::fromStdString(payload.getField("_id").OID().str()) + "\"></td><td>" +
QString::fromStdString(payload.getField("action").str()) + "</td>" +
......
......@@ -195,7 +195,7 @@ void Api_payload::receive_http_payload()
std::size_t eventsSize = sizeof(events);
m_socket_zerogw->getsockopt(ZMQ_RCVMORE, &events, &eventsSize);
std::cout << "Api_payload::receive_payload received request: [" << (char*) request.data() << "]" << std::endl;
//std::cout << "Api_payload::receive_payload received request: [" << (char*) request.data() << "]" << std::endl;
BSONObjBuilder payload_builder;
payload_builder.genOID();
......@@ -230,16 +230,16 @@ void Api_payload::receive_http_payload()
qDebug() << "COUNTER : " << counter;
key = counter == 0? "METHOD" : "";
key = counter == 1? "URI" : "";
key = counter == 2? "X-user-token" : "";
key = counter == 3? "X-node-uuid" : "";
key = counter == 4? "X-node-password" : "";
key = counter == 5? "X-workflow-uuid" : "";
key = counter == 6? "X-payload-filename" : "";
key = counter == 7? "X-payload-type" : "";
key = counter == 1? "URI" : key;
key = counter == 2? "X-user-token" : key;
key = counter == 3? "X-node-uuid" : key;
key = counter == 4? "X-node-password" : key;
key = counter == 5? "X-workflow-uuid" : key;
key = counter == 6? "X-payload-filename" : key;
key = counter == 7? "X-payload-type" : key;
// push or publish
key = counter == 8? "X-payload-action" : "";
key = counter == 8? "X-payload-action" : key;
// body
if (counter == 9 && !zerogw["X-payload-filename"].isEmpty())
......@@ -277,13 +277,15 @@ void Api_payload::receive_http_payload()
}
else if (zerogw["X-payload-type"] == "json")
//else if (zerogw["X-payload-type"] == "json")
else
{
payload_builder.append("gridfs", false);
tmp = QString::fromAscii((char*)request.data(), request.size());
payload_builder.append("data", tmp.toStdString());
}
zerogw[key] = tmp;
std::cout << "not json : " << tmp.toStdString() << std::endl;
......@@ -429,8 +431,7 @@ void Api_payload::receive_http_payload()
qDebug() << "PUSH HTTP API PAYLOAD";
z_message->rebuild(l_payload.objsize());
memcpy(z_message->data(), (char*)l_payload.objdata(), l_payload.objsize());
//z_push_api->send(*z_message, ZMQ_NOBLOCK);
z_push_api->send(*z_message);
z_push_api->send(*z_message, ZMQ_NOBLOCK);
/************************/
}
......@@ -517,9 +518,9 @@ void Api_node::receive_http_payload()
qDebug() << "COUNTER : " << counter;
key = counter == 0? "METHOD" : "";
key = counter == 1? "URI" : "";
key = counter == 2? "X-user-token" : "";
key = counter == 3? "X-node-name" : "";
key = counter == 1? "URI" : key;
key = counter == 2? "X-user-token" : key;
key = counter == 3? "X-node-name" : key;
tmp = QString::fromAscii((char*)request.data(), request.size());
......@@ -655,9 +656,9 @@ void Api_workflow::receive_http_payload()
qDebug() << "COUNTER : " << counter;
key = counter == 0? "METHOD" : "";
key = counter == 1? "URI" : "";
key = counter == 2? "X-user-token" : "";
key = counter == 3? "X-workflow-name" : "";
key = counter == 1? "URI" : key;
key = counter == 2? "X-user-token" : key;
key = counter == 3? "X-workflow-name" : key;
tmp = QString::fromAscii((char*)request.data(), request.size());
......@@ -789,8 +790,8 @@ void Api_user::receive_http_payload()
qDebug() << "COUNTER : " << counter;
key = counter == 0? "METHOD" : "";
key = counter == 1? "URI" : "";
key = counter == 2? "X-admin-token" : "";
key = counter == 1? "URI" : key;
key = counter == 2? "X-admin-token" : key;
tmp = QString::fromAscii((char*)request.data(), request.size());
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment