mirror of
https://github.com/ClusterCockpit/cc-backend
synced 2025-01-12 12:39:05 +01:00
parent
2de4d03c8d
commit
e13f184414
@ -80,12 +80,9 @@
|
|||||||
],
|
],
|
||||||
"responses": {
|
"responses": {
|
||||||
"200": {
|
"200": {
|
||||||
"description": "Array of matching jobs",
|
"description": "Job array and page info",
|
||||||
"schema": {
|
"schema": {
|
||||||
"type": "array",
|
"$ref": "#/definitions/api.GetJobsApiResponse"
|
||||||
"items": {
|
|
||||||
"$ref": "#/definitions/schema.Job"
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"400": {
|
"400": {
|
||||||
@ -681,6 +678,26 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"api.GetJobsApiResponse": {
|
||||||
|
"type": "object",
|
||||||
|
"properties": {
|
||||||
|
"items": {
|
||||||
|
"description": "Number of jobs returned",
|
||||||
|
"type": "integer"
|
||||||
|
},
|
||||||
|
"jobs": {
|
||||||
|
"description": "Array of jobs",
|
||||||
|
"type": "array",
|
||||||
|
"items": {
|
||||||
|
"$ref": "#/definitions/schema.JobMeta"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"page": {
|
||||||
|
"description": "Page id returned",
|
||||||
|
"type": "integer"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
"api.StartJobApiResponse": {
|
"api.StartJobApiResponse": {
|
||||||
"type": "object",
|
"type": "object",
|
||||||
"properties": {
|
"properties": {
|
||||||
|
@ -42,6 +42,20 @@ definitions:
|
|||||||
description: Statustext of Errorcode
|
description: Statustext of Errorcode
|
||||||
type: string
|
type: string
|
||||||
type: object
|
type: object
|
||||||
|
api.GetJobsApiResponse:
|
||||||
|
properties:
|
||||||
|
items:
|
||||||
|
description: Number of jobs returned
|
||||||
|
type: integer
|
||||||
|
jobs:
|
||||||
|
description: Array of jobs
|
||||||
|
items:
|
||||||
|
$ref: '#/definitions/schema.JobMeta'
|
||||||
|
type: array
|
||||||
|
page:
|
||||||
|
description: Page id returned
|
||||||
|
type: integer
|
||||||
|
type: object
|
||||||
api.StartJobApiResponse:
|
api.StartJobApiResponse:
|
||||||
properties:
|
properties:
|
||||||
id:
|
id:
|
||||||
@ -438,11 +452,9 @@ paths:
|
|||||||
- application/json
|
- application/json
|
||||||
responses:
|
responses:
|
||||||
"200":
|
"200":
|
||||||
description: Array of matching jobs
|
description: Job array and page info
|
||||||
schema:
|
schema:
|
||||||
items:
|
$ref: '#/definitions/api.GetJobsApiResponse'
|
||||||
$ref: '#/definitions/schema.Job'
|
|
||||||
type: array
|
|
||||||
"400":
|
"400":
|
||||||
description: Bad Request
|
description: Bad Request
|
||||||
schema:
|
schema:
|
||||||
|
@ -86,12 +86,9 @@ const docTemplate = `{
|
|||||||
],
|
],
|
||||||
"responses": {
|
"responses": {
|
||||||
"200": {
|
"200": {
|
||||||
"description": "Array of matching jobs",
|
"description": "Job array and page info",
|
||||||
"schema": {
|
"schema": {
|
||||||
"type": "array",
|
"$ref": "#/definitions/api.GetJobsApiResponse"
|
||||||
"items": {
|
|
||||||
"$ref": "#/definitions/schema.Job"
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"400": {
|
"400": {
|
||||||
@ -687,6 +684,26 @@ const docTemplate = `{
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"api.GetJobsApiResponse": {
|
||||||
|
"type": "object",
|
||||||
|
"properties": {
|
||||||
|
"items": {
|
||||||
|
"description": "Number of jobs returned",
|
||||||
|
"type": "integer"
|
||||||
|
},
|
||||||
|
"jobs": {
|
||||||
|
"description": "Array of jobs",
|
||||||
|
"type": "array",
|
||||||
|
"items": {
|
||||||
|
"$ref": "#/definitions/schema.JobMeta"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"page": {
|
||||||
|
"description": "Page id returned",
|
||||||
|
"type": "integer"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
"api.StartJobApiResponse": {
|
"api.StartJobApiResponse": {
|
||||||
"type": "object",
|
"type": "object",
|
||||||
"properties": {
|
"properties": {
|
||||||
|
@ -738,29 +738,6 @@ func (api *RestApi) checkAndHandleStopJob(rw http.ResponseWriter, job *schema.Jo
|
|||||||
api.JobRepository.TriggerArchiving(job)
|
api.JobRepository.TriggerArchiving(job)
|
||||||
}
|
}
|
||||||
|
|
||||||
// func (api *RestApi) importJob(rw http.ResponseWriter, r *http.Request) {
|
|
||||||
// if user := auth.GetUser(r.Context()); user != nil && !user.HasRole(auth.RoleApi) {
|
|
||||||
// handleError(fmt.Errorf("missing role: %v", auth.RoleApi), http.StatusForbidden, rw)
|
|
||||||
// return
|
|
||||||
// }
|
|
||||||
|
|
||||||
// var body struct {
|
|
||||||
// Meta *schema.JobMeta `json:"meta"`
|
|
||||||
// Data *schema.JobData `json:"data"`
|
|
||||||
// }
|
|
||||||
// if err := decode(r.Body, &body); err != nil {
|
|
||||||
// handleError(fmt.Errorf("import failed: %s", err.Error()), http.StatusBadRequest, rw)
|
|
||||||
// return
|
|
||||||
// }
|
|
||||||
|
|
||||||
// if err := api.JobRepository.ImportJob(body.Meta, body.Data); err != nil {
|
|
||||||
// handleError(fmt.Errorf("import failed: %s", err.Error()), http.StatusUnprocessableEntity, rw)
|
|
||||||
// return
|
|
||||||
// }
|
|
||||||
|
|
||||||
// rw.Write([]byte(`{ "status": "OK" }`))
|
|
||||||
// }
|
|
||||||
|
|
||||||
func (api *RestApi) getJobMetrics(rw http.ResponseWriter, r *http.Request) {
|
func (api *RestApi) getJobMetrics(rw http.ResponseWriter, r *http.Request) {
|
||||||
id := mux.Vars(r)["id"]
|
id := mux.Vars(r)["id"]
|
||||||
metrics := r.URL.Query()["metric"]
|
metrics := r.URL.Query()["metric"]
|
||||||
|
Loading…
Reference in New Issue
Block a user