Regenerate GraphQL Server

This commit is contained in:
Jan Eitzinger 2023-05-04 11:29:53 +02:00
parent 4ae763ee1b
commit bb20ed655a
4 changed files with 22 additions and 84 deletions

View File

@ -3355,9 +3355,9 @@ func (ec *executionContext) _Job_walltime(ctx context.Context, field graphql.Col
} }
return graphql.Null return graphql.Null
} }
res := resTmp.(*int64) res := resTmp.(int64)
fc.Result = res fc.Result = res
return ec.marshalNInt2int64(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) { 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 return graphql.Null
} }
res := resTmp.(*int32) res := resTmp.(int32)
fc.Result = res fc.Result = res
return ec.marshalNInt2int32(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) { 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 return graphql.Null
} }
res := resTmp.(*int32) res := resTmp.(int32)
fc.Result = res fc.Result = res
return ec.marshalNInt2int32(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) { 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 return graphql.Null
} }
res := resTmp.(*int32) res := resTmp.(int32)
fc.Result = res fc.Result = res
return ec.marshalNInt2int32(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) { 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 return graphql.Null
} }
res := resTmp.(*string) res := resTmp.(string)
fc.Result = res fc.Result = res
return ec.marshalNString2string(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) { 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 return graphql.Null
} }
res := resTmp.(*int64) res := resTmp.(int64)
fc.Result = res fc.Result = res
return ec.marshalNInt2int64(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) { 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 { if resTmp == nil {
return graphql.Null return graphql.Null
} }
res := resTmp.(*string) res := resTmp.(string)
fc.Result = res fc.Result = res
return ec.marshalOString2string(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) { 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 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 { 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)) ret := make(graphql.Array, len(v))
var wg sync.WaitGroup var wg sync.WaitGroup
@ -14203,27 +14161,6 @@ func (ec *executionContext) marshalNString2ᚕstringᚄ(ctx context.Context, sel
return ret 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 { 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)) ret := make(graphql.Array, len(v))
var wg sync.WaitGroup var wg sync.WaitGroup

View File

@ -21,7 +21,7 @@
"Invalid list type provided!" "Invalid list type provided!"
); );
let filters; let filter = []
$: stats = queryStore({ $: stats = queryStore({
client: getContextClient(), client: getContextClient(),
@ -35,10 +35,11 @@
totalCoreHours totalCoreHours
} }
}`, }`,
variables: { filters }, variables: { filter },
pause: true pause: true
}); });
let filters;
let nameFilter = ""; let nameFilter = "";
let sorting = { field: "totalJobs", direction: "down" }; let sorting = { field: "totalJobs", direction: "down" };
@ -91,7 +92,7 @@
startTimeQuickSelect={true} startTimeQuickSelect={true}
menuText="Only {type.toLowerCase()}s with jobs that match the filters will show up" menuText="Only {type.toLowerCase()}s with jobs that match the filters will show up"
on:update={({ detail }) => { on:update={({ detail }) => {
filters = detail.filters; $stats.variables = { filter: detail.filters }
stats.resume(); stats.resume();
}} }}
/> />

View File

@ -29,7 +29,7 @@
let paging = { itemsPerPage, page } let paging = { itemsPerPage, page }
let filter = [] let filter = []
const jobs = queryStore({ $: jobs = queryStore({
client: getContextClient(), client: getContextClient(),
query: gql` query: gql`
query($filter: [JobFilter!]!, $sorting: OrderByInput!, $paging: PageRequest! ){ 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 $: matchedJobs = $jobs.data != null ? $jobs.data.jobs.count : 0
// (Re-)query and optionally set new filters. // (Re-)query and optionally set new filters.

View File

@ -1,6 +1,6 @@
import { expiringCacheExchange } from "./cache-exchange.js"; import { expiringCacheExchange } from "./cache-exchange.js";
import { import {
Client, CreateClient,
setContextClient, setContextClient,
fetchExchange, fetchExchange,
} from "@urql/svelte"; } from "@urql/svelte";
@ -22,7 +22,7 @@ export function init(extraInitQuery = "") {
? getContext("jwt") ? getContext("jwt")
: getContext("cc-config")["jwt"]; : getContext("cc-config")["jwt"];
const client = new Client({ const client = CreateClient({
url: `${window.location.origin}/query`, url: `${window.location.origin}/query`,
fetchOptions: fetchOptions:
jwt != null ? { headers: { Authorization: `Bearer ${jwt}` } } : {}, jwt != null ? { headers: { Authorization: `Bearer ${jwt}` } } : {},