1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2024-12-20 20:40:56 +01:00

Make "Edit Build Plan" more resiliant so old build configurations can be deleted

Summary: Currently the "Edit Build Plan" page crashes if there are any build steps with invalid implementations (because the implementation class has been removed or renamed).  This updates the Edit Build Plan page so that steps with invalid implementations can be deleted.

Test Plan: Looked at a build plan with invalid configurations and deleted it's steps.

Reviewers: epriestley, #blessed_reviewers

Reviewed By: epriestley

CC: Korvin, epriestley, aran

Maniphest Tasks: T4111, T1049

Differential Revision: https://secure.phabricator.com/D7708
This commit is contained in:
James Rhodes 2013-12-05 14:20:40 +11:00
parent 5c02113bf9
commit a8b27130cb

View file

@ -86,7 +86,31 @@ final class HarbormasterPlanViewController
$step_list = id(new PHUIObjectItemListView())
->setUser($viewer);
foreach ($steps as $step) {
$implementation = $step->getStepImplementation();
$implementation = null;
try {
$implementation = $step->getStepImplementation();
} catch (Exception $ex) {
// We can't initialize the implementation. This might be because
// it's been renamed or no longer exists.
$item = id(new PHUIObjectItemView())
->setObjectName("Step ".$i++)
->setHeader(pht('Unknown Implementation'))
->setBarColor('red')
->addAttribute(pht(
'This step has an invalid implementation (%s).',
$step->getClassName()))
->addAction(
id(new PHUIListItemView())
->setIcon('delete')
->addSigil('harbormaster-build-step-delete')
->setWorkflow(true)
->setRenderNameAsTooltip(true)
->setName(pht("Delete"))
->setHref(
$this->getApplicationURI("step/delete/".$step->getID()."/")));
$step_list->addItem($item);
continue;
}
$item = id(new PHUIObjectItemView())
->setObjectName("Step ".$i++)
->setHeader($implementation->getName());