Add new WebBackendSlots.cpp which has the initial slots for

Iohvye Fetch processing
This commit is contained in:
Kris Moore
2016-02-29 14:44:18 -05:00
parent 187b1cc3e3
commit 2401da278d
6 changed files with 36 additions and 4 deletions

View File

@@ -584,7 +584,10 @@ RestOutputStruct::ExitCode WebSocket::EvaluateSysadmIohyveRequest(const QJsonVal
}
if(act=="fetchiso"){
ok = true;
out->insert("fetchiso", sysadm::Iohyve::fetchISO(in_args.toObject()));
DProcess *fetchproc;
out->insert("fetchiso", sysadm::Iohyve::fetchISO(in_args.toObject(), fetchproc));
connect(fetchproc, SIGNAL(ProcessOutput(QString)), this, SLOT(slotIohyveFetchProcessOutput(QString)) );
connect(fetchproc, SIGNAL(Finished(QString, int, QString)), this, SLOT(slotIohyveFetchDone(QString, int, QString)) );
}
if(act=="install"){
ok = true;

View File

@@ -0,0 +1,22 @@
// ===============================
// Slots for long running Library Tasks
// Available under the 3-clause BSD License
// Written by: Kris Moore <kris@pcbsd.org> FEB 2016
// =================================
#include <WebSocket.h>
#define DEBUG 0
// Iohyve Fetch is done
void WebSocket::slotIohyveFetchDone(QString id, int retcode, QString log)
{
}
// Iohyve Fetch has output to read
void WebSocket::slotIohyveFetchProcessOutput(QString output)
{
}

View File

@@ -79,6 +79,10 @@ private slots:
void nowEncrypted(); //the socket/connection is now encrypted
void peerError(const QSslError&); //peerVerifyError() signal
void SslError(const QList<QSslError>&); //sslErrors() signal
// Library Slots
void slotIohyveFetchDone(QString, int, QString);
void slotIohyveFetchReadyRead();
public slots:
void EventUpdate(EventWatcher::EVENT_TYPE, QJsonValue = QJsonValue() );

View File

@@ -44,7 +44,7 @@ QJsonObject Iohyve::createGuest(QJsonObject jsin) {
}
// Queue the fetch of an ISO
QJsonObject Iohyve::fetchISO(QJsonObject jsin) {
QJsonObject Iohyve::fetchISO(QJsonObject jsin, DProcess *returnproc) {
QJsonObject retObject;
QStringList keys = jsin.keys();
@@ -60,7 +60,7 @@ QJsonObject Iohyve::fetchISO(QJsonObject jsin) {
QString ID = QUuid::createUuid().toString();
// Queue the fetch action
DISPATCHER->queueProcess(ID, "iohyve fetch " + url);
returnproc = DISPATCHER->queueProcess(ID, "iohyve fetch " + url);
// Return some details to user that the action was queued
retObject.insert("command", "iohyve fetch " + url);

View File

@@ -9,13 +9,14 @@
#include <QJsonObject>
#include "sysadm-global.h"
#include "globals.h"
namespace sysadm{
class Iohyve{
public:
static QJsonObject createGuest(QJsonObject);
static QJsonObject fetchISO(QJsonObject);
static QJsonObject fetchISO(QJsonObject, DProcess *);
static QJsonObject installGuest(QJsonObject);
static QJsonObject isSetup();
static QJsonObject listVMs();
@@ -24,6 +25,7 @@ public:
static QJsonObject setupIohyve(QJsonObject);
static QJsonObject startGuest(QJsonObject);
static QJsonObject stopGuest(QJsonObject);
};
} //end of pcbsd namespace

View File

@@ -19,6 +19,7 @@ SOURCES += main.cpp \
WebServer.cpp \
WebSocket.cpp \
WebBackend.cpp \
WebBackendSlots.cpp \
syscache-client.cpp \
AuthorizationManager.cpp \
EventWatcher.cpp \