wip
This commit is contained in:
parent
c13e702707
commit
ed1814649e
3 changed files with 21 additions and 1 deletions
|
@ -242,7 +242,7 @@
|
||||||
{
|
{
|
||||||
text: '<i class="fa fa-table"> Assign template</i>',
|
text: '<i class="fa fa-table"> Assign template</i>',
|
||||||
className: 'btn-info',
|
className: 'btn-info',
|
||||||
enabled: false,
|
enabled: true,
|
||||||
action: function () {
|
action: function () {
|
||||||
$.ajax({
|
$.ajax({
|
||||||
type: "GET",
|
type: "GET",
|
||||||
|
@ -292,12 +292,14 @@
|
||||||
|
|
||||||
if (arrayLength > 0 ) {
|
if (arrayLength > 0 ) {
|
||||||
$('#templateEditorSave').prop('disabled', false);
|
$('#templateEditorSave').prop('disabled', false);
|
||||||
|
$('#templateEditorDelete').prop('disabled', false);
|
||||||
|
|
||||||
$('#templateSelector').html(htmlContent);
|
$('#templateSelector').html(htmlContent);
|
||||||
$('#templateSelector').selectpicker('refresh');
|
$('#templateSelector').selectpicker('refresh');
|
||||||
$('#templateSelector').trigger('change');
|
$('#templateSelector').trigger('change');
|
||||||
} else {
|
} else {
|
||||||
$('#templateEditorSave').prop('disabled', true);
|
$('#templateEditorSave').prop('disabled', true);
|
||||||
|
$('#templateEditorDelete').prop('disabled', true);
|
||||||
}
|
}
|
||||||
|
|
||||||
$('#templateEditor').modal('show');
|
$('#templateEditor').modal('show');
|
||||||
|
@ -980,6 +982,7 @@
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="modal-footer">
|
<div class="modal-footer">
|
||||||
|
<button id="templateEditorDelete" type="button" class="btn btn-danger" data-dismiss="modal">Delete</button>
|
||||||
<button id="templateEditorSave" type="button" class="btn btn-success" data-dismiss="modal">Save</button>
|
<button id="templateEditorSave" type="button" class="btn btn-success" data-dismiss="modal">Save</button>
|
||||||
<button id="templateEditorSaveAsDialog" type="button" class="btn btn-primary">Save As...</button>
|
<button id="templateEditorSaveAsDialog" type="button" class="btn btn-primary">Save As...</button>
|
||||||
<button type="button" class="btn btn-danger" data-dismiss="modal">Cancel</button>
|
<button type="button" class="btn btn-danger" data-dismiss="modal">Cancel</button>
|
||||||
|
|
|
@ -155,6 +155,8 @@ unsigned Service::handlePOST(const Options* options, const std::string& url, con
|
||||||
resultCode = setClientConfig(options, clientId, data, resp);
|
resultCode = setClientConfig(options, clientId, data, resp);
|
||||||
} else if (url.rfind("/admin/setClientCommand", 0) == 0) {
|
} else if (url.rfind("/admin/setClientCommand", 0) == 0) {
|
||||||
resultCode = setClientCommand(clientId, data, resp);
|
resultCode = setClientCommand(clientId, data, resp);
|
||||||
|
} else if (url.rfind("/admin/deleteClientConfig", 0) == 0) {
|
||||||
|
resultCode = deleteClientConfig(options, clientId, resp);
|
||||||
} else {
|
} else {
|
||||||
LOG_WARN("[%s] 400 BAD REQUEST - Request does not contain clientId (%s)", clientIp.c_str(), url.c_str());
|
LOG_WARN("[%s] 400 BAD REQUEST - Request does not contain clientId (%s)", clientIp.c_str(), url.c_str());
|
||||||
}
|
}
|
||||||
|
@ -482,6 +484,20 @@ void Service::setClientLog(size_t maxRows, const std::string& clientId, const st
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
unsigned Service::deleteClientConfig(const Options* options, const std::string& clientId, std::string& resp)
|
||||||
|
{
|
||||||
|
if (!clientId.empty()) {
|
||||||
|
std::string clientConfigFileName = getClientConfigFileName(options, clientId);
|
||||||
|
if (!clientConfigFileName.empty() && remove(clientConfigFileName.c_str()) == 0) {
|
||||||
|
return MHD_HTTP_OK;
|
||||||
|
} else {
|
||||||
|
return MHD_HTTP_NOT_FOUND;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
return MHD_HTTP_BAD_REQUEST;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
unsigned Service::resetClientStatusList(const std::string& data, std::string& resp)
|
unsigned Service::resetClientStatusList(const std::string& data, std::string& resp)
|
||||||
{
|
{
|
||||||
m_clientStatus.clear();
|
m_clientStatus.clear();
|
||||||
|
|
|
@ -60,6 +60,7 @@ private:
|
||||||
static unsigned setClientStatus(const Options* options, const std::string& clientIp, const std::string& clientId, const std::string& data, std::string& resp);
|
static unsigned setClientStatus(const Options* options, const std::string& clientIp, const std::string& clientId, const std::string& data, std::string& resp);
|
||||||
static unsigned setClientCommand(const std::string& clientId, const std::string& data, std::string& resp);
|
static unsigned setClientCommand(const std::string& clientId, const std::string& data, std::string& resp);
|
||||||
static unsigned setClientConfig(const Options* options, const std::string &clientId, const std::string &data, std::string &resp);
|
static unsigned setClientConfig(const Options* options, const std::string &clientId, const std::string &data, std::string &resp);
|
||||||
|
static unsigned deleteClientConfig(const Options* options, const std::string& clientId, std::string& resp);
|
||||||
static unsigned resetClientStatusList(const std::string& data, std::string& resp);
|
static unsigned resetClientStatusList(const std::string& data, std::string& resp);
|
||||||
|
|
||||||
static void setClientLog(size_t maxRows, const std::string& clientId, const std::string& log);
|
static void setClientLog(size_t maxRows, const std::string& clientId, const std::string& log);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue