mirror of
https://github.com/outbackdingo/sysadm.git
synced 2026-01-27 10:20:26 +00:00
API CHANGE
Modify the output fields for the sysadm/services, "list_services" action:
Now each service entry will look like this:
"accounting": {
"description": "",
"is_enabled": "false",
"name": "accounting",
"path": "/etc/rc.d/accounting",
"tag": "accounting_enable"
}
I will probably be adding an "is_running" [true/false] field here soon as well - the backend for that still needs to be written first.
This commit is contained in:
@@ -1004,11 +1004,15 @@ RestOutputStruct::ExitCode WebSocket::EvaluateSysadmServiceRequest(const QJsonVa
|
||||
sysadm::ServiceManager SMGR;
|
||||
if(action=="list_services"){
|
||||
QList<sysadm::Service> list = SMGR.GetServices();
|
||||
QList<bool> listEnabled = SMGR.isEnabled(list);
|
||||
QJsonObject services;
|
||||
for(int i=0; i<list.length(); i++){
|
||||
QJsonObject S;
|
||||
S.insert("name", list[i].Name);
|
||||
S.insert("tag", list[i].Tag);
|
||||
S.insert("path", list[i].Path);
|
||||
S.insert("description", list[i].Description);
|
||||
S.insert("is_enabled", listEnabled[i] ? "true" : "false" );
|
||||
//S.insert("filename", list[i].Directory);
|
||||
//Need to add status info as well (isRunning, isEnabled);
|
||||
services.insert(list[i].Name, S);
|
||||
|
||||
Reference in New Issue
Block a user