-
Notifications
You must be signed in to change notification settings - Fork 27
/
job.go
44 lines (36 loc) · 955 Bytes
/
job.go
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
39
40
41
42
43
44
package views
import "github.com/cSploit/daemon/models"
type jobShowView struct {
models.Job
Aps interface{} `json:"aps"`
Clients interface{} `json:"clients"`
Hosts interface{} `json:"hosts"`
Networks interface{} `json:"networks"`
Ifaces interface{} `json:"ifaces"`
Process interface{} `json:"process"`
}
type processJobShowView struct {
models.ProcessJob
hiddenJob string `json:"job,omitempty"`
}
func JobIndex(arg interface{}) interface{} {
return arg
}
func JobShow(arg interface{}) interface{} {
job := arg.(models.Job)
return &jobShowView{
Job: job,
Aps: ApIndex(job.Aps),
Clients: ClientIndex(job.Clients),
Hosts: HostsIndex(job.Hosts),
Networks: NetworkIndex(job.Networks),
Ifaces: IfaceIndex(job.Ifaces),
Process: processJobShow(job.Process),
}
}
func processJobShow(pj *models.ProcessJob) interface{} {
if pj == nil {
return nil
}
return &processJobShowView{ProcessJob: *pj}
}