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
|
|
|
|
implements PhabricatorPolicyInterface {
|
|
|
|
|
2014-02-03 19:52:15 +01:00
|
|
|
protected $name;
|
|
|
|
protected $viewPolicy;
|
|
|
|
protected $editPolicy;
|
2014-05-16 04:12:40 +02:00
|
|
|
protected $layoutConfig = array();
|
2014-02-03 19:52:15 +01:00
|
|
|
|
2014-04-30 23:28:55 +02:00
|
|
|
private $panelPHIDs = self::ATTACHABLE;
|
|
|
|
private $panels = self::ATTACHABLE;
|
|
|
|
|
2014-02-03 19:52:15 +01:00
|
|
|
public static function initializeNewDashboard(PhabricatorUser $actor) {
|
|
|
|
return id(new PhabricatorDashboard())
|
|
|
|
->setName('')
|
|
|
|
->setViewPolicy(PhabricatorPolicies::POLICY_USER)
|
2014-05-16 04:12:40 +02:00
|
|
|
->setEditPolicy($actor->getPHID())
|
|
|
|
->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
|
|
|
|
2014-06-13 06:49:19 +02:00
|
|
|
public static function copyDashboard(
|
|
|
|
PhabricatorDashboard $dst,
|
|
|
|
PhabricatorDashboard $src) {
|
|
|
|
|
|
|
|
$dst->name = $src->name;
|
|
|
|
$dst->layoutConfig = $src->layoutConfig;
|
|
|
|
|
|
|
|
return $dst;
|
|
|
|
}
|
|
|
|
|
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 getConfiguration() {
|
|
|
|
return array(
|
|
|
|
self::CONFIG_AUX_PHID => true,
|
2014-05-16 04:12:40 +02:00
|
|
|
self::CONFIG_SERIALIZATION => array(
|
|
|
|
'layoutConfig' => self::SERIALIZATION_JSON),
|
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(
|
|
|
|
PhabricatorDashboardPHIDTypeDashboard::TYPECONST);
|
|
|
|
}
|
|
|
|
|
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;
|
|
|
|
}
|
|
|
|
|
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);
|
|
|
|
}
|
|
|
|
|
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;
|
|
|
|
}
|
|
|
|
|
|
|
|
public function describeAutomaticCapability($capability) {
|
|
|
|
return null;
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|