Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F13978804
D9573.id22942.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
1 KB
Referenced Files
None
Subscribers
None
D9573.id22942.diff
View Options
diff --git a/src/applications/dashboard/controller/PhabricatorDashboardMovePanelController.php b/src/applications/dashboard/controller/PhabricatorDashboardMovePanelController.php
--- a/src/applications/dashboard/controller/PhabricatorDashboardMovePanelController.php
+++ b/src/applications/dashboard/controller/PhabricatorDashboardMovePanelController.php
@@ -41,29 +41,32 @@
$layout_config->removePanel($panel_phid);
$panel_location_grid = $layout_config->getPanelLocations();
- $panel_columns = idx($panel_location_grid, $column_id, array());
- if ($panel_columns) {
+ $column_phids = idx($panel_location_grid, $column_id, array());
+ $column_phids = array_values($column_phids);
+ if ($column_phids) {
$insert_at = 0;
- $new_panel_columns = $panel_columns;
- foreach ($panel_columns as $index => $curr_panel_phid) {
- if ($curr_panel_phid === $before_phid) {
- $insert_at = max($index - 1, 0);
+ foreach ($column_phids as $index => $phid) {
+ if ($phid === $before_phid) {
+ $insert_at = $index;
break;
}
- if ($curr_panel_phid === $after_phid) {
- $insert_at = $index;
+ if ($phid === $after_phid) {
+ $insert_at = $index + 1;
break;
}
}
+
+ $new_column_phids = $column_phids;
array_splice(
- $new_panel_columns,
+ $new_column_phids,
$insert_at,
0,
array($panel_phid));
} else {
- $new_panel_columns = array(0 => $panel_phid);
+ $new_column_phids = array(0 => $panel_phid);
}
- $panel_location_grid[$column_id] = $new_panel_columns;
+
+ $panel_location_grid[$column_id] = $new_column_phids;
$layout_config->setPanelLocations($panel_location_grid);
$dashboard->setLayoutConfigFromObject($layout_config);
$dashboard->save();
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Sun, Oct 20, 1:03 AM (3 w, 4 d ago)
Storage Engine
blob
Storage Format
Encrypted (AES-256-CBC)
Storage Handle
6729307
Default Alt Text
D9573.id22942.diff (1 KB)
Attached To
Mode
D9573: Fix some off-by-one issues when drag-and-dropping dashboard panels
Attached
Detach File
Event Timeline
Log In to Comment