Differential D20409 Diff 48716 src/applications/dashboard/layoutconfig/PhabricatorDashboardPanelRefList.php
Changeset View
Changeset View
Standalone View
Standalone View
src/applications/dashboard/layoutconfig/PhabricatorDashboardPanelRefList.php
| Show First 20 Lines • Show All 105 Lines • ▼ Show 20 Lines | foreach ($this->refs as $key => $ref) { | ||||
| unset($this->refs[$key]); | unset($this->refs[$key]); | ||||
| return $ref; | return $ref; | ||||
| } | } | ||||
| return null; | return null; | ||||
| } | } | ||||
| public function movePanelRef( | |||||
| PhabricatorDashboardPanelRef $target, | |||||
| $column_key, | |||||
| PhabricatorDashboardPanelRef $after = null) { | |||||
| $target->setColumnKey($column_key); | |||||
| $results = array(); | |||||
| if (!$after) { | |||||
| $results[] = $target; | |||||
| } | |||||
| foreach ($this->refs as $ref) { | |||||
| if ($ref->getPanelKey() === $target->getPanelKey()) { | |||||
| continue; | |||||
| } | |||||
| $results[] = $ref; | |||||
| if ($after) { | |||||
| if ($ref->getPanelKey() === $after->getPanelKey()) { | |||||
| $results[] = $target; | |||||
| } | |||||
| } | |||||
| } | |||||
| $this->refs = $results; | |||||
| $column_map = mgroup($results, 'getColumnKey'); | |||||
| foreach ($this->columns as $column_key => $column) { | |||||
| $column->setPanelRefs(idx($column_map, $column_key, array())); | |||||
| } | |||||
| return $ref; | |||||
| } | |||||
| private function newPanelKey() { | private function newPanelKey() { | ||||
| return Filesystem::readRandomCharacters(8); | return Filesystem::readRandomCharacters(8); | ||||
| } | } | ||||
| } | } | ||||