From 32eb44986b953311f0e4b359be237f7d55c831ca Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Se=CC=81rgio=20Ramos?= Date: Wed, 23 May 2018 17:29:04 +0100 Subject: [PATCH] feat(sg): bootstrap --- .eslintignore | 2 +- bundle/package.json | 4 +- bundle/src/service-groups.js | 4 + bundle/src/templates.js | 4 + consoles/my-joy-images/package.json | 42 +- .../src/components/create-image/details.js | 4 +- .../src/components/description.js | 2 +- .../my-joy-images/src/components/empty.js | 2 +- .../my-joy-images/src/components/image.js | 2 +- .../my-joy-images/src/components/summary.js | 10 +- consoles/my-joy-images/src/components/tags.js | 4 +- .../src/containers/create-image/details.js | 2 +- .../my-joy-images/src/containers/create.js | 2 +- consoles/my-joy-images/src/containers/list.js | 2 +- consoles/my-joy-images/src/routes.js | 39 +- .../my-joy-images/src/state/apollo-client.js | 7 +- consoles/my-joy-images/src/state/global.js | 13 +- .../my-joy-images/src/state/validators.js | 2 +- consoles/my-joy-instances/package.json | 39 +- .../__tests__/__snapshots__/list.spec.js.snap | 478 ++- .../__snapshots__/snapshots.spec.js.snap | 190 +- .../__snapshots__/summary.spec.js.snap | 35 + .../src/components/instances/description.js | 2 +- .../src/components/instances/footer.js | 4 +- .../src/components/instances/list.js | 16 +- .../src/components/instances/snapshots.js | 12 +- .../src/components/instances/summary.js | 12 +- .../__tests__/__snapshots__/cns.spec.js.snap | 192 +- .../__snapshots__/firewall.spec.js.snap | 54 +- .../__tests__/__snapshots__/list.spec.js.snap | 2902 ++++++++--------- .../__snapshots__/metadata.spec.js.snap | 302 +- .../__snapshots__/networks.spec.js.snap | 19 +- .../__snapshots__/summary.spec.js.snap | 10 + .../__tests__/__snapshots__/tags.spec.js.snap | 478 +-- .../src/containers/instances/cns.js | 4 +- .../src/containers/instances/list.js | 4 +- .../src/containers/instances/metadata.js | 2 +- .../src/containers/instances/snapshots.js | 4 +- .../src/containers/instances/summary.js | 2 +- .../src/containers/instances/tags.js | 2 +- consoles/my-joy-instances/src/index.js | 3 +- consoles/my-joy-instances/src/routes.js | 39 +- .../src/state/apollo-client.js | 7 +- consoles/my-joy-instances/src/state/global.js | 3 + .../my-joy-instances/src/state/validators.js | 2 +- consoles/my-joy-navigation/package.json | 28 +- .../src/containers/datacenter.js | 2 +- .../src/containers/services.js | 2 +- consoles/my-joy-service-groups/.babelrc | 12 + consoles/my-joy-service-groups/.gitignore | 25 + consoles/my-joy-service-groups/.lighthouserc | 8 + consoles/my-joy-service-groups/.npmignore | 27 + consoles/my-joy-service-groups/.stylelintrc | 4 + consoles/my-joy-service-groups/.tern-project | 13 + consoles/my-joy-service-groups/.yarnclean | 0 consoles/my-joy-service-groups/lib/index.js | 133 + consoles/my-joy-service-groups/package.json | 73 + .../public/manifest.json | 15 + .../public/static/css/libre-franklin.css | 31 + .../public/static/css/roboto-mono.css | 15 + .../libre-franklin/libre-franklin-bold.ttf | Bin 0 -> 81244 bytes .../libre-franklin/libre-franklin-light.ttf | Bin 0 -> 76968 bytes .../libre-franklin/libre-franklin-medium.ttf | Bin 0 -> 80732 bytes .../libre-franklin/libre-franklin-regular.ttf | Bin 0 -> 78768 bytes .../libre-franklin-semibold.ttf | Bin 0 -> 80352 bytes .../static/fonts/libre-franklin/license.txt | 93 + .../static/fonts/roboto-mono/license.txt | 202 ++ .../fonts/roboto-mono/roboto-mono-bold.ttf | Bin 0 -> 114752 bytes .../fonts/roboto-mono/roboto-mono-regular.ttf | Bin 0 -> 114624 bytes consoles/my-joy-service-groups/readme.md | 20 + .../my-joy-service-groups/src/_aliases.js | 9 + .../my-joy-service-groups/src/_document.js | 54 + consoles/my-joy-service-groups/src/app.js | 14 + .../src/components/list.js | 251 ++ .../src/components/summary.js | 367 +++ .../src/components/templates.js | 175 + .../src/components/toolbar.js | 49 + .../my-joy-service-groups/src/constants.js | 23 + .../__snapshots__/breadcrumb.spec.js.snap | 503 +++ .../containers/__tests__/breadcrumb.spec.js | 36 + .../src/containers/breadcrumb.js | 40 + .../src/containers/create.js | 237 ++ .../src/containers/edit.js | 215 ++ .../src/containers/list.js | 289 ++ .../src/containers/steps/name.js | 171 + .../src/containers/steps/template.js | 333 ++ .../src/containers/summary.js | 141 + .../src/graphql/create-service-group.gql | 16 + .../src/graphql/get-service-group.gql | 16 + .../src/graphql/get-template.gql | 20 + .../src/graphql/list-service-groups.gql | 16 + .../src/graphql/list-templates.gql | 9 + .../src/graphql/remove-service-group.gql | 5 + .../src/graphql/update-service-group.gql | 21 + consoles/my-joy-service-groups/src/html.js | 28 + consoles/my-joy-service-groups/src/index.js | 33 + .../src/mocks/__aliases__.js | 6 + .../src/mocks/declarative-redux-form.js | 3 + .../src/mocks/react-responsive.js | 7 + .../src/mocks/react-router-dom.js | 4 + .../src/mocks/redux-form.js | 4 + .../my-joy-service-groups/src/mocks/theme.js | 23 + consoles/my-joy-service-groups/src/routes.js | 121 + .../my-joy-service-groups/src/server-error.js | 35 + .../src/state/apollo-client.js | 44 + .../src/state/confirm.js | 5 + .../my-joy-service-groups/src/state/global.js | 29 + .../src/state/parse-error.js | 4 + .../src/state/redux-store.js | 24 + .../my-joy-service-groups/src/state/theme.js | 21 + .../src/state/validators.js | 49 + consoles/my-joy-templates/lib/index.js | 55 +- consoles/my-joy-templates/package.json | 34 +- consoles/my-joy-templates/src/_aliases.js | 10 +- consoles/my-joy-templates/src/app.js | 4 + .../my-joy-templates/src/components/list.js | 126 +- .../src/components/summary.js | 127 +- .../src/components/toolbar.js | 31 +- consoles/my-joy-templates/src/constants.js | 2 + .../my-joy-templates/src/containers/create.js | 83 +- .../src/containers/duplicate.js | 76 +- .../my-joy-templates/src/containers/list.js | 243 +- .../src/containers/summary.js | 67 +- .../src/graphql/create-template.gql | 15 + consoles/my-joy-templates/src/index.js | 8 +- consoles/my-joy-templates/src/mocks/editor.js | 3 + consoles/my-joy-templates/src/routes.js | 39 +- .../src/state/apollo-client.js | 7 +- consoles/my-joy-templates/src/state/global.js | 3 + package.json | 16 +- packages/icons/package.json | 10 +- .../__snapshots__/icons.spec.js.snap | 210 ++ packages/icons/src/cpu.js | 2 + packages/icons/src/data-center.js | 2 + packages/icons/src/edit.js | 2 + packages/icons/src/empty-state.js | 242 +- packages/icons/src/external.js | 32 + packages/icons/src/fabric.js | 2 + packages/icons/src/general.js | 2 + packages/icons/src/index.js | 2 + packages/icons/src/memory.js | 2 + packages/icons/src/template.js | 32 + packages/instance-steps/package.json | 14 +- .../instance-steps/src/image/components.js | 31 +- packages/instance-steps/src/name/index.js | 14 +- .../instance-steps/src/package/components.js | 23 +- packages/instance-steps/src/tags/index.js | 2 +- packages/instance-steps/src/validators.js | 2 +- packages/logos/package.json | 8 +- packages/resource-step/package.json | 12 +- packages/resource-step/src/index.js | 6 +- packages/resource-widgets/package.json | 12 +- .../__snapshots__/network.spec.js.snap | 60 + packages/resource-widgets/src/cns/index.js | 10 +- packages/resource-widgets/src/empty/index.js | 2 +- .../resource-widgets/src/firewall/index.js | 12 +- .../resource-widgets/src/key-value/index.js | 23 +- .../resource-widgets/src/network/index.js | 12 +- packages/resource-widgets/src/post/index.js | 41 +- packages/ui-toolkit/package.json | 28 +- packages/ui-toolkit/src/anchor/index.js | 5 + packages/ui-toolkit/src/breadcrumb/index.js | 2 +- packages/ui-toolkit/src/card/demo.md | 30 +- packages/ui-toolkit/src/card/header.js | 4 +- packages/ui-toolkit/src/card/test.md | 150 +- packages/ui-toolkit/src/footer/sticky.md | 7 +- packages/ui-toolkit/src/form/base/input.js | 77 +- .../ui-toolkit/src/form/copiable-field.js | 2 +- packages/ui-toolkit/src/form/input.js | 51 +- packages/ui-toolkit/src/icons/index.js | 10 +- packages/ui-toolkit/src/index.js | 5 +- .../ui-toolkit/src/styleguide/playground.js | 2 +- .../ui-toolkit/src/styleguide/renderer.js | 4 +- packages/ui-toolkit/src/table/Readme.md | 40 +- .../src/text/__tests__/text.spec.js | 5 +- packages/ui-toolkit/src/text/headings.js | 4 + packages/ui-toolkit/src/tooltip/Readme.md | 12 +- prototypes/console-boilerplate/package.json | 2 +- prototypes/cra-boilerplate/src/pages/index.js | 236 +- yarn.lock | 490 ++- 180 files changed, 8479 insertions(+), 3577 deletions(-) create mode 100644 consoles/my-joy-service-groups/.babelrc create mode 100644 consoles/my-joy-service-groups/.gitignore create mode 100644 consoles/my-joy-service-groups/.lighthouserc create mode 100644 consoles/my-joy-service-groups/.npmignore create mode 100644 consoles/my-joy-service-groups/.stylelintrc create mode 100644 consoles/my-joy-service-groups/.tern-project create mode 100644 consoles/my-joy-service-groups/.yarnclean create mode 100644 consoles/my-joy-service-groups/lib/index.js create mode 100644 consoles/my-joy-service-groups/package.json create mode 100644 consoles/my-joy-service-groups/public/manifest.json create mode 100644 consoles/my-joy-service-groups/public/static/css/libre-franklin.css create mode 100644 consoles/my-joy-service-groups/public/static/css/roboto-mono.css create mode 100755 consoles/my-joy-service-groups/public/static/fonts/libre-franklin/libre-franklin-bold.ttf create mode 100755 consoles/my-joy-service-groups/public/static/fonts/libre-franklin/libre-franklin-light.ttf create mode 100755 consoles/my-joy-service-groups/public/static/fonts/libre-franklin/libre-franklin-medium.ttf create mode 100755 consoles/my-joy-service-groups/public/static/fonts/libre-franklin/libre-franklin-regular.ttf create mode 100755 consoles/my-joy-service-groups/public/static/fonts/libre-franklin/libre-franklin-semibold.ttf create mode 100755 consoles/my-joy-service-groups/public/static/fonts/libre-franklin/license.txt create mode 100755 consoles/my-joy-service-groups/public/static/fonts/roboto-mono/license.txt create mode 100755 consoles/my-joy-service-groups/public/static/fonts/roboto-mono/roboto-mono-bold.ttf create mode 100755 consoles/my-joy-service-groups/public/static/fonts/roboto-mono/roboto-mono-regular.ttf create mode 100644 consoles/my-joy-service-groups/readme.md create mode 100644 consoles/my-joy-service-groups/src/_aliases.js create mode 100644 consoles/my-joy-service-groups/src/_document.js create mode 100644 consoles/my-joy-service-groups/src/app.js create mode 100644 consoles/my-joy-service-groups/src/components/list.js create mode 100644 consoles/my-joy-service-groups/src/components/summary.js create mode 100644 consoles/my-joy-service-groups/src/components/templates.js create mode 100644 consoles/my-joy-service-groups/src/components/toolbar.js create mode 100644 consoles/my-joy-service-groups/src/constants.js create mode 100644 consoles/my-joy-service-groups/src/containers/__tests__/__snapshots__/breadcrumb.spec.js.snap create mode 100644 consoles/my-joy-service-groups/src/containers/__tests__/breadcrumb.spec.js create mode 100644 consoles/my-joy-service-groups/src/containers/breadcrumb.js create mode 100644 consoles/my-joy-service-groups/src/containers/create.js create mode 100644 consoles/my-joy-service-groups/src/containers/edit.js create mode 100644 consoles/my-joy-service-groups/src/containers/list.js create mode 100644 consoles/my-joy-service-groups/src/containers/steps/name.js create mode 100644 consoles/my-joy-service-groups/src/containers/steps/template.js create mode 100644 consoles/my-joy-service-groups/src/containers/summary.js create mode 100644 consoles/my-joy-service-groups/src/graphql/create-service-group.gql create mode 100644 consoles/my-joy-service-groups/src/graphql/get-service-group.gql create mode 100644 consoles/my-joy-service-groups/src/graphql/get-template.gql create mode 100644 consoles/my-joy-service-groups/src/graphql/list-service-groups.gql create mode 100644 consoles/my-joy-service-groups/src/graphql/list-templates.gql create mode 100644 consoles/my-joy-service-groups/src/graphql/remove-service-group.gql create mode 100644 consoles/my-joy-service-groups/src/graphql/update-service-group.gql create mode 100644 consoles/my-joy-service-groups/src/html.js create mode 100644 consoles/my-joy-service-groups/src/index.js create mode 100644 consoles/my-joy-service-groups/src/mocks/__aliases__.js create mode 100644 consoles/my-joy-service-groups/src/mocks/declarative-redux-form.js create mode 100644 consoles/my-joy-service-groups/src/mocks/react-responsive.js create mode 100644 consoles/my-joy-service-groups/src/mocks/react-router-dom.js create mode 100644 consoles/my-joy-service-groups/src/mocks/redux-form.js create mode 100644 consoles/my-joy-service-groups/src/mocks/theme.js create mode 100644 consoles/my-joy-service-groups/src/routes.js create mode 100644 consoles/my-joy-service-groups/src/server-error.js create mode 100644 consoles/my-joy-service-groups/src/state/apollo-client.js create mode 100644 consoles/my-joy-service-groups/src/state/confirm.js create mode 100644 consoles/my-joy-service-groups/src/state/global.js create mode 100644 consoles/my-joy-service-groups/src/state/parse-error.js create mode 100644 consoles/my-joy-service-groups/src/state/redux-store.js create mode 100644 consoles/my-joy-service-groups/src/state/theme.js create mode 100644 consoles/my-joy-service-groups/src/state/validators.js create mode 100644 consoles/my-joy-templates/src/mocks/editor.js create mode 100644 packages/icons/src/external.js create mode 100644 packages/icons/src/template.js diff --git a/.eslintignore b/.eslintignore index 1268706e..a73bde13 100644 --- a/.eslintignore +++ b/.eslintignore @@ -5,5 +5,5 @@ coverage dist styleguide build -lib/app +consoles/*/lib/app node_modules \ No newline at end of file diff --git a/bundle/package.json b/bundle/package.json index 35767072..76aa7745 100644 --- a/bundle/package.json +++ b/bundle/package.json @@ -18,12 +18,14 @@ "execa": "^0.10.0", "graphi": "^5.7.0", "h2o2": "^8.1.2", - "hapi": "^17.4.0", + "hapi": "^17.5.0", "hapi-triton-auth": "^3.0.0", "hapi-webconsole-nav": "^2.1.0", "my-joy-images": "*", "my-joy-instances": "*", "my-joy-navigation": "*", + "my-joy-service-groups": "*", + "my-joy-templates": "*", "tsg-graphql": "^1.0.0" } } diff --git a/bundle/src/service-groups.js b/bundle/src/service-groups.js index f9819cbb..88eb77b2 100644 --- a/bundle/src/service-groups.js +++ b/bundle/src/service-groups.js @@ -7,6 +7,7 @@ const Graphi = require('graphi'); const Url = require('url'); const Server = require('./server'); +const Ui = require('my-joy-service-groups'); const { PORT = 4004, @@ -67,6 +68,9 @@ Main(async () => { routes: { prefix: `/${PREFIX}` } + }, + { + plugin: Ui } ]); diff --git a/bundle/src/templates.js b/bundle/src/templates.js index 2bd6a8a3..51694f2e 100644 --- a/bundle/src/templates.js +++ b/bundle/src/templates.js @@ -7,6 +7,7 @@ const Graphi = require('graphi'); const Url = require('url'); const Server = require('./server'); +const Ui = require('my-joy-templates'); const { PORT = 4005, @@ -67,6 +68,9 @@ Main(async () => { routes: { prefix: `/${PREFIX}` } + }, + { + plugin: Ui } ]); diff --git a/consoles/my-joy-images/package.json b/consoles/my-joy-images/package.json index 6e085671..15cb73b3 100644 --- a/consoles/my-joy-images/package.json +++ b/consoles/my-joy-images/package.json @@ -6,7 +6,7 @@ "repository": "github:yldio/joyent-portal", "main": "lib/index.js", "scripts": { - "dev": "NAMESPACE=images NODE_ENV=development REACT_APP_GQL_PORT=4000 PORT=3070 joyent-react-scripts start", + "dev": "REACT_APP_DEV=1 NAMESPACE=images NODE_ENV=development REACT_APP_GQL_PORT=4000 PORT=3070 joyent-react-scripts start", "build:test": "echo 0", "build:lib": "echo 0", "build:bundle": "NAMESPACE=images NODE_ENV=production redrun -p build:frontend build:ssr", @@ -19,23 +19,23 @@ "dependencies": { "@manaflair/redux-batch": "^0.1.0", "apollo": "^0.2.2", - "apollo-cache-inmemory": "^1.1.12", - "apollo-client": "^2.2.8", - "apollo-link-http": "^1.5.3", + "apollo-cache-inmemory": "^1.2.2", + "apollo-client": "^2.3.2", + "apollo-link-http": "^1.5.4", "apr-intercept": "^3.0.3", "apr-reduce": "^3.0.3", "boom": "^7.2.0", - "cross-fetch": "^2.1.0", + "cross-fetch": "^2.2.0", "date-fns": "^1.29.0", "declarative-redux-form": "^2.0.8", "exenv": "^1.2.2", "force-array": "^3.1.0", "fuse.js": "^3.2.0", "hapi-render-react": "^2.5.2", - "hapi-render-react-joyent-document": "^7.1.0", + "hapi-render-react-joyent-document": "^7.2.0", "inert": "^5.1.0", "joyent-logo-assets": "^1.1.0", - "joyent-react-styled-flexboxgrid": "^2.2.3", + "joyent-react-styled-flexboxgrid": "^3.1.0", "joyent-ui-resource-widgets": "^1.0.0", "joyent-ui-toolkit": "^6.0.0", "lodash.assign": "^4.2.0", @@ -46,37 +46,37 @@ "lodash.keys": "^4.2.0", "lodash.omit": "^4.5.0", "lodash.uniqby": "^4.7.0", - "lunr": "^2.1.6", + "lunr": "^2.2.1", "mz": "^2.7.0", "param-case": "^2.1.1", - "react": "^16.3.1", - "react-apollo": "^2.1.2", - "react-dom": "^16.3.1", - "react-helmet-async": "0.0.5", + "react": "^16.4.0", + "react-apollo": "^2.1.4", + "react-dom": "^16.4.0", + "react-helmet-async": "0.1.0", "react-redux": "^5.0.7", "react-redux-values": "^1.1.2", "react-router": "^4.2.0", "react-router-dom": "^4.2.2", - "redux": "^3.7.2", + "redux": "^4.0.0", "redux-form": "^7.3.0", "remcalc": "^1.0.10", - "styled-components": "^3.2.5", - "styled-components-spacing": "^2.1.3", + "styled-components": "^3.3.0", + "styled-components-spacing": "^3.0.0", "styled-flex-component": "^2.2.2", - "styled-is": "^1.1.2", + "styled-is": "^1.1.3", "title-case": "^2.1.1", - "yup": "^0.24.1" + "yup": "^0.25.1" }, "devDependencies": { "babel-cli": "^6.26.0", "babel-preset-joyent-portal": "^7.0.1", "eslint": "^4.19.1", "eslint-config-joyent-portal": "^3.3.1", - "jest-image-snapshot": "^2.4.0", + "jest-image-snapshot": "^2.4.2", "jest-styled-components": "^5.0.1", - "joyent-react-scripts": "^8.2.0", + "joyent-react-scripts": "^8.2.1", "react-screenshot-renderer": "^1.1.2", - "react-test-renderer": "^16.3.1", - "redrun": "^6.0.2" + "react-test-renderer": "^16.4.0", + "redrun": "^6.0.4" } } diff --git a/consoles/my-joy-images/src/components/create-image/details.js b/consoles/my-joy-images/src/components/create-image/details.js index e7d1870c..df688746 100644 --- a/consoles/my-joy-images/src/components/create-image/details.js +++ b/consoles/my-joy-images/src/components/create-image/details.js @@ -2,7 +2,6 @@ import React from 'react'; import { Field } from 'redux-form'; import { Margin } from 'styled-components-spacing'; import Flex, { FlexItem } from 'styled-flex-component'; -import remcalc from 'remcalc'; import { Row, Col } from 'joyent-react-styled-flexboxgrid'; import { @@ -31,7 +30,6 @@ export default ({ placeholderName, randomizing, onRandomize }) => ( - + diff --git a/consoles/my-joy-images/src/containers/list.js b/consoles/my-joy-images/src/containers/list.js index 8d98e2ec..376ef974 100644 --- a/consoles/my-joy-images/src/containers/list.js +++ b/consoles/my-joy-images/src/containers/list.js @@ -78,7 +78,7 @@ export const List = ({ {images.map(image => ( - + handleCreateInstance(image)} diff --git a/consoles/my-joy-images/src/routes.js b/consoles/my-joy-images/src/routes.js index c7e4acc1..6c4cce45 100644 --- a/consoles/my-joy-images/src/routes.js +++ b/consoles/my-joy-images/src/routes.js @@ -1,4 +1,4 @@ -import React from 'react'; +import React, { Fragment } from 'react'; import { Route, Switch, Redirect } from 'react-router-dom'; import get from 'lodash.get'; @@ -19,6 +19,8 @@ import Create from '@containers/create'; import Tags from '@containers/tags'; import { Route as ServerError } from '@root/server-error'; +const { REACT_APP_DEV = false } = process.env; + export default () => ( {/* Breadcrumb */} @@ -70,6 +72,41 @@ export default () => ( } /> + {REACT_APP_DEV ? ( + + + window.location.replace( + `${window.location.protocol}//${window.location.hostname}:3069${ + location.pathname + }${location.search}` + ) + } + /> + + window.location.replace( + `${window.location.protocol}//${window.location.hostname}:3071${ + location.pathname + }${location.search}` + ) + } + /> + + window.location.replace( + `${window.location.protocol}//${window.location.hostname}:3072${ + location.pathname + }${location.search}` + ) + } + /> + + ) : null} +