Add Phrequent workflows to Arcanist
Summary:
Depends on D9906.
This adds `arc start`, `arc stop` and `arc tracking` for tracking tasks, diffs and other objects in Phrequent.
Test Plan: Tested this against a local install.
Reviewers: skyronic, #blessed_reviewers, epriestley
Reviewed By: #blessed_reviewers, epriestley
Subscribers: maxhodak, hach-que, aran, epriestley, Korvin
Maniphest Tasks: T3569, T3969
Differential Revision: https://secure.phabricator.com/D7327
2014-07-17 03:58:22 +02:00
|
|
|
<?php
|
|
|
|
|
|
|
|
/**
|
2015-02-01 01:58:18 +01:00
|
|
|
* Base workflow for Phrequent workflows.
|
Add Phrequent workflows to Arcanist
Summary:
Depends on D9906.
This adds `arc start`, `arc stop` and `arc tracking` for tracking tasks, diffs and other objects in Phrequent.
Test Plan: Tested this against a local install.
Reviewers: skyronic, #blessed_reviewers, epriestley
Reviewed By: #blessed_reviewers, epriestley
Subscribers: maxhodak, hach-que, aran, epriestley, Korvin
Maniphest Tasks: T3569, T3969
Differential Revision: https://secure.phabricator.com/D7327
2014-07-17 03:58:22 +02:00
|
|
|
*/
|
2014-07-21 23:49:15 +02:00
|
|
|
abstract class ArcanistPhrequentWorkflow extends ArcanistWorkflow {
|
Add Phrequent workflows to Arcanist
Summary:
Depends on D9906.
This adds `arc start`, `arc stop` and `arc tracking` for tracking tasks, diffs and other objects in Phrequent.
Test Plan: Tested this against a local install.
Reviewers: skyronic, #blessed_reviewers, epriestley
Reviewed By: #blessed_reviewers, epriestley
Subscribers: maxhodak, hach-que, aran, epriestley, Korvin
Maniphest Tasks: T3569, T3969
Differential Revision: https://secure.phabricator.com/D7327
2014-07-17 03:58:22 +02:00
|
|
|
|
|
|
|
protected function printCurrentTracking() {
|
|
|
|
$conduit = $this->getConduit();
|
|
|
|
|
|
|
|
$results = $conduit->callMethodSynchronous(
|
|
|
|
'phrequent.tracking',
|
2015-02-01 01:58:18 +01:00
|
|
|
array());
|
Add Phrequent workflows to Arcanist
Summary:
Depends on D9906.
This adds `arc start`, `arc stop` and `arc tracking` for tracking tasks, diffs and other objects in Phrequent.
Test Plan: Tested this against a local install.
Reviewers: skyronic, #blessed_reviewers, epriestley
Reviewed By: #blessed_reviewers, epriestley
Subscribers: maxhodak, hach-que, aran, epriestley, Korvin
Maniphest Tasks: T3569, T3969
Differential Revision: https://secure.phabricator.com/D7327
2014-07-17 03:58:22 +02:00
|
|
|
$results = $results['data'];
|
|
|
|
|
|
|
|
if (count($results) === 0) {
|
|
|
|
echo phutil_console_format(
|
2015-02-01 01:58:18 +01:00
|
|
|
"%s\n",
|
|
|
|
pht('Not currently tracking time against any object.'));
|
Add Phrequent workflows to Arcanist
Summary:
Depends on D9906.
This adds `arc start`, `arc stop` and `arc tracking` for tracking tasks, diffs and other objects in Phrequent.
Test Plan: Tested this against a local install.
Reviewers: skyronic, #blessed_reviewers, epriestley
Reviewed By: #blessed_reviewers, epriestley
Subscribers: maxhodak, hach-que, aran, epriestley, Korvin
Maniphest Tasks: T3569, T3969
Differential Revision: https://secure.phabricator.com/D7327
2014-07-17 03:58:22 +02:00
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
$phids_to_lookup = array();
|
|
|
|
foreach ($results as $result) {
|
|
|
|
$phids_to_lookup[] = $result['phid'];
|
|
|
|
}
|
|
|
|
|
|
|
|
$phid_query = $conduit->callMethodSynchronous(
|
|
|
|
'phid.query',
|
|
|
|
array(
|
|
|
|
'phids' => $phids_to_lookup,
|
|
|
|
));
|
|
|
|
|
|
|
|
$phid_map = array();
|
|
|
|
foreach ($phids_to_lookup as $lookup) {
|
|
|
|
if (array_key_exists($lookup, $phid_query)) {
|
|
|
|
$phid_map[$lookup] = $phid_query[$lookup]['fullName'];
|
|
|
|
} else {
|
2015-02-01 01:58:18 +01:00
|
|
|
$phid_map[$lookup] = pht('Unknown Object');
|
Add Phrequent workflows to Arcanist
Summary:
Depends on D9906.
This adds `arc start`, `arc stop` and `arc tracking` for tracking tasks, diffs and other objects in Phrequent.
Test Plan: Tested this against a local install.
Reviewers: skyronic, #blessed_reviewers, epriestley
Reviewed By: #blessed_reviewers, epriestley
Subscribers: maxhodak, hach-que, aran, epriestley, Korvin
Maniphest Tasks: T3569, T3969
Differential Revision: https://secure.phabricator.com/D7327
2014-07-17 03:58:22 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
$table = id(new PhutilConsoleTable())
|
2015-02-01 01:58:18 +01:00
|
|
|
->addColumn('type', array('title' => pht('Status')))
|
|
|
|
->addColumn('time', array('title' => pht('Tracked'), 'align' => 'right'))
|
|
|
|
->addColumn('name', array('title' => pht('Name')))
|
Add Phrequent workflows to Arcanist
Summary:
Depends on D9906.
This adds `arc start`, `arc stop` and `arc tracking` for tracking tasks, diffs and other objects in Phrequent.
Test Plan: Tested this against a local install.
Reviewers: skyronic, #blessed_reviewers, epriestley
Reviewed By: #blessed_reviewers, epriestley
Subscribers: maxhodak, hach-que, aran, epriestley, Korvin
Maniphest Tasks: T3569, T3969
Differential Revision: https://secure.phabricator.com/D7327
2014-07-17 03:58:22 +02:00
|
|
|
->setBorders(false);
|
|
|
|
|
|
|
|
$i = 0;
|
|
|
|
foreach ($results as $result) {
|
2014-07-17 05:26:00 +02:00
|
|
|
if ($i === 0) {
|
2015-02-01 01:58:18 +01:00
|
|
|
$column_type = pht('In Progress');
|
Add Phrequent workflows to Arcanist
Summary:
Depends on D9906.
This adds `arc start`, `arc stop` and `arc tracking` for tracking tasks, diffs and other objects in Phrequent.
Test Plan: Tested this against a local install.
Reviewers: skyronic, #blessed_reviewers, epriestley
Reviewed By: #blessed_reviewers, epriestley
Subscribers: maxhodak, hach-que, aran, epriestley, Korvin
Maniphest Tasks: T3569, T3969
Differential Revision: https://secure.phabricator.com/D7327
2014-07-17 03:58:22 +02:00
|
|
|
} else {
|
2015-02-01 01:58:18 +01:00
|
|
|
$column_type = pht('Suspended');
|
Add Phrequent workflows to Arcanist
Summary:
Depends on D9906.
This adds `arc start`, `arc stop` and `arc tracking` for tracking tasks, diffs and other objects in Phrequent.
Test Plan: Tested this against a local install.
Reviewers: skyronic, #blessed_reviewers, epriestley
Reviewed By: #blessed_reviewers, epriestley
Subscribers: maxhodak, hach-que, aran, epriestley, Korvin
Maniphest Tasks: T3569, T3969
Differential Revision: https://secure.phabricator.com/D7327
2014-07-17 03:58:22 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
$table->addRow(array(
|
|
|
|
'type' => '('.$column_type.')',
|
2015-09-21 21:40:06 +02:00
|
|
|
'time' => tsprintf($result['time']),
|
Add Phrequent workflows to Arcanist
Summary:
Depends on D9906.
This adds `arc start`, `arc stop` and `arc tracking` for tracking tasks, diffs and other objects in Phrequent.
Test Plan: Tested this against a local install.
Reviewers: skyronic, #blessed_reviewers, epriestley
Reviewed By: #blessed_reviewers, epriestley
Subscribers: maxhodak, hach-que, aran, epriestley, Korvin
Maniphest Tasks: T3569, T3969
Differential Revision: https://secure.phabricator.com/D7327
2014-07-17 03:58:22 +02:00
|
|
|
'name' => $phid_map[$result['phid']],
|
|
|
|
));
|
|
|
|
|
|
|
|
$i++;
|
|
|
|
}
|
|
|
|
|
|
|
|
$table->draw();
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|