Skip to content

Commit

Permalink
Merge pull request #37 from Onemind-Services-LLC/dev
Browse files Browse the repository at this point in the history
Fixed datetime parsing
  • Loading branch information
abhi1693 authored Feb 17, 2024
2 parents 3a651b8 + facc8f1 commit c7e4ba1
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 3 deletions.
4 changes: 3 additions & 1 deletion netbox_cloud_pilot/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -371,8 +371,9 @@ def __parse_backup_name(self, backup_name):

# Parse the time from the second part
parts = parts[1].split("-", 1)
timestamp, timezone = parts[0].split("_")
# Parse the time from the first part
time = datetime.fromtimestamp(int(parts[0])).time()
time = datetime.fromtimestamp(int(timestamp)).time()

# Combine the date and time
date = datetime.combine(date, time)
Expand All @@ -387,6 +388,7 @@ def __parse_backup_name(self, backup_name):
return {
"name": backup_name,
"datetime": date,
"timezone": timezone,
"backup_type": backup_type,
"db_version": db_version,
}
Expand Down
5 changes: 4 additions & 1 deletion netbox_cloud_pilot/tables.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,9 @@ class NetBoxBackupsTable(tables.Table):
orderable=False,
verbose_name="Date/Time",
)
timezone = tables.Column(
orderable=False,
)

backup_type = columns.TemplateColumn(
template_code="""{{ record.backup_type|title }}""",
Expand All @@ -42,7 +45,7 @@ class NetBoxBackupsTable(tables.Table):
)

class Meta:
fields = ("name", "datetime", "backup_type", "db_version", "actions")
fields = ("name", "datetime", "timezone", "backup_type", "db_version", "actions")
attrs = {
"class": "table table-hover object-list",
}
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@

setup(
name="netbox-cloud-pilot",
version="0.1.19",
version="0.1.20",
description="Enhances NetBox on CloudMyDC's VAP with advanced management and control features.",
long_description=long_description,
long_description_content_type="text/markdown",
Expand Down

0 comments on commit c7e4ba1

Please sign in to comment.