2 Commits

Author SHA1 Message Date
Natan Keddem ffbc9b71c0 optimize date and time displays 2023-11-19 17:05:58 -05:00
Natan Keddem f3ef97a342 improved result timestamp 2023-11-18 21:46:56 -05:00
5 changed files with 20 additions and 13 deletions
+1 -1
View File
@@ -240,7 +240,7 @@ class SshFileFind(SshFileBrowse):
"headerName": "Modified",
"field": "modified_timestamp",
"filter": "agTextColumnFilter",
"maxWidth": 200,
"maxWidth": 125,
":cellRenderer": """(data) => {
var date = new Date(data.value * 1000).toLocaleString(undefined, {dateStyle: 'short', timeStyle: 'short', hour12: false});;
return date;
+4 -2
View File
@@ -97,12 +97,14 @@ class Tab:
col.tailwind.max_width("lg")
ui.label(f"Host Name: {result.name}").classes("text-secondary")
ui.label(f"Command: {result.command}").classes("text-secondary")
ui.label(f"Date: {result.date}").classes("text-secondary")
timestamp = await ui.run_javascript(
f"new Date({result.timestamp} * 1000).toLocaleString(undefined, {{dateStyle: 'short', timeStyle: 'short', hour12: 'false'}});"
)
ui.label(f"Timestamp: {timestamp}").classes("text-secondary")
with ui.column() as col:
col.tailwind.max_width("lg")
ui.label(f"Task has failed: {result.failed}").classes("text-secondary")
ui.label(f"Data is cached: {result.cached}").classes("text-secondary")
ui.label(f"Time: {result.time}").classes("text-secondary")
with el.Card() as card:
with el.WColumn():
terminal = cli.Terminal(options={"rows": 18, "cols": 120, "convertEol": True})
+13 -8
View File
@@ -161,8 +161,16 @@ class Automation(Tab):
"maxWidth": 150,
},
{"headerName": "Command", "field": "command", "filter": "agTextColumnFilter"},
{"headerName": "Next Date", "field": "next_run_date", "filter": "agDateColumnFilter", "maxWidth": 100},
{"headerName": "Next Time", "field": "next_run_time", "maxWidth": 100},
{
"headerName": "Next Run",
"field": "next_run",
"filter": "agTextColumnFilter",
"maxWidth": 125,
":cellRenderer": """(data) => {
var date = new Date(data.value * 1000).toLocaleString(undefined, {dateStyle: 'short', timeStyle: 'short', hour12: false});;
return date;
}""",
},
{
"headerName": "Status",
"field": "status",
@@ -227,11 +235,9 @@ class Automation(Tab):
self._automations.clear()
for job in self.scheduler.scheduler.get_jobs():
if job.next_run_time is not None:
next_run_date = job.next_run_time.strftime("%Y/%m/%d")
next_run_time = job.next_run_time.strftime("%H:%M")
next_run = job.next_run_time.timestamp()
else:
next_run_date = "NA"
next_run_time = "NA"
next_run = "NA"
if "data" in job.kwargs:
jd = json.loads(job.kwargs["data"])
if self.host == jd["host"]:
@@ -239,8 +245,7 @@ class Automation(Tab):
{
"name": job.id.split("@")[0],
"command": jd["command"],
"next_run_date": next_run_date,
"next_run_time": next_run_time,
"next_run": next_run,
"status": "",
}
)
+1 -1
View File
@@ -52,7 +52,7 @@ class History(Tab):
"headerName": "Timestamp",
"field": "timestamp",
"filter": "agTextColumnFilter",
"maxWidth": 200,
"maxWidth": 125,
":cellRenderer": """(data) => {
var date = new Date(data.value * 1000).toLocaleString(undefined, {dateStyle: 'short', timeStyle: 'short', hour12: false});;
return date;
+1 -1
View File
@@ -82,7 +82,7 @@ class Manage(Tab):
"headerName": "Created",
"field": "creation",
"filter": "agTextColumnFilter",
"maxWidth": 200,
"maxWidth": 125,
":cellRenderer": """(data) => {
var date = new Date(data.value * 1000).toLocaleString(undefined, {dateStyle: 'short', timeStyle: 'short', hour12: false});;
return date;