Skip to content

Commit 194dc40

Browse files
author
epriestley
committed
Add a meta-application
Summary: - Adds a new "Applications" application. - Builds an application list via application config instead of via hard-coding, so we can move toward better concepts of installing/uninstalling applications, etc. - Applications indicate that they need attention with notice counts and brief status messages rathern than 50 giant tables of all sorts of app data. I want to try replacing the home screen with this screen, pretty much. Not sure if this is totally crazy or not. What does everyone else think? Test Plan: Will add screenshots. Reviewers: btrahan, chad, vrana, alanh Reviewed By: vrana CC: aran, davidreuss, champo Maniphest Tasks: T1569 Differential Revision: https://secure.phabricator.com/D3129
1 parent 04fafdb commit 194dc40

28 files changed

+871
-5
lines changed

src/__celerity_resource_map__.php

Lines changed: 86 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,13 +7,90 @@
77
*/
88

99
celerity_register_resource_map(array(
10+
'/rsrc/image/app/app_audit.png' =>
11+
array(
12+
'hash' => '5f5b4a7c48fe921532bef4c986328bdc',
13+
'uri' => '/res/5f5b4a7c/rsrc/image/app/app_audit.png',
14+
'disk' => '/rsrc/image/app/app_audit.png',
15+
'type' => 'png',
16+
),
17+
'/rsrc/image/app/app_differential.png' =>
18+
array(
19+
'hash' => 'b2e42893b64791f8382f7f5a0350b44d',
20+
'uri' => '/res/b2e42893/rsrc/image/app/app_differential.png',
21+
'disk' => '/rsrc/image/app/app_differential.png',
22+
'type' => 'png',
23+
),
24+
'/rsrc/image/app/app_diffusion.png' =>
25+
array(
26+
'hash' => 'e9e4b1c380e19a2908730ad397ae5eca',
27+
'uri' => '/res/e9e4b1c3/rsrc/image/app/app_diffusion.png',
28+
'disk' => '/rsrc/image/app/app_diffusion.png',
29+
'type' => 'png',
30+
),
31+
'/rsrc/image/app/app_fact.png' =>
32+
array(
33+
'hash' => '8b4da94b07e2aad9f741beca9519df98',
34+
'uri' => '/res/8b4da94b/rsrc/image/app/app_fact.png',
35+
'disk' => '/rsrc/image/app/app_fact.png',
36+
'type' => 'png',
37+
),
38+
'/rsrc/image/app/app_flags.png' =>
39+
array(
40+
'hash' => 'e75e1047a6bc2ff428161d2130526367',
41+
'uri' => '/res/e75e1047/rsrc/image/app/app_flags.png',
42+
'disk' => '/rsrc/image/app/app_flags.png',
43+
'type' => 'png',
44+
),
45+
'/rsrc/image/app/app_maniphest.png' =>
46+
array(
47+
'hash' => '88b6a06029b1ce38d5e7a70c1d2ebd97',
48+
'uri' => '/res/88b6a060/rsrc/image/app/app_maniphest.png',
49+
'disk' => '/rsrc/image/app/app_maniphest.png',
50+
'type' => 'png',
51+
),
52+
'/rsrc/image/app/app_phriction.png' =>
53+
array(
54+
'hash' => '68f2387363a26c15653a39bd847157f3',
55+
'uri' => '/res/68f23873/rsrc/image/app/app_phriction.png',
56+
'disk' => '/rsrc/image/app/app_phriction.png',
57+
'type' => 'png',
58+
),
1059
'/rsrc/image/apps.png' =>
1160
array(
1261
'hash' => 'f7cb4abeb73245fea4098a02fd784653',
1362
'uri' => '/res/f7cb4abe/rsrc/image/apps.png',
1463
'disk' => '/rsrc/image/apps.png',
1564
'type' => 'png',
1665
),
66+
'/rsrc/image/appstatus_empty.png' =>
67+
array(
68+
'hash' => '2f8102e0a0f5a0980d87d4ab4ba8c8fd',
69+
'uri' => '/res/2f8102e0/rsrc/image/appstatus_empty.png',
70+
'disk' => '/rsrc/image/appstatus_empty.png',
71+
'type' => 'png',
72+
),
73+
'/rsrc/image/appstatus_info.png' =>
74+
array(
75+
'hash' => '407de6daf2edc4a8b68e2e369f4fc8cb',
76+
'uri' => '/res/407de6da/rsrc/image/appstatus_info.png',
77+
'disk' => '/rsrc/image/appstatus_info.png',
78+
'type' => 'png',
79+
),
80+
'/rsrc/image/appstatus_needs.png' =>
81+
array(
82+
'hash' => '2c1e193bc786ca4fca0b851ed9cd3d92',
83+
'uri' => '/res/2c1e193b/rsrc/image/appstatus_needs.png',
84+
'disk' => '/rsrc/image/appstatus_needs.png',
85+
'type' => 'png',
86+
),
87+
'/rsrc/image/appstatus_okay.png' =>
88+
array(
89+
'hash' => 'd00e683ee1c61d0ccced1200775cdbb5',
90+
'uri' => '/res/d00e683e/rsrc/image/appstatus_okay.png',
91+
'disk' => '/rsrc/image/appstatus_okay.png',
92+
'type' => 'png',
93+
),
1794
'/rsrc/image/avatar.png' =>
1895
array(
1996
'hash' => '1c5f255071537f05406adee86717ff27',
@@ -2142,6 +2219,15 @@
21422219
),
21432220
'disk' => '/rsrc/css/application/directory/phabricator-app-buttons.css',
21442221
),
2222+
'phabricator-application-launch-view-css' =>
2223+
array(
2224+
'uri' => '/res/e157830a/rsrc/css/application/base/phabricator-application-launch-view.css',
2225+
'type' => 'css',
2226+
'requires' =>
2227+
array(
2228+
),
2229+
'disk' => '/rsrc/css/application/base/phabricator-application-launch-view.css',
2230+
),
21452231
'phabricator-chatlog-css' =>
21462232
array(
21472233
'uri' => '/res/f6631adc/rsrc/css/application/chatlog/chatlog.css',

src/__phutil_library_map__.php

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -536,9 +536,18 @@
536536
'Phabricator404Controller' => 'applications/base/controller/Phabricator404Controller.php',
537537
'PhabricatorAccessLog' => 'infrastructure/PhabricatorAccessLog.php',
538538
'PhabricatorApplication' => 'applications/base/PhabricatorApplication.php',
539+
'PhabricatorApplicationApplications' => 'applications/meta/application/PhabricatorApplicationApplications.php',
540+
'PhabricatorApplicationAudit' => 'applications/audit/application/PhabricatorApplicationAudit.php',
539541
'PhabricatorApplicationDifferential' => 'applications/differential/application/PhabricatorApplicationDifferential.php',
542+
'PhabricatorApplicationDiffusion' => 'applications/diffusion/application/PhabricatorApplicationDiffusion.php',
540543
'PhabricatorApplicationFact' => 'applications/fact/application/PhabricatorApplicationFact.php',
544+
'PhabricatorApplicationFlags' => 'applications/flag/application/PhabricatorApplicationFlags.php',
545+
'PhabricatorApplicationLaunchView' => 'applications/meta/view/PhabricatorApplicationLaunchView.php',
541546
'PhabricatorApplicationManiphest' => 'applications/maniphest/application/PhabricatorApplicationManiphest.php',
547+
'PhabricatorApplicationPhriction' => 'applications/phriction/application/PhabricatorApplicationPhriction.php',
548+
'PhabricatorApplicationStatusView' => 'applications/meta/view/PhabricatorApplicationStatusView.php',
549+
'PhabricatorApplicationsController' => 'applications/meta/controller/PhabricatorApplicationsController.php',
550+
'PhabricatorApplicationsListController' => 'applications/meta/controller/PhabricatorApplicationsListController.php',
542551
'PhabricatorAuditActionConstants' => 'applications/audit/constants/PhabricatorAuditActionConstants.php',
543552
'PhabricatorAuditAddCommentController' => 'applications/audit/controller/PhabricatorAuditAddCommentController.php',
544553
'PhabricatorAuditComment' => 'applications/audit/storage/PhabricatorAuditComment.php',
@@ -1602,9 +1611,18 @@
16021611
'PackageDeleteMail' => 'PackageMail',
16031612
'PackageModifyMail' => 'PackageMail',
16041613
'Phabricator404Controller' => 'PhabricatorController',
1614+
'PhabricatorApplicationApplications' => 'PhabricatorApplication',
1615+
'PhabricatorApplicationAudit' => 'PhabricatorApplication',
16051616
'PhabricatorApplicationDifferential' => 'PhabricatorApplication',
1617+
'PhabricatorApplicationDiffusion' => 'PhabricatorApplication',
16061618
'PhabricatorApplicationFact' => 'PhabricatorApplication',
1619+
'PhabricatorApplicationFlags' => 'PhabricatorApplication',
1620+
'PhabricatorApplicationLaunchView' => 'AphrontView',
16071621
'PhabricatorApplicationManiphest' => 'PhabricatorApplication',
1622+
'PhabricatorApplicationPhriction' => 'PhabricatorApplication',
1623+
'PhabricatorApplicationStatusView' => 'AphrontView',
1624+
'PhabricatorApplicationsController' => 'PhabricatorController',
1625+
'PhabricatorApplicationsListController' => 'PhabricatorApplicationsController',
16081626
'PhabricatorAuditAddCommentController' => 'PhabricatorAuditController',
16091627
'PhabricatorAuditComment' => 'PhabricatorAuditDAO',
16101628
'PhabricatorAuditCommitListView' => 'AphrontView',
Lines changed: 73 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,73 @@
1+
<?php
2+
3+
/*
4+
* Copyright 2012 Facebook, Inc.
5+
*
6+
* Licensed under the Apache License, Version 2.0 (the "License");
7+
* you may not use this file except in compliance with the License.
8+
* You may obtain a copy of the License at
9+
*
10+
* http://www.apache.org/licenses/LICENSE-2.0
11+
*
12+
* Unless required by applicable law or agreed to in writing, software
13+
* distributed under the License is distributed on an "AS IS" BASIS,
14+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15+
* See the License for the specific language governing permissions and
16+
* limitations under the License.
17+
*/
18+
19+
final class PhabricatorApplicationAudit extends PhabricatorApplication {
20+
21+
public function getShortDescription() {
22+
return 'Audit Code';
23+
}
24+
25+
public function getBaseURI() {
26+
return '/audit/';
27+
}
28+
29+
30+
public function getIconURI() {
31+
return celerity_get_resource_uri('/rsrc/image/app/app_audit.png');
32+
}
33+
34+
public function loadStatus(PhabricatorUser $user) {
35+
$status = array();
36+
37+
$phids = PhabricatorAuditCommentEditor::loadAuditPHIDsForUser($user);
38+
39+
$audits = id(new PhabricatorAuditQuery())
40+
->withAuditorPHIDs($phids)
41+
->withStatus(PhabricatorAuditQuery::STATUS_OPEN)
42+
->withAwaitingUser($user)
43+
->execute();
44+
45+
$count = count($audits);
46+
$type = $count
47+
? PhabricatorApplicationStatusView::TYPE_INFO
48+
: PhabricatorApplicationStatusView::TYPE_EMPTY;
49+
$status[] = id(new PhabricatorApplicationStatusView())
50+
->setType($type)
51+
->setText(pht('%d Commit(s) Awaiting Audit', $count))
52+
->setCount($count);
53+
54+
55+
$commits = id(new PhabricatorAuditCommitQuery())
56+
->withAuthorPHIDs($phids)
57+
->withStatus(PhabricatorAuditQuery::STATUS_OPEN)
58+
->execute();
59+
60+
$count = count($commits);
61+
$type = $count
62+
? PhabricatorApplicationStatusView::TYPE_NEEDS_ATTENTION
63+
: PhabricatorApplicationStatusView::TYPE_EMPTY;
64+
$status[] = id(new PhabricatorApplicationStatusView())
65+
->setType($type)
66+
->setText(pht('%d Problem Commit(s)', $count))
67+
->setCount($count);
68+
69+
return $status;
70+
}
71+
72+
}
73+

src/applications/base/PhabricatorApplication.php

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,10 @@ public function getIconURI() {
5757
return PhabricatorUser::getDefaultProfileImageURI();
5858
}
5959

60+
public function shouldAppearInLaunchView() {
61+
return true;
62+
}
63+
6064

6165
/* -( URI Routing )-------------------------------------------------------- */
6266

@@ -74,6 +78,14 @@ public function getFactObjectsForAnalysis() {
7478
}
7579

7680

81+
/* -( Launch Integration )------------------------------------------------- */
82+
83+
84+
public function loadStatus(PhabricatorUser $user) {
85+
return array();
86+
}
87+
88+
7789
/* -( Application Management )--------------------------------------------- */
7890

7991

src/applications/differential/application/PhabricatorApplicationDifferential.php

Lines changed: 41 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -18,18 +18,54 @@
1818

1919
final class PhabricatorApplicationDifferential extends PhabricatorApplication {
2020

21+
public function getBaseURI() {
22+
return '/differential/';
23+
}
24+
25+
public function getShortDescription() {
26+
return 'Review Code';
27+
}
28+
29+
public function getIconURI() {
30+
return celerity_get_resource_uri('/rsrc/image/app/app_differential.png');
31+
}
32+
2133
public function getFactObjectsForAnalysis() {
2234
return array(
2335
new DifferentialRevision(),
2436
);
2537
}
2638

27-
public function getBaseURI() {
28-
return '/differential/';
29-
}
39+
public function loadStatus(PhabricatorUser $user) {
40+
$revisions = id(new DifferentialRevisionQuery())
41+
->withResponsibleUsers(array($user->getPHID()))
42+
->withStatus(DifferentialRevisionQuery::STATUS_OPEN)
43+
->execute();
3044

31-
public function getShortDescription() {
32-
return 'Code Review Application';
45+
list($active, $waiting) = DifferentialRevisionQuery::splitResponsible(
46+
$revisions,
47+
$user->getPHID());
48+
49+
$status = array();
50+
51+
$active = count($active);
52+
$type = $active
53+
? PhabricatorApplicationStatusView::TYPE_NEEDS_ATTENTION
54+
: PhabricatorApplicationStatusView::TYPE_EMPTY;
55+
$status[] = id(new PhabricatorApplicationStatusView())
56+
->setType($type)
57+
->setText(pht('%d Review(s) Need Attention', $active))
58+
->setCount($active);
59+
60+
$waiting = count($waiting);
61+
$type = $waiting
62+
? PhabricatorApplicationStatusView::TYPE_INFO
63+
: PhabricatorApplicationStatusView::TYPE_EMPTY;
64+
$status[] = id(new PhabricatorApplicationStatusView())
65+
->setType($type)
66+
->setText(pht('%d Review(s) Waiting on Others', $waiting));
67+
68+
return $status;
3369
}
3470

3571
}
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
<?php
2+
3+
/*
4+
* Copyright 2012 Facebook, Inc.
5+
*
6+
* Licensed under the Apache License, Version 2.0 (the "License");
7+
* you may not use this file except in compliance with the License.
8+
* You may obtain a copy of the License at
9+
*
10+
* http://www.apache.org/licenses/LICENSE-2.0
11+
*
12+
* Unless required by applicable law or agreed to in writing, software
13+
* distributed under the License is distributed on an "AS IS" BASIS,
14+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15+
* See the License for the specific language governing permissions and
16+
* limitations under the License.
17+
*/
18+
19+
final class PhabricatorApplicationDiffusion extends PhabricatorApplication {
20+
21+
public function getShortDescription() {
22+
return 'Repository Browser';
23+
}
24+
25+
public function getBaseURI() {
26+
return '/diffusion/';
27+
}
28+
29+
public function getIconURI() {
30+
return celerity_get_resource_uri('/rsrc/image/app/app_diffusion.png');
31+
}
32+
33+
}
34+

src/applications/fact/application/PhabricatorApplicationFact.php

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,18 @@
1818

1919
final class PhabricatorApplicationFact extends PhabricatorApplication {
2020

21+
public function getShortDescription() {
22+
return 'Analyze Data';
23+
}
24+
25+
public function getBaseURI() {
26+
return '/fact/';
27+
}
28+
29+
public function getIconURI() {
30+
return celerity_get_resource_uri('/rsrc/image/app/app_fact.png');
31+
}
32+
2133
public function getRoutes() {
2234
return array(
2335
'/fact/' => array(

0 commit comments

Comments
 (0)