diff options
Diffstat (limited to 'app/assets/javascripts/ci/catalog/graphql/settings.js')
-rw-r--r-- | app/assets/javascripts/ci/catalog/graphql/settings.js | 44 |
1 files changed, 27 insertions, 17 deletions
diff --git a/app/assets/javascripts/ci/catalog/graphql/settings.js b/app/assets/javascripts/ci/catalog/graphql/settings.js index a87b26ca4fc..4038188a7ce 100644 --- a/app/assets/javascripts/ci/catalog/graphql/settings.js +++ b/app/assets/javascripts/ci/catalog/graphql/settings.js @@ -1,32 +1,42 @@ -import { componentsMockData } from '../constants'; +import getCurrentPage from './queries/client/get_current_page.query.graphql'; export const ciCatalogResourcesItemsCount = 20; export const CI_CATALOG_RESOURCE_TYPE = 'Ci::Catalog::Resource'; export const cacheConfig = { - cacheConfig: { - typePolicies: { - Query: { - fields: { - ciCatalogResource(_, { args, toReference }) { - return toReference({ - __typename: 'CiCatalogResource', - id: args.id, - }); - }, - ciCatalogResources: { - keyArgs: false, - }, + typePolicies: { + Query: { + fields: { + ciCatalogResource(_, { args, toReference }) { + return toReference({ + __typename: 'CiCatalogResource', + // Webpath is the fullpath with a leading slash + webPath: `/${args.fullPath}`, + }); + }, + ciCatalogResources: { + keyArgs: false, }, }, }, + CiCatalogResource: { + keyFields: ['webPath'], + }, }, }; export const resolvers = { - CiCatalogResource: { - components() { - return componentsMockData; + Mutation: { + updateCurrentPage: (_, { pageNumber }, { cache }) => { + cache.writeQuery({ + query: getCurrentPage, + data: { + page: { + __typename: 'CatalogPage', + current: pageNumber, + }, + }, + }); }, }, }; |