HomePhabricator

Rough cut of "Blueprint Authorizations"

Tags
None
Referenced Files
F869866: Screen Shot 2015-10-09 at 1.52.29 PM.png
Oct 10 2015, 2:15 PM
F869868: Screen Shot 2015-10-09 at 1.54.42 PM.png
Oct 10 2015, 2:15 PM
F869867: Screen Shot 2015-10-09 at 1.53.38 PM.png
Oct 10 2015, 2:15 PM
F869865: Screen Shot 2015-10-09 at 1.51.04 PM.png
Oct 10 2015, 2:15 PM
Subscribers
None

Description

Rough cut of "Blueprint Authorizations"

Summary:
Ref T9519. This is like 80% of the way there and doesn't fully work yet, but roughly shows the shape of things to come. Here's how it works:

First, there's a new custom field type for blueprints which works like a normal typeahead but has some extra logic. It's implemented this way to make it easy to add to Blueprints in Drydock and Build Plans in Harbormaster. Here, I've added a "Use Blueprints" field to the "WorkingCopy" blueprint, so you can control which hosts the working copies are permitted to allocate on:

Screen Shot 2015-10-09 at 1.51.04 PM.png (582×1 px, 82 KB)

This control has a bit of custom rendering logic. Instead of rendering a normal list of PHIDs, it renders an annotated list with icons:

Screen Shot 2015-10-09 at 1.52.29 PM.png (419×912 px, 71 KB)

These icons show whether the blueprint on the other size of the authorization has approved this object. Once you have a green checkmark, you're good to go.

On the blueprint side, things look like this:

Screen Shot 2015-10-09 at 1.53.38 PM.png (571×1 px, 103 KB)

This table shows all the objects which have asked for access to this blueprint. In this case it's showing that one object is approved to use the blueprint since I already approved it, but by default new requests come in here as "Authorization Requested" and someone has to go approve them.

You approve them from within the authorization detail screen:

Screen Shot 2015-10-09 at 1.54.42 PM.png (571×1 px, 129 KB)

You can use the "Approve" or "Decline" buttons to allow or prevent use of the blueprint.

This doesn't actually do anything yet -- objects don't need to be authorized in order to use blueprints quite yet. That will come in the next diff, I just wanted to get the UI in reasonable shape first.

The authorization also has a second piece of state, which is whether the request from the object is active or inactive. We use this to keep track of the authorization if the blueprint is (maybe temporarily) deleted.

For example, you might have a Build Plan that uses Blueprints A and B. For a couple days, you only want to use A, so you remove B from the "Use Blueprints: ..." field. Later, you can add B back and it will connect to its old authorization again, so you don't need to go re-approve things (and if you're declined, you stay declined instead of being able to request authorization over and over again). This should make working with authorizations a little easier and less labor intensive.

Stuff not in this diff:

  • Actually preventing any allocations (next diff).
  • Probably should have transactions for approve/decline, at least, at some point, so there's a log of who did approvals and when.
  • Maybe should have a more clear/loud error state when no blueprints are approved?
  • Should probably restrict the typeahead to specific blueprint types.

Test Plan:

  • Added the field.
  • Typed some stuff into it.
  • Saw the UI update properly.
  • Approved an authorization.
  • Declined an authorization.
  • Saw active authorizations on a blueprint page.
  • Didn't see any inactive authroizations there.
  • Clicked "View All Authorizations", saw all authorizations.

Reviewers: chad, hach-que

Reviewed By: chad

Maniphest Tasks: T9519

Differential Revision: https://secure.phabricator.com/D14251