Page MenuHomePhabricator

Add a basic, general-purpose export workflow for all objects with SearchEngine support
ClosedPublic

Authored by epriestley on Jan 23 2018, 6:10 PM.

Details

Summary

Depends on D18918. Ref T13046. Ref T5954. Pull logs can currently be browsed in the web UI, but this isn't very powerful, especially if you have thousands of them.

Allow SearchEngine implementations to define exportable fields so that users can "Use Results > Export Data" on any query. In particular, they can use this workflow to download a file with pull logs.

In the future, this can replace the existing "Export to Excel" feature in Maniphest.

For now, we hard-code JSON as the only supported datatype and don't actually make any effort to format the data properly, but this leaves room to add more exporters (CSV, Excel) and data type awareness (integer casting, date formatting, etc) in the future.

For sufficiently large result sets, this will probably time out. At some point, I'll make this use the job queue (like bulk editing) when the export is "large" (affects more than 1K rows?).

Test Plan

Downloaded pull logs in JSON format.

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

epriestley created this revision.Jan 23 2018, 6:10 PM
epriestley requested review of this revision.Jan 23 2018, 6:12 PM

I'm just defining a separate set of fields here rather than trying to piggyback on something like the Conduit fields since I think the fields that make sense for "Export to Excel" and the fields that make sense for API results are probably often very different.

A concrete example is something like "puller" here or "assignee" in Maniphest. It never makes sense to return a username like "alice" over Conduit since a Conduit client can look it up and likely doesn't care anyway, but returning that in an Excel sheet is useful since a less sophisticated user probably can't look it up easily.

amckinley accepted this revision.Jan 23 2018, 9:14 PM
This revision is now accepted and ready to land.Jan 23 2018, 9:14 PM
This revision was automatically updated to reflect the committed changes.