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

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: Fix FileManagerJsTest.{NavigationListModelTest,ProvidersModel}. 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..b8b1b7cfc5473c5d3f225d94f72fb60975184027 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
@@ -747,7 +747,11 @@ DriveVolumeItem.prototype.handleClick = function(e) {
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 fixedEntries = [this.entry];
+ var teamDriveEntry = this.volumeInfo_.teamDriveDisplayRoot;
+ if (teamDriveEntry)
+ fixedEntries.push(teamDriveEntry);
+ var entries = [];
if (this.parentTree_.fakeEntriesVisible_) {
for (var key in this.volumeInfo_.fakeEntries)
entries.push(this.volumeInfo_.fakeEntries[key]);
@@ -758,6 +762,7 @@ DriveVolumeItem.prototype.updateSubDirectories = function(recursive) {
return 0;
return b.toURL() > a.toURL() ? 1 : -1;
});
+ entries = fixedEntries.concat(entries);
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);
+ // 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