glizzan / concord

Other
1 stars 1 forks source link

Design UX interface #3

Closed shaunagm closed 4 years ago

shaunagm commented 4 years ago

Need to do some research first - not sure how to approach designing an interface for some of Concord's unusual features - permissions, actions, roles, conditions, etc. Probably want to find someone with more experience to at least review.

Checklist:

shaunagm commented 4 years ago

Note: I have some sketches on paper now (on third shelf in home office).

shaunagm commented 4 years ago

Detail: add roles interface

Appearance issues:

Misc issues:

shaunagm commented 4 years ago

Detail: update new role: add conditions to permission; update new role: configure conditions that have been added

Todos:

May have to experiment with making v-if a computed property or something.

shaunagm commented 4 years ago

Detail: "validate condition data somewhere (concord? kybern django? kybern vue? more than one?)"

Okay, so there's two main kinds of validation that can happen here - format validation, and content validation. And so two things need to happen.

For providing validation data to the front end, this would include:

shaunagm commented 4 years ago

Running into a problem here, where we're storing permission configuration options by key permission.change_type, but there can be multiple permissions set on a role if we use configuration (for instance, we might have an 'add people to role 'x'' and and 'add people to role 'y') which will have the same change_type (AddPeopleToRole).

Okay, so: permission-configuration-fields is a computed function. We can heck there whether we're update_or_create-ing. If create, do what we've been doing. If update, get the permission id and look up the values in existing_permissions. Then do the same for conditions.

shaunagm commented 4 years ago

This is getting really complex. :/ Is there a way to simplify it?

I could try breaking things out into components, that would at least make things visually easier. Maybe I also ought to take an inventory of the data structures and whether they should be restructured.

And then of course, better documentation via inline comments.

Data structure inventory:

        role_to_edit: '',
        edit_role_error_message: '',
        edit_mode: 'permission',  // Edit mode starts on permission
        update_or_create: 'create',  // Edit mode defaults to creating new permission
        // Data for edit role moda - permissions
        permissions: [], // intitially from server, list of dicts, { id, name, display, change_type, configuration }
        permission_options: [],
        permission_selected: '',
        permission_configuration_map: {},
        permission_to_update: '',
        // Data for edit role modal - conditions,
        conditions: {},  // initially from server, { perm.id : { 'name': X, 'config': { }}}
        condition_options: [],
        permission_to_condition: '',
        condition_selected: '',
        condition_configuration_map: {},
        condition_to_update: '',

        permission_configuration_fields: function () {   (list of dicts)
        condition_configuration_fields: function () { }    (list of dicts)

Okay, so we need our authoritative list of permissions and conditions, with all attendant data, this.permissions and this.conditions.

The permission_configuration_map and condition_configuration_map give us the configuration options, maybe rename to permission_configuration_options? etc

condition_options and permission_options are options for the selects, and condition_selected and permission_selected the choices. permission_to_condition additionally helps us track which permission our condition is to be set on.

permission_to_update and condition_to_update store the database ids for editing.

Which leaves our computed fields, X_configuration_fields, which return a list of dicts; if it is a create, it is taken from configuration_options, if it is an update, it is taken from this.permissions

shaunagm commented 4 years ago

Thoughts on deletions and removals

Need to handle:

Actually none of these require handling dependencies so it should be as straightforward as making sure the call exists on the backend (client, state changes, etc) and then making that call from the front end. Probably order should be:

  1. Check if client call exists in Concord and if it doesn't, make it.
  2. For deleting conditions and permissions, create a separate button, method on vue, view+url in django. For removing people from members/roles, probably want to add an x on the individual member or an icon of a person with a -, and clicking it removes them from roles/members.
shaunagm commented 4 years ago

Action Includes

Misc appearance fixes:

Okay, so! We should have:

Table:

shaunagm commented 4 years ago

More detail on "create interface for approval condition" /"create interface for vote condition"

Condition interfaces are shown by clicking on the "waiting" badge on an open action. (There is a separate non-interactive condition description to describe what happened with a closed conditioned action.) Clicking on the badge pops open a modal which contains the unique condition interface, defined in $conditionname_condition_include.html.

So for instance, in vote_condition_include.html you'd have the interface for displaying the configuration of the condition as well as the buttons "for", "against" or "abstain" (if configured to allow abstention). Clicking those buttons makes an ajax call to process_vote_condition method (currently in kybern/views.py, this is probably among the things moved to Concord eventually). On success, you move to something that shows the current status.

So, steps:

shaunagm commented 4 years ago

vote condition interface

if you can vote, and the vote is still open

if you can't vote, and the vote is still open

Gives details of vote, says you don't have permission to vote. Return here to see results when voting ends at X.

If the vote is closed

Displays details and also the results.

shaunagm commented 4 years ago

okay, the issue is, when saving roles to permission, saving each letter of the role

For now, let's split the x_roles and ex_actors fields by comma, and make a list that way (stripping white space). Soonish, we'll replace this anyway with a multiple select field populated by existing roles.

Validation on this sucks, let's fix the backend too.

TO DO:

shaunagm commented 4 years ago

Okay, so to refresh the actions, we need to - what? Well, what is the action data structure, and what changes when we respond to a condition?

shaunagm commented 4 years ago

add governance interface details

Misc stuff that's come up:

shaunagm commented 4 years ago

I am running into formatting issues yet again. The question is, where should the formatting happen? In concord? In kybern/views? In vue?

I want to do some work in kybern because there's key data there, but maybe the point isn't to do the formatting there but just to provide the front end data. So you're not just giving a value from kybern, you're giving all the elements of the field via the api, and it's up to the front end what to do with it? But that doesn't seem great either.

We could format going out but not coming back in...

shaunagm commented 4 years ago

Okay, refactoring to use vuex/stores. Steps here are:

shaunagm commented 4 years ago

Still to do on permissions & conditions stuff, before moving to fixing actions & conditionals:

shaunagm commented 4 years ago

Permissions issues:

Multiselect/role issues:

role_name in permissions was saving as list, needed to implement a few things here:

shaunagm commented 4 years ago

When creating permissions via editing roles, we're not checking for existing relevant permissions. So if I give the permission AddPeopleToRole to Role A and Role B, it creates two separate, conflicting permissions, rather than saying "oh an AddPeopleToRole permission already exists on this target, let's update it".

Permissions.py handles this on the backend - it will check multiple permissions - but it looks pretty weird on the front end.

To fix this, we could create an update_or_add_permission method on client that checks and updates if it finds something, or creates a new permission if it doesn't. The downside of this is that AddPermission and AddRoleToPermission (or AddActorToPermission, for that matter) are two different permissions and so there may be some confusion there. But this is probably best for now.

shaunagm commented 4 years ago

More detail for "change access to item"

For any permissioned item, we should display to the user a little pencil icon (or, eventually, a 'permissions' icon). Clicking the icon should pop up an interface for editing the permissions (and conditions) associated with the object.

This should be fairly similar, UX-wise, to "edit role", except that instead of already knowing the role and the target (the target in edit role being the group as a whole), we only know the target (the permissioned item). So we'll need the additional interface showing potential roles & actors (like we see in the leadership include) plus the normal interface. But we should be able to keep the same vuex data structure.

Notes: when we create the "edit forum" permission via a specific forum it should be a permission configured to only be for that forum, at least when the target is the community? GAH, I need to better figure out nested permissions, pressing pause here

shaunagm commented 4 years ago

Item history details

Should be a button of some kind on an item (forum, post, anything permissioned) that, when you click it, pops open an action history similar to (same as?) the group history but with actions targeted at that item.

We don't want to preload the action history for everything all at once, so on clicking the button we'll need to make a call to the server to get the action data for that item, and store it in vuex.