fix(my-joy-beta): adapt to cloudapi-gql breaking changes

This commit is contained in:
Sérgio Ramos 2017-10-03 16:04:54 +01:00
parent d3baebd25f
commit 77540223ab
11 changed files with 35 additions and 36 deletions

View File

@ -16,18 +16,12 @@ import {
const { SmallOnly, Small } = QueryBreakpoints; const { SmallOnly, Small } = QueryBreakpoints;
const stateColor = { const stateColor = {
provisioning: 'blue', PROVISIONING: 'blue',
ready: 'blue', RUNNING: 'green',
active: 'green', STOPPING: 'grey',
running: 'green', STOPPED: 'grey',
stopping: 'grey', DELETED: 'secondaryActive',
stopped: 'grey', FAILED: 'red'
offline: 'red',
destroyed: 'red',
failed: 'red',
deleted: 'secondaryActive',
incomplete: 'secondaryActive',
unknown: 'secondaryActive'
}; };
export default ({ name, state, primaryIp, last, first }) => ( export default ({ name, state, primaryIp, last, first }) => (

View File

@ -11,6 +11,7 @@ import GetFirewallRules from '@graphql/list-firewall-rules.gql';
import { FirewallRule as InstanceFirewallRule } from '@components/instances'; import { FirewallRule as InstanceFirewallRule } from '@components/instances';
const Firewall = ({ const Firewall = ({
// eslint-disable-next-line camelcase
firewallEnabled = false, firewallEnabled = false,
firewallRules = [], firewallRules = [],
loading, loading,
@ -63,9 +64,11 @@ export default compose(
}), }),
props: ({ data: { loading, error, variables, ...rest } }) => { props: ({ data: { loading, error, variables, ...rest } }) => {
const machine = find(get(rest, 'machines', []), ['name', variables.name]); const machine = find(get(rest, 'machines', []), ['name', variables.name]);
const firewallEnabled = get(machine, 'firewallEnabled', false); // eslint-disable-next-line camelcase
const firewallRules = get(machine, 'firewallRules', []); const firewallEnabled = get(machine, 'firewall_enabled', false);
const firewallRules = get(machine, 'firewall_rules', []);
// eslint-disable-next-line camelcase
return { firewallEnabled, firewallRules, loading, error }; return { firewallEnabled, firewallRules, loading, error };
} }
}) })

View File

@ -81,7 +81,7 @@ export default compose(
[] []
); );
const metadata = Object.keys(values).reduce((all, name) => { const metadata = values.reduce((all, { name, value }) => {
const key = paramCase(name); const key = paramCase(name);
return { return {
@ -90,7 +90,7 @@ export default compose(
key, key,
formName: `${key}-name`, formName: `${key}-name`,
formValue: `${key}-value`, formValue: `${key}-value`,
value: values[name], value,
name name
} }
}; };

View File

@ -15,6 +15,8 @@ const Networks = ({ networks = [], loading, error }) => {
const _title = <Title>Networks</Title>; const _title = <Title>Networks</Title>;
const _loading = !(loading && !values.length) ? null : <StatusLoader />; const _loading = !(loading && !values.length) ? null : <StatusLoader />;
console.log(values);
const _networks = const _networks =
!_loading && !_loading &&
values.map((network, i, all) => ( values.map((network, i, all) => (

View File

@ -81,7 +81,7 @@ export default compose(
[] []
); );
const tags = Object.keys(values).reduce((all, name) => { const tags = values.reduce((all, { name, value }) => {
const key = paramCase(name); const key = paramCase(name);
return { return {
@ -90,7 +90,7 @@ export default compose(
key, key,
formName: `${key}-name`, formName: `${key}-name`,
formValue: `${key}-value`, formValue: `${key}-value`,
value: values[name], value,
name name
} }
}; };

View File

@ -2,14 +2,11 @@ query Instance($name: String!) {
machines(name: $name) { machines(name: $name) {
id id
name name
brand
state state
image
memory memory
disk disk
created created
updated updated
firewallEnabled firewall_enabled
package
} }
} }

View File

@ -2,8 +2,8 @@ query Instance($name: String!) {
machines(name: $name) { machines(name: $name) {
id id
name name
firewallEnabled firewall_enabled
firewallRules { firewall_rules {
id id
enabled enabled
global global

View File

@ -2,13 +2,9 @@ query Instances {
machines { machines {
id id
name name
brand
state state
image firewall_enabled
metadata primary_ip
tags
firewallEnabled
primaryIp
docker docker
} }
} }

View File

@ -2,6 +2,10 @@ query Instance($name: String!) {
machines(name: $name) { machines(name: $name) {
id id
name name
metadata metadata {
id
name
value
}
} }
} }

View File

@ -9,12 +9,11 @@ query Instance($name: String!) {
fabric fabric
description description
subnet subnet
provisionStartIp provision_start_ip
provisionEndIp provision_end_ip
gateway gateway
resolvers resolvers
routes internet_nat
internetNat
} }
} }
} }

View File

@ -2,6 +2,10 @@ query Instance($name: String!) {
machines(name: $name) { machines(name: $name) {
id id
name name
tags tags {
id
name
value
}
} }
} }