// +build js package main import ( "github.com/mame82/hvue" "github.com/mame82/P4wnP1_aloa/common_web" "github.com/gopherjs/gopherjs/js" ) type CompHIDEventsData struct { *js.Object Pagination *jsDataTablePagination `js:"pagination"` } func newCompHIDEventsData(vm *hvue.VM) interface{} { data := &CompHIDEventsData{ Object: O() } data.Pagination = newPagination(0, 1) return data } func InitCompHIDEvents() { hvue.NewComponent( "hid-job-event-overview", hvue.Template(compHIDJobEventOverviewTemplate), hvue.DataFunc(newCompHIDEventsData), hvue.Computed("events", func(vm *hvue.VM) interface{} { return vm.Get("$store").Get("state").Get("EventProcessor").Get("eventHidArray") }), hvue.Method("formatDate", func(vm *hvue.VM, timestamp *js.Object) interface{} { return js.Global.Get("Quasar").Get("utils").Get("date").Call("formatDate", timestamp, "YYYY-MM-DD HH:mm:ss Z") }), hvue.Method("evIdToString", func(vm *hvue.VM, evID int64) (res string) { //println("EvID", evID) return common_web.EventTypeHIDName[evID] }), ) } const ( //{ "evtype": 0, "vmId": 2, "jobId": 3, "hasError": false, "result": "null", "error": "", "message": "Script started", "time": "2018-07-30 04:56:42.297533 +0000 UTC m=+7625.097825001" } compHIDJobEventOverviewTemplate = `
{{ formatDate(props.value) }} {{ evIdToString(props.value) }} {{ props.value.slice(0,30) }}
{{ props.value }}
` )