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

client.js « graphql « kubernetes_dashboard « javascripts « assets « app - gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 9454465df9d1754a529c23b032b265ad50082eaa (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
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
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
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 k8sJobsQuery from './queries/k8s_dashboard_jobs.query.graphql';
import k8sCronJobsQuery from './queries/k8s_dashboard_cron_jobs.query.graphql';
import k8sServicesQuery from './queries/k8s_dashboard_services.query.graphql';
import { resolvers } from './resolvers';

export const apolloProvider = () => {
  const defaultClient = createDefaultClient(resolvers, {
    typeDefs,
  });
  const { cache } = defaultClient;

  const metadata = {
    name: null,
    namespace: null,
    creationTimestamp: null,
    labels: null,
    annotations: null,
  };

  cache.writeQuery({
    query: k8sPodsQuery,
    data: {
      metadata,
      status: {
        phase: null,
      },
    },
  });

  cache.writeQuery({
    query: k8sDeploymentsQuery,
    data: {
      metadata,
      status: {
        conditions: null,
      },
    },
  });

  cache.writeQuery({
    query: k8sStatefulSetsQuery,
    data: {
      metadata,
      status: {
        readyReplicas: null,
      },
      spec: {
        replicas: null,
      },
    },
  });

  cache.writeQuery({
    query: k8sReplicaSetsQuery,
    data: {
      metadata,
      status: {
        readyReplicas: null,
      },
      spec: {
        replicas: null,
      },
    },
  });

  cache.writeQuery({
    query: k8sDaemonSetsQuery,
    data: {
      metadata,
      status: {
        numberMisscheduled: null,
        numberReady: null,
        desiredNumberScheduled: null,
      },
    },
  });

  cache.writeQuery({
    query: k8sJobsQuery,
    data: {
      metadata,
      status: {
        failed: null,
        succeeded: null,
      },
      spec: {
        completions: null,
      },
    },
  });

  cache.writeQuery({
    query: k8sCronJobsQuery,
    data: {
      metadata,
      status: {
        active: null,
        lastScheduleTime: null,
      },
      spec: {
        suspend: null,
      },
    },
  });

  cache.writeQuery({
    query: k8sServicesQuery,
    data: {
      metadata,
      spec: {
        type: null,
        clusterIP: null,
        externalIP: null,
        ports: null,
      },
    },
  });

  return new VueApollo({
    defaultClient,
  });
};