This commit is contained in:
Sérgio Ramos 2018-04-19 13:43:08 +00:00 committed by GitHub
commit bbeb05fa64
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
882 changed files with 11309 additions and 144636 deletions

View File

@ -1,4 +1,9 @@
packages/*/**
prototypes/*/**
artifacts
reports
.nyc_output
coverage
dist
styleguide
build
lib/app
node_modules

View File

@ -1,8 +1,10 @@
{
"extends": "joyent-portal",
"rules": {
"jsx-a11y/href-no-hash": 0,
"no-console": 1,
"new-cap": 0,
"no-console": 0
"jsx-a11y/href-no-hash": 0,
"no-negated-condition": 1,
"camelcase": 1
}
}

View File

@ -9,8 +9,6 @@
"build:lib": "echo 0",
"build:bundle": "echo 0",
"prepublish": "echo 0",
"lint": "echo 0",
"lint:ci": "echo 0",
"test": "echo 0",
"test:ci": "echo 0"
},
@ -19,6 +17,7 @@
"brule": "^3.1.0",
"cloudapi-gql": "^7.1.4",
"execa": "^0.10.0",
"graphql-tools": "^2.24.0",
"h2o2": "^8.0.1",
"hapi": "^17.3.1",
"hapi-triton-auth": "^2.0.1",

View File

@ -13,7 +13,6 @@ const {
} = process.env;
module.exports = async ({ PORT, BASE_URL }) => {
const dcName = DC_NAME || Url.parse(SDC_URL).host.split('.')[0];
const keyPath = SDC_KEY_PATH;
const keyId = `/${SDC_ACCOUNT}/keys/${SDC_KEY_ID}`;
const apiBaseUrl = SDC_URL;

View File

@ -0,0 +1,59 @@
const Main = require('apr-main');
const {
makeExecutableSchema,
addMockFunctionsToSchema
} = require('graphql-tools');
const Graphi = require('graphi');
const Url = require('url');
const Path = require('path');
const Fs = require('fs');
const Server = require('./server');
const {
PORT = 4004,
BASE_URL = `http://0.0.0.0:${PORT}`,
PREFIX = 'service-groups'
} = process.env;
const ServiceGroupsGql = {
name: 'tsg-gql',
register: async server => {
const typeDefs = Fs.readFileSync(
Path.join(__dirname, 'tsg.graphql'),
'utf-8'
);
const schema = makeExecutableSchema({
typeDefs
});
addMockFunctionsToSchema({ schema });
const graphiOptions = {
graphiqlPath: '/graphiql',
schema
};
await server.register({
plugin: Graphi,
options: graphiOptions
});
}
};
Main(async () => {
const server = await Server({
PORT,
BASE_URL
});
await server.register({
plugin: ServiceGroupsGql,
routes: {
prefix: `/${PREFIX}`
}
});
await server.start();
});

59
bundle/src/templates.js Normal file
View File

@ -0,0 +1,59 @@
const Main = require('apr-main');
const {
makeExecutableSchema,
addMockFunctionsToSchema
} = require('graphql-tools');
const Graphi = require('graphi');
const Url = require('url');
const Path = require('path');
const Fs = require('fs');
const Server = require('./server');
const {
PORT = 4005,
BASE_URL = `http://0.0.0.0:${PORT}`,
PREFIX = 'templates'
} = process.env;
const ServiceGroupsGql = {
name: 'tsg-gql',
register: async server => {
const typeDefs = Fs.readFileSync(
Path.join(__dirname, 'tsg.graphql'),
'utf-8'
);
const schema = makeExecutableSchema({
typeDefs
});
addMockFunctionsToSchema({ schema });
const graphiOptions = {
graphiqlPath: '/graphiql',
schema
};
await server.register({
plugin: Graphi,
options: graphiOptions
});
}
};
Main(async () => {
const server = await Server({
PORT,
BASE_URL
});
await server.register({
plugin: ServiceGroupsGql,
routes: {
prefix: `/${PREFIX}`
}
});
await server.start();
});

128
bundle/src/tsg.graphql Normal file
View File

@ -0,0 +1,128 @@
input KeyValueInput {
id: ID!
}
type KeyValue {
id: ID!
}
type Network {
id: ID!
}
type Image {
id: ID!
}
type Package {
id: ID!
}
################################################################################
type Group {
# The universal identifier (UUID) of the group.
id: ID!
# The name of the group. The group name is limited to a maximum of 182 alphanumeric characters.
name: String
# A unique identifier for the template that the group is associated with.
template: Template
# The number of compute instances to run and maintain a specified number (the "desired count") of instances.
capacity: Int
# When this group was created. ISO8601 date format.
created_at: String
# When this group's details were last updated. ISO8601 date format.
updated_at: String
}
input GroupInput {
# The name of the group. The group name is limited to a maximum of 182 alphanumeric characters.
name: String
# A unique identifier for the template that the group is associated with.
template: ID
# The number of compute instances to run and maintain a specified number (the "desired count") of instances.
capacity: Int
}
type Template {
# The universal identifier (UUID) of the template.
id: ID!
# The name of the template.
name: String
# The unique identifier (UUID) of the package to use when launching compute instances.
package: Package
# The unique identifier (UUID) of the image to use when launching compute instances.
image: Image
# Whether to enable or disable the firewall on the instances launched. Default is false.
firewall_enabled: Boolean
# A list of unique network identifiers to attach to the compute instances launched.
networks: [Network]
# Arbitrary data to be copied to the instances on boot. This will not be executed.
userdata: String
# A mapping of metadata (a key-value pairs) to apply to the instances launched.
metadata: [KeyValue]
# A mapping of tags (a key-value pairs) to apply to the instances launched.
tags: [KeyValue]
# When this template was created. ISO8601 date format.
created_at: String
}
input TemplateInput {
# The name of the template.
name: String!
# The unique identifier (UUID) of the package to use when launching compute instances.
package: ID!
# The unique identifier (UUID) of the image to use when launching compute instances.
image: ID!
# Whether to enable or disable the firewall on the instances launched. Default is false.
firewall_enabled: Boolean
# A list of unique network identifiers to attach to the compute instances launched.
networks: [ID]
# Arbitrary data to be copied to the instances on boot. This will not be executed.
userdata: String
# A mapping of metadata (a key-value pairs) to apply to the instances launched.
metadata: [KeyValueInput]
# A mapping of tags (a key-value pairs) to apply to the instances launched.
tags: [KeyValueInput]
}
type Mutation {
# Create a new group.
createGroup(group: GroupInput!): Group
# Update an existing group
updateGroup(
# UUID of group to update.
id: ID!
group: GroupInput!
): Group
# Delete a group.
deleteGroup(id: ID!): Group
# Create a new template.
createTemplate(template: TemplateInput!): Template
# Delete an existing template.
deleteTemplate(id: ID!): Template
}
type Query {
# List all of the existing groups
groups: [Group]
# Retrieve a specific group
group(
# The universal identifier (UUID) of the group.
id: ID!
): Group
# List all of the existing templates
templates: [Template]
# Retrieve a specific template
template(
# The universal identifier (UUID) of the template.
id: ID!
): Template
}

View File

@ -4,7 +4,16 @@ module.exports = {
'scope-enum': [
2,
'always',
['ui-toolkit', 'icons', 'instances', 'navigation', 'bundle', 'images']
[
'ui-toolkit',
'icons',
'instances',
'navigation',
'bundle',
'images',
'sg',
'templates'
]
]
}
};

View File

@ -1,7 +1,6 @@
const Inert = require('inert');
const Path = require('path');
const RenderReact = require('hapi-render-react');
const Url = require('url');
const Intercept = require('apr-intercept');
const Fs = require('mz/fs');

View File

@ -11,8 +11,6 @@
"build:lib": "echo 0",
"build:bundle": "NAMESPACE=images NODE_ENV=production redrun -p build:frontend build:ssr",
"prepublish": "NODE_ENV=production redrun build:bundle",
"lint": "redrun lint:ci -- --fix",
"lint:ci": "NODE_ENV=test eslint . --ext .js --ext .md",
"test": "echo 0",
"test:ci": "echo 0",
"build:frontend": "joyent-react-scripts build",

View File

@ -6,7 +6,6 @@ import remcalc from 'remcalc';
import { Row, Col } from 'joyent-react-styled-flexboxgrid';
import {
Divider,
FormGroup,
FormLabel,
Input,
@ -29,7 +28,6 @@ export default ({ placeholderName, randomizing, onRandomize }) => (
</FormGroup>
</FlexItem>
<FlexItem>
<Divider height={remcalc(13)} transparent />
<Margin left={1}>
<Button
type="button"

View File

@ -1,7 +1,12 @@
import React from 'react';
import { Row, Col } from 'joyent-react-styled-flexboxgrid';
import { Margin } from 'styled-components-spacing';
import { P } from 'joyent-ui-toolkit';
import styled from 'styled-components';
import { P as BaseP } from 'joyent-ui-toolkit';
const P = styled(BaseP)`
margin: 0;
`;
export default ({ children }) => (
<Row>

View File

@ -2,15 +2,8 @@ import React from 'react';
import { Field } from 'redux-form';
import Flex from 'styled-flex-component';
import { Margin } from 'styled-components-spacing';
import remcalc from 'remcalc';
import {
Button,
FormGroup,
Input,
FormLabel,
Divider
} from 'joyent-ui-toolkit';
import { Button, FormGroup, Input, FormLabel } from 'joyent-ui-toolkit';
export const Toolbar = ({
searchable = true,
@ -30,7 +23,6 @@ export const Toolbar = ({
</FormGroup>
{action ? (
<FormGroup right>
<Divider height={remcalc(21)} transparent />
<Button
type="button"
disabled={!actionable}
@ -48,6 +40,5 @@ export const Toolbar = ({
export default ({ handleSubmit, ...rest }) => (
<form onSubmit={handleSubmit}>
<Toolbar {...rest} />
<Divider height={remcalc(20)} transparent />
</form>
);

View File

@ -6,17 +6,9 @@ import { destroy, reset } from 'redux-form';
import ReduxForm from 'declarative-redux-form';
import { connect } from 'react-redux';
import get from 'lodash.get';
import remcalc from 'remcalc';
import Flex from 'styled-flex-component';
import {
TagsIcon,
Button,
H3,
TagList,
Divider,
KeyValue
} from 'joyent-ui-toolkit';
import { TagsIcon, Button, H3, TagList, KeyValue } from 'joyent-ui-toolkit';
import Title from '@components/create-image/title';
import Description from '@components/description';
@ -102,7 +94,6 @@ export const Tags = ({
expanded
onCancel={() => handleChangeAddOpen(false)}
/>
<Divider height={remcalc(18)} transparent />
</Fragment>
) : null
}

View File

@ -41,15 +41,12 @@ export const List = ({
handleRemove
}) => (
<ViewContainer main>
<Divider height={remcalc(30)} transparent />
<ReduxForm form={LIST_TOOLBAR_FORM}>
{props => <ToolbarForm {...props} actionable={!loading} />}
</ReduxForm>
<Divider height={remcalc(1)} />
<Divider height={remcalc(24)} transparent />
{loading && !images.length ? (
<Fragment>
<Divider height={remcalc(30)} transparent />
<StatusLoader />
</Fragment>
) : null}

View File

@ -5,12 +5,10 @@ import { connect } from 'react-redux';
import intercept from 'apr-intercept';
import { set } from 'react-redux-values';
import get from 'lodash.get';
import remcalc from 'remcalc';
import {
ViewContainer,
StatusLoader,
Divider,
Message,
MessageTitle,
MessageDescription
@ -32,7 +30,6 @@ export const Summary = ({
<ViewContainer main>
{loading && !image ? (
<Fragment>
<Divider height={remcalc(30)} transparent />
<StatusLoader />
</Fragment>
) : null}

View File

@ -14,11 +14,11 @@ import {
H3,
ViewContainer,
StatusLoader,
Divider,
Message,
MessageTitle,
MessageDescription,
TagList
TagList,
Divider
} from 'joyent-ui-toolkit';
import { Forms } from '@root/constants';

View File

@ -1,6 +1,5 @@
import React from 'react';
import { Margin } from 'styled-components-spacing';
import remcalc from 'remcalc';
import {
RootContainer,
@ -8,15 +7,13 @@ import {
ViewContainer,
Message,
MessageDescription,
MessageTitle,
Divider
MessageTitle
} from 'joyent-ui-toolkit';
import Breadcrumb from '@containers/breadcrumb';
export const Route = () => (
<ViewContainer main>
<Divider height={remcalc(30)} transparent />
<Margin bottom={4}>
<Message error>
<MessageTitle>Ooops!</MessageTitle>

View File

@ -1,8 +1,6 @@
const Inert = require('inert');
const Path = require('path');
const RenderReact = require('hapi-render-react');
const Wreck = require('wreck');
const Url = require('url');
const Intercept = require('apr-intercept');
const Fs = require('mz/fs');

View File

@ -11,9 +11,7 @@
"build:lib": "echo 0",
"build:bundle": "NAMESPACE=instances NODE_ENV=production redrun -p build:frontend build:ssr",
"prepublish": "NODE_ENV=production redrun build:bundle",
"lint": "redrun lint:ci -- --fix",
"lint:ci": "NODE_ENV=test eslint . --ext .js --ext .md",
"test": "DEFAULT_TIMEOUT_INTERVAL=100000 NODE_ENV=test joyent-react-scripts test --env=jsdom",
"test": "DEFAULT_TIMEOUT_INTERVAL=100000 NODE_ENV=test joyent-react-scripts test --env=jsdom --testPathIgnorePatterns='.ui.js'",
"test:ci": "NODE_ENV=test joyent-react-scripts test --env=jsdom --testPathIgnorePatterns='.ui.js'",
"build:frontend": "joyent-react-scripts build",
"build:ssr": "SSR=1 UMD=1 babel src --out-dir lib/app --copy-files"

Some files were not shown because too many files have changed in this diff Show More