@recaptime-dev's working patches + fork for Phorge, a community fork of Phabricator. (Upstream dev and stable branches are at upstream/main and upstream/stable respectively.) hq.recaptime.dev/wiki/Phorge
phorge phabricator
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

Add a summary view of all repository errors to the repository cluster screen

Summary: Ref T11559. This makes managing large numbers of repositories slightly easier.

Test Plan: {F1796119}

Reviewers: chad

Reviewed By: chad

Maniphest Tasks: T11559

Differential Revision: https://secure.phabricator.com/D16472

+83 -1
+72 -1
src/applications/config/controller/PhabricatorConfigClusterRepositoriesController.php
··· 27 27 ->setBorder(true); 28 28 29 29 $repository_status = $this->buildClusterRepositoryStatus(); 30 + $repository_errors = $this->buildClusterRepositoryErrors(); 30 31 31 32 $content = id(new PhabricatorConfigPageView()) 32 33 ->setHeader($header) 33 - ->setContent($repository_status); 34 + ->setContent( 35 + array( 36 + $repository_status, 37 + $repository_errors, 38 + )); 34 39 35 40 return $this->newPage() 36 41 ->setTitle($title) ··· 337 342 return $result; 338 343 } 339 344 345 + 346 + private function buildClusterRepositoryErrors() { 347 + $viewer = $this->getViewer(); 348 + 349 + $messages = id(new PhabricatorRepositoryStatusMessage())->loadAllWhere( 350 + 'statusCode IN (%Ls)', 351 + array( 352 + PhabricatorRepositoryStatusMessage::CODE_ERROR, 353 + )); 354 + 355 + $repository_ids = mpull($messages, 'getRepositoryID'); 356 + if ($repository_ids) { 357 + // NOTE: We're bypassing policies when loading repositories because we 358 + // want to show errors exist even if the viewer can't see the repository. 359 + // We use handles to describe the repository below, so the viewer won't 360 + // actually be able to see any particulars if they can't see the 361 + // repository. 362 + $repositories = id(new PhabricatorRepositoryQuery()) 363 + ->setViewer(PhabricatorUser::getOmnipotentUser()) 364 + ->withIDs($repository_ids) 365 + ->execute(); 366 + $repositories = mpull($repositories, null, 'getID'); 367 + } 368 + 369 + $rows = array(); 370 + foreach ($messages as $message) { 371 + $repository = idx($repositories, $message->getRepositoryID()); 372 + if (!$repository) { 373 + continue; 374 + } 375 + 376 + if (!$repository->isTracked()) { 377 + continue; 378 + } 379 + 380 + $icon = id(new PHUIIconView()) 381 + ->setIcon('fa-exclamation-triangle red'); 382 + 383 + $rows[] = array( 384 + $icon, 385 + $viewer->renderHandle($repository->getPHID()), 386 + phutil_tag( 387 + 'a', 388 + array( 389 + 'href' => $repository->getPathURI('manage/status/'), 390 + ), 391 + $message->getStatusTypeName()), 392 + ); 393 + } 394 + 395 + return id(new AphrontTableView($rows)) 396 + ->setNoDataString( 397 + pht('No active repositories have outstanding errors.')) 398 + ->setHeaders( 399 + array( 400 + null, 401 + pht('Repository'), 402 + pht('Error'), 403 + )) 404 + ->setColumnClasses( 405 + array( 406 + null, 407 + 'pri', 408 + 'wide', 409 + )); 410 + } 340 411 341 412 }
+11
src/applications/repository/storage/PhabricatorRepositoryStatusMessage.php
··· 40 40 return idx($this->parameters, $key, $default); 41 41 } 42 42 43 + public function getStatusTypeName() { 44 + $names = array( 45 + self::TYPE_INIT => pht('Error While Initializing Repository'), 46 + self::TYPE_FETCH => pht('Error While Fetching Changes'), 47 + self::TYPE_NEEDS_UPDATE => pht('Repository Needs Update'), 48 + ); 49 + 50 + $type = $this->getStatusType(); 51 + return idx($names, $type, $type); 52 + } 53 + 43 54 }