Skip to content

Commit

Permalink
feat: add buildimage boolean to allopenshift/k8s query
Browse files Browse the repository at this point in the history
  • Loading branch information
shreddedbacon committed Nov 8, 2023
1 parent e09177d commit 0b0715f
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 5 deletions.
12 changes: 9 additions & 3 deletions services/api/src/resources/openshift/resolvers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -111,15 +111,21 @@ export const deleteOpenshift: ResolverFn = async (

export const getAllOpenshifts: ResolverFn = async (
root,
{ disabled },
{ disabled, buildImage },
{ sqlClientPool, hasPermission }
) => {
await hasPermission('openshift', 'viewAll');

let queryBuilder = knex('openshift');
if (buildImage) {
queryBuilder = queryBuilder.and.whereNot('build_image', '');
}

if (disabled != null) {
return query(sqlClientPool, knex('openshift').where('disabled', disabled).toString());
queryBuilder = queryBuilder.where('disabled', disabled);
}
return query(sqlClientPool, knex('openshift').toString());

return query(sqlClientPool, queryBuilder.toString());
};

export const getOpenshiftByProjectId: ResolverFn = async (
Expand Down
4 changes: 2 additions & 2 deletions services/api/src/typeDefs.js
Original file line number Diff line number Diff line change
Expand Up @@ -1339,11 +1339,11 @@ const typeDefs = gql`
"""
Returns all OpenShift Objects
"""
allOpenshifts(disabled: Boolean): [Openshift]
allOpenshifts(disabled: Boolean, buildImage: Boolean): [Openshift]
"""
Returns all Kubernetes Objects
"""
allKubernetes(disabled: Boolean): [Kubernetes]
allKubernetes(disabled: Boolean, buildImage: Boolean): [Kubernetes]
"""
Returns all Environments matching given filter (all if no filter defined)
"""
Expand Down

0 comments on commit 0b0715f

Please sign in to comment.