Skip to content

Commit

Permalink
Merge pull request #108 from hellofresh/feature/new-oauth-server-name
Browse files Browse the repository at this point in the history
Feature/new oauth server name
  • Loading branch information
ivanzusko authored Oct 24, 2017
2 parents 718412b + e76fb5d commit 6a48def
Show file tree
Hide file tree
Showing 10 changed files with 673 additions and 373 deletions.
138 changes: 138 additions & 0 deletions src/configurations/oAuthServerSchema.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,29 @@ const oAuthServerSchema = {
preserve_host: false,
listen_path: '',
upstream_url: '',
upstreams: {
balancing: '',
targets: [],
options: [
{
balancing: 'roundrobin',
targets: [
{
target: '',
},
],
},
{
balancing: 'weight',
targets: [
{
target: '',
weight: 0,
},
],
}
],
},
insecure_skip_verify: false,
strip_path: false,
append_path: false,
Expand All @@ -16,6 +39,29 @@ const oAuthServerSchema = {
preserve_host: false,
listen_path: '',
upstream_url: '',
upstreams: {
balancing: '',
targets: [],
options: [
{
balancing: 'roundrobin',
targets: [
{
target: '',
},
],
},
{
balancing: 'weight',
targets: [
{
target: '',
weight: 0,
},
],
}
],
},
insecure_skip_verify: false,
strip_path: false,
append_path: false,
Expand All @@ -27,6 +73,29 @@ const oAuthServerSchema = {
preserve_host: false,
listen_path: '',
upstream_url: '',
upstreams: {
balancing: '',
targets: [],
options: [
{
balancing: 'roundrobin',
targets: [
{
target: '',
},
],
},
{
balancing: 'weight',
targets: [
{
target: '',
weight: 0,
},
],
}
],
},
insecure_skip_verify: false,
strip_path: false,
append_path: false,
Expand All @@ -38,6 +107,29 @@ const oAuthServerSchema = {
preserve_host: false,
listen_path: '',
upstream_url: '',
upstreams: {
balancing: '',
targets: [],
options: [
{
balancing: 'roundrobin',
targets: [
{
target: '',
},
],
},
{
balancing: 'weight',
targets: [
{
target: '',
weight: 0,
},
],
}
],
},
insecure_skip_verify: false,
strip_path: false,
append_path: false,
Expand All @@ -51,6 +143,29 @@ const oAuthServerSchema = {
preserve_host: false,
listen_path: '',
upstream_url: '',
upstreams: {
balancing: '',
targets: [],
options: [
{
balancing: 'roundrobin',
targets: [
{
target: '',
},
],
},
{
balancing: 'weight',
targets: [
{
target: '',
weight: 0,
},
],
}
],
},
insecure_skip_verify: false,
strip_path: false,
append_path: false,
Expand All @@ -61,6 +176,29 @@ const oAuthServerSchema = {
preserve_host: false,
listen_path: '',
upstream_url: '',
upstreams: {
balancing: '',
targets: [],
options: [
{
balancing: 'roundrobin',
targets: [
{
target: '',
},
],
},
{
balancing: 'weight',
targets: [
{
target: '',
weight: 0,
},
],
}
],
},
insecure_skip_verify: false,
strip_path: false,
append_path: false,
Expand Down
1 change: 1 addition & 0 deletions src/modules/forms/plugins/Cors/CorsPlugin.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ class CorsPlugin extends PureComponent {
render() {
const { apiSchema, className, edit, name, handlePluginExclude, plugin, pluginName } = this.props;
const b = block(className);

const optionsTransformer = config => {
return config.map(item => ({
label: item,
Expand Down
4 changes: 3 additions & 1 deletion src/modules/pages/NewOAuthServerPage/NewOAuthServerItem.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,9 @@ class NewOAuthServerItem extends PureComponent {
}

submit = values => {
this.props.saveOAuthServer(this.props.location.pathname, values);
const transformedValues = transformFormValues(values, true);

this.props.saveOAuthServer(this.props.location.pathname, transformedValues);
}

renderForm = () => {
Expand Down
27 changes: 21 additions & 6 deletions src/modules/pages/NewOAuthServerPage/OAuthServerForm.js
Original file line number Diff line number Diff line change
Expand Up @@ -122,16 +122,22 @@ class OAuthServerForm extends PureComponent {
<div className={b('tab', { hidden: this.state.activeTab !== 0 })}>
<div className={b('section')}>
<OAuthEndpoints
endpoints={schema.oauth_endpoints}
endpoints={initialValues.oauth_endpoints}
schema={schema}
change={this.props.change}
category={'oauth_endpoints'}
initialValues={initialValues}
/>
</div>
</div>
<div className={b('tab', {hidden: this.state.activeTab !== 1})}>
<div className={b('tab', { hidden: this.state.activeTab !== 1 })}>
<div className={b('section')}>
<OAuthClientEndpoints
endpoints={schema.oauth_client_endpoints}
endpoints={initialValues.oauth_client_endpoints}
schema={schema}
change={this.props.change}
category={'oauth_client_endpoints'}
initialValues={initialValues}
/>
</div>
</div>
Expand Down Expand Up @@ -279,8 +285,10 @@ class OAuthServerForm extends PureComponent {
<Field
name="cors_meta.domains"
type="text"
placeholder={PLACEHOLDER.DOMAINS}
component={Input}
edit={false}
value="cors_meta.domains"
options={optionsTransformer(schema.cors_meta.domains)}
component={TagSelect}
/>
<Hint>A list of all domains from which the endpoint will accept requests</Hint>
</div>
Expand Down Expand Up @@ -432,4 +440,11 @@ const form = reduxForm({
enableReinitialize: true, // this is needed!!
})(OAuthServerForm);

export default form;
export default connect(
state => {
return {
keepDirtyOnReinitialize: false,
};
},
null,
)(form);
Loading

0 comments on commit 6a48def

Please sign in to comment.