Class: Pvectl::Presenters::TaskEntry
- Inherits:
-
Base
- Object
- Base
- Pvectl::Presenters::TaskEntry
show all
- Defined in:
- lib/pvectl/presenters/task_entry.rb
Overview
Presenter for task list entries (pvectl logs vm/ct).
Instance Method Summary
collapse
Methods inherited from Base
#tags_array, #tags_display, #template_display, #to_description, #to_wide_row, #uptime_human, #wide_columns
Instance Method Details
#columns ⇒ Object
7
8
9
|
# File 'lib/pvectl/presenters/task_entry.rb', line 7
def columns
%w[STARTTIME TYPE STATUS USER DURATION NODE]
end
|
#extra_columns ⇒ Object
11
12
13
|
# File 'lib/pvectl/presenters/task_entry.rb', line 11
def extra_columns
%w[UPID ENDTIME ID PID]
end
|
26
27
28
29
30
31
32
33
|
# File 'lib/pvectl/presenters/task_entry.rb', line 26
def (model, **_context)
[
model.upid || "-",
format_time(model.endtime),
model.id || "-",
model.pid&.to_s || "-"
]
end
|
#to_hash(model) ⇒ Object
35
36
37
38
39
40
41
42
43
44
45
46
47
48
|
# File 'lib/pvectl/presenters/task_entry.rb', line 35
def to_hash(model)
{
"starttime" => model.starttime,
"endtime" => model.endtime,
"type" => model.type,
"status" => model.status,
"exitstatus" => model.exitstatus,
"user" => model.user,
"duration" => model.duration,
"node" => model.node,
"id" => model.id,
"upid" => model.upid
}
end
|
#to_row(model, **_context) ⇒ Object
15
16
17
18
19
20
21
22
23
24
|
# File 'lib/pvectl/presenters/task_entry.rb', line 15
def to_row(model, **_context)
[
format_time(model.starttime),
model.type || "-",
model.exitstatus || model.status || "-",
model.user || "-",
format_duration(model.duration),
model.node || "-"
]
end
|