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

UI: ACL Roles cont. plus Service Identities #5661

Merged
merged 25 commits into from
May 1, 2019

Conversation

johncowen
Copy link
Contributor

@johncowen johncowen commented Apr 15, 2019

This PR continues on from #5635 and adds 'Service Identities' to the UI.

Service Identities

Service Identities are more or less the same thing as Policies in that they are essentially a Policy with a predefined Rules template which you can see here.

As each Service Identity only needs a ServiceName to produce the templated Policy, only the ServiceNames are saved via the API (as a list/array on the parent object) for example

{
  ...
  Policies: [{...}],
  ServiceIdentities: [
    {
      ServiceName: ''
    }
  ]
}

In terms of the UI, we present the same form for creating/editing a ServiceIdentity as we do for creating/editing a Policy:

Screenshot 2019-04-24 at 10 15 24

And we treat them in the UI as a 'type' of Policy, as essentially that is what they are. There is also potential down the line for further templated Policies, so we've added a new 'template' field to the Policy objects, normal Policies having an empty template.

This work contains serialization/normalization to reflect that, following the current project conventions in handleResponse and dataForRequest (#5637 🔜 will move this into the serializer using respondFor...). We did this using Adapter Mixins as we need the functionality for Policies and Roles, this should also make it trivial to move it elsewhere when we need to.

Other

{{code-editor}} changes

We have a {{code-editor}} component which wraps ivy-codemirror. We did 2 things here:

  1. Altered our readonly logic for our wrapping component.
  2. Added the ability for block usage (as opposed to a value="" attribute) to make the component feel more a like a <textarea>:
{{#code-editor}}
  service "name" {
  
  }
{{/code-editor}}

name -> type

The form components from #5635 now use a type attribute rather than name (thinking here being: <input type="text" />, <Form type="policy" />)

Tests

The nested nature of the modals (tokens > policies, roles > policies, tokens > roles > policies) here also meant we needed to create a similar nested approach for our PageObjects, and a way to select/find deeply nested PageObjects using our Gherkin steps. We've added the ability to deeply select/find PageObjects via our Gherkin steps using dot syntax with steps like:

And I click delete on the roles.selectedOptions
And I click submit on the roles.form
And I click submit on the roles.form.policies.form
Then I fill in the roles.form.policies.form with:
---

This will also now let us select/find certain indexes in lists:

And I click actions on the roles.form.policies.10

The grammar isn't quite ideal here but thats something we can look at at a later date. We've also maintained the past grammar, but moving forwards we'll deprecate that and work to merge some of the repetitive code used in the steps - you can see the beginnings of some of this work here

We also moved some of our acceptance tests that use policies and roles so we can make better used of looping/tables. Previously we would have had to repeat tests in dc/acls/tokens/policies and dc/acls/roles/policies, so we instead made dc/acls/policies/as-many and loop over both tokens and roles for each test in here.


Lastly, similar to the previous #5635 PR this is not quite how we'd like to do this. We've briefly discussed this with @meirish , but ideally it requires a deeper RFC which we plan to follow up with.

@johncowen johncowen added the theme/ui Anything related to the UI label Apr 15, 2019
@johncowen johncowen added this to the 1.5.0 milestone Apr 16, 2019
@johncowen johncowen force-pushed the feature/ui-service-identities branch from ffd11de to f606028 Compare April 17, 2019 09:05
@johncowen johncowen changed the title UI: Service Identities UI: ACL Roles cont. plus Service Identities Apr 24, 2019
@johncowen johncowen marked this pull request as ready for review April 24, 2019 10:06
@johncowen johncowen requested a review from a team April 24, 2019 10:06
John Cowen added 22 commits April 29, 2019 11:32
1. Tweak readonly support
2. Allow HTML like block component syntax (using a component body)
...treat ServiceIdentities as templated Policies
Policies use a default blank template
1. Add comments for reminding and yet todo at some point
2. Use '' instead of default for the template name
We always has the 'click $property on the $component component'-like
steps

This was never going to be sufficient longer term, and with the form
within form layouts we needed something so we can traverse deeper into
page objects.

This add javascript like traversing for some of the scenario steps (to
be expanded upon at a later date) so you can use dot syntax like
'roles.form.policies.form.selectedOptions.0'

Note this also adds the ability to 'select' indexes on collections using
'.0' or '.1' etc. But we are keeping the default to the first element if
you don't specify an index as it reads nicver.

Lastly, this amends the tests that required this
1. Uses a radioGroupName attribute on the component to set this easily
to avoid 2 modals/forms on the same page using the same HTML radiogroup
1. Begin to add more components for the page objects
2. Fix up other tests as I go along need to refer to deeper page object
components (we'd been lucky enough to be able to reuse things
previously)
3. The tests for Deleting Things were all together in the same feature
file. Things are becoming more different now so we start to move these
out into their own 'model' here, starting with policies
Follows the 'as-many' directory structure (so roles/as-many) so the
model can be tests 'as-many' or as a child of something else. This way
we can use test tables to bring down the repetition
Resulted in cleaning up the Policy/as-many mixin a little more
In order to use the functionality of the child-selector it has to be
present in the page as the form component is saved. As we'd used
javascript state to toggle the visibility of the selector and the form,
the selector wasn't present to add the newly saved item as a child.

This reverts to using a CSS/HTML state so all the things we need are on
the page when we need them
@johncowen johncowen force-pushed the feature/ui-service-identities branch from 14636de to fa17fc8 Compare April 29, 2019 11:32
@johncowen johncowen mentioned this pull request Apr 29, 2019
5 tasks
* ui: Integrate new pills with icons

1. Introduce the idea of 'policy types' instead of just 'is-management'
with a new policy/typeof helper
2. Add placeholders for all structure icons, and start replacing the
older ones.
3. %pills no default to transparent, the gray is added at a project
level
4. Started to introduce a saner way to size tables, basically sane
defaults with the ability to overwrite for the more involved tables

* ui: general CSS refactor

1. Mainly working on tables, all tds are now inline-flex
2. The inline flex meant we could remove a lot of cruft and spacing from
other areas
3. Spotted an area that wasn't using {{tag-list}}

* ui: make sure default helper test passes

* ui: adds missing hasActions class, plus all tables are a minimum 3 rows

* ui: fix too narrow policy listing detail view specifically in edit role

* ui: Adds extra icons to policy-selector tables to distinguish types

This adds a 'service' icon to service identity type policies and a
'star' icon to the global management type policies
@johncowen johncowen merged commit a2ee02f into feature/ui-roles May 1, 2019
@johncowen johncowen deleted the feature/ui-service-identities branch May 1, 2019 18:01
johncowen added a commit that referenced this pull request May 1, 2019
Adds support for ACL Roles and Service Identities CRUD, along with necessary changes to Tokens, and the CSS improvements required.

Also includes refinements/improvements for easier testing of deeply nested components.

1. ember-data adapter/serializer/model triplet for Roles
2. repository, form/validations and searching filter for Roles
3. Moves potentially, repeated, or soon to to repeated functionality
into a mixin (mainly for 'many policy' relationships)
4. A few styling tweaks for little edge cases around roles
5. Router additions, Route, Controller and templates for Roles

Also see: 

* UI: ACL Roles cont. plus Service Identities (#5661 and #5720)
johncowen added a commit that referenced this pull request May 1, 2019
Adds support for ACL Roles and Service Identities CRUD, along with necessary changes to Tokens, and the CSS improvements required.

Also includes refinements/improvements for easier testing of deeply nested components.

1. ember-data adapter/serializer/model triplet for Roles
2. repository, form/validations and searching filter for Roles
3. Moves potentially, repeated, or soon to to repeated functionality
into a mixin (mainly for 'many policy' relationships)
4. A few styling tweaks for little edge cases around roles
5. Router additions, Route, Controller and templates for Roles

Also see: 

* UI: ACL Roles cont. plus Service Identities (#5661 and #5720)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
theme/ui Anything related to the UI
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants