mirror of
https://github.com/ClusterCockpit/cc-backend
synced 2024-11-10 08:57:25 +01:00
Add aggregation to GraphQL API; Update frontend
This commit is contained in:
parent
220758dae1
commit
8ebf00d980
2
frontend
2
frontend
@ -1 +1 @@
|
|||||||
Subproject commit 184a5079bd53a89442664c28c5cebb733557f1f1
|
Subproject commit 03818be47032194f1f450ab242eed56a94a3c5d1
|
@ -143,6 +143,7 @@ type ComplexityRoot struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
MetricConfig struct {
|
MetricConfig struct {
|
||||||
|
Aggregation func(childComplexity int) int
|
||||||
Alert func(childComplexity int) int
|
Alert func(childComplexity int) int
|
||||||
Caution func(childComplexity int) int
|
Caution func(childComplexity int) int
|
||||||
Name func(childComplexity int) int
|
Name func(childComplexity int) int
|
||||||
@ -709,6 +710,13 @@ func (e *executableSchema) Complexity(typeName, field string, childComplexity in
|
|||||||
|
|
||||||
return e.complexity.JobsStatistics.TotalWalltime(childComplexity), true
|
return e.complexity.JobsStatistics.TotalWalltime(childComplexity), true
|
||||||
|
|
||||||
|
case "MetricConfig.aggregation":
|
||||||
|
if e.complexity.MetricConfig.Aggregation == nil {
|
||||||
|
break
|
||||||
|
}
|
||||||
|
|
||||||
|
return e.complexity.MetricConfig.Aggregation(childComplexity), true
|
||||||
|
|
||||||
case "MetricConfig.alert":
|
case "MetricConfig.alert":
|
||||||
if e.complexity.MetricConfig.Alert == nil {
|
if e.complexity.MetricConfig.Alert == nil {
|
||||||
break
|
break
|
||||||
@ -1378,6 +1386,7 @@ type MetricConfig {
|
|||||||
name: String!
|
name: String!
|
||||||
unit: String!
|
unit: String!
|
||||||
scope: MetricScope!
|
scope: MetricScope!
|
||||||
|
aggregation: String
|
||||||
timestep: Int!
|
timestep: Int!
|
||||||
peak: Float!
|
peak: Float!
|
||||||
normal: Float!
|
normal: Float!
|
||||||
@ -4202,6 +4211,38 @@ func (ec *executionContext) _MetricConfig_scope(ctx context.Context, field graph
|
|||||||
return ec.marshalNMetricScope2githubᚗcomᚋClusterCockpitᚋccᚑbackendᚋschemaᚐMetricScope(ctx, field.Selections, res)
|
return ec.marshalNMetricScope2githubᚗcomᚋClusterCockpitᚋccᚑbackendᚋschemaᚐMetricScope(ctx, field.Selections, res)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (ec *executionContext) _MetricConfig_aggregation(ctx context.Context, field graphql.CollectedField, obj *model.MetricConfig) (ret graphql.Marshaler) {
|
||||||
|
defer func() {
|
||||||
|
if r := recover(); r != nil {
|
||||||
|
ec.Error(ctx, ec.Recover(ctx, r))
|
||||||
|
ret = graphql.Null
|
||||||
|
}
|
||||||
|
}()
|
||||||
|
fc := &graphql.FieldContext{
|
||||||
|
Object: "MetricConfig",
|
||||||
|
Field: field,
|
||||||
|
Args: nil,
|
||||||
|
IsMethod: false,
|
||||||
|
IsResolver: false,
|
||||||
|
}
|
||||||
|
|
||||||
|
ctx = graphql.WithFieldContext(ctx, fc)
|
||||||
|
resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) {
|
||||||
|
ctx = rctx // use context from middleware stack in children
|
||||||
|
return obj.Aggregation, nil
|
||||||
|
})
|
||||||
|
if err != nil {
|
||||||
|
ec.Error(ctx, err)
|
||||||
|
return graphql.Null
|
||||||
|
}
|
||||||
|
if resTmp == nil {
|
||||||
|
return graphql.Null
|
||||||
|
}
|
||||||
|
res := resTmp.(*string)
|
||||||
|
fc.Result = res
|
||||||
|
return ec.marshalOString2ᚖstring(ctx, field.Selections, res)
|
||||||
|
}
|
||||||
|
|
||||||
func (ec *executionContext) _MetricConfig_timestep(ctx context.Context, field graphql.CollectedField, obj *model.MetricConfig) (ret graphql.Marshaler) {
|
func (ec *executionContext) _MetricConfig_timestep(ctx context.Context, field graphql.CollectedField, obj *model.MetricConfig) (ret graphql.Marshaler) {
|
||||||
defer func() {
|
defer func() {
|
||||||
if r := recover(); r != nil {
|
if r := recover(); r != nil {
|
||||||
@ -8570,6 +8611,8 @@ func (ec *executionContext) _MetricConfig(ctx context.Context, sel ast.Selection
|
|||||||
if out.Values[i] == graphql.Null {
|
if out.Values[i] == graphql.Null {
|
||||||
invalids++
|
invalids++
|
||||||
}
|
}
|
||||||
|
case "aggregation":
|
||||||
|
out.Values[i] = ec._MetricConfig_aggregation(ctx, field, obj)
|
||||||
case "timestep":
|
case "timestep":
|
||||||
out.Values[i] = ec._MetricConfig_timestep(ctx, field, obj)
|
out.Values[i] = ec._MetricConfig_timestep(ctx, field, obj)
|
||||||
if out.Values[i] == graphql.Null {
|
if out.Values[i] == graphql.Null {
|
||||||
|
@ -100,6 +100,7 @@ type MetricConfig struct {
|
|||||||
Name string `json:"name"`
|
Name string `json:"name"`
|
||||||
Unit string `json:"unit"`
|
Unit string `json:"unit"`
|
||||||
Scope schema.MetricScope `json:"scope"`
|
Scope schema.MetricScope `json:"scope"`
|
||||||
|
Aggregation *string `json:"aggregation"`
|
||||||
Timestep int `json:"timestep"`
|
Timestep int `json:"timestep"`
|
||||||
Peak float64 `json:"peak"`
|
Peak float64 `json:"peak"`
|
||||||
Normal float64 `json:"normal"`
|
Normal float64 `json:"normal"`
|
||||||
|
@ -71,6 +71,7 @@ type MetricConfig {
|
|||||||
name: String!
|
name: String!
|
||||||
unit: String!
|
unit: String!
|
||||||
scope: MetricScope!
|
scope: MetricScope!
|
||||||
|
aggregation: String
|
||||||
timestep: Int!
|
timestep: Int!
|
||||||
peak: Float!
|
peak: Float!
|
||||||
normal: Float!
|
normal: Float!
|
||||||
|
Loading…
Reference in New Issue
Block a user