]> granicus.if.org Git - icinga2/commitdiff
livestatus: finish timeperiods table
authorMichael Friedrich <michael.friedrich@netways.de>
Thu, 18 Jul 2013 13:30:39 +0000 (15:30 +0200)
committerMichael Friedrich <michael.friedrich@netways.de>
Thu, 18 Jul 2013 13:30:39 +0000 (15:30 +0200)
refs #4372

components/livestatus/timeperiodstable.cpp
components/livestatus/timeperiodstable.h

index 48890e0fcf62008592089f3f82df9ac18ffb02e5..6246c4b630af746c9e26619046c93d55fe12c361 100644 (file)
@@ -39,6 +39,7 @@ void TimePeriodsTable::AddColumns(Table *table, const String& prefix,
 {
        table->AddColumn(prefix + "name", Column(&TimePeriodsTable::NameAccessor, objectAccessor));
        table->AddColumn(prefix + "alias", Column(&TimePeriodsTable::AliasAccessor, objectAccessor));
+       table->AddColumn(prefix + "in", Column(&TimePeriodsTable::InAccessor, objectAccessor));
 }
 
 String TimePeriodsTable::GetName(void) const
@@ -60,7 +61,12 @@ Value TimePeriodsTable::NameAccessor(const Value& row)
 
 Value TimePeriodsTable::AliasAccessor(const Value& row)
 {
-       /* TODO GetDisplayName() ? */
-       return static_cast<TimePeriod::Ptr>(row)->GetName();
+       return static_cast<TimePeriod::Ptr>(row)->GetDisplayName();
 }
 
+Value TimePeriodsTable::InAccessor(const Value& row)
+{
+       return (static_cast<TimePeriod::Ptr>(row)->IsInside(Utility::GetTime()) ? 1 : 0);
+}
+
+
index 2595f5c4c3705c9d72e85f723415aee56b2987dc..9439a044a00399c5d3f043df82a156672894163f 100644 (file)
@@ -47,6 +47,7 @@ protected:
 
        static Value NameAccessor(const Value& row);
        static Value AliasAccessor(const Value& row);
+       static Value InAccessor(const Value& row);
 };
 
 }