From b3463e7dabc3478baae1e7eaef1b66025d239682 Mon Sep 17 00:00:00 2001 From: JUDIT GRESKOVITS Date: Tue, 16 May 2017 18:25:45 +0100 Subject: [PATCH] Update graphql schema --- frontend/src/app.js | 16 +++- frontend/src/index.css | 5 -- frontend/src/index.js | 1 - spikes/graphql/graphql-server/src/schema.js | 89 ++++++++++++++------- 4 files changed, 73 insertions(+), 38 deletions(-) delete mode 100644 frontend/src/index.css diff --git a/frontend/src/app.js b/frontend/src/app.js index 3c1d420b..bbc9cec9 100644 --- a/frontend/src/app.js +++ b/frontend/src/app.js @@ -3,16 +3,28 @@ import { ApolloProvider } from 'react-apollo'; import { client, store } from '@state/store'; import Router from '@root/router'; +import { injectGlobal } from 'styled-components'; +import Base, { global } from '@ui/components/base'; + class App extends Component { + + componentWillMount() { + injectGlobal` + ${global} + `; + } + render() { return ( -
+
{Router} -
+
); } } + + export default App; diff --git a/frontend/src/index.css b/frontend/src/index.css deleted file mode 100644 index b4cc7250..00000000 --- a/frontend/src/index.css +++ /dev/null @@ -1,5 +0,0 @@ -body { - margin: 0; - padding: 0; - font-family: sans-serif; -} diff --git a/frontend/src/index.js b/frontend/src/index.js index 61a23971..aa1e0ec8 100644 --- a/frontend/src/index.js +++ b/frontend/src/index.js @@ -1,7 +1,6 @@ import React from 'react'; import ReactDOM from 'react-dom'; import App from './app'; -import './index.css'; ReactDOM.render( , diff --git a/spikes/graphql/graphql-server/src/schema.js b/spikes/graphql/graphql-server/src/schema.js index 43e57e6a..434e4116 100644 --- a/spikes/graphql/graphql-server/src/schema.js +++ b/spikes/graphql/graphql-server/src/schema.js @@ -4,6 +4,7 @@ import resolvers from './resolvers'; const schema = ` scalar Date +scalar Object type Portal { username: String! @@ -15,25 +16,52 @@ type Portal { type DeploymentGroup { uuid: String! name: String! - pathName: String! + slug: String! datacenter: Datacenter! services: [Service]! - state: DeploymentState - version: Manifest! - history: [Manifest]! + version: Version! + history: [Version]! } -type DeploymentState { - current: String +type ServiceScale { + name: String! + replicas: Int! +} + +enum ConvergenceActionType { + NOOP + CREATE + RECREATE + START + } + + type ConvergenceAction { + uuid: String! + type: ConvergenceActionType! + service: String! # service name + machines: [String]! # instance machine ids + } + + type StateConvergencePlan { + uuid: String! + running: Boolean! + actions: [ConvergenceAction]! + } + +type Version { + created: Date! + manifest: Manifest! + scale: [ServiceScale]! + plan: StateConvergencePlan } type Manifest { uuid: String! created: Date! - created: Date! type: String! format: String! raw: String! + obj: Object! } type CurrentMetric { @@ -44,14 +72,12 @@ type CurrentMetric { # immutable type Service { - uuid: String! - hash: String! - deploymentGoup: String! - version: Manifest! - name: String! - pathName: String! + uuid: String! # unique id for db row + hash: String! # unique id for version of service + name: String! # human readable name + slug: String! instances: [Instance]! - metrics: [MetricType]! + # metrics: [MetricType]! currentMetrics: [CurrentMetric]! connections: [String!] # list of serviceUuids parent: String # parent service uuid @@ -64,12 +90,6 @@ type MetricType { id: String! } -# This is ui / dashboard config data - to be stored separately -type ServiceMetric { # name? - metricType: MetricType! - pinned: Boolean! -} - # for metrics max / min (I guess) type Package { type: String! @@ -78,13 +98,21 @@ type Package { vCPUs: Float! # This should be a number / double, not an int } +enum InstanceStatus { + CREATED + RESTARTING + RUNNING + PAUSED + EXITED + DELETED +} + type Instance { uuid: String! name: String! - id: String! - deploymentGoup: String! - service: String! - metrics: [InstanceMetric]! + machineId: String! + status: InstanceStatus! + # metrics: [InstanceMetric]! } type InstanceMetric { @@ -99,18 +127,19 @@ type MetricData { type Datacenter { uuid: String! - id: String! + slug: String! location: String! } +# Need to review queries type Query { portal: Portal deploymentGroups: [DeploymentGroup] - deploymentGroup(uuid: String, pathName: String): DeploymentGroup - services(deploymentGroupUuid: String, deploymentGroupPathName: String): [Service] - service(uuid: String, pathName: String): Service - instances(serviceUuid: String, servicePathName: String): [Instance] - instance(uuid: String, id: String): Instance + deploymentGroup(uuid: String, slug: String): DeploymentGroup + services(deploymentGroupUuid: String, deploymentGroupSlug: String): [Service] + service(uuid: String, slug: String): Service + instances(serviceUuid: String, serviceSlug: String): [Instance] + instance(uuid: String, machineId: String): Instance metricTypes: [MetricType] metricData(instanceUuid: String!, metricType: String!, from: Date!, to: Date!): [InstanceMetric]! package: Package