livestatus: finish timeperiods table

refs #4372
This commit is contained in:
Michael Friedrich 2013-07-18 15:30:39 +02:00
parent 40c62f28bb
commit 26f1bf86f3
2 changed files with 9 additions and 2 deletions

View 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);
}

View File

@ -47,6 +47,7 @@ protected:
static Value NameAccessor(const Value& row);
static Value AliasAccessor(const Value& row);
static Value InAccessor(const Value& row);
};
}