2011-03-27 07:55:18 +02:00
|
|
|
<?php
|
|
|
|
|
|
|
|
/*
|
2012-01-24 01:36:32 +01:00
|
|
|
* Copyright 2012 Facebook, Inc.
|
2011-03-27 07:55:18 +02:00
|
|
|
*
|
|
|
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
|
|
* you may not use this file except in compliance with the License.
|
|
|
|
* You may obtain a copy of the License at
|
|
|
|
*
|
|
|
|
* http://www.apache.org/licenses/LICENSE-2.0
|
|
|
|
*
|
|
|
|
* Unless required by applicable law or agreed to in writing, software
|
|
|
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
|
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
|
|
* See the License for the specific language governing permissions and
|
|
|
|
* limitations under the License.
|
|
|
|
*/
|
|
|
|
|
2012-03-10 00:46:25 +01:00
|
|
|
final class PhabricatorWorkerTaskDetailController
|
2011-03-27 07:55:18 +02:00
|
|
|
extends PhabricatorDaemonController {
|
|
|
|
|
|
|
|
private $id;
|
|
|
|
|
|
|
|
public function willProcessRequest(array $data) {
|
|
|
|
$this->id = $data['id'];
|
|
|
|
}
|
|
|
|
|
|
|
|
public function processRequest() {
|
|
|
|
$request = $this->getRequest();
|
|
|
|
$user = $request->getUser();
|
|
|
|
|
2012-10-31 23:22:16 +01:00
|
|
|
$task = id(new PhabricatorWorkerActiveTask())->load($this->id);
|
2011-03-27 07:55:18 +02:00
|
|
|
if (!$task) {
|
|
|
|
$error_view = new AphrontErrorView();
|
|
|
|
$error_view->setTitle('No Such Task');
|
|
|
|
$error_view->appendChild(
|
|
|
|
'<p>This task may have recently completed.</p>');
|
|
|
|
$error_view->setSeverity(AphrontErrorView::SEVERITY_WARNING);
|
|
|
|
return $this->buildStandardPageResponse(
|
|
|
|
$error_view,
|
|
|
|
array(
|
|
|
|
'title' => 'Task Does Not Exist',
|
|
|
|
));
|
|
|
|
}
|
|
|
|
|
|
|
|
$data = id(new PhabricatorWorkerTaskData())->loadOneWhere(
|
2011-04-14 21:07:57 +02:00
|
|
|
'id = %d',
|
|
|
|
$task->getDataID());
|
Improve several Diffusion UI error states
Summary:
Give users better errors and UI:
- For subpath SVN repositories, default the path to the subdirectory, not to
"/". This makes the home screen useful and things generally less confusing.
- For unparsed commits, show a more descriptive error message without the
"blah blah" silliness.
- For paths outside of the subpath parse tree, short circuit into an
appropriate error message.
- For foreign SVN stub commits (see D892), show an explicit message.
Test Plan: Looked at unparsed commits, subpath repositories, foreign stub
commits, and paths outside of the subpath parse tree. Received sensible error
messages.
Reviewers: jungejason, nh, tuomaspelkonen, aran
Reviewed By: jungejason
CC: aran, jungejason
Differential Revision: 894
2011-09-04 23:39:52 +02:00
|
|
|
|
|
|
|
$extra = null;
|
|
|
|
switch ($task->getTaskClass()) {
|
|
|
|
case 'PhabricatorRepositorySvnCommitChangeParserWorker':
|
|
|
|
case 'PhabricatorRepositoryGitCommitChangeParserWorker':
|
|
|
|
$commit_id = idx($data->getData(), 'commitID');
|
|
|
|
if ($commit_id) {
|
|
|
|
$commit = id(new PhabricatorRepositoryCommit())->load($commit_id);
|
|
|
|
if ($commit) {
|
|
|
|
$repository = id(new PhabricatorRepository())->load(
|
|
|
|
$commit->getRepositoryID());
|
|
|
|
if ($repository) {
|
|
|
|
$extra =
|
|
|
|
"<strong>NOTE:</strong> ".
|
|
|
|
"You can manually retry this task by running this script:".
|
|
|
|
"<pre>".
|
Refactor repository reparse scripts to be more useful
Summary:
Splitting up D960 a bit, see that for context.
We currently have two scripts, "parse_one_commit.php" and
"reparse_all_commit_messages.php", but they're sort of silly and you can't do
certain things with them. Replace them with one script which is more flexible
and can do specific reparse steps on individual commits or entire repos.
I left the old scripts as stubs since I think there are some FB wiki docs and
stuff that mention them. I'll delete them in a month or whenever I remember or
something.
Test Plan: Ran "reparse.php" with various arguments, including vs-one-commit,
vs-repository, with --trace, and against different types of repos.
Reviewers: Makinde, jungejason, nh, tuomaspelkonen, aran
Reviewed By: jungejason
CC: aran, jungejason
Differential Revision: 964
2011-09-27 00:04:04 +02:00
|
|
|
"phabricator/\$ ./scripts/repository/reparse.php ".
|
Improve several Diffusion UI error states
Summary:
Give users better errors and UI:
- For subpath SVN repositories, default the path to the subdirectory, not to
"/". This makes the home screen useful and things generally less confusing.
- For unparsed commits, show a more descriptive error message without the
"blah blah" silliness.
- For paths outside of the subpath parse tree, short circuit into an
appropriate error message.
- For foreign SVN stub commits (see D892), show an explicit message.
Test Plan: Looked at unparsed commits, subpath repositories, foreign stub
commits, and paths outside of the subpath parse tree. Received sensible error
messages.
Reviewers: jungejason, nh, tuomaspelkonen, aran
Reviewed By: jungejason
CC: aran, jungejason
Differential Revision: 894
2011-09-04 23:39:52 +02:00
|
|
|
"r".
|
|
|
|
phutil_escape_html($repository->getCallsign()).
|
|
|
|
phutil_escape_html($commit->getCommitIdentifier()).
|
Refactor repository reparse scripts to be more useful
Summary:
Splitting up D960 a bit, see that for context.
We currently have two scripts, "parse_one_commit.php" and
"reparse_all_commit_messages.php", but they're sort of silly and you can't do
certain things with them. Replace them with one script which is more flexible
and can do specific reparse steps on individual commits or entire repos.
I left the old scripts as stubs since I think there are some FB wiki docs and
stuff that mention them. I'll delete them in a month or whenever I remember or
something.
Test Plan: Ran "reparse.php" with various arguments, including vs-one-commit,
vs-repository, with --trace, and against different types of repos.
Reviewers: Makinde, jungejason, nh, tuomaspelkonen, aran
Reviewed By: jungejason
CC: aran, jungejason
Differential Revision: 964
2011-09-27 00:04:04 +02:00
|
|
|
" ".
|
|
|
|
"--change".
|
Improve several Diffusion UI error states
Summary:
Give users better errors and UI:
- For subpath SVN repositories, default the path to the subdirectory, not to
"/". This makes the home screen useful and things generally less confusing.
- For unparsed commits, show a more descriptive error message without the
"blah blah" silliness.
- For paths outside of the subpath parse tree, short circuit into an
appropriate error message.
- For foreign SVN stub commits (see D892), show an explicit message.
Test Plan: Looked at unparsed commits, subpath repositories, foreign stub
commits, and paths outside of the subpath parse tree. Received sensible error
messages.
Reviewers: jungejason, nh, tuomaspelkonen, aran
Reviewed By: jungejason
CC: aran, jungejason
Differential Revision: 894
2011-09-04 23:39:52 +02:00
|
|
|
"</pre>";
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
2011-03-27 07:55:18 +02:00
|
|
|
if ($data) {
|
|
|
|
$data = json_encode($data->getData());
|
|
|
|
}
|
|
|
|
|
|
|
|
$form = id(new AphrontFormView())
|
|
|
|
->setUser($user)
|
|
|
|
->appendChild(
|
|
|
|
id(new AphrontFormStaticControl())
|
|
|
|
->setLabel('ID')
|
|
|
|
->setValue($task->getID()))
|
|
|
|
->appendChild(
|
|
|
|
id(new AphrontFormStaticControl())
|
|
|
|
->setLabel('Type')
|
|
|
|
->setValue($task->getTaskClass()))
|
|
|
|
->appendChild(
|
|
|
|
id(new AphrontFormStaticControl())
|
|
|
|
->setLabel('Lease Owner')
|
|
|
|
->setValue($task->getLeaseOwner()))
|
|
|
|
->appendChild(
|
|
|
|
id(new AphrontFormStaticControl())
|
|
|
|
->setLabel('Lease Expires')
|
|
|
|
->setValue($task->getLeaseExpires() - time()))
|
|
|
|
->appendChild(
|
|
|
|
id(new AphrontFormStaticControl())
|
|
|
|
->setLabel('Failure Count')
|
|
|
|
->setValue($task->getFailureCount()))
|
|
|
|
->appendChild(
|
|
|
|
id(new AphrontFormTextAreaControl())
|
|
|
|
->setLabel('Data')
|
Improve several Diffusion UI error states
Summary:
Give users better errors and UI:
- For subpath SVN repositories, default the path to the subdirectory, not to
"/". This makes the home screen useful and things generally less confusing.
- For unparsed commits, show a more descriptive error message without the
"blah blah" silliness.
- For paths outside of the subpath parse tree, short circuit into an
appropriate error message.
- For foreign SVN stub commits (see D892), show an explicit message.
Test Plan: Looked at unparsed commits, subpath repositories, foreign stub
commits, and paths outside of the subpath parse tree. Received sensible error
messages.
Reviewers: jungejason, nh, tuomaspelkonen, aran
Reviewed By: jungejason
CC: aran, jungejason
Differential Revision: 894
2011-09-04 23:39:52 +02:00
|
|
|
->setValue($data));
|
|
|
|
|
|
|
|
if ($extra) {
|
|
|
|
$form->appendChild(
|
|
|
|
id(new AphrontFormMarkupControl())
|
|
|
|
->setLabel('More')
|
|
|
|
->setValue($extra));
|
|
|
|
}
|
|
|
|
|
|
|
|
$form
|
2011-03-27 07:55:18 +02:00
|
|
|
->appendChild(
|
|
|
|
id(new AphrontFormSubmitControl())
|
2012-01-24 01:36:32 +01:00
|
|
|
->addCancelButton('/daemon/', 'Back'));
|
2011-03-27 07:55:18 +02:00
|
|
|
|
|
|
|
$panel = new AphrontPanelView();
|
|
|
|
$panel->setHeader('Task Detail');
|
Improve several Diffusion UI error states
Summary:
Give users better errors and UI:
- For subpath SVN repositories, default the path to the subdirectory, not to
"/". This makes the home screen useful and things generally less confusing.
- For unparsed commits, show a more descriptive error message without the
"blah blah" silliness.
- For paths outside of the subpath parse tree, short circuit into an
appropriate error message.
- For foreign SVN stub commits (see D892), show an explicit message.
Test Plan: Looked at unparsed commits, subpath repositories, foreign stub
commits, and paths outside of the subpath parse tree. Received sensible error
messages.
Reviewers: jungejason, nh, tuomaspelkonen, aran
Reviewed By: jungejason
CC: aran, jungejason
Differential Revision: 894
2011-09-04 23:39:52 +02:00
|
|
|
$panel->setWidth(AphrontPanelView::WIDTH_WIDE);
|
2011-03-27 07:55:18 +02:00
|
|
|
$panel->appendChild($form);
|
|
|
|
|
2012-01-24 01:36:32 +01:00
|
|
|
$panel->addButton(
|
|
|
|
javelin_render_tag(
|
|
|
|
'a',
|
|
|
|
array(
|
|
|
|
'href' => '/daemon/task/'.$task->getID().'/delete/',
|
|
|
|
'class' => 'button grey',
|
|
|
|
'sigil' => 'workflow',
|
|
|
|
),
|
|
|
|
'Delete Task'));
|
|
|
|
|
|
|
|
$panel->addButton(
|
|
|
|
javelin_render_tag(
|
|
|
|
'a',
|
|
|
|
array(
|
|
|
|
'href' => '/daemon/task/'.$task->getID().'/release/',
|
|
|
|
'class' => 'button grey',
|
|
|
|
'sigil' => 'workflow',
|
|
|
|
),
|
|
|
|
'Free Lease'));
|
|
|
|
|
2012-08-14 00:27:45 +02:00
|
|
|
$nav = $this->buildSideNavView();
|
|
|
|
$nav->selectFilter('');
|
|
|
|
$nav->appendChild($panel);
|
|
|
|
|
|
|
|
return $this->buildApplicationPage(
|
|
|
|
$nav,
|
2011-03-27 07:55:18 +02:00
|
|
|
array(
|
|
|
|
'title' => 'Task',
|
|
|
|
));
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|