mirror of
https://github.com/ClusterCockpit/cc-backend
synced 2026-01-15 17:21:46 +01:00
Merge branch 'dev' of github.com:ClusterCockpit/cc-backend into dev
This commit is contained in:
@@ -152,14 +152,14 @@ func (api *NatsAPI) handleJobEvent(subject string, data []byte) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if !m.IsEvent() {
|
if !m.IsEvent() {
|
||||||
cclog.Warnf("NATS %s: received non-event message, skipping", subject)
|
cclog.Debugf("NATS %s: received non-event message, skipping", subject)
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
|
|
||||||
if m.Name() == "job" {
|
if m.Name() == "job" {
|
||||||
api.processJobEvent(m)
|
api.processJobEvent(m)
|
||||||
} else {
|
} else {
|
||||||
cclog.Warnf("NATS %s: unexpected measurement name '%s', expected 'job'", subject, m.Name())
|
cclog.Debugf("NATS %s: unexpected measurement name '%s', expected 'job'", subject, m.Name())
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -590,21 +590,24 @@ func (r *queryResolver) Jobs(ctx context.Context, filter []*model.JobFilter, pag
|
|||||||
|
|
||||||
// Note: Even if App-Default 'config.Keys.UiDefaults["job_list_usePaging"]' is set, always return hasNextPage boolean.
|
// Note: Even if App-Default 'config.Keys.UiDefaults["job_list_usePaging"]' is set, always return hasNextPage boolean.
|
||||||
// Users can decide in frontend to use continuous scroll, even if app-default is paging!
|
// Users can decide in frontend to use continuous scroll, even if app-default is paging!
|
||||||
|
// Skip if page.ItemsPerPage == -1 ("Load All" -> No Next Page required, Status Dashboards)
|
||||||
/*
|
/*
|
||||||
Example Page 4 @ 10 IpP : Does item 41 exist?
|
Example Page 4 @ 10 IpP : Does item 41 exist?
|
||||||
Minimal Page 41 @ 1 IpP : If len(result) is 1, Page 5 @ 10 IpP exists.
|
Minimal Page 41 @ 1 IpP : If len(result) is 1, Page 5 @ 10 IpP exists.
|
||||||
*/
|
*/
|
||||||
nextPage := &model.PageRequest{
|
hasNextPage := false
|
||||||
ItemsPerPage: 1,
|
if page.ItemsPerPage != -1 {
|
||||||
Page: ((page.Page * page.ItemsPerPage) + 1),
|
nextPage := &model.PageRequest{
|
||||||
|
ItemsPerPage: 1,
|
||||||
|
Page: ((page.Page * page.ItemsPerPage) + 1),
|
||||||
|
}
|
||||||
|
nextJobs, err := r.Repo.QueryJobs(ctx, filter, nextPage, order)
|
||||||
|
if err != nil {
|
||||||
|
cclog.Warn("Error while querying next jobs")
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
hasNextPage = len(nextJobs) == 1
|
||||||
}
|
}
|
||||||
nextJobs, err := r.Repo.QueryJobs(ctx, filter, nextPage, order)
|
|
||||||
if err != nil {
|
|
||||||
cclog.Warn("Error while querying next jobs")
|
|
||||||
return nil, err
|
|
||||||
}
|
|
||||||
|
|
||||||
hasNextPage := len(nextJobs) == 1
|
|
||||||
|
|
||||||
return &model.JobResultList{Items: jobs, Count: &count, HasNextPage: &hasNextPage}, nil
|
return &model.JobResultList{Items: jobs, Count: &count, HasNextPage: &hasNextPage}, nil
|
||||||
}
|
}
|
||||||
@@ -753,10 +756,16 @@ func (r *queryResolver) NodeMetrics(ctx context.Context, cluster string, nodes [
|
|||||||
return nil, errors.New("you need to be administrator or support staff for this query")
|
return nil, errors.New("you need to be administrator or support staff for this query")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
defaultMetrics := make([]string, 0)
|
||||||
|
for _, mc := range archive.GetCluster(cluster).MetricConfig {
|
||||||
|
defaultMetrics = append(defaultMetrics, mc.Name)
|
||||||
|
}
|
||||||
if metrics == nil {
|
if metrics == nil {
|
||||||
for _, mc := range archive.GetCluster(cluster).MetricConfig {
|
metrics = defaultMetrics
|
||||||
metrics = append(metrics, mc.Name)
|
} else {
|
||||||
}
|
metrics = slices.DeleteFunc(metrics, func(metric string) bool {
|
||||||
|
return !slices.Contains(defaultMetrics, metric) // Remove undefined metrics.
|
||||||
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
data, err := metricdispatch.LoadNodeData(cluster, metrics, nodes, scopes, from, to, ctx)
|
data, err := metricdispatch.LoadNodeData(cluster, metrics, nodes, scopes, from, to, ctx)
|
||||||
|
|||||||
@@ -791,7 +791,7 @@ func (r *JobRepository) FindRunningJobs(cluster string) ([]*schema.Job, error) {
|
|||||||
jobs = append(jobs, job)
|
jobs = append(jobs, job)
|
||||||
}
|
}
|
||||||
|
|
||||||
cclog.Infof("Return job count %d", len(jobs))
|
cclog.Debugf("JobRepository.FindRunningJobs(): Return job count %d (cluster: %s)", len(jobs), cluster)
|
||||||
return jobs, nil
|
return jobs, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -861,7 +861,7 @@ func (r *JobRepository) FindJobsBetween(startTimeBegin int64, startTimeEnd int64
|
|||||||
jobs = append(jobs, job)
|
jobs = append(jobs, job)
|
||||||
}
|
}
|
||||||
|
|
||||||
cclog.Infof("Return job count %d", len(jobs))
|
cclog.Debugf("JobRepository.FindJobsBetween(): Return job count %d (omitTagged: %v)", len(jobs), omitTagged)
|
||||||
return jobs, nil
|
return jobs, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -154,7 +154,7 @@ func (r *JobRepository) GetJobList(limit int, offset int) ([]int64, error) {
|
|||||||
jl = append(jl, id)
|
jl = append(jl, id)
|
||||||
}
|
}
|
||||||
|
|
||||||
cclog.Infof("Return job count %d", len(jl))
|
cclog.Debugf("JobRepository.GetJobList(): Return job count %d", len(jl))
|
||||||
return jl, nil
|
return jl, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -261,7 +261,7 @@ func RenderTemplate(rw http.ResponseWriter, file string, page *Page) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if page.Clusters == nil {
|
if page.Clusters == nil {
|
||||||
page.Clusters = make([]string, 2)
|
page.Clusters = make([]string, 0)
|
||||||
}
|
}
|
||||||
|
|
||||||
if page.SubClusters == nil {
|
if page.SubClusters == nil {
|
||||||
|
|||||||
Reference in New Issue
Block a user