debian-mirror-gitlab/app/assets/javascripts/environments/graphql/client.js

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

89 lines
2.1 KiB
JavaScript
Raw Normal View History

2021-12-11 22:18:48 +05:30
import VueApollo from 'vue-apollo';
import createDefaultClient from '~/lib/graphql';
2022-01-26 12:08:38 +05:30
import environmentApp from './queries/environment_app.query.graphql';
import pageInfoQuery from './queries/page_info.query.graphql';
2022-05-07 20:08:51 +05:30
import environmentToDeleteQuery from './queries/environment_to_delete.query.graphql';
import environmentToRollbackQuery from './queries/environment_to_rollback.query.graphql';
import environmentToStopQuery from './queries/environment_to_stop.query.graphql';
2021-12-11 22:18:48 +05:30
import { resolvers } from './resolvers';
import typeDefs from './typedefs.graphql';
export const apolloProvider = (endpoint) => {
const defaultClient = createDefaultClient(resolvers(endpoint), {
typeDefs,
});
const { cache } = defaultClient;
cache.writeQuery({
query: environmentApp,
data: {
availableCount: 0,
environments: [],
reviewApp: {},
stoppedCount: 0,
},
});
2022-01-26 12:08:38 +05:30
cache.writeQuery({
query: pageInfoQuery,
data: {
pageInfo: {
total: 0,
perPage: 20,
nextPage: 0,
previousPage: 0,
__typename: 'LocalPageInfo',
},
},
});
2022-05-07 20:08:51 +05:30
cache.writeQuery({
query: environmentToDeleteQuery,
data: {
environmentToDelete: {
name: 'null',
__typename: 'LocalEnvironment',
id: '0',
deletePath: null,
folderPath: null,
retryUrl: null,
autoStopPath: null,
lastDeployment: null,
},
},
});
cache.writeQuery({
query: environmentToStopQuery,
data: {
environmentToStop: {
name: 'null',
__typename: 'LocalEnvironment',
id: '0',
deletePath: null,
folderPath: null,
retryUrl: null,
autoStopPath: null,
lastDeployment: null,
},
},
});
cache.writeQuery({
query: environmentToRollbackQuery,
data: {
environmentToRollback: {
name: 'null',
__typename: 'LocalEnvironment',
id: '0',
deletePath: null,
folderPath: null,
retryUrl: null,
autoStopPath: null,
lastDeployment: null,
},
},
});
2021-12-11 22:18:48 +05:30
return new VueApollo({
defaultClient,
});
};