1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2024-11-22 06:42:42 +01:00

Show more in Application Detail and List view

Summary:
Update the Application Detail view and List View to show a unified set of Badges (Deprecated, etc.), show PHIDs and Monograms on the Application Detail view, allow Applications to register Monograms.

Example of the page /applications/view/PhabricatorDiffusionApplication/:

{F393393}

T15568

Test Plan:
1. Visit /applications/ and see Deprecated badges etc.
2. Visit various Configure buttons from that list and see Monograms, Badges, PHIDs etc.
3. Enjoy screenshots in the comments of this Diff

Reviewers: O1 Blessed Committers, valerio.bozzolan, avivey, speck

Reviewed By: O1 Blessed Committers, valerio.bozzolan, avivey, speck

Subscribers: avivey, speck, tobiaswiese, valerio.bozzolan, Cigaryno

Differential Revision: https://we.phorge.it/D25362
This commit is contained in:
Matthew Bowker 2023-11-21 11:17:19 -07:00
parent a741f5d65c
commit 1b49165ddd
26 changed files with 189 additions and 6 deletions

View file

@ -61,6 +61,21 @@ abstract class PhabricatorApplication
return pht('%s Application', $this->getName());
}
/**
* Extensions are allowed to register multi-character monograms.
* The name "Monogram" is actually a bit of a misnomer,
* but we're keeping it due to the history.
*
* @return array
*/
public function getMonograms() {
return array();
}
public function isDeprecated() {
return false;
}
final public function isInstalled() {
if (!$this->canUninstall()) {
return true;

View file

@ -28,6 +28,10 @@ final class PhabricatorCalendarApplication extends PhabricatorApplication {
return "\xE2\x8C\xA8";
}
public function getMonograms() {
return array('E');
}
public function getApplicationGroup() {
return self::GROUP_UTILITIES;
}

View file

@ -11,7 +11,7 @@ final class PhabricatorChatLogApplication extends PhabricatorApplication {
}
public function getShortDescription() {
return pht('(Deprecated)');
return pht('IRC Logs');
}
public function getIcon() {
@ -22,6 +22,10 @@ final class PhabricatorChatLogApplication extends PhabricatorApplication {
return true;
}
public function isDeprecated() {
return true;
}
public function getTitleGlyph() {
return "\xE0\xBC\x84";
}
@ -30,7 +34,7 @@ final class PhabricatorChatLogApplication extends PhabricatorApplication {
return self::GROUP_UTILITIES;
}
public function getRoutes() {
public function getRoutes() {
return array(
'/chatlog/' => array(
'' => 'PhabricatorChatLogChannelListController',

View file

@ -28,6 +28,10 @@ final class PhabricatorConpherenceApplication extends PhabricatorApplication {
);
}
public function getMonograms() {
return array('Z');
}
public function getRoutes() {
return array(
'/Z(?P<id>[1-9]\d*)'

View file

@ -36,6 +36,10 @@ final class PhabricatorCountdownApplication extends PhabricatorApplication {
);
}
public function getMonograms() {
return array('C');
}
public function getRoutes() {
return array(
'/C(?P<id>[1-9]\d*)' => 'PhabricatorCountdownViewController',

View file

@ -30,6 +30,10 @@ final class PhabricatorDashboardApplication extends PhabricatorApplication {
return 0.160;
}
public function getMonograms() {
return array('W');
}
public function getRoutes() {
$menu_rules = $this->getProfileMenuRouting(
'PhabricatorDashboardPortalViewController');

View file

@ -42,6 +42,10 @@ final class PhabricatorDifferentialApplication
'engineers to review, discuss and approve changes to software.');
}
public function getMonograms() {
return array('D');
}
public function getRoutes() {
return array(
'/D(?P<id>[1-9]\d*)' => array(

View file

@ -44,6 +44,11 @@ final class PhabricatorDiffusionApplication extends PhabricatorApplication {
);
}
public function getMonograms() {
// This is a special case, as r and R mean different things.
return array('r', 'R');
}
public function getRoutes() {
$repository_routes = array(
'/' => array(

View file

@ -67,6 +67,10 @@ final class PhabricatorFilesApplication extends PhabricatorApplication {
);
}
public function getMonograms() {
return array('F');
}
public function getRoutes() {
return array(
'/F(?P<id>[1-9]\d*)(?:\$(?P<lines>\d+(?:-\d+)?))?'

View file

@ -36,6 +36,10 @@ final class PhabricatorFundApplication extends PhabricatorApplication {
);
}
public function getMonograms() {
return array('I');
}
public function getRoutes() {
return array(
'/I(?P<id>[1-9]\d*)' => 'FundInitiativeViewController',

View file

@ -51,6 +51,10 @@ final class PhabricatorHarbormasterApplication extends PhabricatorApplication {
);
}
public function getMonograms() {
return array('B');
}
public function getRoutes() {
return array(
'/B(?P<id>[1-9]\d*)' => 'HarbormasterBuildableViewController',

View file

@ -49,6 +49,10 @@ final class PhabricatorHeraldApplication extends PhabricatorApplication {
);
}
public function getMonograms() {
return array('H');
}
public function getRoutes() {
return array(
'/H(?P<id>[1-9]\d*)' => 'HeraldRuleViewController',

View file

@ -48,6 +48,10 @@ final class PhabricatorLegalpadApplication extends PhabricatorApplication {
'open source projects keep track of Contributor License Agreements.');
}
public function getMonograms() {
return array('L');
}
public function getRoutes() {
return array(
'/L(?P<id>\d+)' => 'LegalpadDocumentSignController',

View file

@ -42,6 +42,10 @@ final class PhabricatorManiphestApplication extends PhabricatorApplication {
);
}
public function getMonograms() {
return array('T');
}
public function getRoutes() {
return array(
'/T(?P<id>[1-9]\d*)' => 'ManiphestTaskDetailController',

View file

@ -38,6 +38,30 @@ final class PhabricatorApplicationDetailViewController
$header->setStatus('fa-ban', 'dark', pht('Uninstalled'));
}
if (!$selected->isFirstParty()) {
$header->addTag(id(new PHUITagView())
->setName('Extension')
->setIcon('fa-plug')
->setColor(PHUITagView::COLOR_INDIGO)
->setType(PHUITagView::TYPE_SHADE));
}
if ($selected->isPrototype()) {
$header->addTag(id(new PHUITagView())
->setName('Prototype')
->setIcon('fa-exclamation-circle')
->setColor(PHUITagView::COLOR_ORANGE)
->setType(PHUITagView::TYPE_SHADE));
}
if ($selected->isDeprecated()) {
$header->addTag(id(new PHUITagView())
->setName('Deprecated')
->setIcon('fa-exclamation-triangle')
->setColor(PHUITagView::COLOR_RED)
->setType(PHUITagView::TYPE_SHADE));
}
$timeline = $this->buildTransactionTimeline(
$selected,
new PhabricatorApplicationApplicationTransactionQuery());
@ -95,6 +119,27 @@ final class PhabricatorApplicationDetailViewController
phutil_tag('em', array(), $application->getFlavorText()));
}
$phids = PhabricatorPHIDType::getAllTypesForApplication(
get_class($application));
$user_friendly_phids = array();
foreach ($phids as $phid => $type) {
$user_friendly_phids[] = "PHID-{$phid} ({$type->getTypeName()})";
}
if ($user_friendly_phids) {
$properties->addProperty(
'PHIDs',
phutil_implode_html(phutil_tag('br'), $user_friendly_phids));
}
$monograms = $application->getMonograms();
if ($monograms) {
$properties->addProperty(
'Monograms',
phutil_implode_html(', ', $monograms));
}
if ($application->isPrototype()) {
$proto_href = PhabricatorEnv::getDoclink(
'User Guide: Prototype Applications');

View file

@ -231,13 +231,13 @@ final class PhabricatorAppSearchEngine
->setSideColumn($configure);
if (!$application->isFirstParty()) {
$tag = id(new PHUITagView())
$extension_tag = id(new PHUITagView())
->setName(pht('Extension'))
->setIcon('fa-puzzle-piece')
->setColor(PHUITagView::COLOR_BLUE)
->setIcon('fa-plug')
->setColor(PHUITagView::COLOR_INDIGO)
->setType(PHUITagView::TYPE_SHADE)
->setSlimShady(true);
$item->addAttribute($tag);
$item->addAttribute($extension_tag);
}
if ($application->isPrototype()) {
@ -250,6 +250,16 @@ final class PhabricatorAppSearchEngine
$item->addAttribute($prototype_tag);
}
if ($application->isDeprecated()) {
$deprecated_tag = id(new PHUITagView())
->setName(pht('Deprecated'))
->setIcon('fa-exclamation-triangle')
->setColor(PHUITagView::COLOR_RED)
->setType(PHUITagView::TYPE_SHADE)
->setSlimShady(true);
$item->addAttribute($deprecated_tag);
}
$item->addAttribute($description);
if ($application->getBaseURI() && $application->isInstalled()) {

View file

@ -45,6 +45,10 @@ final class PhabricatorOwnersApplication extends PhabricatorApplication {
);
}
public function getMonograms() {
return array('O');
}
public function getRoutes() {
return array(
'/owners/' => array(

View file

@ -34,6 +34,10 @@ final class PhabricatorPassphraseApplication extends PhabricatorApplication {
return false;
}
public function getMonograms() {
return array('K');
}
public function getRoutes() {
return array(
'/K(?P<id>\d+)' => 'PassphraseCredentialViewController',

View file

@ -32,6 +32,10 @@ final class PhabricatorPasteApplication extends PhabricatorApplication {
);
}
public function getMonograms() {
return array('P');
}
public function getRoutes() {
return array(
'/P(?P<id>[1-9]\d*)(?:\$(?P<lines>\d+(?:-\d+)?))?'

View file

@ -31,6 +31,10 @@ final class PhabricatorPhameApplication extends PhabricatorApplication {
);
}
public function getMonograms() {
return array('J');
}
public function getRoutes() {
return array(
'/J(?P<id>[1-9]\d*)' => 'PhamePostViewController',

View file

@ -205,4 +205,28 @@ abstract class PhabricatorPHIDType extends Phobject {
return $installed_types;
}
/**
* Get all PHID types of applications installed for a given viewer.
*
* @param PhabricatorUser Viewing user.
* @return dict<string, PhabricatorPHIDType> Map of constants to installed
* types.
*/
public static function getAllTypesForApplication(
string $application) {
$all_types = self::getAllTypes();
$application_types = array();
foreach ($all_types as $key => $type) {
if ($type->getPHIDTypeApplicationClass() != $application) {
continue;
}
$application_types[$key] = $type;
}
return $application_types;
}
}

View file

@ -32,6 +32,10 @@ final class PhabricatorPholioApplication extends PhabricatorApplication {
);
}
public function getMonograms() {
return array('M');
}
public function getRoutes() {
return array(
'/M(?P<id>[1-9]\d*)(?:/(?P<imageID>\d+)/)?' => 'PholioMockViewController',

View file

@ -37,6 +37,10 @@ final class PhabricatorPhurlApplication extends PhabricatorApplication {
);
}
public function getMonograms() {
return array('U');
}
public function getRoutes() {
return array(
'/U(?P<id>[1-9]\d*)/?' => 'PhabricatorPhurlURLViewController',

View file

@ -47,6 +47,10 @@ final class PhabricatorPonderApplication extends PhabricatorApplication {
pht('Learn More')));
}
public function getMonograms() {
return array('Q');
}
public function getRoutes() {
return array(
'/Q(?P<id>[1-9]\d*)'

View file

@ -45,6 +45,10 @@ final class PhabricatorSlowvoteApplication extends PhabricatorApplication {
);
}
public function getMonograms() {
return array('V');
}
public function getRoutes() {
return array(
'/V(?P<id>[1-9]\d*)' => 'PhabricatorSlowvotePollController',

View file

@ -49,6 +49,10 @@ final class PhabricatorSpacesApplication extends PhabricatorApplication {
);
}
public function getMonograms() {
return array('S');
}
public function getRoutes() {
return array(
'/S(?P<id>[1-9]\d*)' => 'PhabricatorSpacesViewController',