This commit is contained in:
mr
2025-06-16 09:17:03 +02:00
6 changed files with 143 additions and 28 deletions

View File

@@ -27,9 +27,12 @@ type LokiInfo struct {
// @Success 200 {workspace} models.workspace
// @router / [post]
func (o *LokiController) GetLogs() {
path := "/loki/api/v1/query_range"
var resp map[string]interface{}
json.Unmarshal(o.Ctx.Input.CopyBody(100000), &resp)
path := "/loki/api/v1/query_range"
if len(resp) > 0 {
start := fmt.Sprintf("%v", resp["start"])
if len(start) > 10 {
@@ -53,6 +56,7 @@ func (o *LokiController) GetLogs() {
return
}
path += "?query={" + strings.Join(query, ", ") + "}&start=" + start + "&end=" + end
resp, err := http.Get(config.GetConfig().LokiUrl + path) // CALL
fmt.Println(resp, path)
if err != nil {
@@ -76,6 +80,7 @@ func (o *LokiController) GetLogs() {
o.ServeJSON()
return
}
o.Ctx.ResponseWriter.WriteHeader(403)
o.Data["json"] = map[string]string{"error": "Query error"}
o.ServeJSON()

View File

@@ -12,6 +12,7 @@ import (
)
var orderCollection = oclib.LibDataEnum(oclib.ORDER)
var logger = oclib.GetLogger()
// Operations about workflow
type WorkflowSchedulerController struct {
@@ -40,8 +41,10 @@ func (o *WorkflowSchedulerController) Schedule() {
tools.POST: "/booking/",
},
})
req := oclib.NewRequest(collection, user, peerID, groups, caller)
resp.UUID = uuid.New().String()
sch, err := req.Schedule(id, resp)
if err != nil {
if sch != nil {
@@ -57,6 +60,7 @@ func (o *WorkflowSchedulerController) Schedule() {
o.ServeJSON()
return
}
o.Data["json"] = map[string]interface{}{
"data": sch.WorkflowExecution,
"code": code,