Add initial skeleton for Dashboard application
Summary:
Ref T3583. General idea here is:
- Users will be able to create `DashboardPanel`s, which are things like the jump nav, or a minifeed, or recent assigned tasks, or recent tokens given, or whatever else.
- The `DashboardPanel`s can be combined into `Dashboard`s, which select specific panels and arrange them in some layout (and maybe have a few other options eventually).
- Then, you'll be able to set a specific `Dashboard` for your home page, and maybe for project home pages. But you can also use `Dashboard`s on their own if you just like dashboards.
My plan is pretty much:
- Put in basic infrastructure for dashboards (this diff).
- Add basic create/edit (next few diffs).
- Once dashboards sort of work, do the homepage integration.
This diff does very little: you can't create dashboards or panels yet, and thus there are no dashboards to look at. This is all skeleton code, pretty much.
IMPORTANT: We need an icon bwahahahahaha
Test Plan:
omg si purrfect
{F106367}
Reviewers: chad, btrahan
Reviewed By: btrahan
CC: aran
Maniphest Tasks: T3583
Differential Revision: https://secure.phabricator.com/D8109
2014-01-30 20:43:24 +01:00
|
|
|
<?php
|
|
|
|
|
|
|
|
final class PhabricatorDashboardPanelSearchEngine
|
|
|
|
extends PhabricatorApplicationSearchEngine {
|
|
|
|
|
2014-06-12 22:22:20 +02:00
|
|
|
public function getResultTypeDescription() {
|
|
|
|
return pht('Dashboard Panels');
|
|
|
|
}
|
|
|
|
|
2015-02-05 00:47:48 +01:00
|
|
|
public function getApplicationClassName() {
|
2014-07-23 02:03:09 +02:00
|
|
|
return 'PhabricatorDashboardApplication';
|
2014-05-08 19:08:37 +02:00
|
|
|
}
|
|
|
|
|
2015-07-21 21:01:19 +02:00
|
|
|
public function newQuery() {
|
|
|
|
return new PhabricatorDashboardPanelQuery();
|
Add initial skeleton for Dashboard application
Summary:
Ref T3583. General idea here is:
- Users will be able to create `DashboardPanel`s, which are things like the jump nav, or a minifeed, or recent assigned tasks, or recent tokens given, or whatever else.
- The `DashboardPanel`s can be combined into `Dashboard`s, which select specific panels and arrange them in some layout (and maybe have a few other options eventually).
- Then, you'll be able to set a specific `Dashboard` for your home page, and maybe for project home pages. But you can also use `Dashboard`s on their own if you just like dashboards.
My plan is pretty much:
- Put in basic infrastructure for dashboards (this diff).
- Add basic create/edit (next few diffs).
- Once dashboards sort of work, do the homepage integration.
This diff does very little: you can't create dashboards or panels yet, and thus there are no dashboards to look at. This is all skeleton code, pretty much.
IMPORTANT: We need an icon bwahahahahaha
Test Plan:
omg si purrfect
{F106367}
Reviewers: chad, btrahan
Reviewed By: btrahan
CC: aran
Maniphest Tasks: T3583
Differential Revision: https://secure.phabricator.com/D8109
2014-01-30 20:43:24 +01:00
|
|
|
}
|
|
|
|
|
2015-07-21 21:01:19 +02:00
|
|
|
protected function buildQueryFromParameters(array $map) {
|
|
|
|
$query = $this->newQuery();
|
|
|
|
if ($map['status']) {
|
|
|
|
switch ($map['status']) {
|
|
|
|
case 'active':
|
|
|
|
$query->withArchived(false);
|
|
|
|
break;
|
|
|
|
case 'archived':
|
|
|
|
$query->withArchived(true);
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
break;
|
|
|
|
}
|
2014-07-02 02:50:28 +02:00
|
|
|
}
|
|
|
|
|
2015-07-21 21:01:19 +02:00
|
|
|
if ($map['paneltype']) {
|
|
|
|
$query->withPanelTypes(array($map['paneltype']));
|
2015-02-18 19:50:37 +01:00
|
|
|
}
|
|
|
|
|
2016-12-13 18:51:25 +01:00
|
|
|
if ($map['authorPHIDs']) {
|
|
|
|
$query->withAuthorPHIDs($map['authorPHIDs']);
|
|
|
|
}
|
|
|
|
|
2016-12-16 21:08:43 +01:00
|
|
|
if ($map['name'] !== null) {
|
|
|
|
$query->withNameNgrams($map['name']);
|
|
|
|
}
|
|
|
|
|
Add initial skeleton for Dashboard application
Summary:
Ref T3583. General idea here is:
- Users will be able to create `DashboardPanel`s, which are things like the jump nav, or a minifeed, or recent assigned tasks, or recent tokens given, or whatever else.
- The `DashboardPanel`s can be combined into `Dashboard`s, which select specific panels and arrange them in some layout (and maybe have a few other options eventually).
- Then, you'll be able to set a specific `Dashboard` for your home page, and maybe for project home pages. But you can also use `Dashboard`s on their own if you just like dashboards.
My plan is pretty much:
- Put in basic infrastructure for dashboards (this diff).
- Add basic create/edit (next few diffs).
- Once dashboards sort of work, do the homepage integration.
This diff does very little: you can't create dashboards or panels yet, and thus there are no dashboards to look at. This is all skeleton code, pretty much.
IMPORTANT: We need an icon bwahahahahaha
Test Plan:
omg si purrfect
{F106367}
Reviewers: chad, btrahan
Reviewed By: btrahan
CC: aran
Maniphest Tasks: T3583
Differential Revision: https://secure.phabricator.com/D8109
2014-01-30 20:43:24 +01:00
|
|
|
return $query;
|
|
|
|
}
|
|
|
|
|
2015-07-21 21:01:19 +02:00
|
|
|
protected function buildCustomSearchFields() {
|
2015-02-18 19:50:37 +01:00
|
|
|
|
2015-07-21 21:01:19 +02:00
|
|
|
return array(
|
2016-12-16 21:08:43 +01:00
|
|
|
id(new PhabricatorSearchTextField())
|
|
|
|
->setLabel(pht('Name Contains'))
|
|
|
|
->setKey('name')
|
|
|
|
->setDescription(pht('Search for panels by name substring.')),
|
2016-12-13 18:51:25 +01:00
|
|
|
id(new PhabricatorSearchDatasourceField())
|
|
|
|
->setLabel(pht('Authored By'))
|
|
|
|
->setKey('authorPHIDs')
|
|
|
|
->setDatasource(new PhabricatorPeopleUserFunctionDatasource()),
|
2015-07-21 21:01:19 +02:00
|
|
|
id(new PhabricatorSearchSelectField())
|
|
|
|
->setKey('status')
|
2014-07-02 02:50:28 +02:00
|
|
|
->setLabel(pht('Status'))
|
|
|
|
->setOptions(
|
2015-07-21 21:01:19 +02:00
|
|
|
id(new PhabricatorDashboardPanel())
|
|
|
|
->getStatuses()),
|
|
|
|
id(new PhabricatorSearchSelectField())
|
|
|
|
->setKey('paneltype')
|
2015-02-18 19:50:37 +01:00
|
|
|
->setLabel(pht('Panel Type'))
|
2015-07-21 21:01:19 +02:00
|
|
|
->setOptions(
|
|
|
|
id(new PhabricatorDashboardPanel())
|
|
|
|
->getPanelTypes()),
|
|
|
|
);
|
Add initial skeleton for Dashboard application
Summary:
Ref T3583. General idea here is:
- Users will be able to create `DashboardPanel`s, which are things like the jump nav, or a minifeed, or recent assigned tasks, or recent tokens given, or whatever else.
- The `DashboardPanel`s can be combined into `Dashboard`s, which select specific panels and arrange them in some layout (and maybe have a few other options eventually).
- Then, you'll be able to set a specific `Dashboard` for your home page, and maybe for project home pages. But you can also use `Dashboard`s on their own if you just like dashboards.
My plan is pretty much:
- Put in basic infrastructure for dashboards (this diff).
- Add basic create/edit (next few diffs).
- Once dashboards sort of work, do the homepage integration.
This diff does very little: you can't create dashboards or panels yet, and thus there are no dashboards to look at. This is all skeleton code, pretty much.
IMPORTANT: We need an icon bwahahahahaha
Test Plan:
omg si purrfect
{F106367}
Reviewers: chad, btrahan
Reviewed By: btrahan
CC: aran
Maniphest Tasks: T3583
Differential Revision: https://secure.phabricator.com/D8109
2014-01-30 20:43:24 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
protected function getURI($path) {
|
|
|
|
return '/dashboard/panel/'.$path;
|
|
|
|
}
|
|
|
|
|
2015-01-06 21:34:51 +01:00
|
|
|
protected function getBuiltinQueryNames() {
|
2016-12-13 18:51:25 +01:00
|
|
|
$names = array();
|
|
|
|
|
|
|
|
if ($this->requireViewer()->isLoggedIn()) {
|
|
|
|
$names['authored'] = pht('Authored');
|
|
|
|
}
|
|
|
|
|
|
|
|
$names['active'] = pht('Active Panels');
|
|
|
|
$names['all'] = pht('All Panels');
|
|
|
|
|
|
|
|
return $names;
|
Add initial skeleton for Dashboard application
Summary:
Ref T3583. General idea here is:
- Users will be able to create `DashboardPanel`s, which are things like the jump nav, or a minifeed, or recent assigned tasks, or recent tokens given, or whatever else.
- The `DashboardPanel`s can be combined into `Dashboard`s, which select specific panels and arrange them in some layout (and maybe have a few other options eventually).
- Then, you'll be able to set a specific `Dashboard` for your home page, and maybe for project home pages. But you can also use `Dashboard`s on their own if you just like dashboards.
My plan is pretty much:
- Put in basic infrastructure for dashboards (this diff).
- Add basic create/edit (next few diffs).
- Once dashboards sort of work, do the homepage integration.
This diff does very little: you can't create dashboards or panels yet, and thus there are no dashboards to look at. This is all skeleton code, pretty much.
IMPORTANT: We need an icon bwahahahahaha
Test Plan:
omg si purrfect
{F106367}
Reviewers: chad, btrahan
Reviewed By: btrahan
CC: aran
Maniphest Tasks: T3583
Differential Revision: https://secure.phabricator.com/D8109
2014-01-30 20:43:24 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
public function buildSavedQueryFromBuiltin($query_key) {
|
|
|
|
$query = $this->newSavedQuery();
|
|
|
|
$query->setQueryKey($query_key);
|
2016-12-13 18:51:25 +01:00
|
|
|
$viewer = $this->requireViewer();
|
Add initial skeleton for Dashboard application
Summary:
Ref T3583. General idea here is:
- Users will be able to create `DashboardPanel`s, which are things like the jump nav, or a minifeed, or recent assigned tasks, or recent tokens given, or whatever else.
- The `DashboardPanel`s can be combined into `Dashboard`s, which select specific panels and arrange them in some layout (and maybe have a few other options eventually).
- Then, you'll be able to set a specific `Dashboard` for your home page, and maybe for project home pages. But you can also use `Dashboard`s on their own if you just like dashboards.
My plan is pretty much:
- Put in basic infrastructure for dashboards (this diff).
- Add basic create/edit (next few diffs).
- Once dashboards sort of work, do the homepage integration.
This diff does very little: you can't create dashboards or panels yet, and thus there are no dashboards to look at. This is all skeleton code, pretty much.
IMPORTANT: We need an icon bwahahahahaha
Test Plan:
omg si purrfect
{F106367}
Reviewers: chad, btrahan
Reviewed By: btrahan
CC: aran
Maniphest Tasks: T3583
Differential Revision: https://secure.phabricator.com/D8109
2014-01-30 20:43:24 +01:00
|
|
|
|
|
|
|
switch ($query_key) {
|
2014-07-02 02:50:28 +02:00
|
|
|
case 'active':
|
|
|
|
return $query->setParameter('status', 'active');
|
2016-12-13 18:51:25 +01:00
|
|
|
case 'authored':
|
|
|
|
return $query->setParameter(
|
|
|
|
'authorPHIDs',
|
|
|
|
array(
|
|
|
|
$viewer->getPHID(),
|
|
|
|
));
|
Add initial skeleton for Dashboard application
Summary:
Ref T3583. General idea here is:
- Users will be able to create `DashboardPanel`s, which are things like the jump nav, or a minifeed, or recent assigned tasks, or recent tokens given, or whatever else.
- The `DashboardPanel`s can be combined into `Dashboard`s, which select specific panels and arrange them in some layout (and maybe have a few other options eventually).
- Then, you'll be able to set a specific `Dashboard` for your home page, and maybe for project home pages. But you can also use `Dashboard`s on their own if you just like dashboards.
My plan is pretty much:
- Put in basic infrastructure for dashboards (this diff).
- Add basic create/edit (next few diffs).
- Once dashboards sort of work, do the homepage integration.
This diff does very little: you can't create dashboards or panels yet, and thus there are no dashboards to look at. This is all skeleton code, pretty much.
IMPORTANT: We need an icon bwahahahahaha
Test Plan:
omg si purrfect
{F106367}
Reviewers: chad, btrahan
Reviewed By: btrahan
CC: aran
Maniphest Tasks: T3583
Differential Revision: https://secure.phabricator.com/D8109
2014-01-30 20:43:24 +01:00
|
|
|
case 'all':
|
|
|
|
return $query;
|
|
|
|
}
|
|
|
|
|
|
|
|
return parent::buildSavedQueryFromBuiltin($query_key);
|
|
|
|
}
|
|
|
|
|
2014-05-08 19:08:37 +02:00
|
|
|
protected function renderResultList(
|
|
|
|
array $panels,
|
|
|
|
PhabricatorSavedQuery $query,
|
|
|
|
array $handles) {
|
|
|
|
|
|
|
|
$viewer = $this->requireViewer();
|
|
|
|
|
|
|
|
$list = new PHUIObjectItemListView();
|
|
|
|
$list->setUser($viewer);
|
|
|
|
foreach ($panels as $panel) {
|
|
|
|
$item = id(new PHUIObjectItemView())
|
|
|
|
->setObjectName($panel->getMonogram())
|
|
|
|
->setHeader($panel->getName())
|
|
|
|
->setHref('/'.$panel->getMonogram())
|
|
|
|
->setObject($panel);
|
|
|
|
|
2014-07-02 02:50:28 +02:00
|
|
|
$impl = $panel->getImplementation();
|
|
|
|
if ($impl) {
|
|
|
|
$type_text = $impl->getPanelTypeName();
|
|
|
|
} else {
|
|
|
|
$type_text = nonempty($panel->getPanelType(), pht('Unknown Type'));
|
|
|
|
}
|
2015-07-21 21:01:19 +02:00
|
|
|
$item->addAttribute($type_text);
|
2014-07-02 02:50:28 +02:00
|
|
|
|
2015-07-21 21:01:19 +02:00
|
|
|
$properties = $panel->getProperties();
|
|
|
|
$class = idx($properties, 'class');
|
|
|
|
$item->addAttribute($class);
|
2014-07-02 02:50:28 +02:00
|
|
|
|
|
|
|
if ($panel->getIsArchived()) {
|
|
|
|
$item->setDisabled(true);
|
|
|
|
}
|
|
|
|
|
2014-05-08 19:08:37 +02:00
|
|
|
$list->addItem($item);
|
|
|
|
}
|
|
|
|
|
2015-06-19 12:46:20 +02:00
|
|
|
$result = new PhabricatorApplicationSearchResultView();
|
|
|
|
$result->setObjectList($list);
|
|
|
|
$result->setNoDataString(pht('No panels found.'));
|
|
|
|
|
|
|
|
return $result;
|
2014-05-08 19:08:37 +02:00
|
|
|
}
|
|
|
|
|
Add initial skeleton for Dashboard application
Summary:
Ref T3583. General idea here is:
- Users will be able to create `DashboardPanel`s, which are things like the jump nav, or a minifeed, or recent assigned tasks, or recent tokens given, or whatever else.
- The `DashboardPanel`s can be combined into `Dashboard`s, which select specific panels and arrange them in some layout (and maybe have a few other options eventually).
- Then, you'll be able to set a specific `Dashboard` for your home page, and maybe for project home pages. But you can also use `Dashboard`s on their own if you just like dashboards.
My plan is pretty much:
- Put in basic infrastructure for dashboards (this diff).
- Add basic create/edit (next few diffs).
- Once dashboards sort of work, do the homepage integration.
This diff does very little: you can't create dashboards or panels yet, and thus there are no dashboards to look at. This is all skeleton code, pretty much.
IMPORTANT: We need an icon bwahahahahaha
Test Plan:
omg si purrfect
{F106367}
Reviewers: chad, btrahan
Reviewed By: btrahan
CC: aran
Maniphest Tasks: T3583
Differential Revision: https://secure.phabricator.com/D8109
2014-01-30 20:43:24 +01:00
|
|
|
}
|