Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(84)

Unified Diff: ui/file_manager/file_manager/foreground/js/ui/directory_tree.js

Issue 2839863002: Add Team Drive subtree to the directory list view. (Closed)
Patch Set: Remove some unncecesary code Created 3 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: ui/file_manager/file_manager/foreground/js/ui/directory_tree.js
diff --git a/ui/file_manager/file_manager/foreground/js/ui/directory_tree.js b/ui/file_manager/file_manager/foreground/js/ui/directory_tree.js
index d407e8f30578d193695c777a9c6e1b1baf4e48f1..bacf7d54c40d0e0d92ee341705f04155e58b3b7f 100644
--- a/ui/file_manager/file_manager/foreground/js/ui/directory_tree.js
+++ b/ui/file_manager/file_manager/foreground/js/ui/directory_tree.js
@@ -748,16 +748,21 @@ DriveVolumeItem.prototype.updateSubDirectories = function(recursive) {
// Drive volume has children including fake entries (offline, recent, etc...).
if (this.entry && !this.hasChildren) {
var entries = [this.entry];
+ var teamDriveEntry = this.volumeInfo_.teamDriveDisplayRoot;
+ if (teamDriveEntry)
+ entries.push(teamDriveEntry);
+ var fakeEntries = [];
if (this.parentTree_.fakeEntriesVisible_) {
for (var key in this.volumeInfo_.fakeEntries)
- entries.push(this.volumeInfo_.fakeEntries[key]);
+ fakeEntries.push(this.volumeInfo_.fakeEntries[key]);
+ // This list is sorted by URL on purpose.
+ fakeEntries.sort(function(a, b) {
+ if (a.toURL() === b.toURL())
+ return 0;
+ return b.toURL() > a.toURL() ? 1 : -1;
+ });
+ entries = entries.concat(fakeEntries);
}
- // This list is sorted by URL on purpose.
- entries.sort(function(a, b) {
- if (a.toURL() === b.toURL())
- return 0;
- return b.toURL() > a.toURL() ? 1 : -1;
- });
for (var i = 0; i < entries.length; i++) {
var item = new SubDirectoryItem(
@@ -781,7 +786,10 @@ DriveVolumeItem.prototype.updateSubDirectories = function(recursive) {
* @override
*/
DriveVolumeItem.prototype.updateItemByEntry = function(changedDirectoryEntry) {
- this.items[0].updateItemByEntry(changedDirectoryEntry);
+ // The first item is My Drive, and the second item is Team Drives.
+ // Keep in sync with |fixedEntries| in |updateSubDirectories|.
+ var index = util.isTeamDriveEntry(changedDirectoryEntry) ? 1 : 0;
+ this.items[index].updateItemByEntry(changedDirectoryEntry);
};
/**

Powered by Google App Engine
This is Rietveld 408576698