Delete a template from Dashboard (#257)
* Integrated embedded config parsing #245 * cleanup * Cleanup in remotelog * Fixed MS Visual Studio 2019 compatibility * Embedded config parsing only for miner not server * wip * Finished delete template
This commit is contained in:
parent
5b0fed8be9
commit
78809d44bc
3 changed files with 67 additions and 3 deletions
|
@ -155,6 +155,8 @@ unsigned Service::handlePOST(const Options* options, const std::string& url, con
|
|||
resultCode = setClientConfig(options, clientId, data, resp);
|
||||
} else if (url.rfind("/admin/setClientCommand", 0) == 0) {
|
||||
resultCode = setClientCommand(clientId, data, resp);
|
||||
} else if (url.rfind("/admin/deleteClientConfig", 0) == 0) {
|
||||
resultCode = deleteClientConfig(options, clientId, resp);
|
||||
} else {
|
||||
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)
|
||||
{
|
||||
m_clientStatus.clear();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue