initial branch commit, improve countstate backend logic

- stacked component rough sketch
- gql data request pipeline layed out
This commit is contained in:
Christoph Kluge
2025-10-17 18:24:05 +02:00
parent 6efd6334bb
commit 714d6af7cd
12 changed files with 1267 additions and 55 deletions

View File

@@ -366,17 +366,66 @@ func (r *queryResolver) AllocatedNodes(ctx context.Context, cluster string) ([]*
// Node is the resolver for the node field.
func (r *queryResolver) Node(ctx context.Context, id string) (*schema.Node, error) {
panic(fmt.Errorf("not implemented: Node - node"))
repo := repository.GetNodeRepository()
numericId, err := strconv.ParseInt(id, 10, 64)
if err != nil {
cclog.Warn("Error while parsing job id")
return nil, err
}
return repo.GetNodeById(numericId, false)
}
// Nodes is the resolver for the nodes field.
func (r *queryResolver) Nodes(ctx context.Context, filter []*model.NodeFilter, order *model.OrderByInput) (*model.NodeStateResultList, error) {
panic(fmt.Errorf("not implemented: Nodes - nodes"))
repo := repository.GetNodeRepository()
nodes, err := repo.QueryNodes(ctx, filter, order)
count := len(nodes)
return &model.NodeStateResultList{Items: nodes, Count: &count}, err
}
// NodeStates is the resolver for the nodeStates field.
func (r *queryResolver) NodeStates(ctx context.Context, filter []*model.NodeFilter) ([]*model.NodeStates, error) {
panic(fmt.Errorf("not implemented: NodeStates - nodeStates"))
repo := repository.GetNodeRepository()
stateCounts, serr := repo.CountNodeStates(ctx, filter)
if serr != nil {
cclog.Warnf("Error while counting nodeStates: %s", serr.Error())
return nil, serr
}
healthCounts, herr := repo.CountHealthStates(ctx, filter)
if herr != nil {
cclog.Warnf("Error while counting healthStates: %s", herr.Error())
return nil, herr
}
allCounts := make([]*model.NodeStates, 0)
allCounts = append(stateCounts, healthCounts...)
return allCounts, nil
}
// NodeStatesTimed is the resolver for the nodeStatesTimed field.
func (r *queryResolver) NodeStatesTimed(ctx context.Context, filter []*model.NodeFilter) ([]*model.NodeStatesTimed, error) {
panic(fmt.Errorf("not implemented: NodeStatesTimed - NodeStatesTimed"))
// repo := repository.GetNodeRepository()
// stateCounts, serr := repo.CountNodeStates(ctx, filter)
// if serr != nil {
// cclog.Warnf("Error while counting nodeStates: %s", serr.Error())
// return nil, serr
// }
// healthCounts, herr := repo.CountHealthStates(ctx, filter)
// if herr != nil {
// cclog.Warnf("Error while counting healthStates: %s", herr.Error())
// return nil, herr
// }
// allCounts := make([]*model.NodeStates, 0)
// allCounts = append(stateCounts, healthCounts...)
// return allCounts, nil
}
// Job is the resolver for the job field.