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 stateColor = {
provisioning: 'blue',
ready: 'blue',
active: 'green',
running: 'green',
stopping: 'grey',
stopped: 'grey',
offline: 'red',
destroyed: 'red',
failed: 'red',
deleted: 'secondaryActive',
incomplete: 'secondaryActive',
unknown: 'secondaryActive'
PROVISIONING: 'blue',
RUNNING: 'green',
STOPPING: 'grey',
STOPPED: 'grey',
DELETED: 'secondaryActive',
FAILED: 'red'
};
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';
const Firewall = ({
// eslint-disable-next-line camelcase
firewallEnabled = false,
firewallRules = [],
loading,
@ -63,9 +64,11 @@ export default compose(
}),
props: ({ data: { loading, error, variables, ...rest } }) => {
const machine = find(get(rest, 'machines', []), ['name', variables.name]);
const firewallEnabled = get(machine, 'firewallEnabled', false);
const firewallRules = get(machine, 'firewallRules', []);
// eslint-disable-next-line camelcase
const firewallEnabled = get(machine, 'firewall_enabled', false);
const firewallRules = get(machine, 'firewall_rules', []);
// eslint-disable-next-line camelcase
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);
return {
@ -90,7 +90,7 @@ export default compose(
key,
formName: `${key}-name`,
formValue: `${key}-value`,
value: values[name],
value,
name
}
};

View File

@ -15,6 +15,8 @@ const Networks = ({ networks = [], loading, error }) => {
const _title = <Title>Networks</Title>;
const _loading = !(loading && !values.length) ? null : <StatusLoader />;
console.log(values);
const _networks =
!_loading &&
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);
return {
@ -90,7 +90,7 @@ export default compose(
key,
formName: `${key}-name`,
formValue: `${key}-value`,
value: values[name],
value,
name
}
};

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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