mirror of
https://github.com/Icinga/icinga2.git
synced 2025-07-25 22:54:57 +02:00
timeperiods: re-add display_name
This commit is contained in:
parent
c36ea86ac9
commit
40c62f28bb
@ -328,6 +328,8 @@ type UserGroup {
|
|||||||
}
|
}
|
||||||
|
|
||||||
type TimePeriod {
|
type TimePeriod {
|
||||||
|
%attribute string "display_name",
|
||||||
|
|
||||||
%require "methods",
|
%require "methods",
|
||||||
%attribute dictionary "methods" {
|
%attribute dictionary "methods" {
|
||||||
%require "update",
|
%require "update",
|
||||||
|
@ -39,6 +39,7 @@ static Timer::Ptr l_UpdateTimer;
|
|||||||
TimePeriod::TimePeriod(const Dictionary::Ptr& serializedUpdate)
|
TimePeriod::TimePeriod(const Dictionary::Ptr& serializedUpdate)
|
||||||
: DynamicObject(serializedUpdate)
|
: DynamicObject(serializedUpdate)
|
||||||
{
|
{
|
||||||
|
RegisterAttribute("display_name", Attribute_Config, &m_DisplayName);
|
||||||
RegisterAttribute("valid_begin", Attribute_Replicated, &m_ValidBegin);
|
RegisterAttribute("valid_begin", Attribute_Replicated, &m_ValidBegin);
|
||||||
RegisterAttribute("valid_end", Attribute_Replicated, &m_ValidEnd);
|
RegisterAttribute("valid_end", Attribute_Replicated, &m_ValidEnd);
|
||||||
RegisterAttribute("segments", Attribute_Replicated, &m_Segments);
|
RegisterAttribute("segments", Attribute_Replicated, &m_Segments);
|
||||||
@ -59,6 +60,14 @@ void TimePeriod::Start(void)
|
|||||||
Dump();
|
Dump();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
String TimePeriod::GetDisplayName(void) const
|
||||||
|
{
|
||||||
|
if (!m_DisplayName.IsEmpty())
|
||||||
|
return m_DisplayName;
|
||||||
|
else
|
||||||
|
return GetName();
|
||||||
|
}
|
||||||
|
|
||||||
TimePeriod::Ptr TimePeriod::GetByName(const String& name)
|
TimePeriod::Ptr TimePeriod::GetByName(const String& name)
|
||||||
{
|
{
|
||||||
DynamicObject::Ptr configObject = DynamicObject::GetObject("TimePeriod", name);
|
DynamicObject::Ptr configObject = DynamicObject::GetObject("TimePeriod", name);
|
||||||
|
@ -41,6 +41,8 @@ public:
|
|||||||
|
|
||||||
static TimePeriod::Ptr GetByName(const String& name);
|
static TimePeriod::Ptr GetByName(const String& name);
|
||||||
|
|
||||||
|
String GetDisplayName(void) const;
|
||||||
|
|
||||||
virtual void Start(void);
|
virtual void Start(void);
|
||||||
|
|
||||||
void UpdateRegion(double begin, double end, bool clearExisting);
|
void UpdateRegion(double begin, double end, bool clearExisting);
|
||||||
@ -52,6 +54,7 @@ public:
|
|||||||
static Array::Ptr EvenMinutesTimePeriodUpdate(const TimePeriod::Ptr& tp, double begin, double end);
|
static Array::Ptr EvenMinutesTimePeriodUpdate(const TimePeriod::Ptr& tp, double begin, double end);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
Attribute<String> m_DisplayName;
|
||||||
Attribute<double> m_ValidBegin;
|
Attribute<double> m_ValidBegin;
|
||||||
Attribute<double> m_ValidEnd;
|
Attribute<double> m_ValidEnd;
|
||||||
Attribute<Array::Ptr> m_Segments;
|
Attribute<Array::Ptr> m_Segments;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user