Differential D14259 Diff 34449 src/applications/diffusion/controller/DiffusionRepositoryEditMainController.php
Changeset View
Changeset View
Standalone View
Standalone View
src/applications/diffusion/controller/DiffusionRepositoryEditMainController.php
| Show All 25 Lines | switch ($repository->getVersionControlSystem()) { | ||||
| case PhabricatorRepositoryType::REPOSITORY_TYPE_MERCURIAL: | case PhabricatorRepositoryType::REPOSITORY_TYPE_MERCURIAL: | ||||
| $is_hg = true; | $is_hg = true; | ||||
| break; | break; | ||||
| } | } | ||||
| $has_branches = ($is_git || $is_hg); | $has_branches = ($is_git || $is_hg); | ||||
| $has_local = $repository->usesLocalWorkingCopy(); | $has_local = $repository->usesLocalWorkingCopy(); | ||||
| $supports_staging = $repository->supportsStaging(); | $supports_staging = $repository->supportsStaging(); | ||||
| $supports_automation = $repository->supportsAutomation(); | |||||
| $crumbs = $this->buildApplicationCrumbs($is_main = true); | $crumbs = $this->buildApplicationCrumbs($is_main = true); | ||||
| $title = pht('Edit %s', $repository->getName()); | $title = pht('Edit %s', $repository->getName()); | ||||
| $header = id(new PHUIHeaderView()) | $header = id(new PHUIHeaderView()) | ||||
| ->setHeader($title); | ->setHeader($title); | ||||
| if ($repository->isTracked()) { | if ($repository->isTracked()) { | ||||
| ▲ Show 20 Lines • Show All 53 Lines • ▼ Show 20 Lines | protected function processDiffusionRequest(AphrontRequest $request) { | ||||
| $staging_properties = null; | $staging_properties = null; | ||||
| if ($supports_staging) { | if ($supports_staging) { | ||||
| $staging_properties = $this->buildStagingProperties( | $staging_properties = $this->buildStagingProperties( | ||||
| $repository, | $repository, | ||||
| $this->buildStagingActions($repository)); | $this->buildStagingActions($repository)); | ||||
| } | } | ||||
| $automation_properties = null; | |||||
| if ($supports_automation) { | |||||
| $automation_properties = $this->buildAutomationProperties( | |||||
| $repository, | |||||
| $this->buildAutomationActions($repository)); | |||||
| } | |||||
| $actions_properties = $this->buildActionsProperties( | $actions_properties = $this->buildActionsProperties( | ||||
| $repository, | $repository, | ||||
| $this->buildActionsActions($repository)); | $this->buildActionsActions($repository)); | ||||
| $timeline = $this->buildTransactionTimeline( | $timeline = $this->buildTransactionTimeline( | ||||
| $repository, | $repository, | ||||
| new PhabricatorRepositoryTransactionQuery()); | new PhabricatorRepositoryTransactionQuery()); | ||||
| $timeline->setShouldTerminate(true); | $timeline->setShouldTerminate(true); | ||||
| ▲ Show 20 Lines • Show All 55 Lines • ▼ Show 20 Lines | protected function processDiffusionRequest(AphrontRequest $request) { | ||||
| } | } | ||||
| if ($staging_properties) { | if ($staging_properties) { | ||||
| $boxes[] = id(new PHUIObjectBoxView()) | $boxes[] = id(new PHUIObjectBoxView()) | ||||
| ->setHeaderText(pht('Staging')) | ->setHeaderText(pht('Staging')) | ||||
| ->addPropertyList($staging_properties); | ->addPropertyList($staging_properties); | ||||
| } | } | ||||
| if ($automation_properties) { | |||||
| $boxes[] = id(new PHUIObjectBoxView()) | |||||
| ->setHeaderText(pht('Automation')) | |||||
| ->addPropertyList($automation_properties); | |||||
| } | |||||
| $boxes[] = id(new PHUIObjectBoxView()) | $boxes[] = id(new PHUIObjectBoxView()) | ||||
| ->setHeaderText(pht('Text Encoding')) | ->setHeaderText(pht('Text Encoding')) | ||||
| ->addPropertyList($encoding_properties); | ->addPropertyList($encoding_properties); | ||||
| $boxes[] = id(new PHUIObjectBoxView()) | $boxes[] = id(new PHUIObjectBoxView()) | ||||
| ->setHeaderText(pht('Symbols')) | ->setHeaderText(pht('Symbols')) | ||||
| ->addPropertyList($symbols_properties); | ->addPropertyList($symbols_properties); | ||||
| ▲ Show 20 Lines • Show All 435 Lines • ▼ Show 20 Lines | private function buildStorageProperties( | ||||
| $view->addProperty( | $view->addProperty( | ||||
| pht('Storage Path'), | pht('Storage Path'), | ||||
| $repository->getHumanReadableDetail('local-path')); | $repository->getHumanReadableDetail('local-path')); | ||||
| return $view; | return $view; | ||||
| } | } | ||||
| private function buildStagingActions(PhabricatorRepository $repository) { | private function buildStagingActions(PhabricatorRepository $repository) { | ||||
| $viewer = $this->getViewer(); | $viewer = $this->getViewer(); | ||||
| $view = id(new PhabricatorActionListView()) | $view = id(new PhabricatorActionListView()) | ||||
| ->setObjectURI($this->getRequest()->getRequestURI()) | ->setObjectURI($this->getRequest()->getRequestURI()) | ||||
| ->setUser($viewer); | ->setUser($viewer); | ||||
| $edit = id(new PhabricatorActionView()) | $edit = id(new PhabricatorActionView()) | ||||
| Show All 22 Lines | private function buildStagingProperties( | ||||
| $view->addProperty( | $view->addProperty( | ||||
| pht('Staging Area'), | pht('Staging Area'), | ||||
| $staging_uri); | $staging_uri); | ||||
| return $view; | return $view; | ||||
| } | } | ||||
| private function buildAutomationActions(PhabricatorRepository $repository) { | |||||
| $viewer = $this->getViewer(); | |||||
| $view = id(new PhabricatorActionListView()) | |||||
| ->setObjectURI($this->getRequest()->getRequestURI()) | |||||
| ->setUser($viewer); | |||||
| $edit = id(new PhabricatorActionView()) | |||||
| ->setIcon('fa-pencil') | |||||
| ->setName(pht('Edit Automation')) | |||||
| ->setHref( | |||||
| $this->getRepositoryControllerURI($repository, 'edit/automation/')); | |||||
| $view->addAction($edit); | |||||
| return $view; | |||||
| } | |||||
| private function buildAutomationProperties( | |||||
| PhabricatorRepository $repository, | |||||
| PhabricatorActionListView $actions) { | |||||
| $viewer = $this->getViewer(); | |||||
| $view = id(new PHUIPropertyListView()) | |||||
| ->setUser($viewer) | |||||
| ->setActionList($actions); | |||||
| $blueprint_phids = $repository->getAutomationBlueprintPHIDs(); | |||||
| if (!$blueprint_phids) { | |||||
| $blueprint_view = phutil_tag('em', array(), pht('Not Configured')); | |||||
| } else { | |||||
| $blueprint_view = id(new DrydockObjectAuthorizationView()) | |||||
| ->setUser($viewer) | |||||
| ->setObjectPHID($repository->getPHID()) | |||||
| ->setBlueprintPHIDs($blueprint_phids); | |||||
| } | |||||
| $view->addProperty(pht('Automation'), $blueprint_view); | |||||
| return $view; | |||||
| } | |||||
| private function buildHostingActions(PhabricatorRepository $repository) { | private function buildHostingActions(PhabricatorRepository $repository) { | ||||
| $user = $this->getRequest()->getUser(); | $user = $this->getRequest()->getUser(); | ||||
| $view = id(new PhabricatorActionListView()) | $view = id(new PhabricatorActionListView()) | ||||
| ->setObjectURI($this->getRequest()->getRequestURI()) | ->setObjectURI($this->getRequest()->getRequestURI()) | ||||
| ->setUser($user); | ->setUser($user); | ||||
| $edit = id(new PhabricatorActionView()) | $edit = id(new PhabricatorActionView()) | ||||
| ▲ Show 20 Lines • Show All 637 Lines • Show Last 20 Lines | |||||