Skip to content
This repository has been archived by the owner on Jan 24, 2023. It is now read-only.

Feature json schema #3050

Merged
merged 36 commits into from
Jan 7, 2019
Merged

Feature json schema #3050

merged 36 commits into from
Jan 7, 2019

Conversation

richard-cox
Copy link
Contributor

Updates to original PR - See #2664

  • Improved typing
  • Moved common elements into a new schema-form component
  • Allow users to toggle between form and text input whilst maintaining common value
  • Step validity bound to type of input (form valid vs valid json)
  • Updated form errors to be more material like
  • Fixed stepper navigation (would 're-enter' last step on pressing 'next' in last step
  • Fixed bleed of styles from angular6 form component (via fork)

hamzahamidi and others added 27 commits July 23, 2018 09:44
Signed-off-by: Hamza Hamidi <hamza.hamidi@orange.com>
Signed-off-by: Hamza Hamidi <hamza.hamidi@orange.com>
Signed-off-by: Hamza Hamidi <hamza.hamidi@orange.com>
Signed-off-by: Hamza Hamidi <hamza.hamidi@orange.com>
Signed-off-by: Hamza Hamidi <hamza.hamidi@orange.com>
Signed-off-by: Hamza Hamidi <hamza.hamidi@orange.com>
Signed-off-by: Hamza Hamidi <hamza.hamidi@orange.com>
Signed-off-by: Hamza Hamidi <hamza.hamidi@orange.com>
Signed-off-by: Hamza Hamidi <hamza.hamidi@orange.com>
Signed-off-by: Hamza Hamidi <hamza.hamidi@orange.com>
Signed-off-by: Hamza Hamidi <hamza.hamidi@orange.com>
Signed-off-by: Hamza Hamidi <hamza.hamidi@orange.com>
Signed-off-by: Hamza Hamidi <hamza.hamidi@orange.com>
- Improve typing
- Move common components into new `shema-form` component
- Allow users to toggle between form and text input whilst maintaining common value
- Step valid state bound to type of input (form valid vs valid json)
- Updated form errors to be more material like
- Fixed stepper navigation (would 're-enter' last step on pressing 'next' in last step
@cfdreddbot
Copy link

Hey richard-cox!

Thanks for submitting this pull request! I'm here to inform the recipients of the pull request that you and the commit authors have already signed the CLA.

@codecov
Copy link

codecov bot commented Sep 21, 2018

Codecov Report

Merging #3050 into v2-master will decrease coverage by 0.09%.
The diff coverage is 64.5%.

@@             Coverage Diff              @@
##           v2-master    #3050     +/-   ##
============================================
- Coverage      70.89%   70.79%   -0.1%     
============================================
  Files            641      642      +1     
  Lines          28174    28303    +129     
  Branches        6405     6437     +32     
============================================
+ Hits           19973    20038     +65     
- Misses          8201     8265     +64

- Also minor tidy of json form validate
@richard-cox richard-cox mentioned this pull request Oct 2, 2018
8 tasks
@richard-cox
Copy link
Contributor Author

To test, update line 169 in stratos-ui/src/frontend/app/shared/components/add-service-instance/select-plan-step/select-plan-step.component.ts with the following. This will set 4 schemas in whatever service plan is selected..

  • Schema used when creating a new service instance
  • Schema used when updating an existing service instance
  • Schema used when binding a service instance to an application
  • Schema used when updating a service instance binding to an application (don't think this is possible to see in Stratos

The third field in all schema states the type of schema, so in the ux you should be able to confirm the correct one is used.

All schemas have the 'last name' field as required. Schema validation is ignored when in json mode

data: {
          ...selectedServicePlan.entity,
          entity: {
            ...selectedServicePlan.entity.entity,
            schemas: {
              service_binding: {
                create: {
                  parameters: {
                    'type': 'object',
                    'properties': {
                      'first_name': { 'type': 'string' },
                      'last_name': { 'type': 'string' },
                      'service_binding_create_schema': { 'type': 'string' },
                      'address': {
                        'type': 'object',
                        'properties': {
                          'street_1': { 'type': 'string' },
                          'street_2': { 'type': 'string' },
                          'city': { 'type': 'string' },
                          'state': {
                            'type': 'string',
                            'enum': ['AL', 'AK', 'AS', 'AZ']
                          },
                          'zip_code': { 'type': 'string' }
                        }
                      },
                      'birthday': { 'type': 'string' },
                      'notes': { 'type': 'string' },
                      'phone_numbers': {
                        'type': 'array',
                        'items': {
                          'type': 'object',
                          'properties': {
                            'type': { 'type': 'string', 'enum': ['cell', 'home', 'work'] },
                            'number': { 'type': 'string' }
                          },
                          'required': ['type', 'number']
                        }
                      }
                    },
                    'required': ['last_name']
                  }
                },
                update: {
                  parameters: {
                    'type': 'object',
                    'properties': {
                      'first_name': { 'type': 'string' },
                      'last_name': { 'type': 'string' },
                      'service_binding_update_schema': { 'type': 'string' },
                      'address': {
                        'type': 'object',
                        'properties': {
                          'street_1': { 'type': 'string' },
                          'street_2': { 'type': 'string' },
                          'city': { 'type': 'string' },
                          'state': {
                            'type': 'string',
                            'enum': ['AL', 'AK', 'AS', 'AZ']
                          },
                          'zip_code': { 'type': 'string' }
                        }
                      },
                      'birthday': { 'type': 'string' },
                      'notes': { 'type': 'string' },
                      'phone_numbers': {
                        'type': 'array',
                        'items': {
                          'type': 'object',
                          'properties': {
                            'type': { 'type': 'string', 'enum': ['cell', 'home', 'work'] },
                            'number': { 'type': 'string' }
                          },
                          'required': ['type', 'number']
                        }
                      }
                    },
                    'required': ['last_name']
                  }
                }
              },
              service_instance: {
                create: {
                  parameters: {
                    'type': 'object',
                    'properties': {
                      'first_name': { 'type': 'string' },
                      'last_name': { 'type': 'string' },
                      'service_instance_create_schema': { 'type': 'string' },
                      'address': {
                        'type': 'object',
                        'properties': {
                          'street_1': { 'type': 'string' },
                          'street_2': { 'type': 'string' },
                          'city': { 'type': 'string' },
                          'state': {
                            'type': 'string',
                            'enum': ['AL', 'AK', 'AS', 'AZ']
                          },
                          'zip_code': { 'type': 'string' }
                        }
                      },
                      'birthday': { 'type': 'string' },
                      'notes': { 'type': 'string' },
                      'phone_numbers': {
                        'type': 'array',
                        'items': {
                          'type': 'object',
                          'properties': {
                            'type': { 'type': 'string', 'enum': ['cell', 'home', 'work'] },
                            'number': { 'type': 'string' }
                          },
                          'required': ['type', 'number']
                        }
                      }
                    },
                    'required': ['last_name']
                  }
                },
                update: {
                  parameters: {
                    'type': 'object',
                    'properties': {
                      'first_name': { 'type': 'string' },
                      'last_name': { 'type': 'string' },
                      'service_instance_update_schema': { 'type': 'string' },
                      'address': {
                        'type': 'object',
                        'properties': {
                          'street_1': { 'type': 'string' },
                          'street_2': { 'type': 'string' },
                          'city': { 'type': 'string' },
                          'state': {
                            'type': 'string',
                            'enum': ['AL', 'AK', 'AS', 'AZ']
                          },
                          'zip_code': { 'type': 'string' }
                        }
                      },
                      'birthday': { 'type': 'string' },
                      'notes': { 'type': 'string' },
                      'phone_numbers': {
                        'type': 'array',
                        'items': {
                          'type': 'object',
                          'properties': {
                            'type': { 'type': 'string', 'enum': ['cell', 'home', 'work'] },
                            'number': { 'type': 'string' }
                          },
                          'required': ['type', 'number']
                        }
                      }
                    },
                    'required': ['last_name']
                  }
                }
              }
            }
          }
        }

@KlapTrap KlapTrap added the conflicts Merge conflicts on PR label Nov 20, 2018
@richard-cox richard-cox removed the conflicts Merge conflicts on PR label Nov 21, 2018
# Conflicts:
#	src/frontend/app/shared/components/add-service-instance/add-service-instance/add-service-instance.component.spec.ts
#	src/frontend/app/shared/components/add-service-instance/add-service-instance/add-service-instance.component.ts
#	src/frontend/app/shared/shared.module.ts
@nwmac nwmac merged commit 795a2bc into v2-master Jan 7, 2019
@nwmac nwmac deleted the feature-json-schema branch January 7, 2019 10:23
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants