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
|
|
|
|
|
|
|
|
/**
|
|
|
|
* A collection of dashboard panels with a specific layout.
|
|
|
|
*/
|
|
|
|
final class PhabricatorDashboard extends PhabricatorDashboardDAO
|
2014-08-18 22:15:13 +02:00
|
|
|
implements
|
2014-12-03 22:16:15 +01:00
|
|
|
PhabricatorApplicationTransactionInterface,
|
2014-08-18 22:15:13 +02:00
|
|
|
PhabricatorPolicyInterface,
|
2015-07-18 21:19:17 +02:00
|
|
|
PhabricatorFlaggableInterface,
|
2015-07-21 21:01:19 +02:00
|
|
|
PhabricatorDestructibleInterface,
|
2016-12-16 21:08:43 +01:00
|
|
|
PhabricatorProjectInterface,
|
|
|
|
PhabricatorNgramsInterface {
|
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
|
|
|
|
2014-02-03 19:52:15 +01:00
|
|
|
protected $name;
|
2016-12-13 00:15:05 +01:00
|
|
|
protected $authorPHID;
|
2014-02-03 19:52:15 +01:00
|
|
|
protected $viewPolicy;
|
|
|
|
protected $editPolicy;
|
2015-07-23 23:22:56 +02:00
|
|
|
protected $status;
|
2016-12-13 19:52:19 +01:00
|
|
|
protected $icon;
|
2014-05-16 04:12:40 +02:00
|
|
|
protected $layoutConfig = array();
|
2014-02-03 19:52:15 +01:00
|
|
|
|
2015-07-23 23:22:56 +02:00
|
|
|
const STATUS_ACTIVE = 'active';
|
|
|
|
const STATUS_ARCHIVED = 'archived';
|
|
|
|
|
2014-04-30 23:28:55 +02:00
|
|
|
private $panelPHIDs = self::ATTACHABLE;
|
|
|
|
private $panels = self::ATTACHABLE;
|
2015-07-21 21:01:19 +02:00
|
|
|
private $edgeProjectPHIDs = self::ATTACHABLE;
|
|
|
|
|
2014-04-30 23:28:55 +02:00
|
|
|
|
2014-02-03 19:52:15 +01:00
|
|
|
public static function initializeNewDashboard(PhabricatorUser $actor) {
|
|
|
|
return id(new PhabricatorDashboard())
|
|
|
|
->setName('')
|
2016-12-13 19:52:19 +01:00
|
|
|
->setIcon('fa-dashboard')
|
2017-02-22 01:29:47 +01:00
|
|
|
->setViewPolicy(PhabricatorPolicies::getMostOpenPolicy())
|
2014-05-16 04:12:40 +02:00
|
|
|
->setEditPolicy($actor->getPHID())
|
2015-07-23 23:22:56 +02:00
|
|
|
->setStatus(self::STATUS_ACTIVE)
|
2016-12-13 00:15:05 +01:00
|
|
|
->setAuthorPHID($actor->getPHID())
|
2014-05-16 04:12:40 +02:00
|
|
|
->attachPanels(array())
|
|
|
|
->attachPanelPHIDs(array());
|
2014-02-03 19:52:15 +01: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
|
|
|
|
2015-07-23 23:22:56 +02:00
|
|
|
public static function getStatusNameMap() {
|
|
|
|
return array(
|
|
|
|
self::STATUS_ACTIVE => pht('Active'),
|
|
|
|
self::STATUS_ARCHIVED => pht('Archived'),
|
|
|
|
);
|
|
|
|
}
|
|
|
|
|
2015-01-13 20:47:05 +01:00
|
|
|
protected function getConfiguration() {
|
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 array(
|
|
|
|
self::CONFIG_AUX_PHID => true,
|
2014-05-16 04:12:40 +02:00
|
|
|
self::CONFIG_SERIALIZATION => array(
|
2014-09-18 20:15:49 +02:00
|
|
|
'layoutConfig' => self::SERIALIZATION_JSON,
|
|
|
|
),
|
|
|
|
self::CONFIG_COLUMN_SCHEMA => array(
|
2016-12-16 21:08:43 +01:00
|
|
|
'name' => 'sort255',
|
2015-07-23 23:22:56 +02:00
|
|
|
'status' => 'text32',
|
2016-12-13 19:52:19 +01:00
|
|
|
'icon' => 'text32',
|
2016-12-13 00:15:05 +01:00
|
|
|
'authorPHID' => 'phid',
|
2014-09-18 20:15:49 +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
|
|
|
) + parent::getConfiguration();
|
|
|
|
}
|
|
|
|
|
|
|
|
public function generatePHID() {
|
|
|
|
return PhabricatorPHID::generateNewPHID(
|
2014-07-24 00:05:46 +02:00
|
|
|
PhabricatorDashboardDashboardPHIDType::TYPECONST);
|
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
|
|
|
}
|
|
|
|
|
2014-05-16 04:12:40 +02:00
|
|
|
public function getLayoutConfigObject() {
|
|
|
|
return PhabricatorDashboardLayoutConfig::newFromDictionary(
|
|
|
|
$this->getLayoutConfig());
|
|
|
|
}
|
|
|
|
|
|
|
|
public function setLayoutConfigFromObject(
|
|
|
|
PhabricatorDashboardLayoutConfig $object) {
|
|
|
|
$this->setLayoutConfig($object->toDictionary());
|
|
|
|
return $this;
|
|
|
|
}
|
|
|
|
|
2015-07-21 21:01:19 +02:00
|
|
|
public function getProjectPHIDs() {
|
|
|
|
return $this->assertAttached($this->edgeProjectPHIDs);
|
|
|
|
}
|
|
|
|
|
|
|
|
public function attachProjectPHIDs(array $phids) {
|
|
|
|
$this->edgeProjectPHIDs = $phids;
|
|
|
|
return $this;
|
|
|
|
}
|
|
|
|
|
2014-04-30 23:28:55 +02:00
|
|
|
public function attachPanelPHIDs(array $phids) {
|
|
|
|
$this->panelPHIDs = $phids;
|
|
|
|
return $this;
|
|
|
|
}
|
|
|
|
|
|
|
|
public function getPanelPHIDs() {
|
|
|
|
return $this->assertAttached($this->panelPHIDs);
|
|
|
|
}
|
|
|
|
|
|
|
|
public function attachPanels(array $panels) {
|
|
|
|
assert_instances_of($panels, 'PhabricatorDashboardPanel');
|
|
|
|
$this->panels = $panels;
|
|
|
|
return $this;
|
|
|
|
}
|
|
|
|
|
|
|
|
public function getPanels() {
|
|
|
|
return $this->assertAttached($this->panels);
|
|
|
|
}
|
|
|
|
|
2015-12-09 21:17:03 +01:00
|
|
|
public function isArchived() {
|
2015-07-23 23:22:56 +02:00
|
|
|
return ($this->getStatus() == self::STATUS_ARCHIVED);
|
|
|
|
}
|
|
|
|
|
2016-12-16 22:01:20 +01:00
|
|
|
public function getViewURI() {
|
|
|
|
return '/dashboard/view/'.$this->getID().'/';
|
|
|
|
}
|
|
|
|
|
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
|
|
|
|
2014-12-03 22:16:15 +01:00
|
|
|
/* -( PhabricatorApplicationTransactionInterface )------------------------- */
|
|
|
|
|
|
|
|
|
|
|
|
public function getApplicationTransactionEditor() {
|
|
|
|
return new PhabricatorDashboardTransactionEditor();
|
|
|
|
}
|
|
|
|
|
|
|
|
public function getApplicationTransactionObject() {
|
|
|
|
return $this;
|
|
|
|
}
|
|
|
|
|
|
|
|
public function getApplicationTransactionTemplate() {
|
|
|
|
return new PhabricatorDashboardTransaction();
|
|
|
|
}
|
|
|
|
|
2014-12-04 22:58:52 +01:00
|
|
|
public function willRenderTimeline(
|
|
|
|
PhabricatorApplicationTransactionView $timeline,
|
|
|
|
AphrontRequest $request) {
|
|
|
|
|
|
|
|
return $timeline;
|
|
|
|
}
|
|
|
|
|
2014-12-03 22:16:15 +01: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
|
|
|
/* -( PhabricatorPolicyInterface )----------------------------------------- */
|
|
|
|
|
|
|
|
|
|
|
|
public function getCapabilities() {
|
|
|
|
return array(
|
|
|
|
PhabricatorPolicyCapability::CAN_VIEW,
|
|
|
|
PhabricatorPolicyCapability::CAN_EDIT,
|
|
|
|
);
|
|
|
|
}
|
|
|
|
|
|
|
|
public function getPolicy($capability) {
|
|
|
|
switch ($capability) {
|
|
|
|
case PhabricatorPolicyCapability::CAN_VIEW:
|
|
|
|
return $this->getViewPolicy();
|
|
|
|
case PhabricatorPolicyCapability::CAN_EDIT:
|
|
|
|
return $this->getEditPolicy();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
public function hasAutomaticCapability($capability, PhabricatorUser $viewer) {
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
2014-08-18 22:15:13 +02:00
|
|
|
|
|
|
|
/* -( PhabricatorDestructibleInterface )----------------------------------- */
|
|
|
|
|
|
|
|
|
|
|
|
public function destroyObjectPermanently(
|
|
|
|
PhabricatorDestructionEngine $engine) {
|
|
|
|
|
|
|
|
$this->openTransaction();
|
|
|
|
$installs = id(new PhabricatorDashboardInstall())->loadAllWhere(
|
|
|
|
'dashboardPHID = %s',
|
|
|
|
$this->getPHID());
|
|
|
|
foreach ($installs as $install) {
|
|
|
|
$install->delete();
|
|
|
|
}
|
|
|
|
|
|
|
|
$this->delete();
|
|
|
|
$this->saveTransaction();
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2016-12-16 21:08:43 +01:00
|
|
|
/* -( PhabricatorNgramInterface )------------------------------------------ */
|
|
|
|
|
|
|
|
|
|
|
|
public function newNgrams() {
|
|
|
|
return array(
|
|
|
|
id(new PhabricatorDashboardNgrams())
|
|
|
|
->setValue($this->getName()),
|
|
|
|
);
|
|
|
|
}
|
|
|
|
|
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
|
|
|
}
|