-
Notifications
You must be signed in to change notification settings - Fork 0
/
adm_act.ex
38 lines (35 loc) · 1.21 KB
/
adm_act.ex
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
defmodule ADM.ACT do
require NITRO
require FORM
require BPE
require EXO
def event(:init) do
:nitro.clear(:tableHead)
:nitro.clear(:tableRow)
bin = :nitro.qc(:p)
id = try do :erlang.binary_to_list(bin) rescue _ -> 0 end
case :kvs.get("/bpe/proc",id) do
{:error,:not_found} ->
:nitro.update(:n, "ERR")
:nitro.update(:desc, "No process found.")
:nitro.update(:num, "ERR")
_ ->
:nitro.insert_top(:tableHead, header())
:nitro.update(:n, bin)
:nitro.update(:num, bin)
history = :bpe.hist(id)
:lists.map(fn x ->
{:step,no,step} = BPE.hist(x, :id)
name = :nitro.to_list(no) ++ '-' ++ :nitro.to_list(step)
trace = BPE.Trace.new(:form.atom([:trace,name]),x,[])
:nitro.insert_bottom(:tableRow, trace)
end, history)
end
end
def event(_), do: []
def header() do
NITRO.panel(id: :header, class: :th,
body: [NITRO.panel(class: :column6, body: "Стан"),
NITRO.panel(class: :column6, body: "Документи")])
end
end