Welcome to mirror list, hosted at ThFree Co, Russian Federation.

settings.js « graphql « catalog « ci « javascripts « assets « app - gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 4038188a7ce6ba5f05466b87e3e8a10d3cfb2dc2 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
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 = {
  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 = {
  Mutation: {
    updateCurrentPage: (_, { pageNumber }, { cache }) => {
      cache.writeQuery({
        query: getCurrentPage,
        data: {
          page: {
            __typename: 'CatalogPage',
            current: pageNumber,
          },
        },
      });
    },
  },
};