From bb20ed655acbd878efc9a444ee5a5383d753523c Mon Sep 17 00:00:00 2001 From: Jan Eitzinger Date: Thu, 4 May 2023 11:29:53 +0200 Subject: [PATCH] Regenerate GraphQL Server --- internal/graph/generated/generated.go | 91 ++++--------------------- web/frontend/src/List.root.svelte | 7 +- web/frontend/src/joblist/JobList.svelte | 4 +- web/frontend/src/utils.js | 4 +- 4 files changed, 22 insertions(+), 84 deletions(-) diff --git a/internal/graph/generated/generated.go b/internal/graph/generated/generated.go index db6902a..050c96b 100644 --- a/internal/graph/generated/generated.go +++ b/internal/graph/generated/generated.go @@ -3355,9 +3355,9 @@ func (ec *executionContext) _Job_walltime(ctx context.Context, field graphql.Col } return graphql.Null } - res := resTmp.(*int64) + res := resTmp.(int64) fc.Result = res - return ec.marshalNInt2ᚖint64(ctx, field.Selections, res) + return ec.marshalNInt2int64(ctx, field.Selections, res) } func (ec *executionContext) fieldContext_Job_walltime(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { @@ -3443,9 +3443,9 @@ func (ec *executionContext) _Job_numHWThreads(ctx context.Context, field graphql } return graphql.Null } - res := resTmp.(*int32) + res := resTmp.(int32) fc.Result = res - return ec.marshalNInt2ᚖint32(ctx, field.Selections, res) + return ec.marshalNInt2int32(ctx, field.Selections, res) } func (ec *executionContext) fieldContext_Job_numHWThreads(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { @@ -3487,9 +3487,9 @@ func (ec *executionContext) _Job_numAcc(ctx context.Context, field graphql.Colle } return graphql.Null } - res := resTmp.(*int32) + res := resTmp.(int32) fc.Result = res - return ec.marshalNInt2ᚖint32(ctx, field.Selections, res) + return ec.marshalNInt2int32(ctx, field.Selections, res) } func (ec *executionContext) fieldContext_Job_numAcc(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { @@ -3531,9 +3531,9 @@ func (ec *executionContext) _Job_SMT(ctx context.Context, field graphql.Collecte } return graphql.Null } - res := resTmp.(*int32) + res := resTmp.(int32) fc.Result = res - return ec.marshalNInt2ᚖint32(ctx, field.Selections, res) + return ec.marshalNInt2int32(ctx, field.Selections, res) } func (ec *executionContext) fieldContext_Job_SMT(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { @@ -3619,9 +3619,9 @@ func (ec *executionContext) _Job_partition(ctx context.Context, field graphql.Co } return graphql.Null } - res := resTmp.(*string) + res := resTmp.(string) fc.Result = res - return ec.marshalNString2ᚖstring(ctx, field.Selections, res) + return ec.marshalNString2string(ctx, field.Selections, res) } func (ec *executionContext) fieldContext_Job_partition(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { @@ -3663,9 +3663,9 @@ func (ec *executionContext) _Job_arrayJobId(ctx context.Context, field graphql.C } return graphql.Null } - res := resTmp.(*int64) + res := resTmp.(int64) fc.Result = res - return ec.marshalNInt2ᚖint64(ctx, field.Selections, res) + return ec.marshalNInt2int64(ctx, field.Selections, res) } func (ec *executionContext) fieldContext_Job_arrayJobId(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { @@ -8739,9 +8739,9 @@ func (ec *executionContext) _Unit_prefix(ctx context.Context, field graphql.Coll if resTmp == nil { return graphql.Null } - res := resTmp.(*string) + res := resTmp.(string) fc.Result = res - return ec.marshalOString2ᚖstring(ctx, field.Selections, res) + return ec.marshalOString2string(ctx, field.Selections, res) } func (ec *executionContext) fieldContext_Unit_prefix(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { @@ -13593,48 +13593,6 @@ func (ec *executionContext) marshalNInt2ᚖint(ctx context.Context, sel ast.Sele return res } -func (ec *executionContext) unmarshalNInt2ᚖint32(ctx context.Context, v interface{}) (*int32, error) { - res, err := graphql.UnmarshalInt32(v) - return &res, graphql.ErrorOnPath(ctx, err) -} - -func (ec *executionContext) marshalNInt2ᚖint32(ctx context.Context, sel ast.SelectionSet, v *int32) graphql.Marshaler { - if v == nil { - if !graphql.HasFieldError(ctx, graphql.GetFieldContext(ctx)) { - ec.Errorf(ctx, "the requested element is null which the schema does not allow") - } - return graphql.Null - } - res := graphql.MarshalInt32(*v) - if res == graphql.Null { - if !graphql.HasFieldError(ctx, graphql.GetFieldContext(ctx)) { - ec.Errorf(ctx, "the requested element is null which the schema does not allow") - } - } - return res -} - -func (ec *executionContext) unmarshalNInt2ᚖint64(ctx context.Context, v interface{}) (*int64, error) { - res, err := graphql.UnmarshalInt64(v) - return &res, graphql.ErrorOnPath(ctx, err) -} - -func (ec *executionContext) marshalNInt2ᚖint64(ctx context.Context, sel ast.SelectionSet, v *int64) graphql.Marshaler { - if v == nil { - if !graphql.HasFieldError(ctx, graphql.GetFieldContext(ctx)) { - ec.Errorf(ctx, "the requested element is null which the schema does not allow") - } - return graphql.Null - } - res := graphql.MarshalInt64(*v) - if res == graphql.Null { - if !graphql.HasFieldError(ctx, graphql.GetFieldContext(ctx)) { - ec.Errorf(ctx, "the requested element is null which the schema does not allow") - } - } - return res -} - func (ec *executionContext) marshalNJob2ᚕᚖgithubᚗcomᚋClusterCockpitᚋccᚑbackendᚋpkgᚋschemaᚐJobᚄ(ctx context.Context, sel ast.SelectionSet, v []*schema.Job) graphql.Marshaler { ret := make(graphql.Array, len(v)) var wg sync.WaitGroup @@ -14203,27 +14161,6 @@ func (ec *executionContext) marshalNString2ᚕstringᚄ(ctx context.Context, sel return ret } -func (ec *executionContext) unmarshalNString2ᚖstring(ctx context.Context, v interface{}) (*string, error) { - res, err := graphql.UnmarshalString(v) - return &res, graphql.ErrorOnPath(ctx, err) -} - -func (ec *executionContext) marshalNString2ᚖstring(ctx context.Context, sel ast.SelectionSet, v *string) graphql.Marshaler { - if v == nil { - if !graphql.HasFieldError(ctx, graphql.GetFieldContext(ctx)) { - ec.Errorf(ctx, "the requested element is null which the schema does not allow") - } - return graphql.Null - } - res := graphql.MarshalString(*v) - if res == graphql.Null { - if !graphql.HasFieldError(ctx, graphql.GetFieldContext(ctx)) { - ec.Errorf(ctx, "the requested element is null which the schema does not allow") - } - } - return res -} - func (ec *executionContext) marshalNSubCluster2ᚕᚖgithubᚗcomᚋClusterCockpitᚋccᚑbackendᚋpkgᚋschemaᚐSubClusterᚄ(ctx context.Context, sel ast.SelectionSet, v []*schema.SubCluster) graphql.Marshaler { ret := make(graphql.Array, len(v)) var wg sync.WaitGroup diff --git a/web/frontend/src/List.root.svelte b/web/frontend/src/List.root.svelte index e7fb8e1..87a678d 100644 --- a/web/frontend/src/List.root.svelte +++ b/web/frontend/src/List.root.svelte @@ -21,7 +21,7 @@ "Invalid list type provided!" ); - let filters; + let filter = [] $: stats = queryStore({ client: getContextClient(), @@ -35,10 +35,11 @@ totalCoreHours } }`, - variables: { filters }, + variables: { filter }, pause: true }); + let filters; let nameFilter = ""; let sorting = { field: "totalJobs", direction: "down" }; @@ -91,7 +92,7 @@ startTimeQuickSelect={true} menuText="Only {type.toLowerCase()}s with jobs that match the filters will show up" on:update={({ detail }) => { - filters = detail.filters; + $stats.variables = { filter: detail.filters } stats.resume(); }} /> diff --git a/web/frontend/src/joblist/JobList.svelte b/web/frontend/src/joblist/JobList.svelte index b4a1b59..5985db5 100644 --- a/web/frontend/src/joblist/JobList.svelte +++ b/web/frontend/src/joblist/JobList.svelte @@ -29,7 +29,7 @@ let paging = { itemsPerPage, page } let filter = [] - const jobs = queryStore({ + $: jobs = queryStore({ client: getContextClient(), query: gql` query($filter: [JobFilter!]!, $sorting: OrderByInput!, $paging: PageRequest! ){ @@ -60,7 +60,7 @@ }) } - $: $jobs.variables = { ...$jobs.variables, sorting, paging } + // $: $jobs.variables = { ...$jobs.variables, sorting, paging } $: matchedJobs = $jobs.data != null ? $jobs.data.jobs.count : 0 // (Re-)query and optionally set new filters. diff --git a/web/frontend/src/utils.js b/web/frontend/src/utils.js index ee10e7d..73c1575 100644 --- a/web/frontend/src/utils.js +++ b/web/frontend/src/utils.js @@ -1,6 +1,6 @@ import { expiringCacheExchange } from "./cache-exchange.js"; import { - Client, + CreateClient, setContextClient, fetchExchange, } from "@urql/svelte"; @@ -22,7 +22,7 @@ export function init(extraInitQuery = "") { ? getContext("jwt") : getContext("cc-config")["jwt"]; - const client = new Client({ + const client = CreateClient({ url: `${window.location.origin}/query`, fetchOptions: jwt != null ? { headers: { Authorization: `Bearer ${jwt}` } } : {},