Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
C
clive
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
hive
clive
Merge requests
!102
Redesign header
Code
Review changes
Check out branch
Download
Patches
Plain diff
Merged
Redesign header
kmochocki/issue-21
into
develop
Overview
11
Commits
10
Pipelines
10
Changes
2
All threads resolved!
Hide all comments
Merged
Krzysztof Mochocki
requested to merge
kmochocki/issue-21
into
develop
1 year ago
Overview
11
Commits
10
Pipelines
10
Changes
2
All threads resolved!
Hide all comments
Expand
resolves:
#21 (closed)
0
0
Merge request reports
Viewing commit
e45b79b7
Prev
Next
Show latest version
2 files
+
21
−
23
Inline
Compare changes
Side-by-side
Inline
Show whitespace changes
Show one file at a time
Files
2
Search (e.g. *.vue) (Ctrl+P)
Verified
e45b79b7
Unify the DynamicPropertiesClock design with current header look
· e45b79b7
Mateusz Żebrak
authored
1 year ago
clive/__private/ui/widgets/header.py
+
20
−
11
Options
@@ -73,20 +73,29 @@ class DynamicPropertiesClock(Horizontal, CliveWidget):
def
compose
(
self
)
->
ComposeResult
:
self
.
set_interval
(
0.5
,
self
.
__trigger_last_update
)
yield
DynamicLabel
(
self
.
app
.
world
,
"
app_state
"
,
self
.
__get_block_num
,
id_
=
"
block_num
"
)
yield
DynamicLabel
(
self
.
app
.
world
,
"
app_state
"
,
self
.
__get_chain_time
,
id_
=
"
chain_time
"
)
yield
DynamicLabel
(
self
,
"
last_update_trigger
"
,
self
.
__get_last_update
,
id_
=
"
last_update
"
)
def
__get_block_num
(
self
,
app_state
:
AppState
)
->
str
:
return
f
"
block:
{
app_state
.
get_dynamic_global_properties
().
head_block_number
}
"
def
__get_chain_time
(
self
,
app_state
:
AppState
)
->
str
:
return
f
"
{
app_state
.
get_dynamic_global_properties
().
time
.
time
()
}
UTC
"
yield
TitledLabel
(
"
Block
"
,
obj_to_watch
=
self
.
app
.
world
,
attribute_name
=
"
app_state
"
,
callback
=
self
.
__get_last_block
,
id_
=
"
block_num
"
,
)
yield
TitledLabel
(
"
Last update
"
,
obj_to_watch
=
self
,
attribute_name
=
"
last_update_trigger
"
,
callback
=
self
.
__get_last_update
,
id_
=
"
last_update
"
,
)
def
__get_last_block
(
self
,
app_state
:
AppState
)
->
str
:
block_num
=
app_state
.
get_dynamic_global_properties
().
head_block_number
block_time
=
app_state
.
get_dynamic_global_properties
().
time
.
time
()
return
f
"
{
block_num
}
(
{
block_time
}
UTC)
"
def
__get_last_update
(
self
,
_
:
bool
)
->
str
:
gdpo
=
self
.
app
.
world
.
app_state
.
get_dynamic_global_properties
()
last_update
=
humanize
.
naturaltime
(
datetime
.
datetime
.
utcnow
().
replace
(
tzinfo
=
datetime
.
timezone
.
utc
)
-
gdpo
.
time
)
return
f
"
last update:
{
last_update
}
"
return
humanize
.
naturaltime
(
datetime
.
datetime
.
utcnow
().
replace
(
tzinfo
=
datetime
.
timezone
.
utc
)
-
gdpo
.
time
)
def
__trigger_last_update
(
self
)
->
None
:
self
.
last_update_trigger
=
not
self
.
last_update_trigger
Loading