mirror of
https://github.com/netbox-community/netbox.git
synced 2024-05-10 07:54:54 +00:00
* Add interval to JobResult * Accept a recurrence interval when executing scripts & reports * Cleaned up jobs list display * Schedule next job only if a reference start time can be determined * Improve validation for scheduled jobs
This commit is contained in:
@@ -299,7 +299,7 @@ OTHER_MENU = Menu(
|
||||
),
|
||||
MenuItem(
|
||||
link='extras:jobresult_list',
|
||||
link_text=_('Job Results'),
|
||||
link_text=_('Jobs'),
|
||||
permissions=['extras.view_jobresult'],
|
||||
),
|
||||
),
|
||||
|
@@ -28,6 +28,7 @@ __all__ = (
|
||||
'ContentTypesColumn',
|
||||
'CustomFieldColumn',
|
||||
'CustomLinkColumn',
|
||||
'DurationColumn',
|
||||
'LinkedCountColumn',
|
||||
'MarkdownColumn',
|
||||
'ManyToManyColumn',
|
||||
@@ -77,6 +78,24 @@ class DateTimeColumn(tables.DateTimeColumn):
|
||||
return cls(**kwargs)
|
||||
|
||||
|
||||
class DurationColumn(tables.Column):
|
||||
"""
|
||||
Express a duration of time (in minutes) in a human-friendly format. Example: 437 minutes becomes "7h 17m"
|
||||
"""
|
||||
def render(self, value):
|
||||
ret = ''
|
||||
if days := value // 1440:
|
||||
ret += f'{days}d '
|
||||
if hours := value % 1440 // 60:
|
||||
ret += f'{hours}h '
|
||||
if minutes := value % 60:
|
||||
ret += f'{minutes}m'
|
||||
return ret.strip()
|
||||
|
||||
def value(self, value):
|
||||
return value
|
||||
|
||||
|
||||
class ManyToManyColumn(tables.ManyToManyColumn):
|
||||
"""
|
||||
Overrides django-tables2's stock ManyToManyColumn to ensure that value() returns only plaintext data.
|
||||
|
Reference in New Issue
Block a user