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
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
|
import VueApollo from 'vue-apollo';
import createDefaultClient from '~/lib/graphql';
import typeDefs from '~/environments/graphql/typedefs.graphql';
import k8sPodsQuery from './queries/k8s_dashboard_pods.query.graphql';
import k8sDeploymentsQuery from './queries/k8s_dashboard_deployments.query.graphql';
import k8sStatefulSetsQuery from './queries/k8s_dashboard_stateful_sets.query.graphql';
import k8sReplicaSetsQuery from './queries/k8s_dashboard_replica_sets.query.graphql';
import k8sDaemonSetsQuery from './queries/k8s_dashboard_daemon_sets.query.graphql';
import { resolvers } from './resolvers';
export const apolloProvider = () => {
const defaultClient = createDefaultClient(resolvers, {
typeDefs,
});
const { cache } = defaultClient;
cache.writeQuery({
query: k8sPodsQuery,
data: {
metadata: {
name: null,
namespace: null,
creationTimestamp: null,
labels: null,
annotations: null,
},
status: {
phase: null,
},
},
});
cache.writeQuery({
query: k8sDeploymentsQuery,
data: {
metadata: {
name: null,
namespace: null,
creationTimestamp: null,
labels: null,
annotations: null,
},
status: {
conditions: null,
},
},
});
cache.writeQuery({
query: k8sStatefulSetsQuery,
data: {
metadata: {
name: null,
namespace: null,
creationTimestamp: null,
labels: null,
annotations: null,
},
status: {
readyReplicas: null,
},
spec: {
replicas: null,
},
},
});
cache.writeQuery({
query: k8sReplicaSetsQuery,
data: {
metadata: {
name: null,
namespace: null,
creationTimestamp: null,
labels: null,
annotations: null,
},
status: {
readyReplicas: null,
},
spec: {
replicas: null,
},
},
});
cache.writeQuery({
query: k8sDaemonSetsQuery,
data: {
metadata: {
name: null,
namespace: null,
creationTimestamp: null,
labels: null,
annotations: null,
},
status: {
numberMisscheduled: null,
numberReady: null,
desiredNumberScheduled: null,
},
},
});
return new VueApollo({
defaultClient,
});
};
|