@recaptime-dev's working patches + fork for Phorge, a community fork of Phabricator. (Upstream dev and stable branches are at upstream/main and upstream/stable respectively.) hq.recaptime.dev/wiki/Phorge
phorge phabricator
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

Glue the new FormationView on top of the older Filetree view in Differential

Summary: Ref T13516. This glues "FormationView" to "ChangesetList". The actual tree is not functional in any meaningful way yet.

Test Plan: {F7373838}

Maniphest Tasks: T13516

Differential Revision: https://secure.phabricator.com/D21151

+452 -167
+34 -39
resources/celerity/map.php
··· 12 12 'core.pkg.css' => 'a4a2417c', 13 13 'core.pkg.js' => '4355a8d3', 14 14 'differential.pkg.css' => '607c84be', 15 - 'differential.pkg.js' => '1a72918e', 15 + 'differential.pkg.js' => 'e40c5192', 16 16 'diffusion.pkg.css' => '42c75c37', 17 17 'diffusion.pkg.js' => 'a98c0bf7', 18 18 'maniphest.pkg.css' => '35995d6d', ··· 155 155 'rsrc/css/phui/phui-fontkit.css' => '1ec937e5', 156 156 'rsrc/css/phui/phui-form-view.css' => '01b796c0', 157 157 'rsrc/css/phui/phui-form.css' => '1f177cb7', 158 - 'rsrc/css/phui/phui-formation-view.css' => 'aec68a01', 158 + 'rsrc/css/phui/phui-formation-view.css' => 'e87a0801', 159 159 'rsrc/css/phui/phui-head-thing.css' => 'd7f293df', 160 160 'rsrc/css/phui/phui-header-view.css' => '36c86a58', 161 161 'rsrc/css/phui/phui-hovercard.css' => '6ca90fa0', ··· 379 379 'rsrc/js/application/dashboard/behavior-dashboard-query-panel-select.js' => '1e413dc9', 380 380 'rsrc/js/application/dashboard/behavior-dashboard-tab-panel.js' => '0116d3e8', 381 381 'rsrc/js/application/diff/DiffChangeset.js' => '5a4e4a3b', 382 - 'rsrc/js/application/diff/DiffChangesetList.js' => '139299d7', 382 + 'rsrc/js/application/diff/DiffChangesetList.js' => '3ac694dd', 383 383 'rsrc/js/application/diff/DiffInline.js' => '16e97ebc', 384 384 'rsrc/js/application/diff/behavior-preview-link.js' => 'f51e9c17', 385 385 'rsrc/js/application/differential/behavior-diff-radios.js' => '925fe8cd', 386 - 'rsrc/js/application/differential/behavior-populate.js' => 'dfa1d313', 386 + 'rsrc/js/application/differential/behavior-populate.js' => 'b86ef6c2', 387 387 'rsrc/js/application/diffusion/DiffusionLocateFileSource.js' => '94243d89', 388 388 'rsrc/js/application/diffusion/behavior-audit-preview.js' => 'b7b73831', 389 389 'rsrc/js/application/diffusion/behavior-commit-branches.js' => '4b671572', ··· 520 520 'rsrc/js/phui/behavior-phui-submenu.js' => 'b5e9bff9', 521 521 'rsrc/js/phui/behavior-phui-tab-group.js' => '242aa08b', 522 522 'rsrc/js/phui/behavior-phui-timer-control.js' => 'f84bcbf4', 523 - 'rsrc/js/phui/behavior-phuix-formation-view.js' => '1a12beef', 524 523 'rsrc/js/phuix/PHUIXActionListView.js' => 'c68f183f', 525 524 'rsrc/js/phuix/PHUIXActionView.js' => 'aaa08f3b', 526 525 'rsrc/js/phuix/PHUIXAutocomplete.js' => '2fbe234d', ··· 528 527 'rsrc/js/phuix/PHUIXDropdownMenu.js' => '7acfd98b', 529 528 'rsrc/js/phuix/PHUIXExample.js' => 'c2c500a7', 530 529 'rsrc/js/phuix/PHUIXFormControl.js' => '38c1f3fb', 531 - 'rsrc/js/phuix/PHUIXFormationColumnView.js' => '08fc09e9', 530 + 'rsrc/js/phuix/PHUIXFormationColumnView.js' => '8afd2cb1', 532 531 'rsrc/js/phuix/PHUIXFormationFlankView.js' => '6648270a', 533 - 'rsrc/js/phuix/PHUIXFormationView.js' => '0113c54c', 532 + 'rsrc/js/phuix/PHUIXFormationView.js' => 'cef53b3e', 534 533 'rsrc/js/phuix/PHUIXIconView.js' => 'a5257c4e', 535 534 ), 536 535 'symbols' => array( ··· 614 613 'javelin-behavior-device' => '0cf79f45', 615 614 'javelin-behavior-diff-preview-link' => 'f51e9c17', 616 615 'javelin-behavior-differential-diff-radios' => '925fe8cd', 617 - 'javelin-behavior-differential-populate' => 'dfa1d313', 616 + 'javelin-behavior-differential-populate' => 'b86ef6c2', 618 617 'javelin-behavior-diffusion-commit-branches' => '4b671572', 619 618 'javelin-behavior-diffusion-commit-graph' => 'ef836bf2', 620 619 'javelin-behavior-diffusion-locate-file' => '87428eb2', ··· 672 671 'javelin-behavior-phui-tab-group' => '242aa08b', 673 672 'javelin-behavior-phui-timer-control' => 'f84bcbf4', 674 673 'javelin-behavior-phuix-example' => 'c2c500a7', 675 - 'javelin-behavior-phuix-formation-view' => '1a12beef', 676 674 'javelin-behavior-policy-control' => '0eaa33a9', 677 675 'javelin-behavior-policy-rule-editor' => '9347f172', 678 676 'javelin-behavior-project-boards' => '58cb6a88', ··· 781 779 'phabricator-darkmessage' => '26cd4b73', 782 780 'phabricator-dashboard-css' => '5a205b9d', 783 781 'phabricator-diff-changeset' => '5a4e4a3b', 784 - 'phabricator-diff-changeset-list' => '139299d7', 782 + 'phabricator-diff-changeset-list' => '3ac694dd', 785 783 'phabricator-diff-inline' => '16e97ebc', 786 784 'phabricator-drag-and-drop-file-upload' => '4370900d', 787 785 'phabricator-draggable-list' => '0169e425', ··· 850 848 'phui-fontkit-css' => '1ec937e5', 851 849 'phui-form-css' => '1f177cb7', 852 850 'phui-form-view-css' => '01b796c0', 853 - 'phui-formation-view-css' => 'aec68a01', 851 + 'phui-formation-view-css' => 'e87a0801', 854 852 'phui-head-thing-view-css' => 'd7f293df', 855 853 'phui-header-view-css' => '36c86a58', 856 854 'phui-hovercard' => '074f0783', ··· 893 891 'phuix-button-view' => '55a24e84', 894 892 'phuix-dropdown-menu' => '7acfd98b', 895 893 'phuix-form-control-view' => '38c1f3fb', 896 - 'phuix-formation-column-view' => '08fc09e9', 894 + 'phuix-formation-column-view' => '8afd2cb1', 897 895 'phuix-formation-flank-view' => '6648270a', 898 - 'phuix-formation-view' => '0113c54c', 896 + 'phuix-formation-view' => 'cef53b3e', 899 897 'phuix-icon-view' => 'a5257c4e', 900 898 'policy-css' => 'ceb56a08', 901 899 'policy-edit-css' => '8794e2ed', ··· 922 920 'unhandled-exception-css' => '9ecfc00d', 923 921 ), 924 922 'requires' => array( 925 - '0113c54c' => array( 926 - 'javelin-install', 927 - 'javelin-dom', 928 - ), 929 923 '0116d3e8' => array( 930 924 'javelin-behavior', 931 925 'javelin-dom', ··· 998 992 'javelin-util', 999 993 'javelin-magical-init', 1000 994 ), 1001 - '08fc09e9' => array( 1002 - 'javelin-install', 1003 - 'javelin-dom', 1004 - ), 1005 995 '0922e81d' => array( 1006 996 'herald-rule-editor', 1007 997 'javelin-behavior', ··· 1041 1031 'javelin-uri', 1042 1032 'phabricator-keyboard-shortcut', 1043 1033 ), 1044 - '139299d7' => array( 1045 - 'javelin-install', 1046 - 'phuix-button-view', 1047 - ), 1048 1034 '139ef688' => array( 1049 1035 'javelin-behavior', 1050 1036 'javelin-dom', ··· 1054 1040 '16e97ebc' => array( 1055 1041 'javelin-dom', 1056 1042 ), 1057 - '1a12beef' => array( 1058 - 'javelin-behavior', 1059 - 'phuix-formation-view', 1060 - 'phuix-formation-column-view', 1061 - 'phuix-formation-flank-view', 1062 - ), 1063 1043 '1a844c06' => array( 1064 1044 'javelin-install', 1065 1045 'javelin-util', ··· 1259 1239 'trigger-rule-editor', 1260 1240 'trigger-rule', 1261 1241 'trigger-rule-type', 1242 + ), 1243 + '3ac694dd' => array( 1244 + 'javelin-install', 1245 + 'phuix-button-view', 1262 1246 ), 1263 1247 '3ae89b20' => array( 1264 1248 'phui-workcard-view-css', ··· 1710 1694 'javelin-dom', 1711 1695 'phabricator-draggable-list', 1712 1696 ), 1697 + '8afd2cb1' => array( 1698 + 'javelin-install', 1699 + 'javelin-dom', 1700 + ), 1713 1701 '8b5c7d65' => array( 1714 1702 'javelin-behavior', 1715 1703 'javelin-stratcom', ··· 2012 2000 'javelin-util', 2013 2001 'phabricator-shaped-request', 2014 2002 ), 2003 + 'b86ef6c2' => array( 2004 + 'javelin-behavior', 2005 + 'javelin-dom', 2006 + 'javelin-stratcom', 2007 + 'phabricator-tooltip', 2008 + 'phabricator-diff-changeset-list', 2009 + 'phabricator-diff-changeset', 2010 + 'phuix-formation-view', 2011 + ), 2015 2012 'b86f297f' => array( 2016 2013 'javelin-behavior', 2017 2014 'javelin-stratcom', ··· 2084 2081 'phuix-icon-view', 2085 2082 'phabricator-busy', 2086 2083 ), 2084 + 'cef53b3e' => array( 2085 + 'javelin-install', 2086 + 'javelin-dom', 2087 + 'phuix-formation-column-view', 2088 + 'phuix-formation-flank-view', 2089 + ), 2087 2090 'cf32921f' => array( 2088 2091 'javelin-behavior', 2089 2092 'javelin-dom', ··· 2115 2118 'javelin-behavior', 2116 2119 'javelin-uri', 2117 2120 'phabricator-notification', 2118 - ), 2119 - 'dfa1d313' => array( 2120 - 'javelin-behavior', 2121 - 'javelin-dom', 2122 - 'javelin-stratcom', 2123 - 'phabricator-tooltip', 2124 - 'phabricator-diff-changeset-list', 2125 - 'phabricator-diff-changeset', 2126 2121 ), 2127 2122 'e150bd50' => array( 2128 2123 'javelin-behavior',
+3 -1
src/__phutil_library_map__.php
··· 539 539 'DifferentialExactUserFunctionDatasource' => 'applications/differential/typeahead/DifferentialExactUserFunctionDatasource.php', 540 540 'DifferentialFieldParseException' => 'applications/differential/exception/DifferentialFieldParseException.php', 541 541 'DifferentialFieldValidationException' => 'applications/differential/exception/DifferentialFieldValidationException.php', 542 + 'DifferentialFileTreeEngine' => 'applications/differential/engine/DifferentialFileTreeEngine.php', 542 543 'DifferentialGetAllDiffsConduitAPIMethod' => 'applications/differential/conduit/DifferentialGetAllDiffsConduitAPIMethod.php', 543 544 'DifferentialGetCommitMessageConduitAPIMethod' => 'applications/differential/conduit/DifferentialGetCommitMessageConduitAPIMethod.php', 544 545 'DifferentialGetCommitPathsConduitAPIMethod' => 'applications/differential/conduit/DifferentialGetCommitPathsConduitAPIMethod.php', ··· 6599 6600 'DifferentialExactUserFunctionDatasource' => 'PhabricatorTypeaheadCompositeDatasource', 6600 6601 'DifferentialFieldParseException' => 'Exception', 6601 6602 'DifferentialFieldValidationException' => 'Exception', 6603 + 'DifferentialFileTreeEngine' => 'Phobject', 6602 6604 'DifferentialGetAllDiffsConduitAPIMethod' => 'DifferentialConduitAPIMethod', 6603 6605 'DifferentialGetCommitMessageConduitAPIMethod' => 'DifferentialConduitAPIMethod', 6604 6606 'DifferentialGetCommitPathsConduitAPIMethod' => 'DifferentialConduitAPIMethod', ··· 8332 8334 'PHUIFormationExpanderView' => 'AphrontAutoIDView', 8333 8335 'PHUIFormationFlankView' => 'PHUIFormationColumnDynamicView', 8334 8336 'PHUIFormationResizerView' => 'PHUIFormationColumnView', 8335 - 'PHUIFormationView' => 'AphrontView', 8337 + 'PHUIFormationView' => 'AphrontAutoIDView', 8336 8338 'PHUIHandleListView' => 'AphrontTagView', 8337 8339 'PHUIHandleTagListView' => 'AphrontTagView', 8338 8340 'PHUIHandleView' => 'AphrontView',
+20 -25
src/applications/differential/controller/DifferentialRevisionViewController.php
··· 474 474 ->setKey('history') 475 475 ->appendChild($history)); 476 476 477 - $filetree_on = $viewer->compareUserSetting( 478 - PhabricatorShowFiletreeSetting::SETTINGKEY, 479 - PhabricatorShowFiletreeSetting::VALUE_ENABLE_FILETREE); 477 + $filetree = id(new DifferentialFileTreeEngine()) 478 + ->setViewer($viewer); 480 479 481 - $collapsed_key = PhabricatorFiletreeVisibleSetting::SETTINGKEY; 482 - $filetree_collapsed = (bool)$viewer->getUserSetting($collapsed_key); 480 + $filetree_collapsed = !$filetree->getIsVisible(); 483 481 484 482 // See PHI811. If the viewer has the file tree on, the files tab with the 485 483 // table of contents is redundant, so default to the "History" tab instead. 486 - if ($filetree_on && !$filetree_collapsed) { 484 + if (!$filetree_collapsed) { 487 485 $tab_group->selectTab('history'); 488 486 } 489 487 ··· 609 607 $crumbs->addTextCrumb($monogram); 610 608 $crumbs->setBorder(true); 611 609 612 - $nav = null; 613 - if ($filetree_on && !$this->isVeryLargeDiff()) { 614 - $width_key = PhabricatorFiletreeWidthSetting::SETTINGKEY; 615 - $width_value = $viewer->getUserSetting($width_key); 616 - 617 - $nav = id(new DifferentialChangesetFileTreeSideNavBuilder()) 618 - ->setTitle($monogram) 619 - ->setBaseURI(new PhutilURI($revision->getURI())) 620 - ->setCollapsed($filetree_collapsed) 621 - ->setWidth((int)$width_value) 622 - ->build($changesets); 623 - } 610 + $filetree 611 + ->setChangesets($changesets) 612 + ->setDisabled($this->isVeryLargeDiff()); 624 613 625 614 $view = id(new PHUITwoColumnView()) 626 615 ->setHeader($header) ··· 638 627 )) 639 628 ->setFooter($footer); 640 629 641 - $page = $this->newPage() 630 + $main_content = array( 631 + $crumbs, 632 + $view, 633 + ); 634 + 635 + $main_content = $filetree->newView($main_content); 636 + 637 + if (!$filetree->getDisabled()) { 638 + $changeset_view->setFormationView($main_content); 639 + } 640 + 641 + $page = $this->newPage() 642 642 ->setTitle($monogram.' '.$revision->getTitle()) 643 - ->setCrumbs($crumbs) 644 643 ->setPageObjectPHIDs(array($revision->getPHID())) 645 - ->appendChild($view); 646 - 647 - if ($nav) { 648 - $page->setNavigation($nav); 649 - } 644 + ->appendChild($main_content); 650 645 651 646 return $page; 652 647 }
+155
src/applications/differential/engine/DifferentialFileTreeEngine.php
··· 1 + <?php 2 + 3 + final class DifferentialFileTreeEngine 4 + extends Phobject { 5 + 6 + private $viewer; 7 + private $changesets; 8 + private $disabled; 9 + 10 + public function setViewer($viewer) { 11 + $this->viewer = $viewer; 12 + return $this; 13 + } 14 + 15 + public function getViewer() { 16 + return $this->viewer; 17 + } 18 + 19 + public function getIsVisible() { 20 + return (bool)$this->getSetting($this->getVisibleSettingKey()); 21 + } 22 + 23 + public function setDisabled($disabled) { 24 + $this->disabled = $disabled; 25 + return $this; 26 + } 27 + 28 + public function getDisabled() { 29 + return $this->disabled; 30 + } 31 + 32 + public function setChangesets(array $changesets) { 33 + $this->changesets = $changesets; 34 + return $this; 35 + } 36 + 37 + public function getChangesets() { 38 + return $this->changesets; 39 + } 40 + 41 + public function newView($content) { 42 + if ($this->getDisabled()) { 43 + return $content; 44 + } 45 + 46 + $width = $this->getWidth(); 47 + $is_visible = $this->getIsVisible(); 48 + 49 + $formation_view = new PHUIFormationView(); 50 + 51 + $flank_view = $formation_view->newFlankColumn() 52 + ->setHeaderText(pht('Affected Paths')) 53 + ->setIsResizable(true) 54 + ->setIsFixed(true) 55 + ->setIsVisible($is_visible) 56 + ->setWidth($width) 57 + ->setMinimumWidth($this->getMinimumWidth()) 58 + ->setMaximumWidth($this->getMaximumWidth()); 59 + 60 + $viewer = $this->getViewer(); 61 + if ($viewer->isLoggedIn()) { 62 + $flank_view 63 + ->setVisibleSettingKey($this->getVisibleSettingKey()) 64 + ->setWidthSettingKey($this->getWidthSettingKey()); 65 + } 66 + 67 + $flank_view->setHead( 68 + array( 69 + phutil_tag('div', array(), 70 + array( 71 + id(new PHUIIconView())->setIcon('fa-list'), 72 + pht('Table of Contents'), 73 + '[t]', 74 + )), 75 + )); 76 + 77 + $flank_view->setBody( 78 + phutil_tag( 79 + 'div', 80 + array( 81 + 'class' => 'phui-flank-loading', 82 + ), 83 + pht('Loading...'))); 84 + 85 + $flank_view->setTail( 86 + array( 87 + phutil_tag('div', array(), 88 + array( 89 + id(new PHUIIconView())->setIcon('fa-chevron-left'), 90 + pht('Hide Panel'), 91 + '[f]', 92 + )), 93 + phutil_tag( 94 + 'div', 95 + array(), 96 + array( 97 + id(new PHUIIconView())->setIcon('fa-keyboard-o'), 98 + pht('Keyboard Reference'), 99 + '[?]', 100 + )), 101 + )); 102 + 103 + $main_column = $formation_view->newContentColumn() 104 + ->appendChild($content); 105 + 106 + return $formation_view; 107 + } 108 + 109 + private function getVisibleSettingKey() { 110 + return PhabricatorFiletreeVisibleSetting::SETTINGKEY; 111 + } 112 + 113 + private function getWidthSettingKey() { 114 + return PhabricatorFiletreeWidthSetting::SETTINGKEY; 115 + } 116 + 117 + private function getWidth() { 118 + $width = (int)$this->getSetting($this->getWidthSettingKey()); 119 + 120 + if (!$width) { 121 + $width = $this->getDefaultWidth(); 122 + } 123 + 124 + $min = $this->getMinimumWidth(); 125 + if ($width < $min) { 126 + $width = $min; 127 + } 128 + 129 + $max = $this->getMaximumWidth(); 130 + if ($width > $max) { 131 + $width = $max; 132 + } 133 + 134 + return $width; 135 + } 136 + 137 + private function getDefaultWidth() { 138 + return 240; 139 + } 140 + 141 + private function getMinimumWidth() { 142 + return 150; 143 + } 144 + 145 + private function getMaximumWidth() { 146 + return 512; 147 + } 148 + 149 + private function getSetting($key) { 150 + $viewer = $this->getViewer(); 151 + return $viewer->getUserSetting($key); 152 + } 153 + 154 + 155 + }
+17
src/applications/differential/view/DifferentialChangesetListView.php
··· 24 24 25 25 private $title; 26 26 private $parser; 27 + private $formationView; 27 28 28 29 public function setParser(DifferentialChangesetParser $parser) { 29 30 $this->parser = $parser; ··· 146 147 return $this; 147 148 } 148 149 150 + public function setFormationView(PHUIFormationView $formation_view) { 151 + $this->formationView = $formation_view; 152 + return $this; 153 + } 154 + 155 + public function getFormationView() { 156 + return $this->formationView; 157 + } 158 + 149 159 public function render() { 150 160 $viewer = $this->getViewer(); 151 161 ··· 232 242 233 243 $this->requireResource('aphront-tooltip-css'); 234 244 245 + $formation_id = null; 246 + $formation_view = $this->getFormationView(); 247 + if ($formation_view) { 248 + $formation_id = $formation_view->getID(); 249 + } 250 + 235 251 $this->initBehavior( 236 252 'differential-populate', 237 253 array( 238 254 'changesetViewIDs' => $ids, 255 + 'formationViewID' => $formation_id, 239 256 'inlineURI' => $this->inlineURI, 240 257 'inlineListURI' => $this->inlineListURI, 241 258 'isStandalone' => $this->getIsStandalone(),
+40
src/view/formation/PHUIFormationColumnDynamicView.php
··· 6 6 private $isVisible = true; 7 7 private $isResizable; 8 8 private $width; 9 + private $widthSettingKey; 10 + private $visibleSettingKey; 11 + private $minimumWidth; 12 + private $maximumWidth; 9 13 10 14 public function setIsVisible($is_visible) { 11 15 $this->isVisible = $is_visible; ··· 32 36 33 37 public function getWidth() { 34 38 return $this->width; 39 + } 40 + 41 + public function setWidthSettingKey($width_setting_key) { 42 + $this->widthSettingKey = $width_setting_key; 43 + return $this; 44 + } 45 + 46 + public function getWidthSettingKey() { 47 + return $this->widthSettingKey; 48 + } 49 + 50 + public function setVisibleSettingKey($visible_setting_key) { 51 + $this->visibleSettingKey = $visible_setting_key; 52 + return $this; 53 + } 54 + 55 + public function getVisibleSettingKey() { 56 + return $this->visibleSettingKey; 57 + } 58 + 59 + public function setMinimumWidth($minimum_width) { 60 + $this->minimumWidth = $minimum_width; 61 + return $this; 62 + } 63 + 64 + public function getMinimumWidth() { 65 + return $this->minimumWidth; 66 + } 67 + 68 + public function setMaximumWidth($maximum_width) { 69 + $this->maximumWidth = $maximum_width; 70 + return $this; 71 + } 72 + 73 + public function getMaximumWidth() { 74 + return $this->maximumWidth; 35 75 } 36 76 37 77 }
+11 -3
src/view/formation/PHUIFormationColumnItem.php
··· 73 73 } 74 74 75 75 public function newClientProperties() { 76 + $column = $this->getColumn(); 77 + 76 78 $expander_id = null; 77 79 78 80 $expander = $this->getExpander(); ··· 80 82 $expander_id = $expander->getID(); 81 83 } 82 84 83 - 84 85 $resizer_details = null; 85 86 $resizer_item = $this->getResizerItem(); 86 87 if ($resizer_item) { 88 + $visible_key = $column->getVisibleSettingKey(); 89 + $width_key = $column->getWidthSettingKey(); 90 + $min_width = $column->getMinimumWidth(); 91 + $max_width = $column->getMaximumWidth(); 92 + 87 93 $resizer_details = array( 88 94 'itemID' => $resizer_item->getID(), 89 95 'controlID' => $resizer_item->getColumn()->getID(), 96 + 'widthKey' => $width_key, 97 + 'visibleKey' => $visible_key, 98 + 'minimumWidth' => $min_width, 99 + 'maximumWidth' => $max_width, 90 100 ); 91 101 } 92 - 93 - $column = $this->getColumn(); 94 102 95 103 $width = $column->getWidth(); 96 104 if ($width !== null) {
+16
src/view/formation/PHUIFormationColumnView.php
··· 30 30 return false; 31 31 } 32 32 33 + public function getVisibleSettingKey() { 34 + return null; 35 + } 36 + 37 + public function getWidthSettingKey() { 38 + return null; 39 + } 40 + 41 + public function getMinimumWidth() { 42 + return null; 43 + } 44 + 45 + public function getMaximumWidth() { 46 + return null; 47 + } 48 + 33 49 public function newClientProperties() { 34 50 return null; 35 51 }
+7 -4
src/view/formation/PHUIFormationFlankView.php
··· 99 99 $body_id = $this->getBodyID(); 100 100 $tail_id = $this->getTailID(); 101 101 102 - $head_content = phutil_tag( 102 + $header = phutil_tag( 103 103 'div', 104 104 array( 105 105 'class' => 'phui-flank-header', ··· 128 128 'id' => $head_id, 129 129 'class' => 'phui-flank-view-head', 130 130 ), 131 - $head_content), 131 + array( 132 + $header, 133 + $this->head, 134 + )), 132 135 phutil_tag( 133 136 'div', 134 137 array( 135 138 'id' => $body_id, 136 139 'class' => 'phui-flank-view-body', 137 140 ), 138 - $this->getBody()), 141 + $this->body), 139 142 phutil_tag( 140 143 'div', 141 144 array( 142 145 'id' => $tail_id, 143 146 'class' => 'phui-flank-view-tail', 144 147 ), 145 - $this->getTail()), 148 + $this->tail), 146 149 )); 147 150 148 151 return $content;
+11 -16
src/view/formation/PHUIFormationView.php
··· 1 1 <?php 2 2 3 3 final class PHUIFormationView 4 - extends AphrontView { 4 + extends AphrontAutoIDView { 5 5 6 6 private $items = array(); 7 7 ··· 62 62 )); 63 63 } 64 64 65 - $formation_id = celerity_generate_unique_node_id(); 65 + $phuix_items = array(); 66 + foreach ($items as $item) { 67 + $phuix_items[] = $item->newClientProperties(); 68 + } 66 69 67 70 $table_row = phutil_tag('tr', array(), $cells); 68 71 $table_body = phutil_tag('tbody', array(), $table_row); 69 - $table = phutil_tag( 72 + $table = javelin_tag( 70 73 'table', 71 74 array( 75 + 'id' => $this->getID(), 72 76 'class' => 'phui-formation-view', 73 - 'id' => $formation_id, 77 + 'sigil' => 'phuix-formation-view', 78 + 'meta' => array( 79 + 'items' => $phuix_items, 80 + ), 74 81 ), 75 82 $table_body); 76 - 77 - $phuix_columns = array(); 78 - foreach ($items as $item) { 79 - $phuix_columns[] = $item->newClientProperties(); 80 - } 81 - 82 - Javelin::initBehavior( 83 - 'phuix-formation-view', 84 - array( 85 - 'nodeID' => $formation_id, 86 - 'columns' => $phuix_columns, 87 - )); 88 83 89 84 return $table; 90 85 }
+6
webroot/rsrc/css/phui/phui-formation-view.css
··· 143 143 bottom: 0; 144 144 width: 100%; 145 145 } 146 + 147 + .phui-flank-loading { 148 + color: {$lightgreytext}; 149 + text-align: center; 150 + margin: 16px; 151 + }
+28 -1
webroot/rsrc/js/application/diff/DiffChangesetList.js
··· 90 90 translations: null, 91 91 inlineURI: null, 92 92 inlineListURI: null, 93 - isStandalone: false 93 + isStandalone: false, 94 + formationView: null 94 95 }, 95 96 96 97 members: { ··· 142 143 143 144 this._bannerChangeset = null; 144 145 this._redrawBanner(); 146 + 147 + this._redrawFiletree(); 145 148 146 149 if (this._initialized) { 147 150 return; ··· 1953 1956 } 1954 1957 1955 1958 return null; 1959 + }, 1960 + 1961 + _redrawFiletree : function() { 1962 + var formation = this.getFormationView(); 1963 + 1964 + if (!formation) { 1965 + return; 1966 + } 1967 + 1968 + var filetree = formation.getColumn(0); 1969 + var flank = filetree.getFlank(); 1970 + 1971 + var flank_body = flank.getBodyNode(); 1972 + 1973 + var items = []; 1974 + for (var ii = 0; ii < this._changesets.length; ii++) { 1975 + var changeset = this._changesets[ii]; 1976 + 1977 + var node = JX.$N('div', {}, changeset.getDisplayPath()); 1978 + items.push(node); 1979 + } 1980 + 1981 + JX.DOM.setContent(flank_body, items); 1956 1982 } 1983 + 1957 1984 } 1958 1985 1959 1986 });
+12 -6
webroot/rsrc/js/application/differential/behavior-populate.js
··· 6 6 * phabricator-tooltip 7 7 * phabricator-diff-changeset-list 8 8 * phabricator-diff-changeset 9 + * phuix-formation-view 9 10 * @javelin 10 11 */ 11 12 ··· 64 65 .setInlineListURI(config.inlineListURI) 65 66 .setIsStandalone(config.isStandalone); 66 67 67 - // Install and activate the current page. 68 - var page_id = JX.Quicksand.getCurrentPageID(); 69 - statics.pages[page_id] = [changeset_list]; 70 - onredraw(page_id); 71 - 72 - 68 + if (config.formationViewID) { 69 + var formation_node = JX.$(config.formationViewID); 70 + var formation_view = new JX.PHUIXFormationView(formation_node); 71 + changeset_list.setFormationView(formation_view); 72 + formation_view.start(); 73 + } 73 74 74 75 for (var ii = 0; ii < config.changesetViewIDs.length; ii++) { 75 76 var id = config.changesetViewIDs[ii]; ··· 79 80 changeset.setStabilize(true).load(); 80 81 } 81 82 } 83 + 84 + // Install and activate the current page. 85 + var page_id = JX.Quicksand.getCurrentPageID(); 86 + statics.pages[page_id] = [changeset_list]; 87 + onredraw(page_id); 82 88 83 89 var highlighted = null; 84 90 var highlight_class = null;
-54
webroot/rsrc/js/phui/behavior-phuix-formation-view.js
··· 1 - /** 2 - * @provides javelin-behavior-phuix-formation-view 3 - * @requires javelin-behavior 4 - * phuix-formation-view 5 - * phuix-formation-column-view 6 - * phuix-formation-flank-view 7 - */ 8 - 9 - JX.behavior('phuix-formation-view', function(config) { 10 - 11 - var formation_node = JX.$(config.nodeID); 12 - var formation = new JX.PHUIXFormationView(formation_node); 13 - 14 - var count = config.columns.length; 15 - for (var ii = 0; ii < count; ii++) { 16 - var spec = config.columns[ii]; 17 - var node = JX.$(spec.itemID); 18 - 19 - var column = new JX.PHUIXFormationColumnView(node) 20 - .setIsRightAligned(spec.isRightAligned) 21 - .setWidth(spec.width) 22 - .setIsVisible(spec.isVisible); 23 - 24 - if (spec.expanderID) { 25 - column.setExpanderNode(JX.$(spec.expanderID)); 26 - } 27 - 28 - if (spec.resizer) { 29 - column 30 - .setResizerItem(JX.$(spec.resizer.itemID)) 31 - .setResizerControl(JX.$(spec.resizer.controlID)); 32 - } 33 - 34 - var colspec = spec.column; 35 - if (colspec) { 36 - if (colspec.type === 'flank') { 37 - var flank_node = JX.$(colspec.nodeID); 38 - 39 - var head = JX.$(colspec.headID); 40 - var body = JX.$(colspec.bodyID); 41 - var tail = JX.$(colspec.tailID); 42 - 43 - var flank = new JX.PHUIXFormationFlankView(flank_node, head, body, tail) 44 - .setIsFixed(colspec.isFixed); 45 - 46 - column.setFlank(flank); 47 - } 48 - } 49 - 50 - formation.addColumn(column); 51 - } 52 - 53 - formation.start(); 54 - });
+32 -17
webroot/rsrc/js/phuix/PHUIXFormationColumnView.js
··· 17 17 resizerItem: null, 18 18 resizerControl: null, 19 19 width: null, 20 + widthSettingKey: null, 21 + visibleSettingKey: null, 22 + minimumWidth: null, 23 + maximumWidth: null, 20 24 flank: null 21 25 }, 22 26 ··· 83 87 width = this.getWidth() + dx; 84 88 } 85 89 86 - // TODO: Make these configurable? 87 - width = Math.max(width, 150); 88 - width = Math.min(width, 512); 90 + var min_width = this.getMinimumWidth(); 91 + if (min_width) { 92 + width = Math.max(width, min_width); 93 + } 94 + 95 + var max_width = this.getMaximumWidth(); 96 + if (max_width) { 97 + width = Math.min(width, max_width); 98 + } 89 99 90 100 this._resizingWidth = width; 91 101 ··· 114 124 115 125 this.setWidth(this._resizingWidth); 116 126 117 - JX.log('new width is ' + this.getWidth()); 118 - 119 127 JX.DOM.alterClass(document.body, 'jx-drag-col', false); 120 128 this._dragging = null; 121 129 122 - // TODO: Save new width setting. 123 - 124 - // new JX.Request('/settings/adjust/', JX.bag) 125 - // .setData( 126 - // { 127 - // key: 'filetree.width', 128 - // value: get_width() 129 - // }) 130 - // .send(); 131 - 130 + var width_key = this.getWidthSettingKey(); 131 + if (width_key) { 132 + this._adjustSetting(width_key, this.getWidth()); 133 + } 132 134 }, 133 135 134 136 _setVisibility: function(visible, e) { 135 137 e.kill(); 136 138 137 - // TODO: Save the visibility setting. 138 - 139 139 this.setIsVisible(visible); 140 140 this.repaint(); 141 + 142 + var visible_key = this.getVisibleSettingKey(); 143 + if (visible_key) { 144 + this._adjustSetting(visible_key, visible ? 1 : 0); 145 + } 146 + }, 147 + 148 + _adjustSetting: function(key, value) { 149 + new JX.Request('/settings/adjust/', JX.bag) 150 + .setData( 151 + { 152 + key: key, 153 + value: value 154 + }) 155 + .send(); 141 156 }, 142 157 143 158 repaint: function() {
+60 -1
webroot/rsrc/js/phuix/PHUIXFormationView.js
··· 2 2 * @provides phuix-formation-view 3 3 * @requires javelin-install 4 4 * javelin-dom 5 + * phuix-formation-column-view 6 + * phuix-formation-flank-view 5 7 */ 6 8 7 9 JX.install('PHUIXFormationView', { 8 10 9 - construct: function() { 11 + construct: function(node) { 12 + this._node = node; 10 13 this._columns = []; 14 + 15 + var config = JX.Stratcom.getData(this._node); 16 + 17 + var items = config.items; 18 + var count = items.length; 19 + for (var ii = 0; ii < count; ii++) { 20 + var item = items[ii]; 21 + var item_node = JX.$(item.itemID); 22 + 23 + var column = new JX.PHUIXFormationColumnView(item_node) 24 + .setIsRightAligned(item.isRightAligned) 25 + .setWidth(item.width) 26 + .setIsVisible(item.isVisible); 27 + 28 + if (item.expanderID) { 29 + column.setExpanderNode(JX.$(item.expanderID)); 30 + } 31 + 32 + if (item.resizer) { 33 + column 34 + .setWidthSettingKey(item.resizer.widthKey) 35 + .setVisibleSettingKey(item.resizer.visibleKey) 36 + .setMinimumWidth(item.resizer.minimumWidth) 37 + .setMaximumWidth(item.resizer.maximumWidth) 38 + .setResizerItem(JX.$(item.resizer.itemID)) 39 + .setResizerControl(JX.$(item.resizer.controlID)); 40 + } 41 + 42 + var spec = item.column; 43 + if (spec) { 44 + if (spec.type === 'flank') { 45 + var flank_node = JX.$(spec.nodeID); 46 + 47 + var head = JX.$(spec.headID); 48 + var body = JX.$(spec.bodyID); 49 + var tail = JX.$(spec.tailID); 50 + 51 + var flank = new JX.PHUIXFormationFlankView( 52 + flank_node, 53 + head, 54 + body, 55 + tail); 56 + 57 + flank.setIsFixed(spec.isFixed); 58 + 59 + column.setFlank(flank); 60 + } 61 + } 62 + 63 + this.addColumn(column); 64 + } 11 65 }, 12 66 13 67 members: { 68 + _node: null, 14 69 _columns: null, 15 70 16 71 addColumn: function(column) { 17 72 this._columns.push(column); 73 + }, 74 + 75 + getColumn: function(idx) { 76 + return this._columns[idx]; 18 77 }, 19 78 20 79 start: function() {