mirror of
https://we.phorge.it/source/phorge.git
synced 2025-02-02 09:58:24 +01:00
Use typeahead for tab panel selection
Summary: Fixes T11449. Feels.... magical? Probably a more efficient way of doing this, but only 6 tabs so... Test Plan: Create a tab panel in old UI. Edit panel in new UI. Create a panel in new UI, edit panel in new UI. Reviewers: epriestley Reviewed By: epriestley Subscribers: Korvin Maniphest Tasks: T11449 Differential Revision: https://secure.phabricator.com/D17355
This commit is contained in:
parent
5556f0e45a
commit
b28b2b8ab8
1 changed files with 15 additions and 19 deletions
|
@ -15,7 +15,11 @@ final class PhabricatorDashboardPanelTabsCustomField
|
|||
$value = array();
|
||||
|
||||
$names = $request->getArr($this->getFieldKey().'_name');
|
||||
$panels = $request->getArr($this->getFieldKey().'_panelID');
|
||||
$panel_ids = $request->getArr($this->getFieldKey().'_panelID');
|
||||
$panels = array();
|
||||
foreach ($panel_ids as $panel_id) {
|
||||
$panels[] = $panel_id[0];
|
||||
}
|
||||
foreach ($names as $idx => $name) {
|
||||
$panel_id = idx($panels, $idx);
|
||||
if (strlen($name) && $panel_id) {
|
||||
|
@ -34,21 +38,6 @@ final class PhabricatorDashboardPanelTabsCustomField
|
|||
// when saving a tab panel that includes archied panels. This whole UI is
|
||||
// hopefully temporary anyway.
|
||||
|
||||
$panels = id(new PhabricatorDashboardPanelQuery())
|
||||
->setViewer($this->getViewer())
|
||||
->execute();
|
||||
|
||||
$panel_map = array();
|
||||
foreach ($panels as $panel) {
|
||||
$panel_map[$panel->getID()] = pht(
|
||||
'%s %s',
|
||||
$panel->getMonogram(),
|
||||
$panel->getName());
|
||||
}
|
||||
$panel_map = array(
|
||||
'' => pht('(None)'),
|
||||
) + $panel_map;
|
||||
|
||||
$value = $this->getFieldValue();
|
||||
if (!is_array($value)) {
|
||||
$value = array();
|
||||
|
@ -57,15 +46,22 @@ final class PhabricatorDashboardPanelTabsCustomField
|
|||
$out = array();
|
||||
for ($ii = 1; $ii <= 6; $ii++) {
|
||||
$tab = idx($value, ($ii - 1), array());
|
||||
$panel = idx($tab, 'panelID', null);
|
||||
$panel_id = array();
|
||||
if ($panel) {
|
||||
$panel_id[] = $panel;
|
||||
}
|
||||
$out[] = id(new AphrontFormTextControl())
|
||||
->setName($this->getFieldKey().'_name[]')
|
||||
->setValue(idx($tab, 'name'))
|
||||
->setLabel(pht('Tab %d Name', $ii));
|
||||
|
||||
$out[] = id(new AphrontFormSelectControl())
|
||||
$out[] = id(new AphrontFormTokenizerControl())
|
||||
->setUser($this->getViewer())
|
||||
->setDatasource(new PhabricatorDashboardPanelDatasource())
|
||||
->setName($this->getFieldKey().'_panelID[]')
|
||||
->setValue(idx($tab, 'panelID'))
|
||||
->setOptions($panel_map)
|
||||
->setValue($panel_id)
|
||||
->setLimit(1)
|
||||
->setLabel(pht('Tab %d Panel', $ii));
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue