From: Michael Friedrich Date: Thu, 18 Jul 2013 13:30:39 +0000 (+0200) Subject: livestatus: finish timeperiods table X-Git-Tag: v0.0.3~823 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=26f1bf86f32f4273ebb0a4c8ff79f18925addb31;p=icinga2 livestatus: finish timeperiods table refs #4372 --- diff --git a/components/livestatus/timeperiodstable.cpp b/components/livestatus/timeperiodstable.cpp index 48890e0fc..6246c4b63 100644 --- a/components/livestatus/timeperiodstable.cpp +++ b/components/livestatus/timeperiodstable.cpp @@ -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(row)->GetName(); + return static_cast(row)->GetDisplayName(); } +Value TimePeriodsTable::InAccessor(const Value& row) +{ + return (static_cast(row)->IsInside(Utility::GetTime()) ? 1 : 0); +} + + diff --git a/components/livestatus/timeperiodstable.h b/components/livestatus/timeperiodstable.h index 2595f5c4c..9439a044a 100644 --- a/components/livestatus/timeperiodstable.h +++ b/components/livestatus/timeperiodstable.h @@ -47,6 +47,7 @@ protected: static Value NameAccessor(const Value& row); static Value AliasAccessor(const Value& row); + static Value InAccessor(const Value& row); }; }