mirror of
https://github.com/ClusterCockpit/cc-backend
synced 2024-12-26 05:19:05 +01:00
Add requireField cases to resolver
This commit is contained in:
parent
c84b819212
commit
69519ec040
@ -248,7 +248,8 @@ func (r *queryResolver) JobsStatistics(ctx context.Context, filter []*model.JobF
|
|||||||
var err error
|
var err error
|
||||||
var stats []*model.JobsStatistics
|
var stats []*model.JobsStatistics
|
||||||
|
|
||||||
if requireField(ctx, "totalJobs") {
|
if requireField(ctx, "totalJobs") || requireField(ctx, "totalNodes") || requireField(ctx, "totalCores") || requireField(ctx, "totalAccs") ||
|
||||||
|
requireField(ctx, "totalNodeHours") || requireField(ctx, "totalCoreHours") || requireField(ctx, "totalAccHours") {
|
||||||
if groupBy == nil {
|
if groupBy == nil {
|
||||||
stats, err = r.Repo.JobsStats(ctx, filter)
|
stats, err = r.Repo.JobsStats(ctx, filter)
|
||||||
} else {
|
} else {
|
||||||
|
@ -77,7 +77,7 @@
|
|||||||
client: client,
|
client: client,
|
||||||
query: gql`
|
query: gql`
|
||||||
query($jobFilters: [JobFilter!]!, $paging: PageRequest!) {
|
query($jobFilters: [JobFilter!]!, $paging: PageRequest!) {
|
||||||
jobsStatistics(filter: $jobFilters, page: $paging, sortBy: COREHOURS, groupBy: USER) {
|
topUser: jobsStatistics(filter: $jobFilters, page: $paging, sortBy: COREHOURS, groupBy: USER) {
|
||||||
id
|
id
|
||||||
totalCoreHours
|
totalCoreHours
|
||||||
}
|
}
|
||||||
@ -177,8 +177,8 @@
|
|||||||
<Pie
|
<Pie
|
||||||
size={colWidth1}
|
size={colWidth1}
|
||||||
sliceLabel='Core Hours'
|
sliceLabel='Core Hours'
|
||||||
quantities={$topQuery.data.jobsStatistics.map((tu) => tu.totalCoreHours)}
|
quantities={$topQuery.data.topUser.map((tu) => tu.totalCoreHours)}
|
||||||
entities={$topQuery.data.jobsStatistics.map((tu) => tu.id)}
|
entities={$topQuery.data.topUser.map((tu) => tu.id)}
|
||||||
/>
|
/>
|
||||||
{/key}
|
{/key}
|
||||||
</div>
|
</div>
|
||||||
@ -186,7 +186,7 @@
|
|||||||
<Col>
|
<Col>
|
||||||
<Table>
|
<Table>
|
||||||
<tr class="mb-2"><th>Legend</th><th>User Name</th><th>Core Hours</th></tr>
|
<tr class="mb-2"><th>Legend</th><th>User Name</th><th>Core Hours</th></tr>
|
||||||
{#each $topQuery.data.jobsStatistics as { id, totalCoreHours }, i}
|
{#each $topQuery.data.topUser as { id, totalCoreHours }, i}
|
||||||
<tr>
|
<tr>
|
||||||
<td><Icon name="circle-fill" style="color: {colors[i]};"/></td>
|
<td><Icon name="circle-fill" style="color: {colors[i]};"/></td>
|
||||||
<th scope="col"><a href="/monitoring/user/{id}?cluster={cluster.name}">{id}</a></th>
|
<th scope="col"><a href="/monitoring/user/{id}?cluster={cluster.name}">{id}</a></th>
|
||||||
|
Loading…
Reference in New Issue
Block a user