public function handleRequest(AphrontRequest $request)
 {
     $viewer = $request->getViewer();
     $id = $request->getURIData('id');
     $operation = id(new DrydockRepositoryOperationQuery())->setViewer($viewer)->withIDs(array($id))->executeOne();
     if (!$operation) {
         return new Aphront404Response();
     }
     $id = $operation->getID();
     $title = pht('Repository Operation %d', $id);
     $header = id(new PHUIHeaderView())->setHeader($title)->setUser($viewer)->setPolicyObject($operation);
     $state = $operation->getOperationState();
     $icon = DrydockRepositoryOperation::getOperationStateIcon($state);
     $name = DrydockRepositoryOperation::getOperationStateName($state);
     $header->setStatus($icon, null, $name);
     $actions = $this->buildActionListView($operation);
     $properties = $this->buildPropertyListView($operation);
     $properties->setActionList($actions);
     $crumbs = $this->buildApplicationCrumbs();
     $crumbs->addTextCrumb(pht('Operations'), $this->getApplicationURI('operation/'));
     $crumbs->addTextCrumb($title);
     $object_box = id(new PHUIObjectBoxView())->setHeader($header)->addPropertyList($properties);
     $status_view = id(new DrydockRepositoryOperationStatusView())->setUser($viewer)->setOperation($operation);
     return $this->buildApplicationPage(array($crumbs, $object_box, $status_view), array('title' => $title));
 }
 public function handleRequest(AphrontRequest $request)
 {
     $viewer = $request->getViewer();
     $id = $request->getURIData('id');
     $operation = id(new DrydockRepositoryOperationQuery())->setViewer($viewer)->withIDs(array($id))->executeOne();
     if (!$operation) {
         return new Aphront404Response();
     }
     $id = $operation->getID();
     $title = pht('Repository Operation %d', $id);
     $header = id(new PHUIHeaderView())->setHeader($title)->setUser($viewer)->setPolicyObject($operation)->setHeaderIcon('fa-fighter-jet');
     $state = $operation->getOperationState();
     $icon = DrydockRepositoryOperation::getOperationStateIcon($state);
     $name = DrydockRepositoryOperation::getOperationStateName($state);
     $header->setStatus($icon, null, $name);
     $curtain = $this->buildCurtain($operation);
     $properties = $this->buildPropertyListView($operation);
     $crumbs = $this->buildApplicationCrumbs();
     $crumbs->addTextCrumb(pht('Operations'), $this->getApplicationURI('operation/'));
     $crumbs->addTextCrumb($title);
     $crumbs->setBorder(true);
     $status_view = id(new DrydockRepositoryOperationStatusView())->setUser($viewer)->setOperation($operation);
     $view = id(new PHUITwoColumnView())->setHeader($header)->setCurtain($curtain)->addPropertySection(pht('Properties'), $properties)->setMainColumn(array($status_view));
     return $this->newPage()->setTitle($title)->setCrumbs($crumbs)->appendChild(array($view));
 }
コード例 #3
0
 public function renderUnderwayState()
 {
     $viewer = $this->getUser();
     $operation = $this->getOperation();
     $id = $operation->getID();
     $state = $operation->getOperationState();
     $icon = DrydockRepositoryOperation::getOperationStateIcon($state);
     $name = DrydockRepositoryOperation::getOperationStateName($state);
     $item = id(new PHUIObjectItemView())->setHref("/drydock/operation/{$id}/")->setObjectName(pht('Operation %d', $id))->setHeader($operation->getOperationDescription($viewer))->setStatusIcon($icon, $name);
     if ($state != DrydockRepositoryOperation::STATE_FAIL) {
         $item->addAttribute($operation->getOperationCurrentStatus($viewer));
     } else {
         $vcs_error = $operation->getWorkingCopyVCSError();
         if ($vcs_error) {
             switch ($vcs_error['phase']) {
                 case DrydockWorkingCopyBlueprintImplementation::PHASE_SQUASHMERGE:
                     $message = pht('This change did not merge cleanly. This usually indicates ' . 'that the change is out of date and needs to be updated.');
                     break;
                 default:
                     $message = pht('Operation encountered an error while performing repository ' . 'operations.');
                     break;
             }
             $item->addAttribute($message);
             $table = $this->renderVCSErrorTable($vcs_error);
             list($links, $info) = $this->renderDetailToggles($table);
             $item->addAttribute($links);
             $item->appendChild($info);
         } else {
             $item->addAttribute(pht('Operation encountered an error.'));
         }
         $is_dismissed = $operation->getIsDismissed();
         $item->addAction(id(new PHUIListItemView())->setName('Dismiss')->setIcon('fa-times')->setDisabled($is_dismissed)->setWorkflow(true)->setHref("/drydock/operation/{$id}/dismiss/"));
     }
     return id(new PHUIObjectItemListView())->addItem($item);
 }
コード例 #4
0
 public function renderUnderwayState()
 {
     $viewer = $this->getUser();
     $operation = $this->getOperation();
     $id = $operation->getID();
     $state = $operation->getOperationState();
     $icon = DrydockRepositoryOperation::getOperationStateIcon($state);
     $name = DrydockRepositoryOperation::getOperationStateName($state);
     $item = id(new PHUIObjectItemView())->setHref("/drydock/operation/{$id}/")->setHeader($operation->getOperationDescription($viewer))->setStatusIcon($icon, $name);
     if ($state != DrydockRepositoryOperation::STATE_FAIL) {
         $item->addAttribute($operation->getOperationCurrentStatus($viewer));
     } else {
         // TODO: Make this more useful.
         $item->addAttribute(pht('Operation encountered an error.'));
     }
     return id(new PHUIObjectItemListView())->addItem($item);
 }
コード例 #5
0
 protected function renderResultList(array $operations, PhabricatorSavedQuery $query, array $handles)
 {
     assert_instances_of($operations, 'DrydockRepositoryOperation');
     $viewer = $this->requireViewer();
     $view = new PHUIObjectItemListView();
     foreach ($operations as $operation) {
         $id = $operation->getID();
         $item = id(new PHUIObjectItemView())->setHeader($operation->getOperationDescription($viewer))->setHref($this->getApplicationURI("operation/{$id}/"))->setObjectName(pht('Repository Operation %d', $id));
         $state = $operation->getOperationState();
         $icon = DrydockRepositoryOperation::getOperationStateIcon($state);
         $name = DrydockRepositoryOperation::getOperationStateName($state);
         $item->addIcon($icon, $name);
         $item->addByline(array(pht('Via:'), ' ', $viewer->renderHandle($operation->getAuthorPHID())));
         $item->addAttribute($viewer->renderHandle($operation->getObjectPHID()));
         $item->addAttribute($viewer->renderHandle($operation->getRepositoryPHID()));
         $view->addItem($item);
     }
     $result = id(new PhabricatorApplicationSearchResultView())->setObjectList($view)->setNoDataString(pht('No matching operations.'));
     return $result;
 }