Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Custom Policies] Show full schema info on form preview #712

Merged
merged 2 commits into from
Mar 20, 2019

Conversation

didierofrivia
Copy link
Member

@didierofrivia didierofrivia commented Mar 18, 2019

What this PR does / why we need it:

Screenshot 2019-03-19 at 15 37 34

When editing the policy schema, the form was only displaying the configuration, but not the rest of the attributes (name, version, etc)

Which issue(s) this PR fixes

fixes https://issues.jboss.org/browse/THREESCALE-2098

Verification steps

Go to Custom Policies and you now should see the full schema reflected on the preview.

Special notes for your reviewer:

@didierofrivia didierofrivia self-assigned this Mar 18, 2019
@didierofrivia didierofrivia force-pushed the feature/show-full-schema-preview branch from 9f037b5 to b6ca6ed Compare March 18, 2019 16:13
name: '[Name of the policy]',
summary: '[A brief description of what it does.]',
version: '[0.0.1]',
name: 'Name of the policy',
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it is good to leave those brackets. As we validate those fields, if the user does not edit them they will be invalid and the policy cannot be saved

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the apicast manifest fails to validate the version, the regex doesn't expects those brackets.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes that is what I am saying, so the customer will not save this by inadvertence.
Or if you can make them as placeholder and not real values?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thing is the form will fail to render by default. This way it will be shown and communicating the user the right way to do it.

@didierofrivia didierofrivia force-pushed the feature/show-full-schema-preview branch from b6ca6ed to c74c873 Compare March 19, 2019 14:36
@codecov
Copy link

codecov bot commented Mar 19, 2019

Codecov Report

Merging #712 into master will increase coverage by <.01%.
The diff coverage is n/a.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #712      +/-   ##
==========================================
+ Coverage   92.84%   92.84%   +<.01%     
==========================================
  Files        2387     2388       +1     
  Lines       77549    77579      +30     
==========================================
+ Hits        71999    72030      +31     
+ Misses       5550     5549       -1
Impacted Files Coverage Δ
...ers/provider/admin/registry/policies_controller.rb 92.3% <ø> (ø) ⬆️
app/mailers/mail_preview.rb 33.73% <0%> (-1.15%) ⬇️
...ications/new_notification_system_migration_test.rb 98.33% <0%> (-0.08%) ⬇️
test/unit/observers/message_observer_test.rb 100% <0%> (ø) ⬆️
test/workers/create_service_token_worker_test.rb 100% <0%> (ø) ⬆️
app/workers/create_service_token_worker.rb 100% <0%> (ø) ⬆️
...n/admin/api/buyers_applications_controller_test.rb 100% <0%> (ø) ⬆️
...notifications/new_notification_system_migration.rb 100% <0%> (ø) ⬆️
app/observers/message_observer.rb 100% <0%> (ø) ⬆️
test/unit/observers/cinstance_observer_test.rb 100% <0%> (ø) ⬆️
... and 4 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update cc5bced...b3451ea. Read the comment docs.

@didierofrivia didierofrivia changed the title [WIP] [Custom Policies] Show full schema info on form preview [Custom Policies] Show full schema info on form preview Mar 19, 2019
'summary': '[A brief description of what it does.]',
'version': '[0.0.1]',
'name': 'Name of the policy',
'summary': 'A brief description of what it does.',
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
'summary': 'A brief description of what it does.',
'summary': 'A one-line summary of what this policy does.',

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It should be less than 75 characters. Probably good to add this indication

'version': '[0.0.1]',
'name': 'Name of the policy',
'summary': 'A brief description of what it does.',
'description': 'A description of what it does.',
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A complete description of what this policy does.

@@ -117,24 +62,35 @@ function CustomPolicyForm ({policy, onChange}: {policy: Policy, onChange: OnChan
)
}

function Form ({initialPolicy}: {initialPolicy: Policy}): React.Node {
function CustomPolicyEditor ({initialPolicy}: {initialPolicy: Policy}): React.Node {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The return type React.Node is not mandatory. In some files we are using it, in others we aren't. We should agree in using it or not. At a glance, most files don't have it, so we could follow that way, unless you have a reason to explicitly include it.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ok, then less is better

@didierofrivia didierofrivia force-pushed the feature/show-full-schema-preview branch from 4221516 to 8ec8dec Compare March 20, 2019 13:46
</div>
)
}

function CustomPolicyForm ({policy, onChange}: {policy: Policy, onChange: OnChange}): React.Node {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You missed this one React.Node

@didierofrivia didierofrivia force-pushed the feature/show-full-schema-preview branch from 8ec8dec to 3bda674 Compare March 20, 2019 14:01
@Martouta Martouta requested review from thomasmaas and damianpm and removed request for thomasmaas March 20, 2019 14:05
thomasmaas
thomasmaas previously approved these changes Mar 20, 2019
damianpm
damianpm previously approved these changes Mar 20, 2019
* Resides on a separate component
* Does specific schema validation
* Better error communication
* Better naming
* Reflects the schema missing parts on preview
* Tested
@didierofrivia didierofrivia dismissed stale reviews from damianpm and thomasmaas via b3451ea March 20, 2019 14:58
@didierofrivia didierofrivia force-pushed the feature/show-full-schema-preview branch from 3bda674 to b3451ea Compare March 20, 2019 14:58
@didierofrivia didierofrivia requested review from thomasmaas and damianpm and removed request for thomasmaas March 20, 2019 14:59
@didierofrivia didierofrivia merged commit 2121dee into master Mar 20, 2019
@didierofrivia didierofrivia deleted the feature/show-full-schema-preview branch March 20, 2019 15:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
4 participants