Update resolvers accoring to latest schema
This commit is contained in:
parent
aa8bdf5eb2
commit
4b2e0f53ae
@ -1,5 +1,5 @@
|
|||||||
fragment DeploymentGroupInfo on DeploymentGroup {
|
fragment DeploymentGroupInfo on DeploymentGroup {
|
||||||
uuid
|
uuid
|
||||||
name
|
name
|
||||||
pathName
|
slug
|
||||||
}
|
}
|
||||||
|
@ -1,8 +1,8 @@
|
|||||||
#import "./DeploymentGroupInfo.gql"
|
#import "./DeploymentGroupInfo.gql"
|
||||||
#import "./ServiceInfo.gql"
|
#import "./ServiceInfo.gql"
|
||||||
|
|
||||||
query Instances($deploymentGroupPathName: String!) {
|
query Instances($deploymentGroupSlug: String!) {
|
||||||
deploymentGroup(pathName: $deploymentGroupPathName) {
|
deploymentGroup(slug: $deploymentGroupSlug) {
|
||||||
...DeploymentGroupInfo
|
...DeploymentGroupInfo
|
||||||
services {
|
services {
|
||||||
...ServiceInfo
|
...ServiceInfo
|
||||||
|
@ -1,25 +0,0 @@
|
|||||||
query Instances($deploymentGroupId: String!){
|
|
||||||
deploymentGroup(id: $deploymentGroupId) {
|
|
||||||
uuid
|
|
||||||
id
|
|
||||||
name
|
|
||||||
services {
|
|
||||||
uuid
|
|
||||||
id
|
|
||||||
name
|
|
||||||
instances {
|
|
||||||
uuid
|
|
||||||
name
|
|
||||||
metrics {
|
|
||||||
type {
|
|
||||||
id
|
|
||||||
}
|
|
||||||
data {
|
|
||||||
timestamp
|
|
||||||
value
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,7 +1,6 @@
|
|||||||
query Portal {
|
query Portal {
|
||||||
portal {
|
portal {
|
||||||
username
|
username
|
||||||
host
|
|
||||||
datacenter {
|
datacenter {
|
||||||
id
|
id
|
||||||
}
|
}
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
fragment ServiceInfo on Service {
|
fragment ServiceInfo on Service {
|
||||||
uuid
|
uuid
|
||||||
name
|
name
|
||||||
pathName
|
slug
|
||||||
}
|
}
|
||||||
|
@ -1,8 +1,8 @@
|
|||||||
#import "./DeploymentGroupInfo.gql"
|
#import "./DeploymentGroupInfo.gql"
|
||||||
#import "./ServiceInfo.gql"
|
#import "./ServiceInfo.gql"
|
||||||
|
|
||||||
query Services($deploymentGroupPathName: String!){
|
query Services($deploymentGroupSlug: String!){
|
||||||
deploymentGroup(pathName: $deploymentGroupPathName) {
|
deploymentGroup(slug: $deploymentGroupSlug) {
|
||||||
...DeploymentGroupInfo
|
...DeploymentGroupInfo
|
||||||
services {
|
services {
|
||||||
...ServiceInfo
|
...ServiceInfo
|
||||||
|
@ -1,8 +1,8 @@
|
|||||||
#import "./DeploymentGroupInfo.gql"
|
#import "./DeploymentGroupInfo.gql"
|
||||||
#import "./ServiceInfo.gql"
|
#import "./ServiceInfo.gql"
|
||||||
|
|
||||||
query Instances($deploymentGroupPathName: String!){
|
query Instances($deploymentGroupSlug: String!){
|
||||||
deploymentGroup(pathName: $deploymentGroupPathName) {
|
deploymentGroup(slug: $deploymentGroupSlug) {
|
||||||
...DeploymentGroupInfo
|
...DeploymentGroupInfo
|
||||||
services {
|
services {
|
||||||
...ServiceInfo
|
...ServiceInfo
|
||||||
|
@ -3,7 +3,7 @@ query SingleMetrics {
|
|||||||
type {
|
type {
|
||||||
uuid
|
uuid
|
||||||
name
|
name
|
||||||
id
|
machineId
|
||||||
}
|
}
|
||||||
data {
|
data {
|
||||||
timestamp
|
timestamp
|
||||||
|
@ -5,11 +5,11 @@ import { normalMetricData, leakMetricData } from './mock-data/metrics';
|
|||||||
const datacenters = data.datacenters.data;
|
const datacenters = data.datacenters.data;
|
||||||
const portal = { username: 'juditgreskovits', host: 'dockerhost', datacenter: datacenters[0]};
|
const portal = { username: 'juditgreskovits', host: 'dockerhost', datacenter: datacenters[0]};
|
||||||
const deploymentGroups = data.projects.data.map(p => {
|
const deploymentGroups = data.projects.data.map(p => {
|
||||||
p.pathName = p.id;
|
p.slug = p.id;
|
||||||
return p;
|
return p;
|
||||||
});
|
});
|
||||||
const services = data.services.data.map(s => {
|
const services = data.services.data.map(s => {
|
||||||
s.pathName = s.id;
|
s.slug = s.id;
|
||||||
return s;
|
return s;
|
||||||
});
|
});
|
||||||
const instances = data.instances.data;
|
const instances = data.instances.data;
|
||||||
@ -28,24 +28,61 @@ const resolveFunctions = {
|
|||||||
portal() {
|
portal() {
|
||||||
return portal;
|
return portal;
|
||||||
},
|
},
|
||||||
deploymentGroups() {
|
|
||||||
|
deploymentGroups(_, { name, slug }) {
|
||||||
return deploymentGroups;
|
return deploymentGroups;
|
||||||
},
|
},
|
||||||
deploymentGroup(_, { uuid, pathName }) {
|
deploymentGroup(_, { uuid, name, slug }) {
|
||||||
if(uuid) {
|
if(uuid) {
|
||||||
return find(deploymentGroups, { uuid: uuid });
|
return find(deploymentGroups, { uuid: uuid });
|
||||||
}
|
}
|
||||||
if(pathName) {
|
if(slug) {
|
||||||
return find(deploymentGroups, { pathName: pathName });
|
return find(deploymentGroups, { slug: slug });
|
||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
},
|
},
|
||||||
services(_, { deploymentGroupUuid=null, deploymentGroupPathName=null }) {
|
|
||||||
|
serviceScales(_, { serviceName, versionUuid }) { // : [ServiceScale]
|
||||||
|
return [];
|
||||||
|
},
|
||||||
|
serviceScale(_, { uuid }) { // : ServiceScale
|
||||||
|
return {};
|
||||||
|
},
|
||||||
|
|
||||||
|
convergenceActions(_, { type, service, versionUuid }) { // : [ConvergenceAction]
|
||||||
|
return [];
|
||||||
|
},
|
||||||
|
convergenceAction(uuid) { // : ConvergenceAction
|
||||||
|
return {};
|
||||||
|
},
|
||||||
|
|
||||||
|
stateConvergencePlans(_, { running, versionUuid }) { // : [StateConvergencePlan]
|
||||||
|
return [];
|
||||||
|
},
|
||||||
|
stateConvergencePlan(_, { uuid }) { // : StateConvergencePlan
|
||||||
|
return [];
|
||||||
|
},
|
||||||
|
|
||||||
|
versions(_, { manifestUuid, deploymentGroupUuid }) { // : [Version]
|
||||||
|
return [];
|
||||||
|
},
|
||||||
|
version(_, { uuid, manifestUuid }) { // : Version
|
||||||
|
return null;
|
||||||
|
},
|
||||||
|
|
||||||
|
manifests(_, { type, deploymentGroupUuid }) { // : [Manifest]
|
||||||
|
return [];
|
||||||
|
},
|
||||||
|
manifest(_, { uuid }) { // : Manifest
|
||||||
|
return null;
|
||||||
|
},
|
||||||
|
|
||||||
|
services(_, { name, slug, parentUuid, deploymentGroupUuid, deploymentGroupSlug }) { // }: [Service]
|
||||||
if(deploymentGroupUuid) {
|
if(deploymentGroupUuid) {
|
||||||
return filter(services, { project: deploymentGroupUuid });
|
return filter(services, { project: deploymentGroupUuid });
|
||||||
}
|
}
|
||||||
if(deploymentGroupPathName) {
|
if(deploymentGroupSlug) {
|
||||||
const deploymentGroup = find(deploymentGroups, { pathName: deploymentGroupPathName });
|
const deploymentGroup = find(deploymentGroups, { slug: deploymentGroupSlug });
|
||||||
if(deploymentGroup) {
|
if(deploymentGroup) {
|
||||||
return filter(services, { project: deploymentGroup.uuid });
|
return filter(services, { project: deploymentGroup.uuid });
|
||||||
}
|
}
|
||||||
@ -53,21 +90,29 @@ const resolveFunctions = {
|
|||||||
}
|
}
|
||||||
return services;
|
return services;
|
||||||
},
|
},
|
||||||
service(_, { uuid, pathName }) {
|
service(_, { uuid, hash }) { // : Service
|
||||||
if(uuid) {
|
if(uuid) {
|
||||||
return find(services, { uuid: uuid });
|
return find(services, { uuid: uuid });
|
||||||
}
|
}
|
||||||
if(pathName) {
|
if(hash) {
|
||||||
return find(services, { pathName: pathName });
|
return find(services, { hash: hash });
|
||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
},
|
},
|
||||||
instances(_, { serviceUuid=null, servicePathName=null }) {
|
|
||||||
|
packages(_, { name, type, memory, disk, swap, lwps, vcpus, version, group }) { // : [Package]
|
||||||
|
return [];
|
||||||
|
},
|
||||||
|
package(_, { uuid }) { // : Package
|
||||||
|
return {};
|
||||||
|
},
|
||||||
|
|
||||||
|
instances(_, { name, machineId, status, serviceUuid, serviceSlug, deploymentGroupUuid, deploymentGroupSlug }) { // : [Instance]
|
||||||
if(serviceUuid) {
|
if(serviceUuid) {
|
||||||
return filter(instances, { service: serviceUuid });
|
return filter(instances, { service: serviceUuid });
|
||||||
}
|
}
|
||||||
if(serviceId) {
|
if(serviceSlug) {
|
||||||
const service = find(services, { pathName: servicePathName });
|
const service = find(services, { slug: serviceSlug });
|
||||||
if(service) {
|
if(service) {
|
||||||
return filter(instances, { service: service.uuid });
|
return filter(instances, { service: service.uuid });
|
||||||
}
|
}
|
||||||
@ -75,11 +120,21 @@ const resolveFunctions = {
|
|||||||
}
|
}
|
||||||
return instances;
|
return instances;
|
||||||
},
|
},
|
||||||
metricTypes() {
|
instance(_, { uuid }) { // : Instance
|
||||||
return metricTypes;
|
if(uuid) {
|
||||||
|
return find(instances, { uuid: uuid });
|
||||||
|
}
|
||||||
},
|
},
|
||||||
datacenters() {
|
|
||||||
return datacenters;
|
datacenter() {
|
||||||
|
return {
|
||||||
|
uuid: 'datacenter-uuid',
|
||||||
|
region: 'us-east-1'
|
||||||
|
};
|
||||||
|
},
|
||||||
|
|
||||||
|
/*metricTypes() {
|
||||||
|
return metricTypes;
|
||||||
},
|
},
|
||||||
// tmp test
|
// tmp test
|
||||||
instanceMetric() {
|
instanceMetric() {
|
||||||
@ -91,7 +146,7 @@ const resolveFunctions = {
|
|||||||
},
|
},
|
||||||
data: getInstanceMetricData(leakMetricData, 'node_memory_rss_bytes')
|
data: getInstanceMetricData(leakMetricData, 'node_memory_rss_bytes')
|
||||||
};
|
};
|
||||||
}
|
}*/
|
||||||
},
|
},
|
||||||
Portal: {
|
Portal: {
|
||||||
deploymentGroups(portal) {
|
deploymentGroups(portal) {
|
||||||
@ -107,12 +162,12 @@ const resolveFunctions = {
|
|||||||
instances(service) {
|
instances(service) {
|
||||||
return filter(instances, { service: service.uuid });
|
return filter(instances, { service: service.uuid });
|
||||||
},
|
},
|
||||||
metrics(service) {
|
/*metrics(service) {
|
||||||
return service.metrics ?
|
return service.metrics ?
|
||||||
service.metrics.map((metric) =>
|
service.metrics.map((metric) =>
|
||||||
find(metricTypes, { uuid: metric.type })) : [];
|
find(metricTypes, { uuid: metric.type })) : [];
|
||||||
},
|
},*/
|
||||||
currentMetrics(service) {
|
/*currentMetrics(service) {
|
||||||
// tmp
|
// tmp
|
||||||
return [{
|
return [{
|
||||||
"name": "CPU",
|
"name": "CPU",
|
||||||
@ -127,9 +182,9 @@ const resolveFunctions = {
|
|||||||
"value": 2.9,
|
"value": 2.9,
|
||||||
"measurement": "Kb/sec",
|
"measurement": "Kb/sec",
|
||||||
}];
|
}];
|
||||||
|
},*/
|
||||||
},
|
},
|
||||||
},
|
/*Instance: {
|
||||||
Instance: {
|
|
||||||
metrics(instance) {
|
metrics(instance) {
|
||||||
return ([{
|
return ([{
|
||||||
type: {
|
type: {
|
||||||
@ -140,7 +195,7 @@ const resolveFunctions = {
|
|||||||
data: normalMetricData.node_memory_rss_bytes
|
data: normalMetricData.node_memory_rss_bytes
|
||||||
}]);
|
}]);
|
||||||
}
|
}
|
||||||
}
|
}*/
|
||||||
};
|
};
|
||||||
|
|
||||||
export default resolveFunctions;
|
export default resolveFunctions;
|
||||||
|
0
spikes/graphql/graphql-server/src/schema.gql
Normal file
0
spikes/graphql/graphql-server/src/schema.gql
Normal file
@ -166,9 +166,9 @@ type Query {
|
|||||||
# we probably wont use some of these queries or arguments
|
# we probably wont use some of these queries or arguments
|
||||||
# but this way we expose the entire db through gql
|
# but this way we expose the entire db through gql
|
||||||
type Query {
|
type Query {
|
||||||
portal(): Portal
|
portal: Portal
|
||||||
deploymentGroups(name: String, slug: String): [DeploymentGroup]
|
deploymentGroups(name: String, slug: String): [DeploymentGroup]
|
||||||
deploymentGroup(uuid: ID, name: String, slug: String): DeploymentGroup # WE ARE DISCUSSING THIS
|
deploymentGroup(uuid: ID, name: String, slug: String): DeploymentGroup
|
||||||
serviceScales(serviceName: String, versionUuid: ID): [ServiceScale]
|
serviceScales(serviceName: String, versionUuid: ID): [ServiceScale]
|
||||||
serviceScale(uuid: ID!): ServiceScale
|
serviceScale(uuid: ID!): ServiceScale
|
||||||
convergenceActions(type: ConvergenceActionType, service: String, versionUuid: ID): [ConvergenceAction]
|
convergenceActions(type: ConvergenceActionType, service: String, versionUuid: ID): [ConvergenceAction]
|
||||||
@ -176,33 +176,33 @@ type Query {
|
|||||||
stateConvergencePlans(running: Boolean, versionUuid: ID): [StateConvergencePlan]
|
stateConvergencePlans(running: Boolean, versionUuid: ID): [StateConvergencePlan]
|
||||||
stateConvergencePlan(uuid: ID!): StateConvergencePlan
|
stateConvergencePlan(uuid: ID!): StateConvergencePlan
|
||||||
versions(manifestUuid: ID, deploymentGroupUuid: ID): [Version]
|
versions(manifestUuid: ID, deploymentGroupUuid: ID): [Version]
|
||||||
version(uuid: ID, manifestUuid: ID): Version # WE ARE DISCUSSING THIS
|
version(uuid: ID, manifestUuid: ID): Version
|
||||||
manifests(type: String, deploymentGroupUuid: ID): [Manifest]
|
manifests(type: String, deploymentGroupUuid: ID): [Manifest]
|
||||||
manifest(uuid: ID!): Manifest
|
manifest(uuid: ID!): Manifest
|
||||||
services(name: String, slug: String, parent: ID, deploymentGroupUuid: ID): [Service]
|
services(name: String, slug: String, parentUuid: ID, deploymentGroupUuid: ID, deploymentGroupSlug: String): [Service]
|
||||||
service(uuid: ID, hash: ID): Service # WE ARE DISCUSSING THIS
|
service(uuid: ID, hash: ID): Service
|
||||||
packages(name: String, type: String, memory: Int, disk: Int, swap: Int, lwps: Int, vcpus: Int, version: String, group: String): [Package]
|
packages(name: String, type: String, memory: Int, disk: Int, swap: Int, lwps: Int, vcpus: Int, version: String, group: String): [Package]
|
||||||
package(uuid: ID!): Package
|
package(uuid: ID!): Package
|
||||||
instances(name: String!, machineId: ID, status: InstanceStatus, serviceUuid: ID, deploymentGroupUuid: ID): [Instance]
|
instances(name: String!, machineId: ID, status: InstanceStatus, serviceUuid: ID, serviceSlug: String, deploymentGroupUuid: ID, deploymentGroupSlug: String): [Instance]
|
||||||
instance(uuid: ID!): Instance
|
instance(uuid: ID!): Instance
|
||||||
datacenter(uuid: ID, region: String): Datacenter
|
datacenter(uuid: ID, region: String): Datacenter
|
||||||
}
|
}
|
||||||
|
|
||||||
type Mutation {
|
type Mutation {
|
||||||
createDeploymentGroup(name: String!)
|
createDeploymentGroup(name: String!) : DeploymentGroup
|
||||||
updateDeploymentGroup(uuid: ID!, name: String!)
|
updateDeploymentGroup(uuid: ID!, name: String!) : DeploymentGroup
|
||||||
|
|
||||||
provisionManifest(deploymentGroupUuid: ID!, type: ManifestType!, format: ManifestFormat!, raw: String!)
|
provisionManifest(deploymentGroupUuid: ID!, type: ManifestType!, format: ManifestFormat!, raw: String!) : Version
|
||||||
scale(service: ID!, replicas: Int!)
|
scale(service: ID!, replicas: Int!) : Version
|
||||||
|
|
||||||
stopServices(uuids: [ID]!)
|
stopServices(uuids: [ID]!) : [Service]
|
||||||
startServices(uuids: [ID]!)
|
startServices(uuids: [ID]!) : [Service]
|
||||||
restartServices(uuids: [ID]!)
|
restartServices(uuids: [ID]!) : [Service]
|
||||||
deleteServices(uuids: [ID]!)
|
deleteServices(uuids: [ID]!) : [Service]
|
||||||
|
|
||||||
stopInstances(uuids: [ID]!)
|
stopInstances(uuids: [ID]!) : [Instance]
|
||||||
startInstances(uuids: [ID]!)
|
startInstances(uuids: [ID]!) : [Instance]
|
||||||
restartInstances(uuids: [ID]!)
|
restartInstances(uuids: [ID]!) : [Instance]
|
||||||
|
|
||||||
# reprovision() ???
|
# reprovision() ???
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user