Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F15264418
D21155.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
8 KB
Referenced Files
None
Subscribers
None
D21155.diff
View Options
diff --git a/resources/celerity/map.php b/resources/celerity/map.php
--- a/resources/celerity/map.php
+++ b/resources/celerity/map.php
@@ -59,7 +59,7 @@
'rsrc/css/application/countdown/timer.css' => 'bff8012f',
'rsrc/css/application/daemon/bulk-job.css' => '73af99f5',
'rsrc/css/application/dashboard/dashboard.css' => '5a205b9d',
- 'rsrc/css/application/diff/diff-tree-view.css' => '8f487a99',
+ 'rsrc/css/application/diff/diff-tree-view.css' => 'bd83417c',
'rsrc/css/application/diff/inline-comment-summary.css' => '81eb368d',
'rsrc/css/application/differential/add-comment.css' => '7e5900d9',
'rsrc/css/application/differential/changeset-view.css' => '489b6995',
@@ -381,8 +381,8 @@
'rsrc/js/application/diff/DiffChangeset.js' => '2a3101b1',
'rsrc/js/application/diff/DiffChangesetList.js' => '57035863',
'rsrc/js/application/diff/DiffInline.js' => '16e97ebc',
- 'rsrc/js/application/diff/DiffPathView.js' => 'c0ed32ce',
- 'rsrc/js/application/diff/DiffTreeView.js' => 'a5823e4d',
+ 'rsrc/js/application/diff/DiffPathView.js' => '5f70ad12',
+ 'rsrc/js/application/diff/DiffTreeView.js' => 'ccf691f3',
'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' => 'b86ef6c2',
@@ -558,7 +558,7 @@
'conpherence-thread-manager' => 'aec8e38c',
'conpherence-transaction-css' => '3a3f5e7e',
'd3' => '9d068042',
- 'diff-tree-view-css' => '8f487a99',
+ 'diff-tree-view-css' => 'bd83417c',
'differential-changeset-view-css' => '489b6995',
'differential-core-view-css' => '7300a73e',
'differential-revision-add-comment-css' => '7e5900d9',
@@ -778,8 +778,8 @@
'phabricator-diff-changeset' => '2a3101b1',
'phabricator-diff-changeset-list' => '57035863',
'phabricator-diff-inline' => '16e97ebc',
- 'phabricator-diff-path-view' => 'c0ed32ce',
- 'phabricator-diff-tree-view' => 'a5823e4d',
+ 'phabricator-diff-path-view' => '5f70ad12',
+ 'phabricator-diff-tree-view' => 'ccf691f3',
'phabricator-drag-and-drop-file-upload' => '4370900d',
'phabricator-draggable-list' => '0169e425',
'phabricator-fatal-config-template-css' => '20babf50',
@@ -1517,6 +1517,9 @@
'javelin-dom',
'phuix-dropdown-menu',
),
+ '5f70ad12' => array(
+ 'javelin-dom',
+ ),
'5faf27b9' => array(
'phuix-form-control-view',
),
@@ -1869,9 +1872,6 @@
'javelin-install',
'javelin-dom',
),
- 'a5823e4d' => array(
- 'javelin-dom',
- ),
'a9942052' => array(
'javelin-behavior',
'javelin-dom',
@@ -2035,9 +2035,6 @@
'c03f2fb4' => array(
'javelin-install',
),
- 'c0ed32ce' => array(
- 'javelin-dom',
- ),
'c2c500a7' => array(
'javelin-install',
'javelin-dom',
@@ -2082,6 +2079,9 @@
'phuix-icon-view',
'phabricator-busy',
),
+ 'ccf691f3' => array(
+ 'javelin-dom',
+ ),
'cef53b3e' => array(
'javelin-install',
'javelin-dom',
diff --git a/webroot/rsrc/css/application/diff/diff-tree-view.css b/webroot/rsrc/css/application/diff/diff-tree-view.css
--- a/webroot/rsrc/css/application/diff/diff-tree-view.css
+++ b/webroot/rsrc/css/application/diff/diff-tree-view.css
@@ -8,8 +8,8 @@
.diff-tree-path {
height: 20px;
- color: {$greytext};
line-height: 20px;
+ color: {$greytext};
}
.diff-tree-path-indent {
@@ -23,8 +23,12 @@
text-align: center;
}
+.diff-tree-path-icon .phui-icon-view {
+ color: {$greytext};
+}
+
.diff-tree-path-name {
- margin-left: 24px;
+ margin-left: 22px;
margin-right: 44px;
white-space: nowrap;
overflow: hidden;
diff --git a/webroot/rsrc/js/application/diff/DiffPathView.js b/webroot/rsrc/js/application/diff/DiffPathView.js
--- a/webroot/rsrc/js/application/diff/DiffPathView.js
+++ b/webroot/rsrc/js/application/diff/DiffPathView.js
@@ -21,6 +21,8 @@
_pathNode: null,
_changeset: null,
_inlineNode: null,
+ _isDirectory: false,
+ _displayPath: null,
getNode: function() {
if (!this._node) {
@@ -45,10 +47,19 @@
setPath: function(path) {
this._path = path;
+ this._redrawPath();
+ return this;
+ },
- var display = this._path[this._path.length - 1];
- JX.DOM.setContent(this._getPathNode(), display);
+ setDisplayPath: function(path) {
+ this._displayPath = path;
+ this._redrawPath();
+ return this;
+ },
+ setIsDirectory: function(is_directory) {
+ this._isDirectory = is_directory;
+ this._redrawPath();
return this;
},
@@ -69,10 +80,23 @@
return this._path;
},
+ setHidden: function(hidden) {
+ this._hidden = hidden;
+
+ var node = this.getNode();
+ if (this._hidden) {
+ JX.DOM.hide(node);
+ } else {
+ JX.DOM.show(node);
+ }
+
+ return this;
+ },
+
setDepth: function(depth) {
this._depth = depth;
- this._getIndentNode().style.marginLeft = (6 * this._depth) + 'px';
+ this._getIndentNode().style.marginLeft = (8 * this._depth) + 'px';
return this;
},
@@ -154,6 +178,23 @@
this._inlineNode = JX.$N('div', attrs, '-');
}
return this._inlineNode;
+ },
+
+ _redrawPath: function() {
+ var display;
+ if (this._displayPath) {
+ display = this._displayPath;
+ } else {
+ display = this._path[this._path.length - 1];
+ }
+
+ var is_directory = this._isDirectory;
+
+ if (is_directory) {
+ display = display + '/';
+ }
+
+ JX.DOM.setContent(this._getPathNode(), display);
}
}
diff --git a/webroot/rsrc/js/application/diff/DiffTreeView.js b/webroot/rsrc/js/application/diff/DiffTreeView.js
--- a/webroot/rsrc/js/application/diff/DiffTreeView.js
+++ b/webroot/rsrc/js/application/diff/DiffTreeView.js
@@ -94,11 +94,12 @@
// For nodes which don't have a path object yet, build one.
var tree;
+ var path;
var trees = [];
for (ii = 0; ii < this._keys.length; ii++) {
var key = this._keys[ii];
tree = this._nodes[key];
- var path = tree.pathObject;
+ path = tree.pathObject;
if (!path) {
path = new JX.DiffPathView()
@@ -113,16 +114,87 @@
trees.push(tree);
}
+ for (ii = 0; ii < trees.length; ii++) {
+ tree = trees[ii];
+ tree.displayRoot = null;
+ tree.displayPath = null;
+ tree.displayHide = false;
+ }
+
+ var child;
+ for (ii = 0; ii < trees.length; ii++) {
+ tree = trees[ii];
+
+ if (tree.childCount !== 1) {
+ continue;
+ }
+
+ for (var k in tree.children) {
+ if (tree.children.hasOwnProperty(k)) {
+ child = tree.children[k];
+ break;
+ }
+ }
+
+ if (child.pathObject.getChangeset()) {
+ continue;
+ }
+
+ child.displayRoot = tree.displayRoot || tree;
+ }
+
+ for (ii = 0; ii < trees.length; ii++) {
+ tree = trees[ii];
+
+ if (!tree.displayRoot) {
+ continue;
+ }
+
+ if (!tree.displayRoot.displayPath) {
+ tree.displayRoot.displayPath = [
+ tree.displayRoot.parts[tree.displayRoot.parts.length - 1]
+ ];
+ }
+
+ tree.displayRoot.displayPath.push(tree.parts[tree.parts.length - 1]);
+ tree.displayHide = true;
+ }
+
+ for (ii = 0; ii < trees.length; ii++) {
+ tree = trees[ii];
+ path = tree.pathObject;
+
+ path.setHidden(!!tree.displayHide);
+
+ if (tree.displayPath) {
+ path.setDisplayPath(tree.displayPath.join('/'));
+ } else {
+ path.setDisplayPath(null);
+ }
+ }
+
for (ii = 0; ii < trees.length; ii++) {
tree = trees[ii];
if (!tree.parent) {
tree.depth = 0;
} else {
- tree.depth = tree.parent.depth + 1;
+ // If this node was collapsed into the parent node, don't increase
+ // the tree depth.
+ if (tree.displayHide) {
+ tree.depth = tree.parent.depth;
+ } else {
+ tree.depth = tree.parent.depth + 1;
+ }
+ }
+
+ path = tree.pathObject;
+
+ if (tree.childCount > 0) {
+ path.setIsDirectory(true);
}
- tree.pathObject.setDepth((tree.depth - 1));
+ path.setDepth((tree.depth - 1));
}
var nodes = [];
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Wed, Feb 26, 7:49 PM (7 h, 52 m)
Storage Engine
blob
Storage Format
Encrypted (AES-256-CBC)
Storage Handle
7209256
Default Alt Text
D21155.diff (8 KB)
Attached To
Mode
D21155: When a directory has a single directory child, collapse them into a single "a/b/" path entry
Attached
Detach File
Event Timeline
Log In to Comment