MCPcopy
hub / github.com/Ne0nd0g/merlin / GetTableAll

Method GetTableAll

pkg/services/job/job.go:752–785  ·  view source on GitHub ↗

GetTableAll returns all unsent jobs to be displayed as a table

()

Source from the content-addressed store, hash-verified

750
751// GetTableAll returns all unsent jobs to be displayed as a table
752func (s *Service) GetTableAll() [][]string {
753 var agentJobs [][]string
754
755 for id, job := range s.jobRepo.GetAll() {
756 var status string
757 switch job.Status() {
758 case infoJobs.CREATED:
759 status = "Created"
760 case infoJobs.SENT:
761 status = "Sent"
762 case infoJobs.RETURNED:
763 status = "Returned"
764 default:
765 status = fmt.Sprintf("Unknown job status: %d", job.Status())
766 }
767 if job.Status() != infoJobs.COMPLETE && job.Status() != infoJobs.CANCELED {
768 var zeroTime time.Time
769 var sent string
770 if job.Sent() != zeroTime {
771 sent = job.Sent().Format(time.RFC3339)
772 }
773
774 agentJobs = append(agentJobs, []string{
775 job.AgentID().String(),
776 id,
777 job.Command(),
778 status,
779 job.Created().Format(time.RFC3339),
780 sent,
781 })
782 }
783 }
784 return agentJobs
785}
786
787// Handler evaluates a message sent in by the agent and the subsequently executes any corresponding tasks
788func (s *Service) Handler(agentJobs []jobs.Job) error {

Callers

nothing calls this directly

Calls 7

SentMethod · 0.80
AgentIDMethod · 0.80
CommandMethod · 0.80
CreatedMethod · 0.80
GetAllMethod · 0.65
StatusMethod · 0.65
StringMethod · 0.65

Tested by

no test coverage detected