@@ -872,7 +872,7 @@ void EmbeddedNetworkController::configureHTTPControlPlane(
872
872
std::string networkPath = " /controller/network/([0-9a-fA-F]{16})" ;
873
873
std::string oldAndBustedNetworkCreatePath = " /controller/network/([0-9a-fA-F]{10})______" ;
874
874
std::string memberListPath = " /controller/network/([0-9a-fA-F]{16})/member" ;
875
- std::string memberListPath2 = " /controller/network/([0-9a-fA-F]{16})/member2 " ;
875
+ std::string memberListPath2 = " /unstable/ controller/network/([0-9a-fA-F]{16})/member " ;
876
876
std::string memberPath = " /controller/network/([0-9a-fA-F]{16})/member/([0-9a-fA-F]{10})" ;
877
877
878
878
auto controllerGet = [&, setContent](const httplib::Request &req, httplib::Response &res) {
@@ -1045,12 +1045,27 @@ void EmbeddedNetworkController::configureHTTPControlPlane(
1045
1045
return ;
1046
1046
}
1047
1047
1048
- auto out = nlohmann::json::array ();
1048
+ auto out = nlohmann::json::object ();
1049
+ auto meta = nlohmann::json::object ();
1050
+ auto members = nlohmann::json::array ();
1049
1051
std::vector<json> memTmp;
1050
1052
if (_db.get (nwid, network, memTmp)) {
1051
- out .push_back (memTmp);
1053
+ members .push_back (memTmp);
1052
1054
}
1053
1055
1056
+ uint64_t authorizedCount = 0 ;
1057
+ uint64_t totalCount = memTmp.size ();
1058
+ for (auto m = memTmp.begin (); m != memTmp.end (); ++m) {
1059
+ bool a = OSUtils::jsonBool ((*m)[" authorized" ], 0 );
1060
+ if (a) { authorizedCount++; }
1061
+ }
1062
+
1063
+ meta[" totalCount" ] = totalCount;
1064
+ meta[" authorizedCount" ] = authorizedCount;
1065
+
1066
+ out[" data" ] = members;
1067
+ out[" meta" ] = meta;
1068
+
1054
1069
setContent (req, res, out.dump ());
1055
1070
};
1056
1071
s.Get (memberListPath2, memberListGet2);
0 commit comments