fix(my-joy-beta): don't require proceeded to deploy

# Conflicts:
#	packages/my-joy-beta/src/containers/create-instance/index.js
#	packages/my-joy-beta/src/containers/create-instance/tags.js
#	yarn.lock
This commit is contained in:
Sérgio Ramos 2018-02-21 16:22:30 +00:00
parent 234a481c32
commit 929fcf0ab4
14 changed files with 381 additions and 317 deletions

View File

@ -46,6 +46,7 @@
"lodash.reverse": "^4.0.1",
"lodash.sortby": "^4.7.0",
"lodash.uniqby": "^4.7.0",
"lodash.values": "^4.3.0",
"lunr": "^2.1.5",
"normalized-styled-components": "^1.0.18",
"param-case": "^2.1.1",

View File

@ -12,7 +12,6 @@ import { AffinityIcon, Button, H3, Divider, KeyValue } from 'joyent-ui-toolkit';
import Title from '@components/create-instance/title';
import { Rule, Header } from '@components/create-instance/affinity';
import Animated from '@containers/create-instance/animated';
import Description from '@components/description';
const FORM_NAME_CREATE = 'CREATE-INSTANCE-AFFINITY-ADD';
@ -149,13 +148,19 @@ export const Affinity = ({
);
export default compose(
Animated,
connect(({ values, form }, ownProps) => ({
proceeded: get(values, 'create-instance-affinity-proceeded', false),
addOpen: get(values, 'create-instance-affinity-add-open', false),
affinityRules: get(values, 'create-instance-affinity', []),
rule: get(form, `${FORM_NAME_CREATE}.values`, {})
})),
connect(({ values, form }, ownProps) => {
const proceeded = get(values, 'create-instance-affinity-proceeded', false);
const addOpen = get(values, 'create-instance-affinity-add-open', false);
const affinityRules = get(values, 'create-instance-affinity', []);
const rule = get(form, `${FORM_NAME_CREATE}.values`, {});
return {
proceeded: proceeded || affinityRules.length,
addOpen,
affinityRules,
rule,
};
}),
connect(null, (dispatch, { affinityRules = [], history }) => ({
handleEdit: () => {
return history.push(`/~create/affinity${history.location.search}`);

View File

@ -11,7 +11,6 @@ import punycode from 'punycode';
import { CnsIcon, H3, Button } from 'joyent-ui-toolkit';
import Title from '@components/create-instance/title';
import Animated from '@containers/create-instance/animated';
import Cns, { Footer, AddServiceForm } from '@components/cns';
import Description from '@components/description';
import GetAccount from '@graphql/get-account.gql';
@ -102,13 +101,13 @@ const CNSContainer = ({
);
export default compose(
Animated,
graphql(GetAccount, {
props: ({ data: { account: { id = '<account-id>' } = [] } }) => ({
id
})
}),
connect(({ form, values }, { id }) => {
const proceeded = get(values, `${CNS_FORM}-proceeded`, false);
const instanceName = get(
form,
'create-instance-name.values.name',
@ -154,7 +153,7 @@ export default compose(
return {
cnsEnabled: get(values, `${CNS_FORM}-enabled`, true),
instanceName,
proceeded: get(values, `${CNS_FORM}-proceeded`, false),
proceeded: proceeded || serviceNames.length,
hostnames,
serviceNames
};

View File

@ -19,7 +19,6 @@ import {
} from '@components/firewall';
import Title from '@components/create-instance/title';
import Animated from '@containers/create-instance/animated';
import Description from '@components/description';
import Empty from '@components/empty';
import ListFwRules from '@graphql/list-fw-rules.gql';
@ -150,7 +149,6 @@ const Firewall = ({
);
export default compose(
Animated,
connect(
({ form, values }, ownProps) => ({
...ownProps,

View File

@ -16,7 +16,6 @@ import { InstanceTypeIcon, StatusLoader, Button } from 'joyent-ui-toolkit';
import Image, { Preview, ImageType } from '@components/create-instance/image';
import Title from '@components/create-instance/title';
import Animated from '@containers/create-instance/animated';
import Description from '@components/description';
import imageData from '@data/images-map.json';
import GetImages from '@graphql/get-images.gql';
@ -122,14 +121,17 @@ const ImageContainer = ({
);
export default compose(
Animated,
connect(
({ form, values }, ownProps) => {
const proceeded = get(values, 'create-instance-image-proceeded', false);
const vms = get(form, 'create-instance-vms.values.vms', false);
const image = get(form, 'create-instance-image.values.image', null);
return {
...ownProps,
proceeded: get(values, 'create-instance-image-proceeded', false),
vms: get(form, 'create-instance-vms.values.vms', false),
image: get(form, 'create-instance-image.values.image', null)
proceeded: proceeded || image,
vms,
image
};
},
(dispatch, { history }) => ({

View File

@ -11,6 +11,7 @@ import intercept from 'apr-intercept';
import constantCase from 'constant-case';
import queryString from 'query-string';
import get from 'lodash.get';
import Values from 'lodash.values';
import omit from 'lodash.omit';
import uniqBy from 'lodash.uniqby';
@ -131,61 +132,46 @@ export default compose(
const query = queryString.parse(location.search);
const FORM_NAME = 'create-instance-name';
const step = get(match, 'params.step', 'name');
const nameFilled = get(form, `${FORM_NAME}.values.name`, '');
const disabled = ['name', 'image', 'package', 'networks'].some(
step =>
!get(values, `create-instance-${step}-proceeded`, false) ||
!nameFilled.length
const name = get(form, `${FORM_NAME}.values.name`, '');
const image = get(form, 'create-instance-image.values.image', '');
const pkg = get(form, 'create-instance-package.values.package', '');
const networks = get(form, 'CREATE-INSTANCE-NETWORKS.values', {});
const enabled = (
name.length &&
image.length &&
pkg.length &&
Values(networks).filter(Boolean).length
);
if (disabled) {
if (!enabled) {
return {
query,
disabled,
disabled: !enabled,
step
};
}
const name = get(
form,
'create-instance-name.values.name',
'<instance-name>'
);
const firewall_enabled = get(
form,
'CREATE-INSTANCE-FIREWALL.values.enabled',
false
);
const image = get(
form,
'create-instance-image.values.image',
'<instance-image>'
);
const pkg = get(
form,
'create-instance-package.values.package',
'<instance-pkg>'
);
const networks = get(form, 'CREATE-INSTANCE-NETWORKS.values', {});
const metadata = get(values, 'create-instance-metadata', []);
const receivedTags = get(values, 'create-instance-tags', []);
const affinity = get(values, 'create-instance-affinity', []);
const cns = get(values, 'create-instance-cns-enabled', true);
const cnsServices = get(values, 'create-instance-cns-services', null);
const userScript = get(values, 'create-instance-user-script', {});
const tags = receivedTags.map(a => omit(a, 'expanded'));
tags.push({ name: 'triton.cns.disable', value: !cns });
const firewall_enabled = get(form, 'CREATE-INSTANCE-FIREWALL.values.enabled', false);
tags.push({
name: 'triton.cns.disable',
value: !cns
});
if (cnsServices && cns) {
tags.push({ name: 'triton.cns.services', value: cnsServices.join(',') });
tags.push({
name: 'triton.cns.services',
value: cnsServices.join(',')
});
}
return {
@ -200,7 +186,6 @@ export default compose(
tags,
firewall_enabled,
networks,
disabled,
step
};
}),

View File

@ -12,7 +12,6 @@ import { MetadataIcon, Button, H3, Divider, KeyValue } from 'joyent-ui-toolkit';
import Editor from 'joyent-ui-toolkit/dist/es/editor';
import Title from '@components/create-instance/title';
import Animated from '@containers/create-instance/animated';
import Description from '@components/description';
const FORM_NAME_CREATE = 'CREATE-INSTANCE-METADATA-ADD';
@ -145,12 +144,17 @@ export const Metadata = ({
);
export default compose(
Animated,
connect(({ values }, ownProps) => ({
proceeded: get(values, 'create-instance-metadata-proceeded', false),
addOpen: get(values, 'create-instance-metadata-add-open', false),
metadata: get(values, 'create-instance-metadata', [])
})),
connect(({ values }, ownProps) => {
const proceeded = get(values, 'create-instance-metadata-proceeded', false);
const addOpen = get(values, 'create-instance-metadata-add-open', false);
const metadata = get(values, 'create-instance-metadata', []);
return {
proceeded: proceeded || metadata.length,
addOpen,
metadata
};
}),
connect(null, (dispatch, { metadata = [], history }) => ({
handleNext: () => {
dispatch(

View File

@ -12,7 +12,6 @@ import punycode from 'punycode';
import { NameIcon, H3, Button } from 'joyent-ui-toolkit';
import Title from '@components/create-instance/title';
import Animated from '@containers/create-instance/animated';
import Name from '@components/create-instance/name';
import Description from '@components/description';
import GetInstance from '@graphql/get-instance-small.gql';
@ -89,7 +88,6 @@ const NameContainer = ({
);
export default compose(
Animated,
graphql(GetRandomName, {
fetchPolicy: 'network-only',
props: ({ data }) => ({
@ -109,7 +107,7 @@ export default compose(
return {
...ownProps,
proceeded,
proceeded: proceeded || name.length,
randomizing,
name
};

View File

@ -6,13 +6,13 @@ import { connect } from 'react-redux';
import { Margin } from 'styled-components-spacing';
import forceArray from 'force-array';
import includes from 'lodash.includes';
import find from 'lodash.find';
import get from 'lodash.get';
import { NetworkIcon, Button, H3, StatusLoader } from 'joyent-ui-toolkit';
import Title from '@components/create-instance/title';
import Network from '@components/create-instance/network';
import Animated from '@containers/create-instance/animated';
import Description from '@components/description';
import ListNetworks from '@graphql/list-networks.gql';
@ -24,6 +24,7 @@ export const Networks = ({
expanded = false,
proceeded = false,
loading = false,
initialValues,
setInfoExpanded,
setMachinesExpanded,
handleNext,
@ -64,6 +65,7 @@ export const Networks = ({
form={FORM_NAME}
destroyOnUnmount={false}
forceUnregisterOnUnmount={true}
initialValues={initialValues}
>
{props =>
!loading ? (
@ -109,7 +111,6 @@ export const Networks = ({
);
export default compose(
Animated,
graphql(ListNetworks, {
props: ({ data }) => {
const { networks = [], loading = false, error = null, refetch } = data;
@ -126,6 +127,12 @@ export default compose(
({ values, form }, { networks }) => {
const selected = get(form, `${FORM_NAME}.values`, {});
const empty = id => !includes(Object.keys(selected), id);
const proceeded = get(values, 'create-instance-networks-proceeded', false);
const _public = find(networks, ['name', 'Joyent-SDC-Public']);
const initialValues = _public ? {
[_public.id]: true
} : {};
const _networks = networks.map(({ id, name, ...network }) => {
if (empty(id) && name === 'Joyent-SDC-Public') {
@ -154,8 +161,9 @@ export default compose(
});
return {
proceeded: get(values, 'create-instance-networks-proceeded', false),
proceeded,
networks: _networks,
initialValues,
selected: Object.keys(selected).filter(n => selected[n])
};
},

View File

@ -22,7 +22,6 @@ import {
Overview
} from '@components/create-instance/package';
import Animated from '@containers/create-instance/animated';
import Title from '@components/create-instance/title';
import Description from '@components/description';
import getPackages from '@graphql/get-packages.gql';
@ -134,7 +133,6 @@ const PackageContainer = ({
);
export default compose(
Animated,
graphql(getPackages, {
props: ({ data: { loading, packages = [] } }) => ({
loading,
@ -190,6 +188,7 @@ export default compose(
const vmSelected = get(form, 'create-instance-vms.values.vms', false);
const pkgSelected = get(form, `${FORM_NAME}.values.package`, null);
const selected = find(packages, ['id', pkgSelected]);
const sorted = sortBy(packages, [_sortBy]);
@ -219,7 +218,7 @@ export default compose(
packages: _sortOrder === 'asc' ? filtered : reverse(filtered),
hasVms: vmSelected,
selected: find(packages, ['id', pkgSelected]),
proceeded
proceeded: proceeded || selected
};
},
(dispatch, { history }) => ({

View File

@ -18,7 +18,7 @@ import {
} from 'joyent-ui-toolkit';
import Title from '@components/create-instance/title';
import Animated from '@containers/create-instance/animated';
import KeyValue from '@components/key-value';
import Description from '@components/description';
import Tag from '@components/tags';
@ -127,12 +127,17 @@ export const Tags = ({
);
export default compose(
Animated,
connect(({ values }, ownProps) => ({
proceeded: get(values, 'create-instance-tags-proceeded', false),
addOpen: get(values, 'create-instance-tags-add-open', false),
tags: get(values, 'create-instance-tags', [])
})),
connect(({ values }, ownProps) => {
const proceeded = get(values, 'create-instance-tags-proceeded', false);
const addOpen = get(values, 'create-instance-tags-add-open', false);
const tags = get(values, 'create-instance-tags', []);
return {
proceeded: proceeded || tags.length,
addOpen,
tags
};
}),
connect(null, (dispatch, { tags = [], history }) => ({
handleNext: () => {
dispatch(set({ name: 'create-instance-tags-proceeded', value: true }));

View File

@ -11,7 +11,6 @@ import { ScriptIcon, Button, KeyValue } from 'joyent-ui-toolkit';
import Editor from 'joyent-ui-toolkit/dist/es/editor';
import Title from '@components/create-instance/title';
import Animated from '@containers/create-instance/animated';
import Description from '@components/description';
const FORM_NAME = 'create-instance-user-script';
@ -94,13 +93,14 @@ export const UserScript = ({
);
export default compose(
Animated,
connect(
({ values }, ownProps) => {
const formOpen = get(values, 'create-instance-user-script-open', false);
const script = get(values, 'create-instance-user-script', {
name: 'user-script'
});
const formOpen = get(values, 'create-instance-user-script-open', false);
const proceeded = get(
values,
'create-instance-user-script-proceeded',
@ -109,7 +109,7 @@ export default compose(
return {
script,
proceeded,
proceeded: proceeded || script.value,
create: !script.value,
edit: script.value,
formOpen

View File

@ -9,7 +9,7 @@ import paramCase from 'param-case';
const {
REACT_APP_GQL_PORT = window.location.port,
REACT_APP_GQL_PROTOCOL = window.location.protocol.replace(/\:$/, ''),
REACT_APP_GQL_PROTOCOL = window.location.protocol.replace(/:$/, ''),
REACT_APP_GQL_HOSTNAME = window.location.hostname
} = process.env;

526
yarn.lock

File diff suppressed because it is too large Load Diff