Page MenuHomePhabricator

Add harbormaster.buildplan.search api method
ClosedPublic

Authored by timhirsh on Nov 2 2018, 1:50 AM.

Active Operations

Details

Summary

This revision adds a conduit search method for build plans. Other api methods (eg: harbormaster.build.search) support build plan phid's as a constraint, but they weren't exposed anywhere, so this provides a way to fetch them.

Test Plan

Used the api console to run some searches. Output:

{
  "data": [
    {
      "id": 1,
      "type": "HMCP",
      "phid": "PHID-HMCP-q2c25wvegzdkxs7gzor6",
      "fields": {
        "name": "my build plan",
        "planStatus": "active",
        "dateCreated": 1538085249,
        "dateModified": 1538085249,
        "policy": {
          "view": "users",
          "edit": "admin"
        }
      },
    {
      "id": 1,
      "type": "HMCP",
      "phid": "PHID-HMCP-q2c25wvegzdkxs7gzor6",
      "fields": {
        "name": "my build plan",
        "status": {
          "value": "active"
        },
        "dateCreated": 1538085249,
        "dateModified": 1538085249,
        "policy": {
          "view": "users",
          "edit": "admin"
        }
      },
      "attachments": {}
    },
    ...
  ],
  "maps": {},
  "query": {
    "queryKey": null
  },
  "cursor": {
    "limit": 100,
    "after": null,
    "before": null,
    "order": null
  }
}

Diff Detail

Repository
rP Phabricator
Lint
Automatic diff as part of commit; lint not applicable.
Unit
Automatic diff as part of commit; unit tests not applicable.

Event Timeline

timhirsh created this revision.Nov 2 2018, 1:50 AM
timhirsh requested review of this revision.Nov 2 2018, 1:52 AM
epriestley requested changes to this revision.Nov 2 2018, 1:57 AM

Couple of minor inlines, happy to upstream this otherwise.

src/applications/harbormaster/conduit/HarbormasterBuildPlanSearchAPIMethod.php
16

For consistency, capitalize "Harbormaster".

src/applications/harbormaster/storage/configuration/HarbormasterBuildPlan.php
231

Let's just call this status and make it a dictionary with the status constant in "value" so we can add name, icon, color, etc., later if necessary. See DifferentialRevision for a similar object.

...
"status": {
  "value": <whatever getPlanStatus() returns>
}
...
This revision now requires changes to proceed.Nov 2 2018, 1:57 AM
timhirsh updated this revision to Diff 47225.Nov 2 2018, 2:07 AM

capitalization & make status a dictionary

timhirsh edited the test plan for this revision. (Show Details)Nov 2 2018, 2:09 AM
epriestley accepted this revision.Nov 2 2018, 2:29 AM
epriestley added inline comments.
src/applications/harbormaster/storage/configuration/HarbormasterBuildPlan.php
223

Oh, make this, uh, map<string ,wild> now too. (It's just documentation for human consumers.)

This revision is now accepted and ready to land.Nov 2 2018, 2:29 AM
timhirsh updated this revision to Diff 47226.Nov 2 2018, 2:49 AM

oops, update field spec too

timhirsh marked 3 inline comments as done.Nov 2 2018, 2:53 AM

thanks Evan!

This revision was automatically updated to reflect the committed changes.