mirror of
https://github.com/ClusterCockpit/cc-backend
synced 2025-09-07 01:03:00 +02:00
add job starttime to legend
This commit is contained in:
@@ -171,8 +171,9 @@ type ComplexityRoot struct {
|
||||
}
|
||||
|
||||
JobStats struct {
|
||||
JobID func(childComplexity int) int
|
||||
Stats func(childComplexity int) int
|
||||
JobID func(childComplexity int) int
|
||||
StartTime func(childComplexity int) int
|
||||
Stats func(childComplexity int) int
|
||||
}
|
||||
|
||||
JobsStatistics struct {
|
||||
@@ -947,6 +948,13 @@ func (e *executableSchema) Complexity(typeName, field string, childComplexity in
|
||||
|
||||
return e.complexity.JobStats.JobID(childComplexity), true
|
||||
|
||||
case "JobStats.startTime":
|
||||
if e.complexity.JobStats.StartTime == nil {
|
||||
break
|
||||
}
|
||||
|
||||
return e.complexity.JobStats.StartTime(childComplexity), true
|
||||
|
||||
case "JobStats.stats":
|
||||
if e.complexity.JobStats.Stats == nil {
|
||||
break
|
||||
@@ -2281,6 +2289,7 @@ type ScopedStats {
|
||||
|
||||
type JobStats {
|
||||
jobId: Int!
|
||||
startTime: Int!
|
||||
stats: [NamedStats!]!
|
||||
}
|
||||
|
||||
@@ -7400,6 +7409,50 @@ func (ec *executionContext) fieldContext_JobStats_jobId(_ context.Context, field
|
||||
return fc, nil
|
||||
}
|
||||
|
||||
func (ec *executionContext) _JobStats_startTime(ctx context.Context, field graphql.CollectedField, obj *model.JobStats) (ret graphql.Marshaler) {
|
||||
fc, err := ec.fieldContext_JobStats_startTime(ctx, field)
|
||||
if err != nil {
|
||||
return graphql.Null
|
||||
}
|
||||
ctx = graphql.WithFieldContext(ctx, fc)
|
||||
defer func() {
|
||||
if r := recover(); r != nil {
|
||||
ec.Error(ctx, ec.Recover(ctx, r))
|
||||
ret = graphql.Null
|
||||
}
|
||||
}()
|
||||
resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (any, error) {
|
||||
ctx = rctx // use context from middleware stack in children
|
||||
return obj.StartTime, nil
|
||||
})
|
||||
if err != nil {
|
||||
ec.Error(ctx, err)
|
||||
return graphql.Null
|
||||
}
|
||||
if resTmp == nil {
|
||||
if !graphql.HasFieldError(ctx, fc) {
|
||||
ec.Errorf(ctx, "must not be null")
|
||||
}
|
||||
return graphql.Null
|
||||
}
|
||||
res := resTmp.(int)
|
||||
fc.Result = res
|
||||
return ec.marshalNInt2int(ctx, field.Selections, res)
|
||||
}
|
||||
|
||||
func (ec *executionContext) fieldContext_JobStats_startTime(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) {
|
||||
fc = &graphql.FieldContext{
|
||||
Object: "JobStats",
|
||||
Field: field,
|
||||
IsMethod: false,
|
||||
IsResolver: false,
|
||||
Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) {
|
||||
return nil, errors.New("field of type Int does not have child fields")
|
||||
},
|
||||
}
|
||||
return fc, nil
|
||||
}
|
||||
|
||||
func (ec *executionContext) _JobStats_stats(ctx context.Context, field graphql.CollectedField, obj *model.JobStats) (ret graphql.Marshaler) {
|
||||
fc, err := ec.fieldContext_JobStats_stats(ctx, field)
|
||||
if err != nil {
|
||||
@@ -11197,6 +11250,8 @@ func (ec *executionContext) fieldContext_Query_jobsMetricStats(ctx context.Conte
|
||||
switch field.Name {
|
||||
case "jobId":
|
||||
return ec.fieldContext_JobStats_jobId(ctx, field)
|
||||
case "startTime":
|
||||
return ec.fieldContext_JobStats_startTime(ctx, field)
|
||||
case "stats":
|
||||
return ec.fieldContext_JobStats_stats(ctx, field)
|
||||
}
|
||||
@@ -17527,6 +17582,11 @@ func (ec *executionContext) _JobStats(ctx context.Context, sel ast.SelectionSet,
|
||||
if out.Values[i] == graphql.Null {
|
||||
out.Invalids++
|
||||
}
|
||||
case "startTime":
|
||||
out.Values[i] = ec._JobStats_startTime(ctx, field, obj)
|
||||
if out.Values[i] == graphql.Null {
|
||||
out.Invalids++
|
||||
}
|
||||
case "stats":
|
||||
out.Values[i] = ec._JobStats_stats(ctx, field, obj)
|
||||
if out.Values[i] == graphql.Null {
|
||||
|
@@ -97,8 +97,9 @@ type JobResultList struct {
|
||||
}
|
||||
|
||||
type JobStats struct {
|
||||
JobID int `json:"jobId"`
|
||||
Stats []*NamedStats `json:"stats"`
|
||||
JobID int `json:"jobId"`
|
||||
StartTime int `json:"startTime"`
|
||||
Stats []*NamedStats `json:"stats"`
|
||||
}
|
||||
|
||||
type JobsStatistics struct {
|
||||
|
@@ -616,8 +616,9 @@ func (r *queryResolver) JobsMetricStats(ctx context.Context, filter []*model.Job
|
||||
}
|
||||
|
||||
res = append(res, &model.JobStats{
|
||||
JobID: int(job.JobID),
|
||||
Stats: sres,
|
||||
JobID: int(job.JobID),
|
||||
StartTime: int(job.StartTime.Unix()),
|
||||
Stats: sres,
|
||||
})
|
||||
}
|
||||
return res, err
|
||||
|
Reference in New Issue
Block a user