mirror of
https://github.com/Telecominfraproject/wlan-cloud-ucentralfms.git
synced 2026-01-27 10:23:12 +00:00
Fixing dashboard + adding firmware age average.
This commit is contained in:
@@ -239,6 +239,8 @@ components:
|
||||
$ref: '#/components/schemas/TagIntPairList'
|
||||
usingLatest:
|
||||
$ref: '#/components/schemas/TagIntPairList'
|
||||
totalSecondsOld:
|
||||
$ref: '#/components/schemas/TagIntPairList'
|
||||
|
||||
#########################################################################################
|
||||
##
|
||||
|
||||
@@ -220,6 +220,7 @@ namespace uCentral::FMSObjects {
|
||||
field_to_json(Obj, "unknownFirmwares", UnknownFirmwares_);
|
||||
field_to_json(Obj,"snapshot",snapshot);
|
||||
field_to_json(Obj,"numberOfDevices",numberOfDevices);
|
||||
field_to_json(Obj, "totalSecondsOld", totalSecondsOld_);
|
||||
}
|
||||
|
||||
void DeviceReport::reset() {
|
||||
|
||||
@@ -122,6 +122,7 @@ namespace uCentral::FMSObjects {
|
||||
Types::CountedMap EndPoints_;
|
||||
Types::CountedMap UsingLatest_;
|
||||
Types::CountedMap UnknownFirmwares_;
|
||||
Types::CountedMap totalSecondsOld_;
|
||||
void to_json(Poco::JSON::Object &Obj) const;
|
||||
void reset();
|
||||
bool from_json(const Poco::JSON::Object::Ptr &Obj);
|
||||
|
||||
@@ -221,7 +221,7 @@ namespace uCentral {
|
||||
} else if (Age.age == 0) {
|
||||
Types::UpdateCountedMap(Report.UnknownFirmwares_, Revision);
|
||||
} else {
|
||||
|
||||
Types::UpdateCountedMap(Report.totalSecondsOld_,"total_seconds", Age.age);
|
||||
}
|
||||
}
|
||||
More = RSet.moveNext();
|
||||
|
||||
@@ -28,12 +28,12 @@ namespace uCentral::Types {
|
||||
typedef std::map<std::string, TopicNotifyFunctionList> NotifyTable;
|
||||
typedef std::map<std::string,uint64_t> CountedMap;
|
||||
|
||||
inline void UpdateCountedMap(CountedMap &M, const std::string &S ) {
|
||||
inline void UpdateCountedMap(CountedMap &M, const std::string &S, uint64_t Increment=1) {
|
||||
auto it = M.find(S);
|
||||
if(it==M.end())
|
||||
M[S]=1;
|
||||
M[S] = Increment;
|
||||
else
|
||||
it->second += 1;
|
||||
it->second += Increment;
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user