Skip to content

Commit

Permalink
added date saved in TUI search
Browse files Browse the repository at this point in the history
  • Loading branch information
levnikmyskin committed Feb 7, 2023
1 parent 06e9160 commit af377e9
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 7 deletions.
12 changes: 6 additions & 6 deletions tests/test_db_tui.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@
"id": "test",
"name": "test",
"args": "",
"date_created": 0,
"date_created": 1675779332,
"local_results_path": "",
"local_snapshot_path": "the/snapshot/path",
"date_saved": null,
"date_saved": 1675779432,
"metrics": [{"entry_id": "test", "name": "f1", "value": 0.87}, {"entry_id": "test", "name": "loss", "value": 0.003}, {"entry_id": "test", "name": "loss", "value": 0.003}, {"entry_id": "test", "name": "loss", "value": 0.003}, {"entry_id": "test", "name": "loss", "value": 0.003}, {"entry_id": "test", "name": "loss", "value": 0.003}, {"entry_id": "test", "name": "loss", "value": 0.003}, {"entry_id": "test", "name": "loss", "value": 0.003}, {"entry_id": "test", "name": "loss", "value": 0.003}, {"entry_id": "test", "name": "loss", "value": 0.003}, {"entry_id": "test", "name": "loss", "value": 0.003}, {"entry_id": "test", "name": "loss", "value": 0.003}, {"entry_id": "test", "name": "loss", "value": 0.003}, {"entry_id": "test", "name": "loss", "value": 0.003}, {"entry_id": "test", "name": "loss", "value": 0.003}, {"entry_id": "test", "name": "loss", "value": 0.003}, {"entry_id": "test", "name": "loss", "value": 0.003}, {"entry_id": "test", "name": "loss", "value": 0.003}, {"entry_id": "test", "name": "loss", "value": 0.003}],
"other_runs": [],
"results": [{"entry_id": "test", "name": "with_svm", "path": "/the/result/path"}, {"entry_id": "test", "name": "with_svm", "path": "/a/very/very/very/very/very/long/path"}, {"entry_id": "test", "name": "with_svm", "path": "/the/result/path"}, {"entry_id": "test", "name": "with_svm", "path": "/the/result/path"}, {"entry_id": "test", "name": "with_svm", "path": "/the/result/path"}, {"entry_id": "test", "name": "with_svm", "path": "/the/result/path"}, {"entry_id": "test", "name": "with_svm", "path": "/the/result/path"}],
Expand All @@ -17,10 +17,10 @@
"id": "test1",
"name": "test1",
"args": "",
"date_created": 0,
"date_created": 1675779332,
"local_results_path": "",
"local_snapshot_path": "",
"date_saved": null,
"date_saved": 1675779432,
"metrics": [],
"other_runs": [],
"results": [],
Expand All @@ -30,10 +30,10 @@
"id": "test2",
"name": "test2",
"args": "",
"date_created": 0,
"date_created": 1675779332,
"local_results_path": "",
"local_snapshot_path": "",
"date_saved": null,
"date_saved": 1675779432,
"metrics": [],
"other_runs": [],
"results": [],
Expand Down
4 changes: 3 additions & 1 deletion tmt/interface/tui/search.py
Original file line number Diff line number Diff line change
Expand Up @@ -76,11 +76,13 @@ def _show_results(self, entries: Iterable[Entry]):
ids = HSplit([Label(text='ID')])
names = HSplit([Label(text='Name')])
dates = HSplit([Label(text='Date created')])
self.results_box.children.append(VSplit([ids, names, dates]))
dates_saved = HSplit([Label(text='Date saved')])
self.results_box.children.append(VSplit([ids, names, dates, dates_saved]))
for entry in entries:
ids.children.append(to_container(FocusableText(entry.id, handler=partial(self.entry_select_handler, entry))))
names.children.append(to_container(Label(text=entry.name)))
dates.children.append(to_container(Label(text=date_formatter(entry.date_created))))
dates_saved.children.append(to_container(Label(text=date_formatter(float(entry.date_saved)) if entry.date_saved else "NA")))

def _bottom_toolbar(self):
toolbar = super()._bottom_toolbar()
Expand Down

0 comments on commit af377e9

Please sign in to comment.