Summary: Depends on D20362. Ref T13272. Currently, Dashboards have an "Install Dashboard" flow which is pretty janky and only allows you to install things to the home page. Instead, allow users to install things to any valid target (home, favorites, portals, projects). This also provides URIs like `dashboard/install/1/home/personal/` which allow you to link users to an "install a dashboard" page; this may or may not get used. Test Plan: Installed dashboards on home, favorites, projects, and portals. Reviewers: amckinley Reviewed By: amckinley Maniphest Tasks: T13272 Differential Revision: https://secure.phabricator.com/D20364
63 lines
1.7 KiB
PHP
63 lines
1.7 KiB
PHP
<?php
|
|
|
|
final class PhabricatorDashboardPortalInstallWorkflow
|
|
extends PhabricatorDashboardObjectInstallWorkflow {
|
|
|
|
const WORKFLOWKEY = 'portal';
|
|
|
|
public function getOrder() {
|
|
return 2000;
|
|
}
|
|
|
|
protected function newWorkflowMenuItem() {
|
|
return $this->newMenuItem()
|
|
->setHeader(pht('Add to Portal Menu'))
|
|
->setImageIcon('fa-compass')
|
|
->addAttribute(
|
|
pht('Add this dashboard to the menu on a portal.'));
|
|
}
|
|
|
|
protected function newProfileEngine() {
|
|
return new PhabricatorDashboardPortalProfileMenuEngine();
|
|
}
|
|
|
|
protected function newQuery() {
|
|
return new PhabricatorDashboardPortalQuery();
|
|
}
|
|
|
|
protected function newConfirmDialog($object) {
|
|
return $this->newDialog()
|
|
->setTitle(pht('Add Dashboard to Portal Menu'))
|
|
->appendParagraph(
|
|
pht(
|
|
'Add the dashboard %s to portal %s?',
|
|
$this->getDashboardDisplayName(),
|
|
phutil_tag('strong', array(), $object->getName())))
|
|
->addSubmitButton(pht('Add to Portal'));
|
|
}
|
|
protected function newObjectSelectionForm($object) {
|
|
$viewer = $this->getViewer();
|
|
|
|
if ($object) {
|
|
$tokenizer_value = array($object->getPHID());
|
|
} else {
|
|
$tokenizer_value = array();
|
|
}
|
|
|
|
return id(new AphrontFormView())
|
|
->setViewer($viewer)
|
|
->appendInstructions(
|
|
pht(
|
|
'Select which portal you want to add the dashboard %s to.',
|
|
$this->getDashboardDisplayName()))
|
|
->appendControl(
|
|
id(new AphrontFormTokenizerControl())
|
|
->setName('target')
|
|
->setLimit(1)
|
|
->setLabel(pht('Add to Portal'))
|
|
->setValue($tokenizer_value)
|
|
->setDatasource(new PhabricatorDashboardPortalDatasource()));
|
|
}
|
|
|
|
}
|