mirror of
https://github.com/yldio/copilot.git
synced 2024-11-10 21:30:06 +02:00
fix(cp-gql-mock-server): schema compability
This commit is contained in:
parent
487f3dcc6d
commit
ead66d38e6
@ -1,11 +1,11 @@
|
|||||||
{
|
{
|
||||||
"datacenter": {
|
"datacenter": {
|
||||||
"uuid": "datacenter-uuid",
|
"id": "datacenter-uuid",
|
||||||
"region": "us-east-1"
|
"region": "us-east-1"
|
||||||
},
|
},
|
||||||
"portal": {
|
"portal": {
|
||||||
"user": {
|
"user": {
|
||||||
"uuid": "uuid",
|
"id": "id",
|
||||||
"login": "juditgreskovits",
|
"login": "juditgreskovits",
|
||||||
"firstName": "Judit",
|
"firstName": "Judit",
|
||||||
"lastName": "Greskovits",
|
"lastName": "Greskovits",
|
||||||
@ -14,24 +14,24 @@
|
|||||||
},
|
},
|
||||||
"deploymentGroups": [
|
"deploymentGroups": [
|
||||||
{
|
{
|
||||||
"uuid": "e0ea0c02-55cc-45fe-8064-3e5176a59401",
|
"id": "e0ea0c02-55cc-45fe-8064-3e5176a59401",
|
||||||
"slug": "forest-foundation-dev",
|
"slug": "forest-foundation-dev",
|
||||||
"name": "WarpRecords Blog"
|
"name": "WarpRecords Blog"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"uuid": "9fcb374d-a267-4c2a-9d9c-ba469b804639",
|
"id": "9fcb374d-a267-4c2a-9d9c-ba469b804639",
|
||||||
"slug": "forest-foundation-testing",
|
"slug": "forest-foundation-testing",
|
||||||
"name": "Forest Foundation Testing"
|
"name": "Forest Foundation Testing"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"uuid": "ac2c2498-e865-4ee3-9e26-8c75a81cbe25",
|
"id": "ac2c2498-e865-4ee3-9e26-8c75a81cbe25",
|
||||||
"slug": "forest-foundation-production",
|
"slug": "forest-foundation-production",
|
||||||
"name": "Forest Foundation Production"
|
"name": "Forest Foundation Production"
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"services": [
|
"services": [
|
||||||
{
|
{
|
||||||
"uuid": "081a792c-47e0-4439-924b-2efa9788ae9e",
|
"id": "081a792c-47e0-4439-924b-2efa9788ae9e",
|
||||||
"slug": "nginx",
|
"slug": "nginx",
|
||||||
"name": "Nginx",
|
"name": "Nginx",
|
||||||
"deploymentGroup": "e0ea0c02-55cc-45fe-8064-3e5176a59401",
|
"deploymentGroup": "e0ea0c02-55cc-45fe-8064-3e5176a59401",
|
||||||
@ -40,7 +40,7 @@
|
|||||||
]
|
]
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"uuid": "be227788-74f1-4e5b-a85f-b5c71cbae8d8",
|
"id": "be227788-74f1-4e5b-a85f-b5c71cbae8d8",
|
||||||
"slug": "wordpress",
|
"slug": "wordpress",
|
||||||
"name": "Wordpress",
|
"name": "Wordpress",
|
||||||
"deploymentGroup": "e0ea0c02-55cc-45fe-8064-3e5176a59401",
|
"deploymentGroup": "e0ea0c02-55cc-45fe-8064-3e5176a59401",
|
||||||
@ -51,57 +51,57 @@
|
|||||||
]
|
]
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"uuid": "6a0eee76-c019-413b-9d5f-44712b55b993",
|
"id": "6a0eee76-c019-413b-9d5f-44712b55b993",
|
||||||
"slug": "nfs",
|
"slug": "nfs",
|
||||||
"name": "NFS",
|
"name": "NFS",
|
||||||
"deploymentGroup": "e0ea0c02-55cc-45fe-8064-3e5176a59401"
|
"deploymentGroup": "e0ea0c02-55cc-45fe-8064-3e5176a59401"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"uuid": "6d31aff4-de1e-4042-a983-fbd23d5c530c",
|
"id": "6d31aff4-de1e-4042-a983-fbd23d5c530c",
|
||||||
"slug": "memcached",
|
"slug": "memcached",
|
||||||
"name": "Memcached",
|
"name": "Memcached",
|
||||||
"deploymentGroup": "e0ea0c02-55cc-45fe-8064-3e5176a59401"
|
"deploymentGroup": "e0ea0c02-55cc-45fe-8064-3e5176a59401"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"uuid": "4ee4103e-1a52-4099-a48e-01588f597c70",
|
"id": "4ee4103e-1a52-4099-a48e-01588f597c70",
|
||||||
"slug": "percona",
|
"slug": "percona",
|
||||||
"name": "Percona",
|
"name": "Percona",
|
||||||
"deploymentGroup": "e0ea0c02-55cc-45fe-8064-3e5176a59401"
|
"deploymentGroup": "e0ea0c02-55cc-45fe-8064-3e5176a59401"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"uuid": "9572d367-c4ae-4fb1-8ad5-f5e3830e7034",
|
"id": "9572d367-c4ae-4fb1-8ad5-f5e3830e7034",
|
||||||
"slug": "primary",
|
"slug": "primary",
|
||||||
"name": "Primary",
|
"name": "Primary",
|
||||||
"parent": "4ee4103e-1a52-4099-a48e-01588f597c70",
|
"parent": "4ee4103e-1a52-4099-a48e-01588f597c70",
|
||||||
"deploymentGroup": "e0ea0c02-55cc-45fe-8064-3e5176a59401"
|
"deploymentGroup": "e0ea0c02-55cc-45fe-8064-3e5176a59401"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"uuid": "c8411ef0-ab39-42cb-a704-d20b170eff31",
|
"id": "c8411ef0-ab39-42cb-a704-d20b170eff31",
|
||||||
"slug": "secondaries",
|
"slug": "secondaries",
|
||||||
"name": "Secondaries",
|
"name": "Secondaries",
|
||||||
"parent": "4ee4103e-1a52-4099-a48e-01588f597c70",
|
"parent": "4ee4103e-1a52-4099-a48e-01588f597c70",
|
||||||
"deploymentGroup": "e0ea0c02-55cc-45fe-8064-3e5176a59401"
|
"deploymentGroup": "e0ea0c02-55cc-45fe-8064-3e5176a59401"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"uuid": "97c68055-db88-45c9-ad49-f26da4264777",
|
"id": "97c68055-db88-45c9-ad49-f26da4264777",
|
||||||
"slug": "consul",
|
"slug": "consul",
|
||||||
"name": "Consul",
|
"name": "Consul",
|
||||||
"deploymentGroup": "e0ea0c02-55cc-45fe-8064-3e5176a59401"
|
"deploymentGroup": "e0ea0c02-55cc-45fe-8064-3e5176a59401"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"uuid": "primary-consul",
|
"id": "primary-consul",
|
||||||
"slug": "consul",
|
"slug": "consul",
|
||||||
"name": "Consul",
|
"name": "Consul",
|
||||||
"deploymentGroup": "9fcb374d-a267-4c2a-9d9c-ba469b804639"
|
"deploymentGroup": "9fcb374d-a267-4c2a-9d9c-ba469b804639"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"uuid": "primary-nginx",
|
"id": "primary-nginx",
|
||||||
"slug": "nginx",
|
"slug": "nginx",
|
||||||
"name": "Nginx",
|
"name": "Nginx",
|
||||||
"deploymentGroup": "9fcb374d-a267-4c2a-9d9c-ba469b804639"
|
"deploymentGroup": "9fcb374d-a267-4c2a-9d9c-ba469b804639"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"uuid": "primary-mongodb",
|
"id": "primary-mongodb",
|
||||||
"slug": "mongodb",
|
"slug": "mongodb",
|
||||||
"name": "MongoDB",
|
"name": "MongoDB",
|
||||||
"deploymentGroup": "9fcb374d-a267-4c2a-9d9c-ba469b804639"
|
"deploymentGroup": "9fcb374d-a267-4c2a-9d9c-ba469b804639"
|
||||||
@ -109,67 +109,67 @@
|
|||||||
],
|
],
|
||||||
"instances": [
|
"instances": [
|
||||||
{
|
{
|
||||||
"uuid": "309ecd9f-ac03-474b-aff7-4bd2e743296c",
|
"id": "309ecd9f-ac03-474b-aff7-4bd2e743296c",
|
||||||
"name": "wordpress_01",
|
"name": "wordpress_01",
|
||||||
"service": "be227788-74f1-4e5b-a85f-b5c71cbae8d8",
|
"service": "be227788-74f1-4e5b-a85f-b5c71cbae8d8",
|
||||||
"deploymentGroup": "e0ea0c02-55cc-45fe-8064-3e5176a59401"
|
"deploymentGroup": "e0ea0c02-55cc-45fe-8064-3e5176a59401"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"uuid": "0db6db53-de6f-4378-839e-5d5b452fbaf2",
|
"id": "0db6db53-de6f-4378-839e-5d5b452fbaf2",
|
||||||
"name": "nfs_01",
|
"name": "nfs_01",
|
||||||
"service": "6a0eee76-c019-413b-9d5f-44712b55b993",
|
"service": "6a0eee76-c019-413b-9d5f-44712b55b993",
|
||||||
"deploymentGroup": "e0ea0c02-55cc-45fe-8064-3e5176a59401"
|
"deploymentGroup": "e0ea0c02-55cc-45fe-8064-3e5176a59401"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"uuid": "250c8a6c-7d02-49a9-8abd-e1c22773041d",
|
"id": "250c8a6c-7d02-49a9-8abd-e1c22773041d",
|
||||||
"name": "consul",
|
"name": "consul",
|
||||||
"service": "97c68055-db88-45c9-ad49-f26da4264777",
|
"service": "97c68055-db88-45c9-ad49-f26da4264777",
|
||||||
"deploymentGroup": "e0ea0c02-55cc-45fe-8064-3e5176a59401"
|
"deploymentGroup": "e0ea0c02-55cc-45fe-8064-3e5176a59401"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"uuid": "2c921f3a-8bc3-4f57-9cd7-789ebae72061",
|
"id": "2c921f3a-8bc3-4f57-9cd7-789ebae72061",
|
||||||
"name": "memcache_01",
|
"name": "memcache_01",
|
||||||
"service": "6d31aff4-de1e-4042-a983-fbd23d5c530c",
|
"service": "6d31aff4-de1e-4042-a983-fbd23d5c530c",
|
||||||
"deploymentGroup": "e0ea0c02-55cc-45fe-8064-3e5176a59401"
|
"deploymentGroup": "e0ea0c02-55cc-45fe-8064-3e5176a59401"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"uuid": "68d3046e-8e34-4f5d-a0e5-db3795a250fd",
|
"id": "68d3046e-8e34-4f5d-a0e5-db3795a250fd",
|
||||||
"name": "memcache_02",
|
"name": "memcache_02",
|
||||||
"service": "6d31aff4-de1e-4042-a983-fbd23d5c530c",
|
"service": "6d31aff4-de1e-4042-a983-fbd23d5c530c",
|
||||||
"deploymentGroup": "e0ea0c02-55cc-45fe-8064-3e5176a59401"
|
"deploymentGroup": "e0ea0c02-55cc-45fe-8064-3e5176a59401"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"uuid": "2ea99763-3b44-4179-8393-d66d94961051",
|
"id": "2ea99763-3b44-4179-8393-d66d94961051",
|
||||||
"name": "memcache_03",
|
"name": "memcache_03",
|
||||||
"service": "6d31aff4-de1e-4042-a983-fbd23d5c530c",
|
"service": "6d31aff4-de1e-4042-a983-fbd23d5c530c",
|
||||||
"deploymentGroup": "e0ea0c02-55cc-45fe-8064-3e5176a59401"
|
"deploymentGroup": "e0ea0c02-55cc-45fe-8064-3e5176a59401"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"uuid": "25f6bc62-63b8-4959-908e-1f6d7ff6341d",
|
"id": "25f6bc62-63b8-4959-908e-1f6d7ff6341d",
|
||||||
"name": "memcache_04",
|
"name": "memcache_04",
|
||||||
"service": "6d31aff4-de1e-4042-a983-fbd23d5c530c",
|
"service": "6d31aff4-de1e-4042-a983-fbd23d5c530c",
|
||||||
"deploymentGroup": "e0ea0c02-55cc-45fe-8064-3e5176a59401"
|
"deploymentGroup": "e0ea0c02-55cc-45fe-8064-3e5176a59401"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"uuid": "8be01042-0281-4a77-a357-25979e87bf3d",
|
"id": "8be01042-0281-4a77-a357-25979e87bf3d",
|
||||||
"name": "memcache_05",
|
"name": "memcache_05",
|
||||||
"service": "6d31aff4-de1e-4042-a983-fbd23d5c530c",
|
"service": "6d31aff4-de1e-4042-a983-fbd23d5c530c",
|
||||||
"deploymentGroup": "e0ea0c02-55cc-45fe-8064-3e5176a59401"
|
"deploymentGroup": "e0ea0c02-55cc-45fe-8064-3e5176a59401"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"uuid": "3d652e9d-73e8-4a6f-8171-84fa83740662",
|
"id": "3d652e9d-73e8-4a6f-8171-84fa83740662",
|
||||||
"name": "nginx",
|
"name": "nginx",
|
||||||
"service": "081a792c-47e0-4439-924b-2efa9788ae9e",
|
"service": "081a792c-47e0-4439-924b-2efa9788ae9e",
|
||||||
"deploymentGroup": "e0ea0c02-55cc-45fe-8064-3e5176a59401"
|
"deploymentGroup": "e0ea0c02-55cc-45fe-8064-3e5176a59401"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"uuid": "c3ec7633-a02b-4615-86a0-9e6faeaae94b",
|
"id": "c3ec7633-a02b-4615-86a0-9e6faeaae94b",
|
||||||
"name": "percona-primary",
|
"name": "percona-primary",
|
||||||
"service": "4ee4103e-1a52-4099-a48e-01588f597c70",
|
"service": "4ee4103e-1a52-4099-a48e-01588f597c70",
|
||||||
"deploymentGroup": "e0ea0c02-55cc-45fe-8064-3e5176a59401"
|
"deploymentGroup": "e0ea0c02-55cc-45fe-8064-3e5176a59401"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"uuid": "c2b5fec2-31e2-41a7-b7fc-cd0bb1822e76",
|
"id": "c2b5fec2-31e2-41a7-b7fc-cd0bb1822e76",
|
||||||
"name": "percona-secondary",
|
"name": "percona-secondary",
|
||||||
"service": "4ee4103e-1a52-4099-a48e-01588f597c70",
|
"service": "4ee4103e-1a52-4099-a48e-01588f597c70",
|
||||||
"deploymentGroup": "e0ea0c02-55cc-45fe-8064-3e5176a59401"
|
"deploymentGroup": "e0ea0c02-55cc-45fe-8064-3e5176a59401"
|
||||||
|
@ -13,7 +13,7 @@ const cleanQuery = (q = {}) => JSON.parse(JSON.stringify(q));
|
|||||||
|
|
||||||
const getServiceInstances = s =>
|
const getServiceInstances = s =>
|
||||||
Object.assign({}, s, {
|
Object.assign({}, s, {
|
||||||
instances: instances.filter(find({ service: s.uuid })).map(s =>
|
instances: instances.filter(find({ service: s.id })).map(s =>
|
||||||
Object.assign({}, s, {
|
Object.assign({}, s, {
|
||||||
slug: s.name
|
slug: s.name
|
||||||
})
|
})
|
||||||
@ -23,7 +23,7 @@ const getServiceInstances = s =>
|
|||||||
const getDeploymentGroupServices = dg =>
|
const getDeploymentGroupServices = dg =>
|
||||||
Object.assign({}, dg, {
|
Object.assign({}, dg, {
|
||||||
services: services
|
services: services
|
||||||
.filter(find({ deploymentGroup: dg.uuid }))
|
.filter(find({ deploymentGroup: dg.id }))
|
||||||
.map(getServiceInstances)
|
.map(getServiceInstances)
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -32,21 +32,18 @@ const getDeploymentGroups = query =>
|
|||||||
.filter(find(cleanQuery(query)))
|
.filter(find(cleanQuery(query)))
|
||||||
.map(getDeploymentGroupServices);
|
.map(getDeploymentGroupServices);
|
||||||
|
|
||||||
const getPortal = () =>
|
const getPortal = () => Object.assign({}, portal, {
|
||||||
Object.assign({}, portal, {
|
datacenter,
|
||||||
datacenter,
|
deploymentGroups: getDeploymentGroups()
|
||||||
deploymentGroups: getDeploymentGroups()
|
});
|
||||||
});
|
|
||||||
|
|
||||||
const getServices = query =>
|
const getServices = query =>
|
||||||
services.filter(find(query)).map(getDeploymentGroupServices);
|
services.filter(find(query)).map(getDeploymentGroupServices);
|
||||||
|
|
||||||
module.exports = {
|
module.exports = {
|
||||||
Query: {
|
portal: (options, request, fn) => fn(null, getPortal()),
|
||||||
portal: getPortal,
|
deploymentGroups: (options, request, fn) => fn(null, getDeploymentGroups(options)),
|
||||||
deploymentGroups: getDeploymentGroups,
|
deploymentGroup: (options, request, fn) => fn(null, getDeploymentGroups(options).shift()),
|
||||||
deploymentGroup: query => getDeploymentGroups(query).shift(),
|
services: (options, request, fn) => fn(null, getServices()),
|
||||||
services: getServices,
|
service: (options, request, fn) => fn(null, getServices(options).shift())
|
||||||
service: query => getServices(query).shift()
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
Loading…
Reference in New Issue
Block a user