mirror of
https://we.phorge.it/source/phorge.git
synced 2024-11-29 02:02:41 +01:00
56c65e33ef
Summary: Ref T1049. This is very minimal, but does what it says. I merged the variable replacement code so Remote + HTTP can share more stuff. Test Plan: Ran "HTTP" and "Remote" build plans. {F79886} {F79887} Reviewers: hach-que, btrahan Reviewed By: hach-que CC: zeeg, aran Maniphest Tasks: T1049 Differential Revision: https://secure.phabricator.com/D7541
49 lines
1.1 KiB
PHP
49 lines
1.1 KiB
PHP
<?php
|
|
|
|
final class HarbormasterBuildCancelController
|
|
extends HarbormasterController {
|
|
|
|
private $id;
|
|
|
|
public function willProcessRequest(array $data) {
|
|
$this->id = $data['id'];
|
|
}
|
|
|
|
public function processRequest() {
|
|
$request = $this->getRequest();
|
|
$viewer = $request->getUser();
|
|
|
|
$id = $this->id;
|
|
|
|
$build = id(new HarbormasterBuildQuery())
|
|
->setViewer($viewer)
|
|
->withIDs(array($id))
|
|
->executeOne();
|
|
if ($build === null) {
|
|
return new Aphront404Response();
|
|
}
|
|
|
|
$build_uri = $this->getApplicationURI('/build/'.$build->getID());
|
|
|
|
if ($request->isDialogFormPost()) {
|
|
$build->setCancelRequested(1);
|
|
$build->save();
|
|
|
|
return id(new AphrontRedirectResponse())->setURI($build_uri);
|
|
}
|
|
|
|
$dialog = new AphrontDialogView();
|
|
$dialog->setTitle(pht('Really cancel build?'))
|
|
->setUser($viewer)
|
|
->addSubmitButton(pht('Cancel'))
|
|
->addCancelButton($build_uri, pht('Don\'t Cancel'));
|
|
$dialog->appendChild(
|
|
phutil_tag(
|
|
'p',
|
|
array(),
|
|
pht(
|
|
'Really cancel this build?')));
|
|
return id(new AphrontDialogResponse())->setDialog($dialog);
|
|
}
|
|
|
|
}
|