Commit 64628097 authored by epriestley's avatar epriestley
Browse files

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
parent fef2cdab
......@@ -12,7 +12,7 @@ return array(
'core.pkg.css' => 'a4a2417c',
'core.pkg.js' => '4355a8d3',
'differential.pkg.css' => '607c84be',
'differential.pkg.js' => '1a72918e',
'differential.pkg.js' => 'e40c5192',
'diffusion.pkg.css' => '42c75c37',
'diffusion.pkg.js' => 'a98c0bf7',
'maniphest.pkg.css' => '35995d6d',
......@@ -155,7 +155,7 @@ return array(
'rsrc/css/phui/phui-fontkit.css' => '1ec937e5',
'rsrc/css/phui/phui-form-view.css' => '01b796c0',
'rsrc/css/phui/phui-form.css' => '1f177cb7',
'rsrc/css/phui/phui-formation-view.css' => 'aec68a01',
'rsrc/css/phui/phui-formation-view.css' => 'e87a0801',
'rsrc/css/phui/phui-head-thing.css' => 'd7f293df',
'rsrc/css/phui/phui-header-view.css' => '36c86a58',
'rsrc/css/phui/phui-hovercard.css' => '6ca90fa0',
......@@ -379,11 +379,11 @@ return array(
'rsrc/js/application/dashboard/behavior-dashboard-query-panel-select.js' => '1e413dc9',
'rsrc/js/application/dashboard/behavior-dashboard-tab-panel.js' => '0116d3e8',
'rsrc/js/application/diff/DiffChangeset.js' => '5a4e4a3b',
'rsrc/js/application/diff/DiffChangesetList.js' => '139299d7',
'rsrc/js/application/diff/DiffChangesetList.js' => '3ac694dd',
'rsrc/js/application/diff/DiffInline.js' => '16e97ebc',
'rsrc/js/application/diff/behavior-preview-link.js' => 'f51e9c17',
'rsrc/js/application/differential/behavior-diff-radios.js' => '925fe8cd',
'rsrc/js/application/differential/behavior-populate.js' => 'dfa1d313',
'rsrc/js/application/differential/behavior-populate.js' => 'b86ef6c2',
'rsrc/js/application/diffusion/DiffusionLocateFileSource.js' => '94243d89',
'rsrc/js/application/diffusion/behavior-audit-preview.js' => 'b7b73831',
'rsrc/js/application/diffusion/behavior-commit-branches.js' => '4b671572',
......@@ -520,7 +520,6 @@ return array(
'rsrc/js/phui/behavior-phui-submenu.js' => 'b5e9bff9',
'rsrc/js/phui/behavior-phui-tab-group.js' => '242aa08b',
'rsrc/js/phui/behavior-phui-timer-control.js' => 'f84bcbf4',
'rsrc/js/phui/behavior-phuix-formation-view.js' => '1a12beef',
'rsrc/js/phuix/PHUIXActionListView.js' => 'c68f183f',
'rsrc/js/phuix/PHUIXActionView.js' => 'aaa08f3b',
'rsrc/js/phuix/PHUIXAutocomplete.js' => '2fbe234d',
......@@ -528,9 +527,9 @@ return array(
'rsrc/js/phuix/PHUIXDropdownMenu.js' => '7acfd98b',
'rsrc/js/phuix/PHUIXExample.js' => 'c2c500a7',
'rsrc/js/phuix/PHUIXFormControl.js' => '38c1f3fb',
'rsrc/js/phuix/PHUIXFormationColumnView.js' => '08fc09e9',
'rsrc/js/phuix/PHUIXFormationColumnView.js' => '8afd2cb1',
'rsrc/js/phuix/PHUIXFormationFlankView.js' => '6648270a',
'rsrc/js/phuix/PHUIXFormationView.js' => '0113c54c',
'rsrc/js/phuix/PHUIXFormationView.js' => 'cef53b3e',
'rsrc/js/phuix/PHUIXIconView.js' => 'a5257c4e',
),
'symbols' => array(
......@@ -614,7 +613,7 @@ return array(
'javelin-behavior-device' => '0cf79f45',
'javelin-behavior-diff-preview-link' => 'f51e9c17',
'javelin-behavior-differential-diff-radios' => '925fe8cd',
'javelin-behavior-differential-populate' => 'dfa1d313',
'javelin-behavior-differential-populate' => 'b86ef6c2',
'javelin-behavior-diffusion-commit-branches' => '4b671572',
'javelin-behavior-diffusion-commit-graph' => 'ef836bf2',
'javelin-behavior-diffusion-locate-file' => '87428eb2',
......@@ -672,7 +671,6 @@ return array(
'javelin-behavior-phui-tab-group' => '242aa08b',
'javelin-behavior-phui-timer-control' => 'f84bcbf4',
'javelin-behavior-phuix-example' => 'c2c500a7',
'javelin-behavior-phuix-formation-view' => '1a12beef',
'javelin-behavior-policy-control' => '0eaa33a9',
'javelin-behavior-policy-rule-editor' => '9347f172',
'javelin-behavior-project-boards' => '58cb6a88',
......@@ -781,7 +779,7 @@ return array(
'phabricator-darkmessage' => '26cd4b73',
'phabricator-dashboard-css' => '5a205b9d',
'phabricator-diff-changeset' => '5a4e4a3b',
'phabricator-diff-changeset-list' => '139299d7',
'phabricator-diff-changeset-list' => '3ac694dd',
'phabricator-diff-inline' => '16e97ebc',
'phabricator-drag-and-drop-file-upload' => '4370900d',
'phabricator-draggable-list' => '0169e425',
......@@ -850,7 +848,7 @@ return array(
'phui-fontkit-css' => '1ec937e5',
'phui-form-css' => '1f177cb7',
'phui-form-view-css' => '01b796c0',
'phui-formation-view-css' => 'aec68a01',
'phui-formation-view-css' => 'e87a0801',
'phui-head-thing-view-css' => 'd7f293df',
'phui-header-view-css' => '36c86a58',
'phui-hovercard' => '074f0783',
......@@ -893,9 +891,9 @@ return array(
'phuix-button-view' => '55a24e84',
'phuix-dropdown-menu' => '7acfd98b',
'phuix-form-control-view' => '38c1f3fb',
'phuix-formation-column-view' => '08fc09e9',
'phuix-formation-column-view' => '8afd2cb1',
'phuix-formation-flank-view' => '6648270a',
'phuix-formation-view' => '0113c54c',
'phuix-formation-view' => 'cef53b3e',
'phuix-icon-view' => 'a5257c4e',
'policy-css' => 'ceb56a08',
'policy-edit-css' => '8794e2ed',
......@@ -922,10 +920,6 @@ return array(
'unhandled-exception-css' => '9ecfc00d',
),
'requires' => array(
'0113c54c' => array(
'javelin-install',
'javelin-dom',
),
'0116d3e8' => array(
'javelin-behavior',
'javelin-dom',
......@@ -998,10 +992,6 @@ return array(
'javelin-util',
'javelin-magical-init',
),
'08fc09e9' => array(
'javelin-install',
'javelin-dom',
),
'0922e81d' => array(
'herald-rule-editor',
'javelin-behavior',
......@@ -1041,10 +1031,6 @@ return array(
'javelin-uri',
'phabricator-keyboard-shortcut',
),
'139299d7' => array(
'javelin-install',
'phuix-button-view',
),
'139ef688' => array(
'javelin-behavior',
'javelin-dom',
......@@ -1054,12 +1040,6 @@ return array(
'16e97ebc' => array(
'javelin-dom',
),
'1a12beef' => array(
'javelin-behavior',
'phuix-formation-view',
'phuix-formation-column-view',
'phuix-formation-flank-view',
),
'1a844c06' => array(
'javelin-install',
'javelin-util',
......@@ -1260,6 +1240,10 @@ return array(
'trigger-rule',
'trigger-rule-type',
),
'3ac694dd' => array(
'javelin-install',
'phuix-button-view',
),
'3ae89b20' => array(
'phui-workcard-view-css',
),
......@@ -1710,6 +1694,10 @@ return array(
'javelin-dom',
'phabricator-draggable-list',
),
'8afd2cb1' => array(
'javelin-install',
'javelin-dom',
),
'8b5c7d65' => array(
'javelin-behavior',
'javelin-stratcom',
......@@ -2012,6 +2000,15 @@ return array(
'javelin-util',
'phabricator-shaped-request',
),
'b86ef6c2' => array(
'javelin-behavior',
'javelin-dom',
'javelin-stratcom',
'phabricator-tooltip',
'phabricator-diff-changeset-list',
'phabricator-diff-changeset',
'phuix-formation-view',
),
'b86f297f' => array(
'javelin-behavior',
'javelin-stratcom',
......@@ -2084,6 +2081,12 @@ return array(
'phuix-icon-view',
'phabricator-busy',
),
'cef53b3e' => array(
'javelin-install',
'javelin-dom',
'phuix-formation-column-view',
'phuix-formation-flank-view',
),
'cf32921f' => array(
'javelin-behavior',
'javelin-dom',
......@@ -2116,14 +2119,6 @@ return array(
'javelin-uri',
'phabricator-notification',
),
'dfa1d313' => array(
'javelin-behavior',
'javelin-dom',
'javelin-stratcom',
'phabricator-tooltip',
'phabricator-diff-changeset-list',
'phabricator-diff-changeset',
),
'e150bd50' => array(
'javelin-behavior',
'javelin-stratcom',
......
......@@ -539,6 +539,7 @@ phutil_register_library_map(array(
'DifferentialExactUserFunctionDatasource' => 'applications/differential/typeahead/DifferentialExactUserFunctionDatasource.php',
'DifferentialFieldParseException' => 'applications/differential/exception/DifferentialFieldParseException.php',
'DifferentialFieldValidationException' => 'applications/differential/exception/DifferentialFieldValidationException.php',
'DifferentialFileTreeEngine' => 'applications/differential/engine/DifferentialFileTreeEngine.php',
'DifferentialGetAllDiffsConduitAPIMethod' => 'applications/differential/conduit/DifferentialGetAllDiffsConduitAPIMethod.php',
'DifferentialGetCommitMessageConduitAPIMethod' => 'applications/differential/conduit/DifferentialGetCommitMessageConduitAPIMethod.php',
'DifferentialGetCommitPathsConduitAPIMethod' => 'applications/differential/conduit/DifferentialGetCommitPathsConduitAPIMethod.php',
......@@ -6599,6 +6600,7 @@ phutil_register_library_map(array(
'DifferentialExactUserFunctionDatasource' => 'PhabricatorTypeaheadCompositeDatasource',
'DifferentialFieldParseException' => 'Exception',
'DifferentialFieldValidationException' => 'Exception',
'DifferentialFileTreeEngine' => 'Phobject',
'DifferentialGetAllDiffsConduitAPIMethod' => 'DifferentialConduitAPIMethod',
'DifferentialGetCommitMessageConduitAPIMethod' => 'DifferentialConduitAPIMethod',
'DifferentialGetCommitPathsConduitAPIMethod' => 'DifferentialConduitAPIMethod',
......@@ -8332,7 +8334,7 @@ phutil_register_library_map(array(
'PHUIFormationExpanderView' => 'AphrontAutoIDView',
'PHUIFormationFlankView' => 'PHUIFormationColumnDynamicView',
'PHUIFormationResizerView' => 'PHUIFormationColumnView',
'PHUIFormationView' => 'AphrontView',
'PHUIFormationView' => 'AphrontAutoIDView',
'PHUIHandleListView' => 'AphrontTagView',
'PHUIHandleTagListView' => 'AphrontTagView',
'PHUIHandleView' => 'AphrontView',
......@@ -474,16 +474,14 @@ final class DifferentialRevisionViewController
->setKey('history')
->appendChild($history));
$filetree_on = $viewer->compareUserSetting(
PhabricatorShowFiletreeSetting::SETTINGKEY,
PhabricatorShowFiletreeSetting::VALUE_ENABLE_FILETREE);
$filetree = id(new DifferentialFileTreeEngine())
->setViewer($viewer);
$collapsed_key = PhabricatorFiletreeVisibleSetting::SETTINGKEY;
$filetree_collapsed = (bool)$viewer->getUserSetting($collapsed_key);
$filetree_collapsed = !$filetree->getIsVisible();
// See PHI811. If the viewer has the file tree on, the files tab with the
// table of contents is redundant, so default to the "History" tab instead.
if ($filetree_on && !$filetree_collapsed) {
if (!$filetree_collapsed) {
$tab_group->selectTab('history');
}
......@@ -609,18 +607,9 @@ final class DifferentialRevisionViewController
$crumbs->addTextCrumb($monogram);
$crumbs->setBorder(true);
$nav = null;
if ($filetree_on && !$this->isVeryLargeDiff()) {
$width_key = PhabricatorFiletreeWidthSetting::SETTINGKEY;
$width_value = $viewer->getUserSetting($width_key);
$nav = id(new DifferentialChangesetFileTreeSideNavBuilder())
->setTitle($monogram)
->setBaseURI(new PhutilURI($revision->getURI()))
->setCollapsed($filetree_collapsed)
->setWidth((int)$width_value)
->build($changesets);
}
$filetree
->setChangesets($changesets)
->setDisabled($this->isVeryLargeDiff());
$view = id(new PHUITwoColumnView())
->setHeader($header)
......@@ -638,16 +627,22 @@ final class DifferentialRevisionViewController
))
->setFooter($footer);
$page = $this->newPage()
->setTitle($monogram.' '.$revision->getTitle())
->setCrumbs($crumbs)
->setPageObjectPHIDs(array($revision->getPHID()))
->appendChild($view);
$main_content = array(
$crumbs,
$view,
);
$main_content = $filetree->newView($main_content);
if ($nav) {
$page->setNavigation($nav);
if (!$filetree->getDisabled()) {
$changeset_view->setFormationView($main_content);
}
$page = $this->newPage()
->setTitle($monogram.' '.$revision->getTitle())
->setPageObjectPHIDs(array($revision->getPHID()))
->appendChild($main_content);
return $page;
}
......
<?php
final class DifferentialFileTreeEngine
extends Phobject {
private $viewer;
private $changesets;
private $disabled;
public function setViewer($viewer) {
$this->viewer = $viewer;
return $this;
}
public function getViewer() {
return $this->viewer;
}
public function getIsVisible() {
return (bool)$this->getSetting($this->getVisibleSettingKey());
}
public function setDisabled($disabled) {
$this->disabled = $disabled;
return $this;
}
public function getDisabled() {
return $this->disabled;
}
public function setChangesets(array $changesets) {
$this->changesets = $changesets;
return $this;
}
public function getChangesets() {
return $this->changesets;
}
public function newView($content) {
if ($this->getDisabled()) {
return $content;
}
$width = $this->getWidth();
$is_visible = $this->getIsVisible();
$formation_view = new PHUIFormationView();
$flank_view = $formation_view->newFlankColumn()
->setHeaderText(pht('Affected Paths'))
->setIsResizable(true)
->setIsFixed(true)
->setIsVisible($is_visible)
->setWidth($width)
->setMinimumWidth($this->getMinimumWidth())
->setMaximumWidth($this->getMaximumWidth());
$viewer = $this->getViewer();
if ($viewer->isLoggedIn()) {
$flank_view
->setVisibleSettingKey($this->getVisibleSettingKey())
->setWidthSettingKey($this->getWidthSettingKey());
}
$flank_view->setHead(
array(
phutil_tag('div', array(),
array(
id(new PHUIIconView())->setIcon('fa-list'),
pht('Table of Contents'),
'[t]',
)),
));
$flank_view->setBody(
phutil_tag(
'div',
array(
'class' => 'phui-flank-loading',
),
pht('Loading...')));
$flank_view->setTail(
array(
phutil_tag('div', array(),
array(
id(new PHUIIconView())->setIcon('fa-chevron-left'),
pht('Hide Panel'),
'[f]',
)),
phutil_tag(
'div',
array(),
array(
id(new PHUIIconView())->setIcon('fa-keyboard-o'),
pht('Keyboard Reference'),
'[?]',
)),
));
$main_column = $formation_view->newContentColumn()
->appendChild($content);
return $formation_view;
}
private function getVisibleSettingKey() {
return PhabricatorFiletreeVisibleSetting::SETTINGKEY;
}
private function getWidthSettingKey() {
return PhabricatorFiletreeWidthSetting::SETTINGKEY;
}
private function getWidth() {
$width = (int)$this->getSetting($this->getWidthSettingKey());
if (!$width) {
$width = $this->getDefaultWidth();
}
$min = $this->getMinimumWidth();
if ($width < $min) {
$width = $min;
}
$max = $this->getMaximumWidth();
if ($width > $max) {
$width = $max;
}
return $width;
}
private function getDefaultWidth() {
return 240;
}
private function getMinimumWidth() {
return 150;
}
private function getMaximumWidth() {
return 512;
}
private function getSetting($key) {
$viewer = $this->getViewer();
return $viewer->getUserSetting($key);
}
}
......@@ -24,6 +24,7 @@ final class DifferentialChangesetListView extends AphrontView {
private $title;
private $parser;
private $formationView;
public function setParser(DifferentialChangesetParser $parser) {
$this->parser = $parser;
......@@ -146,6 +147,15 @@ final class DifferentialChangesetListView extends AphrontView {
return $this;
}
public function setFormationView(PHUIFormationView $formation_view) {
$this->formationView = $formation_view;
return $this;
}
public function getFormationView() {
return $this->formationView;
}
public function render() {
$viewer = $this->getViewer();
......@@ -232,10 +242,17 @@ final class DifferentialChangesetListView extends AphrontView {
$this->requireResource('aphront-tooltip-css');
$formation_id = null;
$formation_view = $this->getFormationView();
if ($formation_view) {
$formation_id = $formation_view->getID();
}
$this->initBehavior(
'differential-populate',
array(
'changesetViewIDs' => $ids,
'formationViewID' => $formation_id,
'inlineURI' => $this->inlineURI,
'inlineListURI' => $this->inlineListURI,
'isStandalone' => $this->getIsStandalone(),
......
......@@ -6,6 +6,10 @@ abstract class PHUIFormationColumnDynamicView
private $isVisible = true;
private $isResizable;
private $width;
private $widthSettingKey;
private $visibleSettingKey;
private $minimumWidth;
private $maximumWidth;
public function setIsVisible($is_visible) {
$this->isVisible = $is_visible;
......@@ -34,4 +38,40 @@ abstract class PHUIFormationColumnDynamicView
return $this->width;
}
public function setWidthSettingKey($width_setting_key) {
$this->widthSettingKey = $width_setting_key;
return $this;
}
public function getWidthSettingKey() {
return $this->widthSettingKey;
}
public function setVisibleSettingKey($visible_setting_key) {
$this->visibleSettingKey = $visible_setting_key;
return $this;
}
public function getVisibleSettingKey() {
return $this->visibleSettingKey;
}
public function setMinimumWidth($minimum_width) {
$this->minimumWidth = $minimum_width;
return $this;
}
public function getMinimumWidth() {
return $this->minimumWidth;
}
public function setMaximumWidth($maximum_width) {
$this->maximumWidth = $maximum_width;
return $this;
}
public function getMaximumWidth() {
return $this->maximumWidth;
}
}
......@@ -73,6 +73,8 @@ final class PHUIFormationColumnItem
}
public function newClientProperties() {
$column = $this->getColumn();
$expander_id = null;
$expander = $this->getExpander();
......@@ -80,18 +82,24 @@ final class PHUIFormationColumnItem
$expander_id = $expander->getID();
}
$resizer_details = null;
$resizer_item = $this->getResizerItem();
if ($resizer_item) {
$visible_key = $column->getVisibleSettingKey();
$width_key = $column->getWidthSettingKey();
$min_width = $column->getMinimumWidth();
$max_width = $column->getMaximumWidth();
$resizer_details = array(
'itemID' => $resizer_item->getID(),
'controlID' => $resizer_item->getColumn()->getID(),
'widthKey' => $width_key,
'visibleKey' => $visible_key,
'minimumWidth' => $min_width,
'maximumWidth' => $max_width,
);
}
$column = $this->getColumn();
$width = $column->getWidth();
if ($width !== null) {
$width = (int)$width;
......
......@@ -30,6 +30,22 @@ abstract class PHUIFormationColumnView
return false;
}
public function getVisibleSettingKey() {
return null;
}
public function getWidthSettingKey() {
return null;
}
public function getMinimumWidth() {
return null;
}