From 8f7216d50633271481289af5974b8c4db825fcc3 Mon Sep 17 00:00:00 2001 From: MaksimChegulov Date: Mon, 3 Oct 2022 11:45:02 +0300 Subject: [PATCH 01/54] Files: added room filtering by provider type --- .../RequestDto/CreateRoomRequestDto.cs | 8 +++++++ .../Core/Core/Dao/TeamlabDao/DaoFactory.cs | 2 +- .../Core/Core/Dao/TeamlabDao/FolderDao.cs | 10 +++++++- .../ASC.Files/Core/Core/FilterTypeEnum.cs | 10 +++++++- .../Core/Core/Thirdparty/Box/BoxFolderDao.cs | 6 +++++ .../Thirdparty/Dropbox/DropboxFolderDao.cs | 6 +++++ .../GoogleDrive/GoogleDriveFolderDao.cs | 6 +++++ .../Core/Thirdparty/IThirdPartyProviderDao.cs | 2 +- .../Thirdparty/OneDrive/OneDriveFolderDao.cs | 6 +++++ .../ProviderDao/ProviderFolderDao.cs | 23 ++++++++++++++++++- .../SharePoint/SharePointFolderDao.cs | 6 +++++ .../Thirdparty/Sharpbox/SharpBoxFolderDao.cs | 6 +++++ .../Server/Api/VirtualRoomsController.cs | 8 +++++++ 13 files changed, 94 insertions(+), 5 deletions(-) diff --git a/products/ASC.Files/Core/ApiModels/RequestDto/CreateRoomRequestDto.cs b/products/ASC.Files/Core/ApiModels/RequestDto/CreateRoomRequestDto.cs index c299b6fa45..dc88c7a53a 100644 --- a/products/ASC.Files/Core/ApiModels/RequestDto/CreateRoomRequestDto.cs +++ b/products/ASC.Files/Core/ApiModels/RequestDto/CreateRoomRequestDto.cs @@ -43,6 +43,14 @@ public enum RoomFilterType ReadOnlyRoomOnly = 4, CustomRoomOnly = 5, FoldersOnly = 6, + BoxOnly = 7, + DropboxV2Only = 8, + GoogleDriveOnly = 9, + OneDriveOnly = 10, + SharePointOnly = 11, + WebDavOnly = 12, + kDriveOnly = 13, + YandexOnly = 14, } public class CreateRoomRequestDto diff --git a/products/ASC.Files/Core/Core/Dao/TeamlabDao/DaoFactory.cs b/products/ASC.Files/Core/Core/Dao/TeamlabDao/DaoFactory.cs index 84f1ccb47c..1ff06b4851 100644 --- a/products/ASC.Files/Core/Core/Dao/TeamlabDao/DaoFactory.cs +++ b/products/ASC.Files/Core/Core/Dao/TeamlabDao/DaoFactory.cs @@ -9,7 +9,7 @@ // // This program is distributed WITHOUT ANY WARRANTY, without even the implied warranty // of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. For details, see -// the GNU AGPL at: http://www.gnu.org/licenses/agpl-3.0.html +// the GNU AGPL at: http://www.gnu.org/licenses/agpl-3.0.htm // // You can contact Ascensio System SIA at Lubanas st. 125a-25, Riga, Latvia, EU, LV-1021. // diff --git a/products/ASC.Files/Core/Core/Dao/TeamlabDao/FolderDao.cs b/products/ASC.Files/Core/Core/Dao/TeamlabDao/FolderDao.cs index 1777df47f5..061edcf6de 100644 --- a/products/ASC.Files/Core/Core/Dao/TeamlabDao/FolderDao.cs +++ b/products/ASC.Files/Core/Core/Dao/TeamlabDao/FolderDao.cs @@ -1566,7 +1566,15 @@ internal class FolderDao : AbstractDao, IFolderDao FilterType.PresentationsOnly or FilterType.SpreadsheetsOnly or FilterType.ArchiveOnly or - FilterType.MediaOnly; + FilterType.MediaOnly or + FilterType.BoxOnly or + FilterType.DropboxV2Only or + FilterType.GoogleDriveOnly or + FilterType.OneDriveOnly or + FilterType.SharePointOnly or + FilterType.WebDavOnly or + FilterType.kDriveOnly or + FilterType.YandexOnly; } private FolderType GetRoomTypeFilter(FilterType filterType) diff --git a/products/ASC.Files/Core/Core/FilterTypeEnum.cs b/products/ASC.Files/Core/Core/FilterTypeEnum.cs index 68f8072a3c..1e1c814d13 100644 --- a/products/ASC.Files/Core/Core/FilterTypeEnum.cs +++ b/products/ASC.Files/Core/Core/FilterTypeEnum.cs @@ -46,5 +46,13 @@ public enum FilterType [EnumMember] ReadOnlyRooms = 16, [EnumMember] CustomRooms = 17, [EnumMember] OFormTemplateOnly = 18, - [EnumMember] OFormOnly = 19, + [EnumMember] OFormOnly = 19, + [EnumMember] BoxOnly = 20, + [EnumMember] DropboxV2Only = 21, + [EnumMember] GoogleDriveOnly = 22, + [EnumMember] OneDriveOnly = 23, + [EnumMember] SharePointOnly = 24, + [EnumMember] WebDavOnly = 25, + [EnumMember] kDriveOnly = 26, + [EnumMember] YandexOnly = 27, } \ No newline at end of file diff --git a/products/ASC.Files/Core/Core/Thirdparty/Box/BoxFolderDao.cs b/products/ASC.Files/Core/Core/Thirdparty/Box/BoxFolderDao.cs index 4563300965..5de183b8d6 100644 --- a/products/ASC.Files/Core/Core/Thirdparty/Box/BoxFolderDao.cs +++ b/products/ASC.Files/Core/Core/Thirdparty/Box/BoxFolderDao.cs @@ -529,4 +529,10 @@ internal class BoxFolderDao : BoxDaoBase, IFolderDao return chunkedUpload ? storageMaxUploadSize : Math.Min(storageMaxUploadSize, _setupInfo.AvailableFileSize); } + + public override bool CheckInvalidFilter(FilterType filterType) + { + return base.CheckInvalidFilter(filterType) || filterType is FilterType.GoogleDriveOnly or FilterType.DropboxV2Only or FilterType.kDriveOnly or FilterType.SharePointOnly + or FilterType.YandexOnly or FilterType.WebDavOnly or FilterType.OneDriveOnly; + } } diff --git a/products/ASC.Files/Core/Core/Thirdparty/Dropbox/DropboxFolderDao.cs b/products/ASC.Files/Core/Core/Thirdparty/Dropbox/DropboxFolderDao.cs index 7e07c5b4a7..6acf436deb 100644 --- a/products/ASC.Files/Core/Core/Thirdparty/Dropbox/DropboxFolderDao.cs +++ b/products/ASC.Files/Core/Core/Thirdparty/Dropbox/DropboxFolderDao.cs @@ -519,4 +519,10 @@ internal class DropboxFolderDao : DropboxDaoBase, IFolderDao return chunkedUpload ? storageMaxUploadSize : Math.Min(storageMaxUploadSize, _setupInfo.AvailableFileSize); } + + public override bool CheckInvalidFilter(FilterType filterType) + { + return base.CheckInvalidFilter(filterType) || filterType is FilterType.BoxOnly or FilterType.GoogleDriveOnly or FilterType.kDriveOnly or FilterType.SharePointOnly + or FilterType.YandexOnly or FilterType.WebDavOnly or FilterType.OneDriveOnly; + } } diff --git a/products/ASC.Files/Core/Core/Thirdparty/GoogleDrive/GoogleDriveFolderDao.cs b/products/ASC.Files/Core/Core/Thirdparty/GoogleDrive/GoogleDriveFolderDao.cs index 2e7b8b9c06..142eaf9f9a 100644 --- a/products/ASC.Files/Core/Core/Thirdparty/GoogleDrive/GoogleDriveFolderDao.cs +++ b/products/ASC.Files/Core/Core/Thirdparty/GoogleDrive/GoogleDriveFolderDao.cs @@ -520,4 +520,10 @@ internal class GoogleDriveFolderDao : GoogleDriveDaoBase, IFolderDao return chunkedUpload ? storageMaxUploadSize : Math.Min(storageMaxUploadSize, _setupInfo.AvailableFileSize); } + + public override bool CheckInvalidFilter(FilterType filterType) + { + return base.CheckInvalidFilter(filterType) || filterType is FilterType.BoxOnly or FilterType.DropboxV2Only or FilterType.kDriveOnly or FilterType.SharePointOnly + or FilterType.YandexOnly or FilterType.WebDavOnly or FilterType.OneDriveOnly; + } } diff --git a/products/ASC.Files/Core/Core/Thirdparty/IThirdPartyProviderDao.cs b/products/ASC.Files/Core/Core/Thirdparty/IThirdPartyProviderDao.cs index 6490176de6..432c978ecc 100644 --- a/products/ASC.Files/Core/Core/Thirdparty/IThirdPartyProviderDao.cs +++ b/products/ASC.Files/Core/Core/Thirdparty/IThirdPartyProviderDao.cs @@ -466,7 +466,7 @@ internal abstract class ThirdPartyProviderDao : ThirdPartyProviderDao, IDispo return rooms; } - protected bool CheckInvalidFilter(FilterType filterType) + public virtual bool CheckInvalidFilter(FilterType filterType) { return filterType is FilterType.FilesOnly or diff --git a/products/ASC.Files/Core/Core/Thirdparty/OneDrive/OneDriveFolderDao.cs b/products/ASC.Files/Core/Core/Thirdparty/OneDrive/OneDriveFolderDao.cs index 4c2ee44d79..f806fb6b52 100644 --- a/products/ASC.Files/Core/Core/Thirdparty/OneDrive/OneDriveFolderDao.cs +++ b/products/ASC.Files/Core/Core/Thirdparty/OneDrive/OneDriveFolderDao.cs @@ -532,4 +532,10 @@ internal class OneDriveFolderDao : OneDriveDaoBase, IFolderDao return chunkedUpload ? storageMaxUploadSize : Math.Min(storageMaxUploadSize, _setupInfo.AvailableFileSize); } + + public override bool CheckInvalidFilter(FilterType filterType) + { + return base.CheckInvalidFilter(filterType) || filterType is FilterType.BoxOnly or FilterType.DropboxV2Only or FilterType.kDriveOnly or FilterType.SharePointOnly + or FilterType.YandexOnly or FilterType.WebDavOnly or FilterType.GoogleDriveOnly; + } } diff --git a/products/ASC.Files/Core/Core/Thirdparty/ProviderDao/ProviderFolderDao.cs b/products/ASC.Files/Core/Core/Thirdparty/ProviderDao/ProviderFolderDao.cs index d594c18641..99c3dc1c09 100644 --- a/products/ASC.Files/Core/Core/Thirdparty/ProviderDao/ProviderFolderDao.cs +++ b/products/ASC.Files/Core/Core/Thirdparty/ProviderDao/ProviderFolderDao.cs @@ -95,7 +95,8 @@ internal class ProviderFolderDao : ProviderDaoBase, IFolderDao var selector = GetSelector(parentId); var folderDao = selector.GetFolderDao(parentId); var rooms = folderDao.GetRoomsAsync(selector.ConvertId(parentId), filterType, tags, subjectId, searchText, withSubfolders, withoutTags, excludeSubject); - var result = await rooms.Where(r => r != null).ToListAsync(); + + var result = await FilterByProviders(rooms.Where(r => r != null), filterType).ToListAsync(); await SetSharedPropertyAsync(result); @@ -130,6 +131,8 @@ internal class ProviderFolderDao : ProviderDaoBase, IFolderDao .Where(r => r != null)); } + result = FilterByProviders(result, filterType); + return result.Distinct(); } @@ -435,4 +438,22 @@ internal class ProviderFolderDao : ProviderDaoBase, IFolderDao return storageMaxUploadSize; } + + private IAsyncEnumerable> FilterByProviders(IAsyncEnumerable> folders, FilterType filterType) + { + if (filterType != FilterType.WebDavOnly && filterType != FilterType.YandexOnly && filterType != FilterType.kDriveOnly) + { + return folders; + } + + var providerKey = filterType switch + { + FilterType.YandexOnly => ProviderTypes.Yandex.ToStringFast(), + FilterType.WebDavOnly => ProviderTypes.WebDav.ToStringFast(), + FilterType.kDriveOnly => ProviderTypes.kDrive.ToStringFast(), + _ => throw new NotImplementedException(), + }; + + return folders.Where(x => providerKey == x.ProviderKey); + } } diff --git a/products/ASC.Files/Core/Core/Thirdparty/SharePoint/SharePointFolderDao.cs b/products/ASC.Files/Core/Core/Thirdparty/SharePoint/SharePointFolderDao.cs index 482af24032..027bd20634 100644 --- a/products/ASC.Files/Core/Core/Thirdparty/SharePoint/SharePointFolderDao.cs +++ b/products/ASC.Files/Core/Core/Thirdparty/SharePoint/SharePointFolderDao.cs @@ -455,4 +455,10 @@ internal class SharePointFolderDao : SharePointDaoBase, IFolderDao { return Task.FromResult(2L * 1024L * 1024L * 1024L); } + + public override bool CheckInvalidFilter(FilterType filterType) + { + return base.CheckInvalidFilter(filterType) || filterType is FilterType.BoxOnly or FilterType.DropboxV2Only or FilterType.kDriveOnly or FilterType.GoogleDriveOnly + or FilterType.YandexOnly or FilterType.WebDavOnly or FilterType.OneDriveOnly; + } } diff --git a/products/ASC.Files/Core/Core/Thirdparty/Sharpbox/SharpBoxFolderDao.cs b/products/ASC.Files/Core/Core/Thirdparty/Sharpbox/SharpBoxFolderDao.cs index 8714e9e6ee..fc2374f9ad 100644 --- a/products/ASC.Files/Core/Core/Thirdparty/Sharpbox/SharpBoxFolderDao.cs +++ b/products/ASC.Files/Core/Core/Thirdparty/Sharpbox/SharpBoxFolderDao.cs @@ -521,4 +521,10 @@ internal class SharpBoxFolderDao : SharpBoxDaoBase, IFolderDao return Task.FromResult(chunkedUpload ? storageMaxUploadSize : Math.Min(storageMaxUploadSize, _setupInfo.AvailableFileSize)); } + + public override bool CheckInvalidFilter(FilterType filterType) + { + return base.CheckInvalidFilter(filterType) || filterType is FilterType.BoxOnly or FilterType.DropboxV2Only or FilterType.SharePointOnly + or FilterType.GoogleDriveOnly or FilterType.OneDriveOnly; + } } diff --git a/products/ASC.Files/Server/Api/VirtualRoomsController.cs b/products/ASC.Files/Server/Api/VirtualRoomsController.cs index c06bd309bb..0ff50ff466 100644 --- a/products/ASC.Files/Server/Api/VirtualRoomsController.cs +++ b/products/ASC.Files/Server/Api/VirtualRoomsController.cs @@ -670,6 +670,14 @@ public class VirtualRoomsCommonController : ApiControllerBase RoomFilterType.ReviewRoomOnly => FilterType.ReviewRooms, RoomFilterType.CustomRoomOnly => FilterType.CustomRooms, RoomFilterType.FoldersOnly => FilterType.FoldersOnly, + RoomFilterType.GoogleDriveOnly => FilterType.GoogleDriveOnly, + RoomFilterType.BoxOnly => FilterType.BoxOnly, + RoomFilterType.DropboxV2Only => FilterType.DropboxV2Only, + RoomFilterType.OneDriveOnly => FilterType.OneDriveOnly, + RoomFilterType.SharePointOnly => FilterType.SharePointOnly, + RoomFilterType.YandexOnly => FilterType.YandexOnly, + RoomFilterType.kDriveOnly => FilterType.kDriveOnly, + RoomFilterType.WebDavOnly => FilterType.WebDavOnly, _ => FilterType.None }; From 627e6b75fc66f16dd2a41a4eb77d135f92969867 Mon Sep 17 00:00:00 2001 From: MaksimChegulov Date: Mon, 3 Oct 2022 12:15:20 +0300 Subject: [PATCH 02/54] Files: fix --- .../Core/Core/Thirdparty/IThirdPartyProviderDao.cs | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/products/ASC.Files/Core/Core/Thirdparty/IThirdPartyProviderDao.cs b/products/ASC.Files/Core/Core/Thirdparty/IThirdPartyProviderDao.cs index 432c978ecc..4e64babc15 100644 --- a/products/ASC.Files/Core/Core/Thirdparty/IThirdPartyProviderDao.cs +++ b/products/ASC.Files/Core/Core/Thirdparty/IThirdPartyProviderDao.cs @@ -438,7 +438,9 @@ internal abstract class ThirdPartyProviderDao : ThirdPartyProviderDao, IDispo protected IAsyncEnumerable> FilterByRoomType(IAsyncEnumerable> rooms, FilterType filterType) { - if (filterType == FilterType.None || filterType == FilterType.FoldersOnly) + if (filterType == FilterType.None || filterType == FilterType.FoldersOnly || filterType == FilterType.GoogleDriveOnly || filterType == FilterType.OneDriveOnly || + filterType == FilterType.BoxOnly || filterType == FilterType.DropboxV2Only || filterType == FilterType.YandexOnly || filterType == FilterType.SharePointOnly || + filterType == FilterType.kDriveOnly || filterType == FilterType.WebDavOnly) { return rooms; } @@ -453,14 +455,14 @@ internal abstract class ThirdPartyProviderDao : ThirdPartyProviderDao, IDispo _ => FolderType.DEFAULT, }; - return rooms.Where(f => f.FolderType == filter || filter == FolderType.DEFAULT); + return rooms.Where(f => f != null && (f.FolderType == filter || filter == FolderType.DEFAULT)); } protected IAsyncEnumerable> FilterBySubject(IAsyncEnumerable> rooms, Guid subjectId, bool excludeSubject) { if (subjectId != Guid.Empty) { - rooms = excludeSubject ? rooms.Where(f => f.CreateBy != subjectId) : rooms.Where(f => f.CreateBy == subjectId); + rooms = excludeSubject ? rooms.Where(f => f != null && f.CreateBy != subjectId) : rooms.Where(f => f != null && f.CreateBy == subjectId); } return rooms; From 20e37c254debd81cc7383990e9a5e41888965ed3 Mon Sep 17 00:00:00 2001 From: MaksimChegulov Date: Mon, 3 Oct 2022 17:56:54 +0300 Subject: [PATCH 03/54] Files: added parameter for filtering by provider --- .../RequestDto/CreateRoomRequestDto.cs | 8 ---- .../Core/Core/Dao/Interfaces/IFolderDao.cs | 4 +- .../Core/Core/Dao/TeamlabDao/FolderDao.cs | 18 +++----- .../ASC.Files/Core/Core/FileStorageService.cs | 5 ++- .../ASC.Files/Core/Core/FilterTypeEnum.cs | 10 +---- .../ASC.Files/Core/Core/ProviderFilter.cs | 41 +++++++++++++++++++ .../Core/Core/Security/FileSecurity.cs | 22 +++++----- .../Core/Core/Thirdparty/Box/BoxFolderDao.cs | 14 ++----- .../Thirdparty/Dropbox/DropboxFolderDao.cs | 14 ++----- .../GoogleDrive/GoogleDriveFolderDao.cs | 14 ++----- .../Core/Thirdparty/IThirdPartyProviderDao.cs | 6 +-- .../Thirdparty/OneDrive/OneDriveFolderDao.cs | 14 ++----- .../ProviderDao/ProviderFolderDao.cs | 25 +++++------ .../SharePoint/SharePointFolderDao.cs | 14 ++----- .../Thirdparty/Sharpbox/SharpBoxFolderDao.cs | 14 ++----- products/ASC.Files/Core/Utils/EntryManager.cs | 4 +- .../Server/Api/VirtualRoomsController.cs | 16 +++----- 17 files changed, 110 insertions(+), 133 deletions(-) create mode 100644 products/ASC.Files/Core/Core/ProviderFilter.cs diff --git a/products/ASC.Files/Core/ApiModels/RequestDto/CreateRoomRequestDto.cs b/products/ASC.Files/Core/ApiModels/RequestDto/CreateRoomRequestDto.cs index dc88c7a53a..c299b6fa45 100644 --- a/products/ASC.Files/Core/ApiModels/RequestDto/CreateRoomRequestDto.cs +++ b/products/ASC.Files/Core/ApiModels/RequestDto/CreateRoomRequestDto.cs @@ -43,14 +43,6 @@ public enum RoomFilterType ReadOnlyRoomOnly = 4, CustomRoomOnly = 5, FoldersOnly = 6, - BoxOnly = 7, - DropboxV2Only = 8, - GoogleDriveOnly = 9, - OneDriveOnly = 10, - SharePointOnly = 11, - WebDavOnly = 12, - kDriveOnly = 13, - YandexOnly = 14, } public class CreateRoomRequestDto diff --git a/products/ASC.Files/Core/Core/Dao/Interfaces/IFolderDao.cs b/products/ASC.Files/Core/Core/Dao/Interfaces/IFolderDao.cs index ace8f95f57..813b6ade1b 100644 --- a/products/ASC.Files/Core/Core/Dao/Interfaces/IFolderDao.cs +++ b/products/ASC.Files/Core/Core/Dao/Interfaces/IFolderDao.cs @@ -58,10 +58,10 @@ public interface IFolderDao Task> GetRootFolderByFileAsync(T fileId); IAsyncEnumerable> GetRoomsAsync(T parentId, FilterType filterType, IEnumerable tags, Guid subjectId, string searchText, bool withSubfolders, - bool withoutTags, bool excludeSubject); + bool withoutTags, bool excludeSubject, ProviderFilter provider); IAsyncEnumerable> GetRoomsAsync(IEnumerable roomsIds, FilterType filterType, IEnumerable tags, Guid subjectId, string searchText, bool withSubfolders, - bool withoutTags, bool excludeSubject); + bool withoutTags, bool excludeSubject, ProviderFilter provider); /// /// Get a list of folders in current folder. diff --git a/products/ASC.Files/Core/Core/Dao/TeamlabDao/FolderDao.cs b/products/ASC.Files/Core/Core/Dao/TeamlabDao/FolderDao.cs index 061edcf6de..559451054d 100644 --- a/products/ASC.Files/Core/Core/Dao/TeamlabDao/FolderDao.cs +++ b/products/ASC.Files/Core/Core/Dao/TeamlabDao/FolderDao.cs @@ -166,9 +166,9 @@ internal class FolderDao : AbstractDao, IFolderDao return GetFoldersAsync(parentId, default, FilterType.None, false, default, string.Empty); } - public async IAsyncEnumerable> GetRoomsAsync(int parentId, FilterType filterType, IEnumerable tags, Guid subjectId, string searchText, bool withSubfolders, bool withoutTags, bool excludeSubject) + public async IAsyncEnumerable> GetRoomsAsync(int parentId, FilterType filterType, IEnumerable tags, Guid subjectId, string searchText, bool withSubfolders, bool withoutTags, bool excludeSubject, ProviderFilter provider) { - if (CheckInvalidFilter(filterType)) + if (CheckInvalidFilter(filterType) || provider != ProviderFilter.None) { yield break; } @@ -196,9 +196,9 @@ internal class FolderDao : AbstractDao, IFolderDao } } - public async IAsyncEnumerable> GetRoomsAsync(IEnumerable roomsIds, FilterType filterType, IEnumerable tags, Guid subjectId, string searchText, bool withSubfolders, bool withoutTags, bool excludeSubject) + public async IAsyncEnumerable> GetRoomsAsync(IEnumerable roomsIds, FilterType filterType, IEnumerable tags, Guid subjectId, string searchText, bool withSubfolders, bool withoutTags, bool excludeSubject, ProviderFilter provider) { - if (CheckInvalidFilter(filterType)) + if (CheckInvalidFilter(filterType) || provider != ProviderFilter.None) { yield break; } @@ -1566,15 +1566,7 @@ internal class FolderDao : AbstractDao, IFolderDao FilterType.PresentationsOnly or FilterType.SpreadsheetsOnly or FilterType.ArchiveOnly or - FilterType.MediaOnly or - FilterType.BoxOnly or - FilterType.DropboxV2Only or - FilterType.GoogleDriveOnly or - FilterType.OneDriveOnly or - FilterType.SharePointOnly or - FilterType.WebDavOnly or - FilterType.kDriveOnly or - FilterType.YandexOnly; + FilterType.MediaOnly; } private FolderType GetRoomTypeFilter(FilterType filterType) diff --git a/products/ASC.Files/Core/Core/FileStorageService.cs b/products/ASC.Files/Core/Core/FileStorageService.cs index bb1e299b00..0d11ab19eb 100644 --- a/products/ASC.Files/Core/Core/FileStorageService.cs +++ b/products/ASC.Files/Core/Core/FileStorageService.cs @@ -266,7 +266,8 @@ public class FileStorageService //: IFileStorageService SearchArea searchArea = SearchArea.Active, bool withoutTags = false, IEnumerable tagNames = null, - bool excludeSubject = false) + bool excludeSubject = false, + ProviderFilter provider = ProviderFilter.None) { var subjectId = string.IsNullOrEmpty(subject) ? Guid.Empty : new Guid(subject); @@ -316,7 +317,7 @@ public class FileStorageService //: IFileStorageService try { (entries, total) = await _entryManager.GetEntriesAsync(parent, from, count, filterType, subjectGroup, subjectId, searchText, searchInContent, withSubfolders, orderBy, searchArea, - withoutTags, tagNames, excludeSubject); + withoutTags, tagNames, excludeSubject, provider); } catch (Exception e) { diff --git a/products/ASC.Files/Core/Core/FilterTypeEnum.cs b/products/ASC.Files/Core/Core/FilterTypeEnum.cs index 1e1c814d13..68f8072a3c 100644 --- a/products/ASC.Files/Core/Core/FilterTypeEnum.cs +++ b/products/ASC.Files/Core/Core/FilterTypeEnum.cs @@ -46,13 +46,5 @@ public enum FilterType [EnumMember] ReadOnlyRooms = 16, [EnumMember] CustomRooms = 17, [EnumMember] OFormTemplateOnly = 18, - [EnumMember] OFormOnly = 19, - [EnumMember] BoxOnly = 20, - [EnumMember] DropboxV2Only = 21, - [EnumMember] GoogleDriveOnly = 22, - [EnumMember] OneDriveOnly = 23, - [EnumMember] SharePointOnly = 24, - [EnumMember] WebDavOnly = 25, - [EnumMember] kDriveOnly = 26, - [EnumMember] YandexOnly = 27, + [EnumMember] OFormOnly = 19, } \ No newline at end of file diff --git a/products/ASC.Files/Core/Core/ProviderFilter.cs b/products/ASC.Files/Core/Core/ProviderFilter.cs new file mode 100644 index 0000000000..1aa3e36958 --- /dev/null +++ b/products/ASC.Files/Core/Core/ProviderFilter.cs @@ -0,0 +1,41 @@ +// (c) Copyright Ascensio System SIA 2010-2022 +// +// This program is a free software product. +// You can redistribute it and/or modify it under the terms +// of the GNU Affero General Public License (AGPL) version 3 as published by the Free Software +// Foundation. In accordance with Section 7(a) of the GNU AGPL its Section 15 shall be amended +// to the effect that Ascensio System SIA expressly excludes the warranty of non-infringement of +// any third-party rights. +// +// This program is distributed WITHOUT ANY WARRANTY, without even the implied warranty +// of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. For details, see +// the GNU AGPL at: http://www.gnu.org/licenses/agpl-3.0.html +// +// You can contact Ascensio System SIA at Lubanas st. 125a-25, Riga, Latvia, EU, LV-1021. +// +// The interactive user interfaces in modified source and object code versions of the Program must +// display Appropriate Legal Notices, as required under Section 5 of the GNU AGPL version 3. +// +// Pursuant to Section 7(b) of the License you must retain the original Product logo when +// distributing the program. Pursuant to Section 7(e) we decline to grant you any rights under +// trademark law for use of our trademarks. +// +// All the Product's GUI elements, including illustrations and icon sets, as well as technical writing +// content are licensed under the terms of the Creative Commons Attribution-ShareAlike 4.0 +// International. See the License terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode + +namespace ASC.Files.Core; + +[EnumExtensions] +public enum ProviderFilter +{ + None, + Box, + DropBox, + GoogleDrive, + kDrive, + OneDrive, + SharePoint, + WebDav, + Yandex +} \ No newline at end of file diff --git a/products/ASC.Files/Core/Core/Security/FileSecurity.cs b/products/ASC.Files/Core/Core/Security/FileSecurity.cs index 05a5c037e5..c0dc3ecd5f 100644 --- a/products/ASC.Files/Core/Core/Security/FileSecurity.cs +++ b/products/ASC.Files/Core/Core/Security/FileSecurity.cs @@ -923,11 +923,11 @@ public class FileSecurity : IFileSecurity } public async Task> GetVirtualRoomsAsync(FilterType filterType, Guid subjectId, string searchText, bool searchInContent, bool withSubfolders, - SearchArea searchArea, bool withoutTags, IEnumerable tagNames, bool excludeSubject) + SearchArea searchArea, bool withoutTags, IEnumerable tagNames, bool excludeSubject, ProviderFilter provider) { if (_fileSecurityCommon.IsAdministrator(_authContext.CurrentAccount.ID)) { - return await GetVirtualRoomsForAdminAsync(filterType, subjectId, searchText, searchInContent, withSubfolders, searchArea, withoutTags, tagNames, excludeSubject); + return await GetVirtualRoomsForAdminAsync(filterType, subjectId, searchText, searchInContent, withSubfolders, searchArea, withoutTags, tagNames, excludeSubject, provider); } var securityDao = _daoFactory.GetSecurityDao(); @@ -936,9 +936,9 @@ public class FileSecurity : IFileSecurity var entries = new List(); var rooms = await GetVirtualRoomsForUserAsync(records.Where(r => r.EntryId is int), subjects, filterType, subjectId, searchText, searchInContent, - withSubfolders, searchArea, withoutTags, tagNames, excludeSubject); + withSubfolders, searchArea, withoutTags, tagNames, excludeSubject, provider); var thirdPartyRooms = await GetVirtualRoomsForUserAsync(records.Where(r => r.EntryId is string), subjects, filterType, subjectId, searchText, - searchInContent, withSubfolders, searchArea, withoutTags, tagNames, excludeSubject); + searchInContent, withSubfolders, searchArea, withoutTags, tagNames, excludeSubject, provider); entries.AddRange(rooms); entries.AddRange(thirdPartyRooms); @@ -947,7 +947,7 @@ public class FileSecurity : IFileSecurity } private async Task> GetVirtualRoomsForAdminAsync(FilterType filterType, Guid subjectId, string search, bool searchInContent, bool withSubfolders, - SearchArea searchArea, bool withoutTags, IEnumerable tagNames, bool excludeSubject) + SearchArea searchArea, bool withoutTags, IEnumerable tagNames, bool excludeSubject, ProviderFilter provider) { var folderDao = _daoFactory.GetFolderDao(); var folderThirdPartyDao = _daoFactory.GetFolderDao(); @@ -964,8 +964,8 @@ public class FileSecurity : IFileSecurity var roomsFolderId = await _globalFolder.GetFolderVirtualRoomsAsync(_daoFactory); var thirdPartyRoomsIds = await providerDao.GetProvidersInfoAsync(FolderType.VirtualRooms).Select(p => p.FolderId).ToListAsync(); - var roomsEntries = await folderDao.GetRoomsAsync(roomsFolderId, filterType, tagNames, subjectId, search, withSubfolders, withoutTags, excludeSubject).ToListAsync(); - var thirdPartyRoomsEntries = await folderThirdPartyDao.GetRoomsAsync(thirdPartyRoomsIds, filterType, tagNames, subjectId, search, withSubfolders, withoutTags, excludeSubject) + var roomsEntries = await folderDao.GetRoomsAsync(roomsFolderId, filterType, tagNames, subjectId, search, withSubfolders, withoutTags, excludeSubject, provider).ToListAsync(); + var thirdPartyRoomsEntries = await folderThirdPartyDao.GetRoomsAsync(thirdPartyRoomsIds, filterType, tagNames, subjectId, search, withSubfolders, withoutTags, excludeSubject, provider) .ToListAsync(); foldersInt.AddRange(roomsEntries); @@ -996,8 +996,8 @@ public class FileSecurity : IFileSecurity var archiveFolderId = await _globalFolder.GetFolderArchive(_daoFactory); var thirdPartyRoomsIds = await providerDao.GetProvidersInfoAsync(FolderType.Archive).Select(p => p.FolderId).ToListAsync(); - var roomsEntries = await folderDao.GetRoomsAsync(archiveFolderId, filterType, tagNames, subjectId, search, withSubfolders, withoutTags, excludeSubject).ToListAsync(); - var thirdPartyRoomsEntries = await folderThirdPartyDao.GetRoomsAsync(thirdPartyRoomsIds, filterType, tagNames, subjectId, search, withSubfolders, withoutTags, excludeSubject) + var roomsEntries = await folderDao.GetRoomsAsync(archiveFolderId, filterType, tagNames, subjectId, search, withSubfolders, withoutTags, excludeSubject, provider).ToListAsync(); + var thirdPartyRoomsEntries = await folderThirdPartyDao.GetRoomsAsync(thirdPartyRoomsIds, filterType, tagNames, subjectId, search, withSubfolders, withoutTags, excludeSubject, provider) .ToListAsync(); foldersInt.AddRange(roomsEntries); @@ -1036,7 +1036,7 @@ public class FileSecurity : IFileSecurity } private async Task> GetVirtualRoomsForUserAsync(IEnumerable records, List subjects, FilterType filterType, Guid subjectId, string search, - bool searchInContent, bool withSubfolders, SearchArea searchArea, bool withoutTags, IEnumerable tagNames, bool excludeSubject) + bool searchInContent, bool withSubfolders, SearchArea searchArea, bool withoutTags, IEnumerable tagNames, bool excludeSubject, ProviderFilter provider) { var folderDao = _daoFactory.GetFolderDao(); var fileDao = _daoFactory.GetFileDao(); @@ -1078,7 +1078,7 @@ public class FileSecurity : IFileSecurity return false; }; - var fileEntries = await folderDao.GetRoomsAsync(roomsIds.Keys, filterType, tagNames, subjectId, search, withSubfolders, withoutTags, excludeSubject) + var fileEntries = await folderDao.GetRoomsAsync(roomsIds.Keys, filterType, tagNames, subjectId, search, withSubfolders, withoutTags, excludeSubject, provider) .Where(filter).ToListAsync(); await SetTagsAsync(fileEntries); diff --git a/products/ASC.Files/Core/Core/Thirdparty/Box/BoxFolderDao.cs b/products/ASC.Files/Core/Core/Thirdparty/Box/BoxFolderDao.cs index 5de183b8d6..8a75d85f45 100644 --- a/products/ASC.Files/Core/Core/Thirdparty/Box/BoxFolderDao.cs +++ b/products/ASC.Files/Core/Core/Thirdparty/Box/BoxFolderDao.cs @@ -75,9 +75,9 @@ internal class BoxFolderDao : BoxDaoBase, IFolderDao } public IAsyncEnumerable> GetRoomsAsync(string parentId, FilterType filterType, IEnumerable tags, Guid subjectId, string searchText, bool withSubfolders, - bool withoutTags, bool excludeSubject) + bool withoutTags, bool excludeSubject, ProviderFilter provider) { - if (CheckInvalidFilter(filterType)) + if (CheckInvalidFilter(filterType) || (provider != ProviderFilter.None && provider != ProviderFilter.Box)) { return AsyncEnumerable.Empty>(); } @@ -98,9 +98,9 @@ internal class BoxFolderDao : BoxDaoBase, IFolderDao } public IAsyncEnumerable> GetRoomsAsync(IEnumerable roomsIds, FilterType filterType, IEnumerable tags, Guid subjectId, string searchText, - bool withSubfolders, bool withoutTags, bool excludeSubject) + bool withSubfolders, bool withoutTags, bool excludeSubject, ProviderFilter provider) { - if (CheckInvalidFilter(filterType)) + if (CheckInvalidFilter(filterType) || (provider != ProviderFilter.None && provider != ProviderFilter.Box)) { return AsyncEnumerable.Empty>(); } @@ -529,10 +529,4 @@ internal class BoxFolderDao : BoxDaoBase, IFolderDao return chunkedUpload ? storageMaxUploadSize : Math.Min(storageMaxUploadSize, _setupInfo.AvailableFileSize); } - - public override bool CheckInvalidFilter(FilterType filterType) - { - return base.CheckInvalidFilter(filterType) || filterType is FilterType.GoogleDriveOnly or FilterType.DropboxV2Only or FilterType.kDriveOnly or FilterType.SharePointOnly - or FilterType.YandexOnly or FilterType.WebDavOnly or FilterType.OneDriveOnly; - } } diff --git a/products/ASC.Files/Core/Core/Thirdparty/Dropbox/DropboxFolderDao.cs b/products/ASC.Files/Core/Core/Thirdparty/Dropbox/DropboxFolderDao.cs index 6acf436deb..a998cff59f 100644 --- a/products/ASC.Files/Core/Core/Thirdparty/Dropbox/DropboxFolderDao.cs +++ b/products/ASC.Files/Core/Core/Thirdparty/Dropbox/DropboxFolderDao.cs @@ -77,9 +77,9 @@ internal class DropboxFolderDao : DropboxDaoBase, IFolderDao return GetRootFolderAsync(fileId); } - public IAsyncEnumerable> GetRoomsAsync(string parentId, FilterType filterType, IEnumerable tags, Guid subjectId, string searchText, bool withSubfolders, bool withoutTags, bool excludeSubject) + public IAsyncEnumerable> GetRoomsAsync(string parentId, FilterType filterType, IEnumerable tags, Guid subjectId, string searchText, bool withSubfolders, bool withoutTags, bool excludeSubject, ProviderFilter provider) { - if (CheckInvalidFilter(filterType)) + if (CheckInvalidFilter(filterType) || (provider != ProviderFilter.None && provider != ProviderFilter.DropBox)) { return AsyncEnumerable.Empty>(); } @@ -99,9 +99,9 @@ internal class DropboxFolderDao : DropboxDaoBase, IFolderDao return rooms; } - public IAsyncEnumerable> GetRoomsAsync(IEnumerable roomsIds, FilterType filterType, IEnumerable tags, Guid subjectId, string searchText, bool withSubfolders, bool withoutTags, bool excludeSubject) + public IAsyncEnumerable> GetRoomsAsync(IEnumerable roomsIds, FilterType filterType, IEnumerable tags, Guid subjectId, string searchText, bool withSubfolders, bool withoutTags, bool excludeSubject, ProviderFilter provider) { - if (CheckInvalidFilter(filterType)) + if (CheckInvalidFilter(filterType) || (provider != ProviderFilter.None && provider != ProviderFilter.DropBox)) { return AsyncEnumerable.Empty>(); } @@ -519,10 +519,4 @@ internal class DropboxFolderDao : DropboxDaoBase, IFolderDao return chunkedUpload ? storageMaxUploadSize : Math.Min(storageMaxUploadSize, _setupInfo.AvailableFileSize); } - - public override bool CheckInvalidFilter(FilterType filterType) - { - return base.CheckInvalidFilter(filterType) || filterType is FilterType.BoxOnly or FilterType.GoogleDriveOnly or FilterType.kDriveOnly or FilterType.SharePointOnly - or FilterType.YandexOnly or FilterType.WebDavOnly or FilterType.OneDriveOnly; - } } diff --git a/products/ASC.Files/Core/Core/Thirdparty/GoogleDrive/GoogleDriveFolderDao.cs b/products/ASC.Files/Core/Core/Thirdparty/GoogleDrive/GoogleDriveFolderDao.cs index 142eaf9f9a..9137bf3d02 100644 --- a/products/ASC.Files/Core/Core/Thirdparty/GoogleDrive/GoogleDriveFolderDao.cs +++ b/products/ASC.Files/Core/Core/Thirdparty/GoogleDrive/GoogleDriveFolderDao.cs @@ -74,9 +74,9 @@ internal class GoogleDriveFolderDao : GoogleDriveDaoBase, IFolderDao return GetRootFolderAsync(""); } - public IAsyncEnumerable> GetRoomsAsync(string parentId, FilterType filterType, IEnumerable tags, Guid subjectId, string searchText, bool withSubfolders, bool withoutTags, bool excludeSubject) + public IAsyncEnumerable> GetRoomsAsync(string parentId, FilterType filterType, IEnumerable tags, Guid subjectId, string searchText, bool withSubfolders, bool withoutTags, bool excludeSubject, ProviderFilter provider) { - if (CheckInvalidFilter(filterType)) + if (CheckInvalidFilter(filterType) || (provider != ProviderFilter.None && provider != ProviderFilter.GoogleDrive)) { return AsyncEnumerable.Empty>(); } @@ -96,9 +96,9 @@ internal class GoogleDriveFolderDao : GoogleDriveDaoBase, IFolderDao return rooms; } - public IAsyncEnumerable> GetRoomsAsync(IEnumerable roomsIds, FilterType filterType, IEnumerable tags, Guid subjectId, string searchText, bool withSubfolders, bool withoutTags, bool excludeSubject) + public IAsyncEnumerable> GetRoomsAsync(IEnumerable roomsIds, FilterType filterType, IEnumerable tags, Guid subjectId, string searchText, bool withSubfolders, bool withoutTags, bool excludeSubject, ProviderFilter provider) { - if (CheckInvalidFilter(filterType)) + if (CheckInvalidFilter(filterType) || (provider != ProviderFilter.None && provider != ProviderFilter.GoogleDrive)) { return AsyncEnumerable.Empty>(); } @@ -520,10 +520,4 @@ internal class GoogleDriveFolderDao : GoogleDriveDaoBase, IFolderDao return chunkedUpload ? storageMaxUploadSize : Math.Min(storageMaxUploadSize, _setupInfo.AvailableFileSize); } - - public override bool CheckInvalidFilter(FilterType filterType) - { - return base.CheckInvalidFilter(filterType) || filterType is FilterType.BoxOnly or FilterType.DropboxV2Only or FilterType.kDriveOnly or FilterType.SharePointOnly - or FilterType.YandexOnly or FilterType.WebDavOnly or FilterType.OneDriveOnly; - } } diff --git a/products/ASC.Files/Core/Core/Thirdparty/IThirdPartyProviderDao.cs b/products/ASC.Files/Core/Core/Thirdparty/IThirdPartyProviderDao.cs index 4e64babc15..db4301be44 100644 --- a/products/ASC.Files/Core/Core/Thirdparty/IThirdPartyProviderDao.cs +++ b/products/ASC.Files/Core/Core/Thirdparty/IThirdPartyProviderDao.cs @@ -438,9 +438,7 @@ internal abstract class ThirdPartyProviderDao : ThirdPartyProviderDao, IDispo protected IAsyncEnumerable> FilterByRoomType(IAsyncEnumerable> rooms, FilterType filterType) { - if (filterType == FilterType.None || filterType == FilterType.FoldersOnly || filterType == FilterType.GoogleDriveOnly || filterType == FilterType.OneDriveOnly || - filterType == FilterType.BoxOnly || filterType == FilterType.DropboxV2Only || filterType == FilterType.YandexOnly || filterType == FilterType.SharePointOnly || - filterType == FilterType.kDriveOnly || filterType == FilterType.WebDavOnly) + if (filterType == FilterType.None || filterType == FilterType.FoldersOnly) { return rooms; } @@ -468,7 +466,7 @@ internal abstract class ThirdPartyProviderDao : ThirdPartyProviderDao, IDispo return rooms; } - public virtual bool CheckInvalidFilter(FilterType filterType) + protected bool CheckInvalidFilter(FilterType filterType) { return filterType is FilterType.FilesOnly or diff --git a/products/ASC.Files/Core/Core/Thirdparty/OneDrive/OneDriveFolderDao.cs b/products/ASC.Files/Core/Core/Thirdparty/OneDrive/OneDriveFolderDao.cs index f806fb6b52..505e360b3d 100644 --- a/products/ASC.Files/Core/Core/Thirdparty/OneDrive/OneDriveFolderDao.cs +++ b/products/ASC.Files/Core/Core/Thirdparty/OneDrive/OneDriveFolderDao.cs @@ -74,9 +74,9 @@ internal class OneDriveFolderDao : OneDriveDaoBase, IFolderDao return GetRootFolderAsync(fileId); } - public IAsyncEnumerable> GetRoomsAsync(string parentId, FilterType filterType, IEnumerable tags, Guid subjectId, string searchText, bool withSubfolders, bool withoutTags, bool excludeSubject) + public IAsyncEnumerable> GetRoomsAsync(string parentId, FilterType filterType, IEnumerable tags, Guid subjectId, string searchText, bool withSubfolders, bool withoutTags, bool excludeSubject, ProviderFilter provider) { - if (CheckInvalidFilter(filterType)) + if (CheckInvalidFilter(filterType) || (provider != ProviderFilter.None && provider != ProviderFilter.OneDrive)) { return AsyncEnumerable.Empty>(); } @@ -96,9 +96,9 @@ internal class OneDriveFolderDao : OneDriveDaoBase, IFolderDao return rooms; } - public IAsyncEnumerable> GetRoomsAsync(IEnumerable roomsIds, FilterType filterType, IEnumerable tags, Guid subjectId, string searchText, bool withSubfolders, bool withoutTags, bool excludeSubject) + public IAsyncEnumerable> GetRoomsAsync(IEnumerable roomsIds, FilterType filterType, IEnumerable tags, Guid subjectId, string searchText, bool withSubfolders, bool withoutTags, bool excludeSubject, ProviderFilter provider) { - if (CheckInvalidFilter(filterType)) + if (CheckInvalidFilter(filterType) || (provider != ProviderFilter.None && provider != ProviderFilter.OneDrive)) { return AsyncEnumerable.Empty>(); } @@ -532,10 +532,4 @@ internal class OneDriveFolderDao : OneDriveDaoBase, IFolderDao return chunkedUpload ? storageMaxUploadSize : Math.Min(storageMaxUploadSize, _setupInfo.AvailableFileSize); } - - public override bool CheckInvalidFilter(FilterType filterType) - { - return base.CheckInvalidFilter(filterType) || filterType is FilterType.BoxOnly or FilterType.DropboxV2Only or FilterType.kDriveOnly or FilterType.SharePointOnly - or FilterType.YandexOnly or FilterType.WebDavOnly or FilterType.GoogleDriveOnly; - } } diff --git a/products/ASC.Files/Core/Core/Thirdparty/ProviderDao/ProviderFolderDao.cs b/products/ASC.Files/Core/Core/Thirdparty/ProviderDao/ProviderFolderDao.cs index 99c3dc1c09..f16c1aa5d9 100644 --- a/products/ASC.Files/Core/Core/Thirdparty/ProviderDao/ProviderFolderDao.cs +++ b/products/ASC.Files/Core/Core/Thirdparty/ProviderDao/ProviderFolderDao.cs @@ -90,13 +90,13 @@ internal class ProviderFolderDao : ProviderDaoBase, IFolderDao return folderDao.GetRootFolderByFileAsync(selector.ConvertId(fileId)); } - public async IAsyncEnumerable> GetRoomsAsync(string parentId, FilterType filterType, IEnumerable tags, Guid subjectId, string searchText, bool withSubfolders, bool withoutTags, bool excludeSubject) + public async IAsyncEnumerable> GetRoomsAsync(string parentId, FilterType filterType, IEnumerable tags, Guid subjectId, string searchText, bool withSubfolders, bool withoutTags, bool excludeSubject, ProviderFilter provider) { var selector = GetSelector(parentId); var folderDao = selector.GetFolderDao(parentId); - var rooms = folderDao.GetRoomsAsync(selector.ConvertId(parentId), filterType, tags, subjectId, searchText, withSubfolders, withoutTags, excludeSubject); + var rooms = folderDao.GetRoomsAsync(selector.ConvertId(parentId), filterType, tags, subjectId, searchText, withSubfolders, withoutTags, excludeSubject, provider); - var result = await FilterByProviders(rooms.Where(r => r != null), filterType).ToListAsync(); + var result = await FilterByProvider(rooms.Where(r => r != null), provider).ToListAsync(); await SetSharedPropertyAsync(result); @@ -106,7 +106,8 @@ internal class ProviderFolderDao : ProviderDaoBase, IFolderDao } } - public IAsyncEnumerable> GetRoomsAsync(IEnumerable roomsIds, FilterType filterType, IEnumerable tags, Guid subjectId, string searchText, bool withSubfolders, bool withoutTags, bool excludeSubject) + public IAsyncEnumerable> GetRoomsAsync(IEnumerable roomsIds, FilterType filterType, IEnumerable tags, Guid subjectId, string searchText, bool withSubfolders, bool withoutTags, bool excludeSubject, + ProviderFilter provider) { var result = AsyncEnumerable.Empty>(); @@ -126,12 +127,12 @@ internal class ProviderFolderDao : ProviderDaoBase, IFolderDao { var folderDao = selectorLocal.GetFolderDao(matchedId.FirstOrDefault()); - return folderDao.GetRoomsAsync(matchedId.Select(selectorLocal.ConvertId).ToList(), filterType, tags, subjectId, searchText, withSubfolders, withoutTags, excludeSubject); + return folderDao.GetRoomsAsync(matchedId.Select(selectorLocal.ConvertId).ToList(), filterType, tags, subjectId, searchText, withSubfolders, withoutTags, excludeSubject, provider); }) .Where(r => r != null)); } - result = FilterByProviders(result, filterType); + result = FilterByProvider(result, provider); return result.Distinct(); } @@ -439,18 +440,18 @@ internal class ProviderFolderDao : ProviderDaoBase, IFolderDao return storageMaxUploadSize; } - private IAsyncEnumerable> FilterByProviders(IAsyncEnumerable> folders, FilterType filterType) + private IAsyncEnumerable> FilterByProvider(IAsyncEnumerable> folders, ProviderFilter provider) { - if (filterType != FilterType.WebDavOnly && filterType != FilterType.YandexOnly && filterType != FilterType.kDriveOnly) + if (provider != ProviderFilter.kDrive && provider != ProviderFilter.WebDav && provider != ProviderFilter.Yandex) { return folders; } - var providerKey = filterType switch + var providerKey = provider switch { - FilterType.YandexOnly => ProviderTypes.Yandex.ToStringFast(), - FilterType.WebDavOnly => ProviderTypes.WebDav.ToStringFast(), - FilterType.kDriveOnly => ProviderTypes.kDrive.ToStringFast(), + ProviderFilter.Yandex => ProviderTypes.Yandex.ToStringFast(), + ProviderFilter.WebDav => ProviderTypes.WebDav.ToStringFast(), + ProviderFilter.kDrive => ProviderTypes.kDrive.ToStringFast(), _ => throw new NotImplementedException(), }; diff --git a/products/ASC.Files/Core/Core/Thirdparty/SharePoint/SharePointFolderDao.cs b/products/ASC.Files/Core/Core/Thirdparty/SharePoint/SharePointFolderDao.cs index 027bd20634..924f4cbf69 100644 --- a/products/ASC.Files/Core/Core/Thirdparty/SharePoint/SharePointFolderDao.cs +++ b/products/ASC.Files/Core/Core/Thirdparty/SharePoint/SharePointFolderDao.cs @@ -80,9 +80,9 @@ internal class SharePointFolderDao : SharePointDaoBase, IFolderDao return Task.FromResult(ProviderInfo.ToFolder(ProviderInfo.RootFolder)); } - public IAsyncEnumerable> GetRoomsAsync(string parentId, FilterType filterType, IEnumerable tags, Guid subjectId, string searchText, bool withSubfolders, bool withoutTags, bool excludeSubject) + public IAsyncEnumerable> GetRoomsAsync(string parentId, FilterType filterType, IEnumerable tags, Guid subjectId, string searchText, bool withSubfolders, bool withoutTags, bool excludeSubject, ProviderFilter provider) { - if (CheckInvalidFilter(filterType)) + if (CheckInvalidFilter(filterType) || (provider != ProviderFilter.None && provider != ProviderFilter.SharePoint)) { return AsyncEnumerable.Empty>(); } @@ -102,9 +102,9 @@ internal class SharePointFolderDao : SharePointDaoBase, IFolderDao return rooms; } - public IAsyncEnumerable> GetRoomsAsync(IEnumerable roomsIds, FilterType filterType, IEnumerable tags, Guid subjectId, string searchText, bool withSubfolders, bool withoutTags, bool excludeSubject) + public IAsyncEnumerable> GetRoomsAsync(IEnumerable roomsIds, FilterType filterType, IEnumerable tags, Guid subjectId, string searchText, bool withSubfolders, bool withoutTags, bool excludeSubject, ProviderFilter provider) { - if (CheckInvalidFilter(filterType)) + if (CheckInvalidFilter(filterType) || (provider != ProviderFilter.None && provider != ProviderFilter.SharePoint)) { return AsyncEnumerable.Empty>(); } @@ -455,10 +455,4 @@ internal class SharePointFolderDao : SharePointDaoBase, IFolderDao { return Task.FromResult(2L * 1024L * 1024L * 1024L); } - - public override bool CheckInvalidFilter(FilterType filterType) - { - return base.CheckInvalidFilter(filterType) || filterType is FilterType.BoxOnly or FilterType.DropboxV2Only or FilterType.kDriveOnly or FilterType.GoogleDriveOnly - or FilterType.YandexOnly or FilterType.WebDavOnly or FilterType.OneDriveOnly; - } } diff --git a/products/ASC.Files/Core/Core/Thirdparty/Sharpbox/SharpBoxFolderDao.cs b/products/ASC.Files/Core/Core/Thirdparty/Sharpbox/SharpBoxFolderDao.cs index fc2374f9ad..bc70e09bb6 100644 --- a/products/ASC.Files/Core/Core/Thirdparty/Sharpbox/SharpBoxFolderDao.cs +++ b/products/ASC.Files/Core/Core/Thirdparty/Sharpbox/SharpBoxFolderDao.cs @@ -79,9 +79,9 @@ internal class SharpBoxFolderDao : SharpBoxDaoBase, IFolderDao return Task.FromResult(ToFolder(RootFolder())); } - public IAsyncEnumerable> GetRoomsAsync(string parentId, FilterType filterType, IEnumerable tags, Guid subjectId, string searchText, bool withSubfolders, bool withoutTags, bool excludeSubject) + public IAsyncEnumerable> GetRoomsAsync(string parentId, FilterType filterType, IEnumerable tags, Guid subjectId, string searchText, bool withSubfolders, bool withoutTags, bool excludeSubject, ProviderFilter provider) { - if (CheckInvalidFilter(filterType)) + if (CheckInvalidFilter(filterType) || (provider != ProviderFilter.None && provider != ProviderFilter.kDrive && provider != ProviderFilter.WebDav && provider != ProviderFilter.Yandex)) { return AsyncEnumerable.Empty>(); } @@ -101,9 +101,9 @@ internal class SharpBoxFolderDao : SharpBoxDaoBase, IFolderDao return rooms; } - public IAsyncEnumerable> GetRoomsAsync(IEnumerable roomsIds, FilterType filterType, IEnumerable tags, Guid subjectId, string searchText, bool withSubfolders, bool withoutTags, bool excludeSubject) + public IAsyncEnumerable> GetRoomsAsync(IEnumerable roomsIds, FilterType filterType, IEnumerable tags, Guid subjectId, string searchText, bool withSubfolders, bool withoutTags, bool excludeSubject, ProviderFilter provider) { - if (CheckInvalidFilter(filterType)) + if (CheckInvalidFilter(filterType) || (provider != ProviderFilter.None && provider != ProviderFilter.kDrive && provider != ProviderFilter.WebDav && provider != ProviderFilter.Yandex)) { return AsyncEnumerable.Empty>(); } @@ -521,10 +521,4 @@ internal class SharpBoxFolderDao : SharpBoxDaoBase, IFolderDao return Task.FromResult(chunkedUpload ? storageMaxUploadSize : Math.Min(storageMaxUploadSize, _setupInfo.AvailableFileSize)); } - - public override bool CheckInvalidFilter(FilterType filterType) - { - return base.CheckInvalidFilter(filterType) || filterType is FilterType.BoxOnly or FilterType.DropboxV2Only or FilterType.SharePointOnly - or FilterType.GoogleDriveOnly or FilterType.OneDriveOnly; - } } diff --git a/products/ASC.Files/Core/Utils/EntryManager.cs b/products/ASC.Files/Core/Utils/EntryManager.cs index 257c1ebf42..ef8a947210 100644 --- a/products/ASC.Files/Core/Utils/EntryManager.cs +++ b/products/ASC.Files/Core/Utils/EntryManager.cs @@ -374,7 +374,7 @@ public class EntryManager public async Task<(IEnumerable Entries, int Total)> GetEntriesAsync(Folder parent, int from, int count, FilterType filterType, bool subjectGroup, Guid subjectId, string searchText, bool searchInContent, bool withSubfolders, OrderBy orderBy, SearchArea searchArea = SearchArea.Active, bool withoutTags = false, IEnumerable tagNames = null, - bool excludeSubject = false) + bool excludeSubject = false, ProviderFilter provider = ProviderFilter.None) { var total = 0; @@ -457,7 +457,7 @@ public class EntryManager } else if ((parent.FolderType == FolderType.VirtualRooms || parent.FolderType == FolderType.Archive) && !parent.ProviderEntry) { - entries = await _fileSecurity.GetVirtualRoomsAsync(filterType, subjectId, searchText, searchInContent, withSubfolders, searchArea, withoutTags, tagNames, excludeSubject); + entries = await _fileSecurity.GetVirtualRoomsAsync(filterType, subjectId, searchText, searchInContent, withSubfolders, searchArea, withoutTags, tagNames, excludeSubject, provider); CalculateTotal(); } diff --git a/products/ASC.Files/Server/Api/VirtualRoomsController.cs b/products/ASC.Files/Server/Api/VirtualRoomsController.cs index 0ff50ff466..fd67ff8440 100644 --- a/products/ASC.Files/Server/Api/VirtualRoomsController.cs +++ b/products/ASC.Files/Server/Api/VirtualRoomsController.cs @@ -24,6 +24,8 @@ // content are licensed under the terms of the Creative Commons Attribution-ShareAlike 4.0 // International. See the License terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode +using ASC.Files.Thirdparty; + namespace ASC.Files.Api; [ConstraintRoute("int")] @@ -655,7 +657,8 @@ public class VirtualRoomsCommonController : ApiControllerBase /// Virtual Rooms content /// [HttpGet("rooms")] - public async Task> GetRoomsFolderAsync(RoomFilterType? type, string subjectId, bool? searchInContent, bool? withSubfolders, SearchArea? searchArea, bool? withoutTags, string tags, bool? excludeSubject) + public async Task> GetRoomsFolderAsync(RoomFilterType? type, string subjectId, bool? searchInContent, bool? withSubfolders, SearchArea? searchArea, bool? withoutTags, string tags, bool? excludeSubject, + ProviderFilter? provider) { ErrorIfNotDocSpace(); @@ -670,14 +673,6 @@ public class VirtualRoomsCommonController : ApiControllerBase RoomFilterType.ReviewRoomOnly => FilterType.ReviewRooms, RoomFilterType.CustomRoomOnly => FilterType.CustomRooms, RoomFilterType.FoldersOnly => FilterType.FoldersOnly, - RoomFilterType.GoogleDriveOnly => FilterType.GoogleDriveOnly, - RoomFilterType.BoxOnly => FilterType.BoxOnly, - RoomFilterType.DropboxV2Only => FilterType.DropboxV2Only, - RoomFilterType.OneDriveOnly => FilterType.OneDriveOnly, - RoomFilterType.SharePointOnly => FilterType.SharePointOnly, - RoomFilterType.YandexOnly => FilterType.YandexOnly, - RoomFilterType.kDriveOnly => FilterType.kDriveOnly, - RoomFilterType.WebDavOnly => FilterType.WebDavOnly, _ => FilterType.None }; @@ -694,7 +689,8 @@ public class VirtualRoomsCommonController : ApiControllerBase var filterValue = _apiContext.FilterValue; var content = await _fileStorageServiceInt.GetFolderItemsAsync(parentId, startIndex, count, filter, false, subjectId, filterValue, - searchInContent ?? false, withSubfolders ?? false, orderBy, searchArea ?? SearchArea.Active, withoutTags ?? false, tagNames, excludeSubject ?? false); + searchInContent ?? false, withSubfolders ?? false, orderBy, searchArea ?? SearchArea.Active, withoutTags ?? false, tagNames, excludeSubject ?? false, + provider ?? ProviderFilter.None); var dto = await _folderContentDtoHelper.GetAsync(content, startIndex); From ce2618fe573c675fe12bf3608b5ed962fb21263e Mon Sep 17 00:00:00 2001 From: gazizova-vlada Date: Wed, 5 Oct 2022 14:31:05 +0300 Subject: [PATCH 04/54] Web:Client:Add icons for tags ThirdParty. --- .../public/images/icon_box_small.react.svg | 3 ++ .../images/icon_dropbox_small.react.svg | 4 +++ .../images/icon_google_drive_small.react.svg | 30 +++++++++++++++++++ .../public/images/icon_kdrive_small.react.svg | 14 +++++++++ .../images/icon_nextcloud_small.react.svg | 10 +++++++ .../images/icon_onedrive_small.react.svg | 4 +++ .../images/icon_owncloud_small.react.svg | 3 ++ .../images/icon_sharepoint_small.react.svg | 4 +++ .../public/images/icon_webdav_small.react.svg | 3 ++ .../images/icon_yandex_disk_small.react.svg | 12 ++++++++ 10 files changed, 87 insertions(+) create mode 100644 packages/client/public/images/icon_box_small.react.svg create mode 100644 packages/client/public/images/icon_dropbox_small.react.svg create mode 100644 packages/client/public/images/icon_google_drive_small.react.svg create mode 100644 packages/client/public/images/icon_kdrive_small.react.svg create mode 100644 packages/client/public/images/icon_nextcloud_small.react.svg create mode 100644 packages/client/public/images/icon_onedrive_small.react.svg create mode 100644 packages/client/public/images/icon_owncloud_small.react.svg create mode 100644 packages/client/public/images/icon_sharepoint_small.react.svg create mode 100644 packages/client/public/images/icon_webdav_small.react.svg create mode 100644 packages/client/public/images/icon_yandex_disk_small.react.svg diff --git a/packages/client/public/images/icon_box_small.react.svg b/packages/client/public/images/icon_box_small.react.svg new file mode 100644 index 0000000000..0173579ebb --- /dev/null +++ b/packages/client/public/images/icon_box_small.react.svg @@ -0,0 +1,3 @@ + + + diff --git a/packages/client/public/images/icon_dropbox_small.react.svg b/packages/client/public/images/icon_dropbox_small.react.svg new file mode 100644 index 0000000000..a30550fe32 --- /dev/null +++ b/packages/client/public/images/icon_dropbox_small.react.svg @@ -0,0 +1,4 @@ + + + + diff --git a/packages/client/public/images/icon_google_drive_small.react.svg b/packages/client/public/images/icon_google_drive_small.react.svg new file mode 100644 index 0000000000..43d6573376 --- /dev/null +++ b/packages/client/public/images/icon_google_drive_small.react.svg @@ -0,0 +1,30 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/packages/client/public/images/icon_kdrive_small.react.svg b/packages/client/public/images/icon_kdrive_small.react.svg new file mode 100644 index 0000000000..c5b02734e3 --- /dev/null +++ b/packages/client/public/images/icon_kdrive_small.react.svg @@ -0,0 +1,14 @@ + + + + + + + + + + + + + + diff --git a/packages/client/public/images/icon_nextcloud_small.react.svg b/packages/client/public/images/icon_nextcloud_small.react.svg new file mode 100644 index 0000000000..cd2d606ad1 --- /dev/null +++ b/packages/client/public/images/icon_nextcloud_small.react.svg @@ -0,0 +1,10 @@ + + + + + + + + + + diff --git a/packages/client/public/images/icon_onedrive_small.react.svg b/packages/client/public/images/icon_onedrive_small.react.svg new file mode 100644 index 0000000000..81f7c39aa2 --- /dev/null +++ b/packages/client/public/images/icon_onedrive_small.react.svg @@ -0,0 +1,4 @@ + + + + diff --git a/packages/client/public/images/icon_owncloud_small.react.svg b/packages/client/public/images/icon_owncloud_small.react.svg new file mode 100644 index 0000000000..19a1633d53 --- /dev/null +++ b/packages/client/public/images/icon_owncloud_small.react.svg @@ -0,0 +1,3 @@ + + + diff --git a/packages/client/public/images/icon_sharepoint_small.react.svg b/packages/client/public/images/icon_sharepoint_small.react.svg new file mode 100644 index 0000000000..d0e241abde --- /dev/null +++ b/packages/client/public/images/icon_sharepoint_small.react.svg @@ -0,0 +1,4 @@ + + + + diff --git a/packages/client/public/images/icon_webdav_small.react.svg b/packages/client/public/images/icon_webdav_small.react.svg new file mode 100644 index 0000000000..c268423ff5 --- /dev/null +++ b/packages/client/public/images/icon_webdav_small.react.svg @@ -0,0 +1,3 @@ + + + diff --git a/packages/client/public/images/icon_yandex_disk_small.react.svg b/packages/client/public/images/icon_yandex_disk_small.react.svg new file mode 100644 index 0000000000..cbab03d66e --- /dev/null +++ b/packages/client/public/images/icon_yandex_disk_small.react.svg @@ -0,0 +1,12 @@ + + + + + + + + + + + + From cd1eb903819d6b80aae5af92e1e9996669e32961 Mon Sep 17 00:00:00 2001 From: gazizova-vlada Date: Wed, 5 Oct 2022 14:31:47 +0300 Subject: [PATCH 05/54] Web:Client:Add roomFilterProviderType in FilterGroups. --- packages/client/src/helpers/filesConstants.js | 1 + 1 file changed, 1 insertion(+) diff --git a/packages/client/src/helpers/filesConstants.js b/packages/client/src/helpers/filesConstants.js index e2b38d1dba..b2da28a291 100644 --- a/packages/client/src/helpers/filesConstants.js +++ b/packages/client/src/helpers/filesConstants.js @@ -16,6 +16,7 @@ export const FilterGroups = Object.freeze({ filterAuthor: "filter-author", filterFolders: "filter-folders", filterContent: "filter-withContent", + roomFilterProviderType: "filter-provider-type", roomFilterType: "filter-type", roomFilterOwner: "filter-owner", roomFilterTags: "filter-tags", From e92dd1052163015c99a877fce2c255a2ff9d398c Mon Sep 17 00:00:00 2001 From: gazizova-vlada Date: Wed, 5 Oct 2022 14:51:17 +0300 Subject: [PATCH 06/54] Web:Client:Add thirdPartyStore in filesStore. --- packages/client/src/store/index.js | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/packages/client/src/store/index.js b/packages/client/src/store/index.js index 62a326f598..a5a36a7fb6 100644 --- a/packages/client/src/store/index.js +++ b/packages/client/src/store/index.js @@ -61,8 +61,7 @@ const filesStore = new FilesStore( selectedFolderStore, treeFoldersStore, settingsStore, - selectFolderDialogStore, - selectFileDialogStore + thirdPartyStore ); const mediaViewerDataStore = new MediaViewerDataStore( From 114255fd6003fa0972af41a91be06f7294cbbc3f Mon Sep 17 00:00:00 2001 From: gazizova-vlada Date: Wed, 5 Oct 2022 14:51:37 +0300 Subject: [PATCH 07/54] Web:Client:Add getThirdPartyIconSmall. --- packages/client/src/store/ThirdPartyStore.js | 30 ++++++++++++++++++++ 1 file changed, 30 insertions(+) diff --git a/packages/client/src/store/ThirdPartyStore.js b/packages/client/src/store/ThirdPartyStore.js index 0c4eb2671d..af13a14481 100644 --- a/packages/client/src/store/ThirdPartyStore.js +++ b/packages/client/src/store/ThirdPartyStore.js @@ -119,6 +119,36 @@ class ThirdPartyStore { } }; + getThirdPartyIconSmall = (iconName) => { + switch (iconName) { + case "Box": + return "images/icon_box_small.react.svg"; + case "DropboxV2": + return "images/icon_dropbox_small.react.svg"; + case "GoogleDrive": + return "images/icon_google_drive_small.react.svg"; + case "OneDrive": + return "images/icon_onedrive_small.react.svg"; + case "SharePoint": + return "images/icon_sharepoint_small.react.svg"; + case "kDrive": + return "images/icon_kdrive_small.react.svg"; + case "Yandex": + return "images/icon_yandex_disk_small.react.svg"; + case "OwnCloud": + return "images/icon_owncloud_small.react.svg"; + case "NextCloud": + return "images/icon_nextcloud_small.react.svg"; + case "OneDriveForBusiness": + return "images/icon_onedrive_small.react.svg"; + case "WebDav": + return "images/icon_webdav_small.react.svg"; + + default: + return ""; + } + }; + get googleConnectItem() { return ( this.capabilities && this.capabilities.find((x) => x[0] === "GoogleDrive") From 92f28a066c83755f4cbff08c944dfede343ebf1a Mon Sep 17 00:00:00 2001 From: gazizova-vlada Date: Wed, 5 Oct 2022 14:52:02 +0300 Subject: [PATCH 08/54] Web:Common:Add RoomsProviderType. --- packages/common/constants/index.js | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/packages/common/constants/index.js b/packages/common/constants/index.js index 4eef0f545b..282c0e3175 100644 --- a/packages/common/constants/index.js +++ b/packages/common/constants/index.js @@ -83,6 +83,20 @@ export const RoomsTypeTranslations = Object.freeze({ 4: "Files:ViewOnlyRooms", 5: "Files:CustomRooms", }); +/** + * Enum for room provider type. + * @readonly + */ +export const RoomsProviderType = Object.freeze({ + Box: 1, + DropBox: 2, + GoogleDrive: 3, + kDrive: 4, + OneDrive: 5, + SharePoint: 6, + WebDav: 7, + Yandex: 8, +}); /** * Enum for room search area. From cee1eb8c6c4ddf0f179c5427cda8819238de6827 Mon Sep 17 00:00:00 2001 From: gazizova-vlada Date: Wed, 5 Oct 2022 14:54:47 +0300 Subject: [PATCH 09/54] Web:Common:Add provider in filter. --- packages/common/api/rooms/filter.js | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/packages/common/api/rooms/filter.js b/packages/common/api/rooms/filter.js index 07a3f8b428..388e297414 100644 --- a/packages/common/api/rooms/filter.js +++ b/packages/common/api/rooms/filter.js @@ -10,6 +10,9 @@ const DEFAULT_TOTAL = 0; const FILTER_VALUE = "filterValue"; const DEFAULT_FILTER_VALUE = null; +const PROVIDER = "provider"; +const DEFAULT_PROVIDER = null; + const TYPE = "type"; const DEFAULT_TYPE = null; @@ -65,6 +68,9 @@ class RoomsFilter { (urlFilter[FILTER_VALUE] && urlFilter[FILTER_VALUE]) || defaultFilter.filterValue; + const provider = + (urlFilter[PROVIDER] && urlFilter[PROVIDER]) || defaultFilter.filterType; + const type = (urlFilter[TYPE] && urlFilter[TYPE]) || defaultFilter.type; const subjectId = @@ -104,6 +110,7 @@ class RoomsFilter { pageCount, defaultFilter.total, filterValue, + provider, type, subjectId, searchInContent, @@ -124,6 +131,7 @@ class RoomsFilter { pageCount = DEFAULT_PAGE_COUNT, total = DEFAULT_TOTAL, filterValue = DEFAULT_FILTER_VALUE, + provider = DEFAULT_PROVIDER, type = DEFAULT_TYPE, subjectId = DEFAULT_SUBJECT_ID, searchInContent = DEFAULT_SEARCH_IN_CONTENT, @@ -139,6 +147,7 @@ class RoomsFilter { this.pageCount = pageCount; this.total = total; this.filterValue = filterValue; + this.provider = provider; this.type = type; this.subjectId = subjectId; this.searchInContent = searchInContent; @@ -168,6 +177,7 @@ class RoomsFilter { page, pageCount, filterValue, + provider, type, subjectId, searchInContent, @@ -185,6 +195,7 @@ class RoomsFilter { page: page, startIndex: this.getStartIndex(), filterValue: (filterValue ?? "").trim(), + provider: provider, type: type, subjectId: subjectId, searchInContent: searchInContent, @@ -206,6 +217,7 @@ class RoomsFilter { page, pageCount, filterValue, + provider, type, subjectId, searchInContent, @@ -224,6 +236,10 @@ class RoomsFilter { dtoFilter[FILTER_VALUE] = filterValue; } + if (provider) { + dtoFilter[PROVIDER] = provider; + } + if (type) { dtoFilter[TYPE] = type; } @@ -275,6 +291,7 @@ class RoomsFilter { this.pageCount, this.total, this.filterValue, + this.provider, this.type, this.subjectId, this.searchInContent, @@ -300,6 +317,7 @@ class RoomsFilter { const equals = this.page === filter.page && this.pageCount === filter.pageCount && + this.provider === filter.provider && this.filterValue === filter.filterValue && typeEqual && this.subjectId === filter.subjectId && From b959daddee6ce60a4917f138b56314d695a53e7c Mon Sep 17 00:00:00 2001 From: gazizova-vlada Date: Wed, 5 Oct 2022 14:55:36 +0300 Subject: [PATCH 10/54] Web:Client:Add selectOption, delete selectType. --- packages/client/src/store/FilesActionsStore.js | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/packages/client/src/store/FilesActionsStore.js b/packages/client/src/store/FilesActionsStore.js index 6671f9f0c4..25db00ecc5 100644 --- a/packages/client/src/store/FilesActionsStore.js +++ b/packages/client/src/store/FilesActionsStore.js @@ -930,14 +930,21 @@ class FilesActionStore { fetchRooms(id, newFilter).finally(() => setIsLoading(false)); }; - selectType = (type) => { + selectOption = ({ option, value }) => { const { roomsFilter, fetchRooms, setIsLoading } = this.filesStore; const { id } = this.selectedFolderStore; const newFilter = roomsFilter.clone(); const tags = newFilter.tags ? [...newFilter.tags] : []; newFilter.tags = [...tags]; - newFilter.type = type; + + if (option === "defaultTypeRoom") { + newFilter.type = value; + } + + if (option === "typeProvider") { + newFilter.provider = value; + } setIsLoading(true); fetchRooms(id, newFilter).finally(() => setIsLoading(false)); From 46834e110d64f88f2af880f30715246d8f379bf0 Mon Sep 17 00:00:00 2001 From: gazizova-vlada Date: Wed, 5 Oct 2022 14:59:57 +0300 Subject: [PATCH 11/54] Web:Client:Add thirdPartyIcon and providerType in options item. --- packages/client/src/store/FilesStore.js | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/packages/client/src/store/FilesStore.js b/packages/client/src/store/FilesStore.js index 52d52dc9de..f2fe1cb2d9 100644 --- a/packages/client/src/store/FilesStore.js +++ b/packages/client/src/store/FilesStore.js @@ -8,6 +8,7 @@ import { FileStatus, RoomSearchArea, RoomsType, + RoomsProviderType, } from "@docspace/common/constants"; import history from "@docspace/common/history"; import { combineUrl } from "@docspace/common/utils"; @@ -35,6 +36,7 @@ class FilesStore { selectedFolderStore; treeFoldersStore; filesSettingsStore; + thirdPartyStore; isLoaded = false; isLoading = false; @@ -94,7 +96,8 @@ class FilesStore { authStore, selectedFolderStore, treeFoldersStore, - filesSettingsStore + filesSettingsStore, + thirdPartyStore ) { const pathname = window.location.pathname.toLowerCase(); this.isEditor = pathname.indexOf("doceditor") !== -1; @@ -105,6 +108,7 @@ class FilesStore { this.selectedFolderStore = selectedFolderStore; this.treeFoldersStore = treeFoldersStore; this.filesSettingsStore = filesSettingsStore; + this.thirdPartyStore = thirdPartyStore; const { socketHelper, withPaging } = authStore.settingsStore; @@ -1963,6 +1967,15 @@ class FilesStore { pinned, } = item; + const thirdPartyIcon = this.thirdPartyStore.getThirdPartyIconSmall( + item.providerKey + ); + + const providerType = + RoomsProviderType[ + Object.keys(RoomsProviderType).find((key) => key === item.providerKey) + ]; + const { canConvert, isMediaOrImage } = this.filesSettingsStore; const canOpenPlayer = isMediaOrImage(item.fileExst); @@ -2075,6 +2088,8 @@ class FilesStore { isArchive, tags, pinned, + thirdPartyIcon, + providerType, }; }); From f1216660e8581c3da1f584d7616b43d421294403 Mon Sep 17 00:00:00 2001 From: gazizova-vlada Date: Wed, 5 Oct 2022 15:18:59 +0300 Subject: [PATCH 12/54] Web:Client:Add in filterValues filter by provider type. --- .../src/pages/Home/Section/Filter/index.js | 31 ++++++++++++++++++- 1 file changed, 30 insertions(+), 1 deletion(-) diff --git a/packages/client/src/pages/Home/Section/Filter/index.js b/packages/client/src/pages/Home/Section/Filter/index.js index a212422f55..efe4c1396d 100644 --- a/packages/client/src/pages/Home/Section/Filter/index.js +++ b/packages/client/src/pages/Home/Section/Filter/index.js @@ -12,7 +12,11 @@ import { } from "@docspace/client/src/helpers/filesConstants"; import { getUser } from "@docspace/common/api/people"; -import { FilterType, RoomsType } from "@docspace/common/constants"; +import { + FilterType, + RoomsType, + RoomsProviderType, +} from "@docspace/common/constants"; import Loaders from "@docspace/common/components/Loaders"; import FilterInput from "@docspace/common/components/FilterInput"; import { withLayoutSize } from "@docspace/common/utils"; @@ -138,6 +142,7 @@ const SectionFilterContent = ({ userId, isPersonalRoom, setCurrentRoomsFilter, + getThirdPartyIconSmall, }) => { const onFilter = React.useCallback( (data) => { @@ -360,6 +365,20 @@ const SectionFilterContent = ({ // }); // } + if (roomsFilter.provider) { + const provider = +roomsFilter.provider; + + const providerKey = Object.entries(RoomsProviderType).find( + (item) => item[1] === provider + )[0]; + + filterValues.push({ + key: provider, + icon: getThirdPartyIconSmall(providerKey), + group: FilterGroups.roomFilterProviderType, + }); + } + if (roomsFilter.type) { const key = +roomsFilter.type; @@ -502,6 +521,7 @@ const SectionFilterContent = ({ filter.filterType, filter.searchInContent, filter.excludeSubject, + roomsFilter.provider, roomsFilter.type, roomsFilter.subjectId, roomsFilter.tags, @@ -512,6 +532,7 @@ const SectionFilterContent = ({ // roomsFilter.searchInContent, userId, isRooms, + getThirdPartyIconSmall, ]); const getFilterData = React.useCallback(async () => { @@ -960,6 +981,10 @@ const SectionFilterContent = ({ const newFilter = roomsFilter.clone(); + if (group === FilterGroups.roomFilterProviderType) { + newFilter.provider = null; + } + if (group === FilterGroups.roomFilterType) { newFilter.type = null; } @@ -1090,8 +1115,11 @@ export default inject( viewAs, createThumbnails, setCurrentRoomsFilter, + thirdPartyStore, } = filesStore; + const { getThirdPartyIconSmall } = thirdPartyStore; + const { fetchTags } = tagsStore; const { user } = auth.userStore; @@ -1133,6 +1161,7 @@ export default inject( isPersonalRoom, infoPanelVisible, setCurrentRoomsFilter, + getThirdPartyIconSmall, }; } )( From 6f9db105a9bc2fa9aab78123c337449c3f01e99c Mon Sep 17 00:00:00 2001 From: gazizova-vlada Date: Wed, 5 Oct 2022 15:20:32 +0300 Subject: [PATCH 13/54] Web:Client:Change onSelectType to onSelectOption. --- packages/client/src/HOCs/withFileActions.js | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/packages/client/src/HOCs/withFileActions.js b/packages/client/src/HOCs/withFileActions.js index 1b2bc9181a..ea9af5a181 100644 --- a/packages/client/src/HOCs/withFileActions.js +++ b/packages/client/src/HOCs/withFileActions.js @@ -176,8 +176,8 @@ export default function withFileActions(WrappedFileItem) { this.props.selectTag(tag); }; - onSelectType = (type) => { - this.props.selectType(type); + onSelectOption = (selectedOption) => { + this.props.selectOption(selectedOption); }; getContextModel = () => { @@ -241,7 +241,7 @@ export default function withFileActions(WrappedFileItem) { onMouseClick={this.onMouseClick} onHideContextMenu={this.onHideContextMenu} onSelectTag={this.onSelectTag} - onSelectType={this.onSelectType} + onSelectOption={this.onSelectOption} getClassName={this.getClassName} className={className} isDragging={isDragging} @@ -276,7 +276,7 @@ export default function withFileActions(WrappedFileItem) { const { selectRowAction, selectTag, - selectType, + selectOption, onSelectItem, setNewBadgeCount, openFileAction, @@ -345,7 +345,7 @@ export default function withFileActions(WrappedFileItem) { selectRowAction, onSelectItem, selectTag, - selectType, + selectOption, setSharingPanelVisible, isPrivacy: isPrivacyFolder, isRoomsFolder, From f149f0bdfa7002a77302b75820fadf5db37c74e2 Mon Sep 17 00:00:00 2001 From: gazizova-vlada Date: Wed, 5 Oct 2022 15:21:24 +0300 Subject: [PATCH 14/54] Web:Client:Delete onSelectType. --- .../client/src/pages/Home/Section/Body/TableView/TableRow.js | 1 - 1 file changed, 1 deletion(-) diff --git a/packages/client/src/pages/Home/Section/Body/TableView/TableRow.js b/packages/client/src/pages/Home/Section/Body/TableView/TableRow.js index fa7fb302f4..333124530f 100644 --- a/packages/client/src/pages/Home/Section/Body/TableView/TableRow.js +++ b/packages/client/src/pages/Home/Section/Body/TableView/TableRow.js @@ -296,7 +296,6 @@ const FilesTableRow = (props) => { id, isRooms, - onSelectType, } = props; const { acceptBackground, background } = theme.dragAndDrop; From 55e17eef429fc3995a519df37caa699f4b9063a5 Mon Sep 17 00:00:00 2001 From: gazizova-vlada Date: Wed, 5 Oct 2022 15:23:39 +0300 Subject: [PATCH 15/54] Web:Components:Add icon in tag. --- packages/components/tag/index.js | 39 +++++++++++++++++++------------- 1 file changed, 23 insertions(+), 16 deletions(-) diff --git a/packages/components/tag/index.js b/packages/components/tag/index.js index 7b9c2e9816..c3a7297d04 100644 --- a/packages/components/tag/index.js +++ b/packages/components/tag/index.js @@ -25,6 +25,7 @@ const Tag = ({ id, className, style, + icon, }) => { const [openDropdown, setOpenDropdown] = React.useState(false); @@ -113,22 +114,28 @@ const Tag = ({ className={`tag${className ? ` ${className}` : ""}`} style={style} > - - {label} - - {isNewTag && ( - + {icon ? ( + + ) : ( + <> + + {label} + + {isNewTag && ( + + )} + )} )} From ee43c167cc005cf5a7d9a5f3f0f4f19a2e161e19 Mon Sep 17 00:00:00 2001 From: gazizova-vlada Date: Wed, 5 Oct 2022 15:24:11 +0300 Subject: [PATCH 16/54] Web:Common:Add icon in SelectedItem. --- .../FilterInput/sub-components/SelectedItem.js | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/packages/common/components/FilterInput/sub-components/SelectedItem.js b/packages/common/components/FilterInput/sub-components/SelectedItem.js index ebe1955a09..9b13f39750 100644 --- a/packages/common/components/FilterInput/sub-components/SelectedItem.js +++ b/packages/common/components/FilterInput/sub-components/SelectedItem.js @@ -32,16 +32,20 @@ const StyledSelectedItem = styled.div` StyledSelectedItem.defaultProps = { theme: Base }; -const SelectedItem = ({ propKey, label, group, removeSelectedItem }) => { +const SelectedItem = ({ propKey, label, group, icon, removeSelectedItem }) => { const onRemove = () => { removeSelectedItem(propKey, label, group); }; return ( - - {label} - + {icon ? ( + + ) : ( + + {label} + + )} Date: Wed, 5 Oct 2022 15:24:36 +0300 Subject: [PATCH 17/54] Web:Common:Add props icon in SelectedItem. --- packages/common/components/FilterInput/index.js | 1 + 1 file changed, 1 insertion(+) diff --git a/packages/common/components/FilterInput/index.js b/packages/common/components/FilterInput/index.js index df5590f4c1..97c61bb22b 100644 --- a/packages/common/components/FilterInput/index.js +++ b/packages/common/components/FilterInput/index.js @@ -164,6 +164,7 @@ const FilterInput = React.memo( From eb37163ea9a369328ce19c69d1690ef300f9104a Mon Sep 17 00:00:00 2001 From: gazizova-vlada Date: Wed, 5 Oct 2022 15:25:10 +0300 Subject: [PATCH 18/54] Web:Client:Change onSelectType to onSelectOption. --- .../client/src/pages/Home/Section/Body/TilesView/FileTile.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/client/src/pages/Home/Section/Body/TilesView/FileTile.js b/packages/client/src/pages/Home/Section/Body/TilesView/FileTile.js index c920c604b4..301eeb523f 100644 --- a/packages/client/src/pages/Home/Section/Body/TilesView/FileTile.js +++ b/packages/client/src/pages/Home/Section/Body/TilesView/FileTile.js @@ -43,7 +43,7 @@ const FileTile = (props) => { setSelection, id, onSelectTag, - onSelectType, + onSelectOption, columnCount, } = props; @@ -111,7 +111,7 @@ const FileTile = (props) => { showHotkeyBorder={showHotkeyBorder} setSelection={setSelection} selectTag={onSelectTag} - selectType={onSelectType} + selectOption={onSelectOption} columnCount={columnCount} > Date: Wed, 5 Oct 2022 15:26:32 +0300 Subject: [PATCH 19/54] Web:Client:Change selectType to selectOption, add props isThirdParty in StyledTile, add tag with providerType. --- .../Body/TilesView/sub-components/Tile.js | 24 +++++++++++++++++-- 1 file changed, 22 insertions(+), 2 deletions(-) diff --git a/packages/client/src/pages/Home/Section/Body/TilesView/sub-components/Tile.js b/packages/client/src/pages/Home/Section/Body/TilesView/sub-components/Tile.js index d31dd339b6..567cb49287 100644 --- a/packages/client/src/pages/Home/Section/Body/TilesView/sub-components/Tile.js +++ b/packages/client/src/pages/Home/Section/Body/TilesView/sub-components/Tile.js @@ -53,6 +53,7 @@ const roomsStyles = css` } .room-tile_bottom-content { + display: ${(props) => props.isThirdParty && "flex"}; width: 100%; height: 56px; @@ -465,7 +466,7 @@ class Tile extends React.PureComponent { t, columnCount, selectTag, - selectType, + selectOption, } = this.props; const { isFolder, isRoom, id, fileExst } = item; @@ -525,6 +526,7 @@ class Tile extends React.PureComponent { inProgress={inProgress} showHotkeyBorder={showHotkeyBorder} onClick={this.onFileClick} + isThirdParty={item.providerType} > {isFolder || (!fileExst && id === -1) ? ( isRoom ? ( @@ -588,6 +590,19 @@ class Tile extends React.PureComponent {
+ {item.providerType && ( + + selectOption({ + option: "typeProvider", + value: item.providerType, + }) + } + /> + )} + {item.tags.length > 0 ? ( selectType(item.roomType)} + onClick={() => + selectOption({ + option: "defaultTypeRoom", + value: item.roomType, + }) + } /> )}
From cf4559f486447258366615cae6fdf984c61807e5 Mon Sep 17 00:00:00 2001 From: gazizova-vlada Date: Wed, 5 Oct 2022 15:27:43 +0300 Subject: [PATCH 20/54] Web:Client:Add tag with providerType, change onSelectType to onSelectOption. --- .../Body/TableView/sub-components/TagsCell.js | 30 +++++++++++++++++-- 1 file changed, 27 insertions(+), 3 deletions(-) diff --git a/packages/client/src/pages/Home/Section/Body/TableView/sub-components/TagsCell.js b/packages/client/src/pages/Home/Section/Body/TableView/sub-components/TagsCell.js index d8cd87c975..fa98ca8eb4 100644 --- a/packages/client/src/pages/Home/Section/Body/TableView/sub-components/TagsCell.js +++ b/packages/client/src/pages/Home/Section/Body/TableView/sub-components/TagsCell.js @@ -5,9 +5,28 @@ import Tags from "@docspace/common/components/Tags"; import Tag from "@docspace/components/tag"; import { RoomsTypeTranslations } from "@docspace/common/constants"; -const TagsCell = ({ t, item, tagCount, onSelectTag, onSelectType }) => { +const TagsCell = ({ t, item, tagCount, onSelectTag, onSelectOption }) => { + const styleTagsCell = { + width: "100%", + overflow: "hidden", + display: item.thirdPartyIcon ? "flex" : "", + }; + return ( -
+
+ {item.providerType && ( + + onSelectOption({ + option: "typeProvider", + value: item.providerType, + }) + } + /> + )} + {item.tags.length > 0 ? ( { onSelectType(item.roomType)} + onClick={() => + onSelectOption({ + option: "defaultTypeRoom", + value: item.roomType, + }) + } /> )}
From 0ba61c940bc6bc9943489b90b93a0ff3e5668fcf Mon Sep 17 00:00:00 2001 From: gazizova-vlada Date: Thu, 6 Oct 2022 12:44:14 +0300 Subject: [PATCH 21/54] Web:Client:Add translation "ThirdPartyResource". --- packages/client/public/locales/en/Files.json | 1 + 1 file changed, 1 insertion(+) diff --git a/packages/client/public/locales/en/Files.json b/packages/client/public/locales/en/Files.json index d3e619460e..b030a3c749 100644 --- a/packages/client/public/locales/en/Files.json +++ b/packages/client/public/locales/en/Files.json @@ -94,6 +94,7 @@ "ShowVersionHistory": "Show version history", "Spreadsheet": "Spreadsheet", "Tags": "Tags", + "ThirdPartyResource": "Third party resource", "ToArchive": "Move to archive", "TooltipElementCopyMessage": "Copy {{element}}", "TooltipElementsCopyMessage": "Copy {{element}} elements", From 2b471fc6104fbd9294394f1a60cbc37a842d6913 Mon Sep 17 00:00:00 2001 From: gazizova-vlada Date: Thu, 6 Oct 2022 12:48:16 +0300 Subject: [PATCH 22/54] Web:Client:Add getProviderType, providerType in FilterInput. --- .../src/pages/Home/Section/Filter/index.js | 44 ++++++++++++++++++- 1 file changed, 42 insertions(+), 2 deletions(-) diff --git a/packages/client/src/pages/Home/Section/Filter/index.js b/packages/client/src/pages/Home/Section/Filter/index.js index efe4c1396d..409b9ba04f 100644 --- a/packages/client/src/pages/Home/Section/Filter/index.js +++ b/packages/client/src/pages/Home/Section/Filter/index.js @@ -68,6 +68,16 @@ const getType = (filterValues) => { return type; }; +const getProviderType = (filterValues) => { + const filterType = filterValues.find( + (value) => value.group === FilterGroups.roomFilterProviderType + )?.key[0]; + + const type = filterType; + + return type; +}; + const getOwner = (filterValues) => { const filterOwner = result( find(filterValues, (value) => { @@ -143,6 +153,7 @@ const SectionFilterContent = ({ isPersonalRoom, setCurrentRoomsFilter, getThirdPartyIconSmall, + providers, }) => { const onFilter = React.useCallback( (data) => { @@ -158,6 +169,7 @@ const SectionFilterContent = ({ const withoutMe = owner === FilterKeys.other; + const providerType = getProviderType(data) || null; const tags = getTags(data) || null; // const withSubfolders = @@ -170,6 +182,7 @@ const SectionFilterContent = ({ const newFilter = roomsFilter.clone(); newFilter.page = 0; + newFilter.provider = providerType ? providerType : null; newFilter.type = type ? type : null; newFilter.subjectId = subjectId ? subjectId : null; if (tags) { @@ -723,6 +736,12 @@ const SectionFilterContent = ({ filterOptions.push(...typeOptions); const tags = await fetchTags(); + const connectedThirdParty = []; + + providers.forEach((item) => { + if (connectedThirdParty.includes(item.provider_key)) return; + connectedThirdParty.push(item.provider_key); + }); if (tags) { const tagsOptions = tags.map((tag) => ({ @@ -744,11 +763,31 @@ const SectionFilterContent = ({ group: FilterGroups.roomFilterTags, label: t("Tags"), isHeader: true, - isLast: true, }); filterOptions.push(...tagsOptions); } + + if (connectedThirdParty) { + const thirdPartyOptions = connectedThirdParty.map((thirdParty) => ({ + key: Object.entries(RoomsProviderType).find( + (item) => item[0] === thirdParty + )[1], + group: FilterGroups.roomFilterProviderType, + label: thirdParty, + isMultiSelect: true, + })); + + filterOptions.push({ + key: FilterGroups.roomFilterProviderType, + group: FilterGroups.roomFilterProviderType, + label: t("ThirdPartyResource"), + isHeader: true, + isLast: true, + }); + + filterOptions.push(...thirdPartyOptions); + } } else { if (!isRecentFolder && !isFavoritesFolder) { const foldersOptions = [ @@ -1118,7 +1157,7 @@ export default inject( thirdPartyStore, } = filesStore; - const { getThirdPartyIconSmall } = thirdPartyStore; + const { getThirdPartyIconSmall, providers } = thirdPartyStore; const { fetchTags } = tagsStore; @@ -1162,6 +1201,7 @@ export default inject( infoPanelVisible, setCurrentRoomsFilter, getThirdPartyIconSmall, + providers, }; } )( From f790a61dac5e3a5ee69513cd376d76ba802df769 Mon Sep 17 00:00:00 2001 From: gazizova-vlada Date: Thu, 6 Oct 2022 13:21:49 +0300 Subject: [PATCH 23/54] Web:Common:Delete props icon from SelectedItem. --- .../FilterInput/sub-components/SelectedItem.js | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/packages/common/components/FilterInput/sub-components/SelectedItem.js b/packages/common/components/FilterInput/sub-components/SelectedItem.js index 9b13f39750..ebe1955a09 100644 --- a/packages/common/components/FilterInput/sub-components/SelectedItem.js +++ b/packages/common/components/FilterInput/sub-components/SelectedItem.js @@ -32,20 +32,16 @@ const StyledSelectedItem = styled.div` StyledSelectedItem.defaultProps = { theme: Base }; -const SelectedItem = ({ propKey, label, group, icon, removeSelectedItem }) => { +const SelectedItem = ({ propKey, label, group, removeSelectedItem }) => { const onRemove = () => { removeSelectedItem(propKey, label, group); }; return ( - {icon ? ( - - ) : ( - - {label} - - )} + + {label} + Date: Thu, 6 Oct 2022 13:24:28 +0300 Subject: [PATCH 24/54] Web:Client:Change icon to label in filterValues for roomsFilter.provider. --- packages/client/src/pages/Home/Section/Filter/index.js | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/packages/client/src/pages/Home/Section/Filter/index.js b/packages/client/src/pages/Home/Section/Filter/index.js index 409b9ba04f..af7e537574 100644 --- a/packages/client/src/pages/Home/Section/Filter/index.js +++ b/packages/client/src/pages/Home/Section/Filter/index.js @@ -152,7 +152,6 @@ const SectionFilterContent = ({ userId, isPersonalRoom, setCurrentRoomsFilter, - getThirdPartyIconSmall, providers, }) => { const onFilter = React.useCallback( @@ -381,13 +380,13 @@ const SectionFilterContent = ({ if (roomsFilter.provider) { const provider = +roomsFilter.provider; - const providerKey = Object.entries(RoomsProviderType).find( + const label = Object.entries(RoomsProviderType).find( (item) => item[1] === provider )[0]; filterValues.push({ key: provider, - icon: getThirdPartyIconSmall(providerKey), + label: label, group: FilterGroups.roomFilterProviderType, }); } @@ -545,7 +544,6 @@ const SectionFilterContent = ({ // roomsFilter.searchInContent, userId, isRooms, - getThirdPartyIconSmall, ]); const getFilterData = React.useCallback(async () => { @@ -1157,7 +1155,7 @@ export default inject( thirdPartyStore, } = filesStore; - const { getThirdPartyIconSmall, providers } = thirdPartyStore; + const { providers } = thirdPartyStore; const { fetchTags } = tagsStore; @@ -1200,7 +1198,6 @@ export default inject( isPersonalRoom, infoPanelVisible, setCurrentRoomsFilter, - getThirdPartyIconSmall, providers, }; } From e5a2331003c3c6318322bc793629bd614810f299 Mon Sep 17 00:00:00 2001 From: gazizova-vlada Date: Thu, 6 Oct 2022 13:24:50 +0300 Subject: [PATCH 25/54] Web:Common:Delete props icon. --- packages/common/components/FilterInput/index.js | 1 - 1 file changed, 1 deletion(-) diff --git a/packages/common/components/FilterInput/index.js b/packages/common/components/FilterInput/index.js index 97c61bb22b..df5590f4c1 100644 --- a/packages/common/components/FilterInput/index.js +++ b/packages/common/components/FilterInput/index.js @@ -164,7 +164,6 @@ const FilterInput = React.memo( From b018be53f9969c879994a95b953cd0c3310cb10b Mon Sep 17 00:00:00 2001 From: gazizova-vlada Date: Mon, 10 Oct 2022 19:11:37 +0300 Subject: [PATCH 26/54] Web:Client:Add reconnect image. --- packages/client/public/images/reconnect.svg | 3 +++ 1 file changed, 3 insertions(+) create mode 100644 packages/client/public/images/reconnect.svg diff --git a/packages/client/public/images/reconnect.svg b/packages/client/public/images/reconnect.svg new file mode 100644 index 0000000000..085ad85271 --- /dev/null +++ b/packages/client/public/images/reconnect.svg @@ -0,0 +1,3 @@ + + + From 49d688450272a028da852dae8e034398bfe9998b Mon Sep 17 00:00:00 2001 From: gazizova-vlada Date: Mon, 10 Oct 2022 19:12:26 +0300 Subject: [PATCH 27/54] Web:Client:Add translation "SuccessfulConnectionOfAThirdParty". --- packages/client/public/locales/en/ConnectDialog.json | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/packages/client/public/locales/en/ConnectDialog.json b/packages/client/public/locales/en/ConnectDialog.json index 22219770e9..5967c8f71d 100644 --- a/packages/client/public/locales/en/ConnectDialog.json +++ b/packages/client/public/locales/en/ConnectDialog.json @@ -4,5 +4,6 @@ "ConnectMakeShared": "Share and put into 'Common' folder", "ConnectionUrl": "Connection url", "Login": "Login", - "Reconnect": "Reconnect" + "Reconnect": "Reconnect", + "SuccessfulConnectionOfAThirdParty": "Connection of a third-party resource was successful." } From 60b9ed3dd1ec113eb4b48d7765ef22316e9d32c6 Mon Sep 17 00:00:00 2001 From: gazizova-vlada Date: Mon, 10 Oct 2022 19:13:01 +0300 Subject: [PATCH 28/54] Web:Add translation "ReconnectStorage". --- public/locales/en/Common.json | 1 + 1 file changed, 1 insertion(+) diff --git a/public/locales/en/Common.json b/public/locales/en/Common.json index ec6b1243fc..b18ba98e00 100644 --- a/public/locales/en/Common.json +++ b/public/locales/en/Common.json @@ -144,6 +144,7 @@ "PunycodeDomain": "Punycode domains are not supported", "PunycodeLocalPart": "Punycode local part is not supported", "Plugin": "Plugin", + "ReconnectStorage": "Reconnect storage", "RequiredField": "Required field", "ResetApplication": "Reset application", "Restore": "Restore", From 16dc28d6b29cffee0b1cd7c82d02eedf437b0179 Mon Sep 17 00:00:00 2001 From: gazizova-vlada Date: Mon, 10 Oct 2022 19:14:33 +0300 Subject: [PATCH 29/54] Web:Client:Moved getting connectItems to ThirdPartyStore. --- .../GlobalEvents/CreateRoomEvent.js | 46 +------------------ packages/client/src/store/ThirdPartyStore.js | 42 +++++++++++++++++ 2 files changed, 43 insertions(+), 45 deletions(-) diff --git a/packages/client/src/components/GlobalEvents/CreateRoomEvent.js b/packages/client/src/components/GlobalEvents/CreateRoomEvent.js index cb98c25780..c0f44461f2 100644 --- a/packages/client/src/components/GlobalEvents/CreateRoomEvent.js +++ b/packages/client/src/components/GlobalEvents/CreateRoomEvent.js @@ -140,51 +140,7 @@ export default inject( const thirdPartyStore = settingsStore.thirdPartyStore; - const { openConnectWindow } = settingsStore.thirdPartyStore; - - let nextCloudConnectItem = [], - ownCloudConnectItem = []; - - if (thirdPartyStore.nextCloudConnectItem) { - nextCloudConnectItem.push( - ...thirdPartyStore.nextCloudConnectItem, - "Nextcloud" - ); - } - - if (thirdPartyStore.ownCloudConnectItem) { - ownCloudConnectItem.push( - ...thirdPartyStore.ownCloudConnectItem, - "ownCloud" - ); - } - - const connectItems = [ - thirdPartyStore.googleConnectItem, - thirdPartyStore.boxConnectItem, - thirdPartyStore.dropboxConnectItem, - thirdPartyStore.oneDriveConnectItem, - nextCloudConnectItem, - thirdPartyStore.kDriveConnectItem, - thirdPartyStore.yandexConnectItem, - ownCloudConnectItem, - thirdPartyStore.webDavConnectItem, - thirdPartyStore.sharePointConnectItem, - ] - .map( - (item) => - item && { - isAvialable: !!item, - id: item[0], - providerName: item[0], - isOauth: item.length > 1 && item[0] !== "WebDav", - oauthHref: item.length > 1 && item[0] !== "WebDav" ? item[1] : "", - ...(item[0] === "WebDav" && { - category: item[item.length - 1], - }), - } - ) - .filter((item) => !!item); + const { connectItems, openConnectWindow } = thirdPartyStore; const { getOAuthToken } = auth.settingsStore; diff --git a/packages/client/src/store/ThirdPartyStore.js b/packages/client/src/store/ThirdPartyStore.js index af13a14481..09a0d7359e 100644 --- a/packages/client/src/store/ThirdPartyStore.js +++ b/packages/client/src/store/ThirdPartyStore.js @@ -206,6 +206,48 @@ class ThirdPartyStore { this.capabilities && this.capabilities.find((x) => x[0] === "WebDav") ); } + + get connectItems() { + let nextCloudConnectItem = [], + ownCloudConnectItem = []; + + if (this.nextCloudConnectItem) { + nextCloudConnectItem.push(...this.nextCloudConnectItem, "Nextcloud"); + } + + if (this.ownCloudConnectItem) { + ownCloudConnectItem.push(...this.ownCloudConnectItem, "ownCloud"); + } + + const connectItems = [ + this.googleConnectItem, + this.boxConnectItem, + this.dropboxConnectItem, + this.oneDriveConnectItem, + nextCloudConnectItem, + this.kDriveConnectItem, + this.yandexConnectItem, + ownCloudConnectItem, + this.webDavConnectItem, + this.sharePointConnectItem, + ] + .map( + (item) => + item && { + isAvialable: !!item, + id: item[0], + providerName: item[0], + isOauth: item.length > 1 && item[0] !== "WebDav", + oauthHref: item.length > 1 && item[0] !== "WebDav" ? item[1] : "", + ...(item[0] === "WebDav" && { + category: item[item.length - 1], + }), + } + ) + .filter((item) => !!item); + + return connectItems; + } } export default new ThirdPartyStore(); From ec45c0b4c7068442a28ac5d87d74b3cc93b3d1f2 Mon Sep 17 00:00:00 2001 From: gazizova-vlada Date: Mon, 10 Oct 2022 19:15:16 +0300 Subject: [PATCH 30/54] Web:Client:Add "reconnect-storage" in roomOptions. --- packages/client/src/store/FilesStore.js | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/packages/client/src/store/FilesStore.js b/packages/client/src/store/FilesStore.js index 5f7ec3f51b..f79fe34f91 100644 --- a/packages/client/src/store/FilesStore.js +++ b/packages/client/src/store/FilesStore.js @@ -1350,6 +1350,7 @@ class FilesStore { return fileOptions; } else if (isRoom) { let roomOptions = [ + "reconnect-storage", "edit-room", "invite-users-to-room", "room-info", @@ -1361,6 +1362,10 @@ class FilesStore { "delete", ]; + if (!item.providerKey) { + roomOptions = this.removeOptions(roomOptions, ["reconnect-storage"]); + } + if (item.pinned) { roomOptions = this.removeOptions(roomOptions, ["pin-room"]); } else { From c5bba6a596c38ce94081fe80d5e8c3fa15124eec Mon Sep 17 00:00:00 2001 From: gazizova-vlada Date: Mon, 10 Oct 2022 19:16:40 +0300 Subject: [PATCH 31/54] Web:Client:Add setIsConnectDialogReconnect, setSaveAfterReconnectOAuth, saveAfterReconnectOAuth, isConnectDialogReconnect. --- packages/client/src/store/DialogsStore.js | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/packages/client/src/store/DialogsStore.js b/packages/client/src/store/DialogsStore.js index 8a5f1e6290..6fb78b4d73 100644 --- a/packages/client/src/store/DialogsStore.js +++ b/packages/client/src/store/DialogsStore.js @@ -44,6 +44,9 @@ class DialogsStore { formCreationInfo = null; saveThirdpartyResponse = null; + isConnectDialogReconnect = false; + saveAfterReconnectOAuth = false; + constructor( authStore, treeFoldersStore, @@ -134,6 +137,14 @@ class DialogsStore { this.connectItem = connectItem; }; + setIsConnectDialogReconnect = (isConnectDialogReconnect) => { + this.isConnectDialogReconnect = isConnectDialogReconnect; + }; + + setSaveAfterReconnectOAuth = (saveAfterReconnectOAuth) => { + this.saveAfterReconnectOAuth = saveAfterReconnectOAuth; + }; + setThirdPartyDialogVisible = (thirdPartyDialogVisible) => { this.thirdPartyDialogVisible = thirdPartyDialogVisible; }; From 7b3bd37f2c49ab764eb8b67c022ffb452d34df08 Mon Sep 17 00:00:00 2001 From: gazizova-vlada Date: Mon, 10 Oct 2022 19:24:23 +0300 Subject: [PATCH 32/54] Web:Client:Add method onClickReconnectStorage, add object "reconnect-storage" in optionsModel in getFilesContextOptions in ContextOptionsStore. Add props isConnectDialogReconnect, setIsConnectDialogReconnect, saveAfterReconnectOAuth, setSaveAfterReconnectOAuth in ConnectDialog. Add changeable header, add toastr in saveThirdParty in ConnectDialog. --- .../components/dialogs/ConnectDialog/index.js | 39 +++++++++-- .../client/src/store/ContextOptionsStore.js | 64 +++++++++++++++++++ 2 files changed, 99 insertions(+), 4 deletions(-) diff --git a/packages/client/src/components/dialogs/ConnectDialog/index.js b/packages/client/src/components/dialogs/ConnectDialog/index.js index bbe79f59c6..d3224213b5 100644 --- a/packages/client/src/components/dialogs/ConnectDialog/index.js +++ b/packages/client/src/components/dialogs/ConnectDialog/index.js @@ -30,6 +30,10 @@ const PureConnectDialogContainer = (props) => { isConnectionViaBackupModule, roomCreation, setSaveThirdpartyResponse, + isConnectDialogReconnect, + setIsConnectDialogReconnect, + saveAfterReconnectOAuth, + setSaveAfterReconnectOAuth, } = props; const { corporate, @@ -65,6 +69,10 @@ const PureConnectDialogContainer = (props) => { key === "WebDav" || key === "SharePoint"; + const header = isConnectDialogReconnect + ? t("Common:ReconnectStorage") + : t("Translations:ConnectingAccount"); + const onChangeUrl = (e) => { setIsUrlValid(true); setUrlValue(e.target.value); @@ -93,7 +101,16 @@ const PureConnectDialogContainer = (props) => { const onClose = useCallback(() => { !isLoading && setConnectDialogVisible(false); - }, [isLoading, setConnectDialogVisible]); + + if (isConnectDialogReconnect) { + setIsConnectDialogReconnect(false); + } + }, [ + isLoading, + setConnectDialogVisible, + isConnectDialogReconnect, + setIsConnectDialogReconnect, + ]); const onSave = useCallback(() => { const isTitleValid = !!customerTitle.trim(); @@ -161,6 +178,7 @@ const PureConnectDialogContainer = (props) => { ) .then(async (res) => { setSaveThirdpartyResponse(res); + toastr.success(t("SuccessfulConnectionOfAThirdParty")); await fetchThirdPartyProviders(); }) .catch((err) => { @@ -171,6 +189,7 @@ const PureConnectDialogContainer = (props) => { .finally(() => { onClose(); setIsLoading(false); + setSaveAfterReconnectOAuth(false); }); }, [ customerTitle, @@ -214,6 +233,12 @@ const PureConnectDialogContainer = (props) => { return setToken(token); }, [setToken, token]); + useEffect(() => { + if (saveAfterReconnectOAuth) { + onSave(); + } + }, [saveAfterReconnectOAuth]); + return ( { autoMaxHeight onClose={onClose} > - - {t("Translations:ConnectingAccount")} - + {header} {isAccount ? ( { + const { thirdPartyStore } = this.settingsStore; + + const { openConnectWindow, connectItems } = thirdPartyStore; + + const { + setRoomCreation, + setConnectItem, + setConnectDialogVisible, + setIsConnectDialogReconnect, + setSaveAfterReconnectOAuth, + } = this.dialogsStore; + + setIsConnectDialogReconnect(true); + + setRoomCreation(true); + + const provider = connectItems.find( + (connectItem) => connectItem.providerName === item.providerKey + ); + + const itemThirdParty = { + title: connectedCloudsTypeTitleTranslation(provider.providerName, t), + customer_title: "NOTITLE", + provider_key: provider.providerName, + link: provider.oauthHref, + }; + + if (provider.isOauth) { + let authModal = window.open( + "", + "Authorization", + "height=600, width=1020" + ); + await openConnectWindow(provider.providerName, authModal) + .then(getOAuthToken) + .then((token) => { + authModal.close(); + setConnectItem({ + ...itemThirdParty, + token, + }); + + setSaveAfterReconnectOAuth(true); + }) + .catch((err) => { + if (!err) return; + toastr.error(err); + }); + } else { + setConnectItem(itemThirdParty); + setConnectDialogVisible(true); + } + }; + onClickMakeForm = (item, t) => { const { setConvertPasswordDialogVisible, @@ -534,6 +591,13 @@ class ContextOptionsStore { onClick: () => this.onClickMakeForm(item, t), disabled: false, }, + { + key: "reconnect-storage", + label: t("Common:ReconnectStorage"), + icon: "images/reconnect.svg", + onClick: () => this.onClickReconnectStorage(item, t), + disabled: false, + }, { key: "edit-room", label: "Edit room", From 0a87f8988dca852b4c17dc00beecfdce28931a27 Mon Sep 17 00:00:00 2001 From: gazizova-vlada Date: Wed, 12 Oct 2022 13:35:49 +0300 Subject: [PATCH 33/54] Web:Client:Delete field isMultiSelect in thirdPartyOptions. --- packages/client/src/pages/Home/Section/Filter/index.js | 1 - 1 file changed, 1 deletion(-) diff --git a/packages/client/src/pages/Home/Section/Filter/index.js b/packages/client/src/pages/Home/Section/Filter/index.js index a3244e71d0..2173f8667f 100644 --- a/packages/client/src/pages/Home/Section/Filter/index.js +++ b/packages/client/src/pages/Home/Section/Filter/index.js @@ -773,7 +773,6 @@ const SectionFilterContent = ({ )[1], group: FilterGroups.roomFilterProviderType, label: thirdParty, - isMultiSelect: true, })); filterOptions.push({ From 7273fda06c97b5f902a3a9a7e3b83e92f81f3e30 Mon Sep 17 00:00:00 2001 From: gazizova-vlada Date: Wed, 12 Oct 2022 13:37:09 +0300 Subject: [PATCH 34/54] Web:Common:Add props label, group in SelectedItem. --- packages/common/components/FilterInput/index.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/packages/common/components/FilterInput/index.js b/packages/common/components/FilterInput/index.js index df5590f4c1..7a16c0554b 100644 --- a/packages/common/components/FilterInput/index.js +++ b/packages/common/components/FilterInput/index.js @@ -164,7 +164,8 @@ const FilterInput = React.memo( ))} From c51e42f2f45e5fd3a5b152ae081623e46e371ca0 Mon Sep 17 00:00:00 2001 From: gazizova-vlada Date: Wed, 12 Oct 2022 13:47:43 +0300 Subject: [PATCH 35/54] Web:Client:Delete wrong translation "ThirdPartyResource". --- packages/client/public/locales/en/Files.json | 1 - 1 file changed, 1 deletion(-) diff --git a/packages/client/public/locales/en/Files.json b/packages/client/public/locales/en/Files.json index dba9926e44..db62c7ef70 100644 --- a/packages/client/public/locales/en/Files.json +++ b/packages/client/public/locales/en/Files.json @@ -95,7 +95,6 @@ "ShowVersionHistory": "Show version history", "Spreadsheet": "Spreadsheet", "Tags": "Tags", - "ThirdPartyResource": "Third party resource", "ToArchive": "Move to archive", "TooltipElementCopyMessage": "Copy {{element}}", "TooltipElementsCopyMessage": "Copy {{element}} elements", From f5e3e09a00a93849a2ab94da04d11af47322e0b8 Mon Sep 17 00:00:00 2001 From: gazizova-vlada Date: Wed, 12 Oct 2022 13:48:26 +0300 Subject: [PATCH 36/54] Web:Client:Add correct translation "ThirdPartyResource". --- packages/client/src/pages/Home/Section/Filter/index.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/client/src/pages/Home/Section/Filter/index.js b/packages/client/src/pages/Home/Section/Filter/index.js index 2173f8667f..cbc2a3b6f1 100644 --- a/packages/client/src/pages/Home/Section/Filter/index.js +++ b/packages/client/src/pages/Home/Section/Filter/index.js @@ -778,7 +778,7 @@ const SectionFilterContent = ({ filterOptions.push({ key: FilterGroups.roomFilterProviderType, group: FilterGroups.roomFilterProviderType, - label: t("ThirdPartyResource"), + label: t("Settings:ThirdPartyResource"), isHeader: true, isLast: true, }); @@ -1203,7 +1203,7 @@ export default inject( )( withRouter( withLayoutSize( - withTranslation(["Files", "Common", "Translations"])( + withTranslation(["Files", "Settings", "Common", "Translations"])( withLoader(observer(SectionFilterContent))() ) ) From ac6c60ad172b94ddce21cf508c9ddb0a7c0412e1 Mon Sep 17 00:00:00 2001 From: gazizova-vlada Date: Wed, 12 Oct 2022 14:42:18 +0300 Subject: [PATCH 37/54] Web:Client:Add dependence providers in method getFilterData. --- packages/client/src/pages/Home/Section/Filter/index.js | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/packages/client/src/pages/Home/Section/Filter/index.js b/packages/client/src/pages/Home/Section/Filter/index.js index cbc2a3b6f1..5fbe6953ac 100644 --- a/packages/client/src/pages/Home/Section/Filter/index.js +++ b/packages/client/src/pages/Home/Section/Filter/index.js @@ -862,7 +862,15 @@ const SectionFilterContent = ({ } return filterOptions; - }, [isFavoritesFolder, isRecentFolder, isRooms, t, personal, isPersonalRoom]); + }, [ + isFavoritesFolder, + isRecentFolder, + isRooms, + t, + personal, + isPersonalRoom, + providers, + ]); const getViewSettingsData = React.useCallback(() => { const viewSettings = [ From 08379aeaa3e2d943f44b4928930333e75aa76714 Mon Sep 17 00:00:00 2001 From: gazizova-vlada Date: Wed, 12 Oct 2022 17:21:42 +0300 Subject: [PATCH 38/54] Web:Client:Delete small icons. --- .../public/images/icon_box_small.react.svg | 3 -- .../images/icon_dropbox_small.react.svg | 4 --- .../images/icon_google_drive_small.react.svg | 30 ------------------- .../public/images/icon_kdrive_small.react.svg | 14 --------- .../images/icon_nextcloud_small.react.svg | 10 ------- .../images/icon_onedrive_small.react.svg | 4 --- .../images/icon_owncloud_small.react.svg | 3 -- .../images/icon_sharepoint_small.react.svg | 4 --- .../public/images/icon_webdav_small.react.svg | 3 -- .../images/icon_yandex_disk_small.react.svg | 12 -------- 10 files changed, 87 deletions(-) delete mode 100644 packages/client/public/images/icon_box_small.react.svg delete mode 100644 packages/client/public/images/icon_dropbox_small.react.svg delete mode 100644 packages/client/public/images/icon_google_drive_small.react.svg delete mode 100644 packages/client/public/images/icon_kdrive_small.react.svg delete mode 100644 packages/client/public/images/icon_nextcloud_small.react.svg delete mode 100644 packages/client/public/images/icon_onedrive_small.react.svg delete mode 100644 packages/client/public/images/icon_owncloud_small.react.svg delete mode 100644 packages/client/public/images/icon_sharepoint_small.react.svg delete mode 100644 packages/client/public/images/icon_webdav_small.react.svg delete mode 100644 packages/client/public/images/icon_yandex_disk_small.react.svg diff --git a/packages/client/public/images/icon_box_small.react.svg b/packages/client/public/images/icon_box_small.react.svg deleted file mode 100644 index 0173579ebb..0000000000 --- a/packages/client/public/images/icon_box_small.react.svg +++ /dev/null @@ -1,3 +0,0 @@ - - - diff --git a/packages/client/public/images/icon_dropbox_small.react.svg b/packages/client/public/images/icon_dropbox_small.react.svg deleted file mode 100644 index a30550fe32..0000000000 --- a/packages/client/public/images/icon_dropbox_small.react.svg +++ /dev/null @@ -1,4 +0,0 @@ - - - - diff --git a/packages/client/public/images/icon_google_drive_small.react.svg b/packages/client/public/images/icon_google_drive_small.react.svg deleted file mode 100644 index 43d6573376..0000000000 --- a/packages/client/public/images/icon_google_drive_small.react.svg +++ /dev/null @@ -1,30 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/packages/client/public/images/icon_kdrive_small.react.svg b/packages/client/public/images/icon_kdrive_small.react.svg deleted file mode 100644 index c5b02734e3..0000000000 --- a/packages/client/public/images/icon_kdrive_small.react.svg +++ /dev/null @@ -1,14 +0,0 @@ - - - - - - - - - - - - - - diff --git a/packages/client/public/images/icon_nextcloud_small.react.svg b/packages/client/public/images/icon_nextcloud_small.react.svg deleted file mode 100644 index cd2d606ad1..0000000000 --- a/packages/client/public/images/icon_nextcloud_small.react.svg +++ /dev/null @@ -1,10 +0,0 @@ - - - - - - - - - - diff --git a/packages/client/public/images/icon_onedrive_small.react.svg b/packages/client/public/images/icon_onedrive_small.react.svg deleted file mode 100644 index 81f7c39aa2..0000000000 --- a/packages/client/public/images/icon_onedrive_small.react.svg +++ /dev/null @@ -1,4 +0,0 @@ - - - - diff --git a/packages/client/public/images/icon_owncloud_small.react.svg b/packages/client/public/images/icon_owncloud_small.react.svg deleted file mode 100644 index 19a1633d53..0000000000 --- a/packages/client/public/images/icon_owncloud_small.react.svg +++ /dev/null @@ -1,3 +0,0 @@ - - - diff --git a/packages/client/public/images/icon_sharepoint_small.react.svg b/packages/client/public/images/icon_sharepoint_small.react.svg deleted file mode 100644 index d0e241abde..0000000000 --- a/packages/client/public/images/icon_sharepoint_small.react.svg +++ /dev/null @@ -1,4 +0,0 @@ - - - - diff --git a/packages/client/public/images/icon_webdav_small.react.svg b/packages/client/public/images/icon_webdav_small.react.svg deleted file mode 100644 index c268423ff5..0000000000 --- a/packages/client/public/images/icon_webdav_small.react.svg +++ /dev/null @@ -1,3 +0,0 @@ - - - diff --git a/packages/client/public/images/icon_yandex_disk_small.react.svg b/packages/client/public/images/icon_yandex_disk_small.react.svg deleted file mode 100644 index cbab03d66e..0000000000 --- a/packages/client/public/images/icon_yandex_disk_small.react.svg +++ /dev/null @@ -1,12 +0,0 @@ - - - - - - - - - - - - From cbbdb07b9ca415f2e568168bcef3c893b1bc7e67 Mon Sep 17 00:00:00 2001 From: gazizova-vlada Date: Wed, 12 Oct 2022 17:22:19 +0300 Subject: [PATCH 39/54] Web:Client:Delete method getThirdPartyIconSmall. --- packages/client/src/store/ThirdPartyStore.js | 30 -------------------- 1 file changed, 30 deletions(-) diff --git a/packages/client/src/store/ThirdPartyStore.js b/packages/client/src/store/ThirdPartyStore.js index 09a0d7359e..c081fefe77 100644 --- a/packages/client/src/store/ThirdPartyStore.js +++ b/packages/client/src/store/ThirdPartyStore.js @@ -119,36 +119,6 @@ class ThirdPartyStore { } }; - getThirdPartyIconSmall = (iconName) => { - switch (iconName) { - case "Box": - return "images/icon_box_small.react.svg"; - case "DropboxV2": - return "images/icon_dropbox_small.react.svg"; - case "GoogleDrive": - return "images/icon_google_drive_small.react.svg"; - case "OneDrive": - return "images/icon_onedrive_small.react.svg"; - case "SharePoint": - return "images/icon_sharepoint_small.react.svg"; - case "kDrive": - return "images/icon_kdrive_small.react.svg"; - case "Yandex": - return "images/icon_yandex_disk_small.react.svg"; - case "OwnCloud": - return "images/icon_owncloud_small.react.svg"; - case "NextCloud": - return "images/icon_nextcloud_small.react.svg"; - case "OneDriveForBusiness": - return "images/icon_onedrive_small.react.svg"; - case "WebDav": - return "images/icon_webdav_small.react.svg"; - - default: - return ""; - } - }; - get googleConnectItem() { return ( this.capabilities && this.capabilities.find((x) => x[0] === "GoogleDrive") From 7fe1fb4265bd3052b4dcaad89d1e99aa61d2ca1b Mon Sep 17 00:00:00 2001 From: gazizova-vlada Date: Wed, 12 Oct 2022 17:22:52 +0300 Subject: [PATCH 40/54] Web:Client:Change getThirdPartyIconSmall to getThirdPartyIcon. --- packages/client/src/store/FilesStore.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/client/src/store/FilesStore.js b/packages/client/src/store/FilesStore.js index 08232c637a..72f4c856a9 100644 --- a/packages/client/src/store/FilesStore.js +++ b/packages/client/src/store/FilesStore.js @@ -1987,7 +1987,7 @@ class FilesStore { pinned, } = item; - const thirdPartyIcon = this.thirdPartyStore.getThirdPartyIconSmall( + const thirdPartyIcon = this.thirdPartyStore.getThirdPartyIcon( item.providerKey ); From 8e87ad705f9247dda5e08ea90a9e3858d9dfb1f4 Mon Sep 17 00:00:00 2001 From: gazizova-vlada Date: Wed, 12 Oct 2022 17:32:34 +0300 Subject: [PATCH 41/54] Web:Components:Add tag ReactSVG, add class third-party-tag. --- packages/components/tag/index.js | 2 +- packages/components/tag/styled-tag.js | 10 ++++++++++ 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/packages/components/tag/index.js b/packages/components/tag/index.js index c3a7297d04..13cb205cc1 100644 --- a/packages/components/tag/index.js +++ b/packages/components/tag/index.js @@ -115,7 +115,7 @@ const Tag = ({ style={style} > {icon ? ( - + ) : ( <> !props.isDisabled && css` From d084f53802ee00b0ce566ae257506981fd3e8921 Mon Sep 17 00:00:00 2001 From: gazizova-vlada Date: Thu, 13 Oct 2022 11:55:32 +0300 Subject: [PATCH 42/54] Web:Common:Fix props item.group. --- packages/common/components/FilterInput/index.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/common/components/FilterInput/index.js b/packages/common/components/FilterInput/index.js index 7a16c0554b..d360b5dc55 100644 --- a/packages/common/components/FilterInput/index.js +++ b/packages/common/components/FilterInput/index.js @@ -165,7 +165,7 @@ const FilterInput = React.memo( key={`${item.key}_${item.group}`} propKey={item.key} label={item.label} - group={item.label} + group={item.group} removeSelectedItem={removeSelectedItemAction} /> ))} From 745554af0379e777d02a31a0a1ed560fbd9ca1d8 Mon Sep 17 00:00:00 2001 From: gazizova-vlada Date: Thu, 13 Oct 2022 11:55:54 +0300 Subject: [PATCH 43/54] Web:Common:Add RoomsProviderTypeName. --- packages/common/constants/index.js | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/packages/common/constants/index.js b/packages/common/constants/index.js index 9922ba9d01..12c1a7365c 100644 --- a/packages/common/constants/index.js +++ b/packages/common/constants/index.js @@ -98,6 +98,17 @@ export const RoomsProviderType = Object.freeze({ Yandex: 8, }); +export const RoomsProviderTypeName = Object.freeze({ + 1: "Box", + 2: "DropBox", + 3: "Google Drive", + 4: "kDrive", + 5: "OneDrive", + 6: "SharePoint", + 7: "WebDav", + 8: "Yandex", +}); + /** * Enum for room search area. * @readonly From e7c72598ee473428a87406506e3031e37ff32d4b Mon Sep 17 00:00:00 2001 From: gazizova-vlada Date: Thu, 13 Oct 2022 11:56:33 +0300 Subject: [PATCH 44/54] Web:Client:Fix getProviderType, add RoomsProviderTypeName. --- .../src/pages/Home/Section/Filter/index.js | 26 ++++++++++++------- 1 file changed, 16 insertions(+), 10 deletions(-) diff --git a/packages/client/src/pages/Home/Section/Filter/index.js b/packages/client/src/pages/Home/Section/Filter/index.js index 5fbe6953ac..2d40532ec6 100644 --- a/packages/client/src/pages/Home/Section/Filter/index.js +++ b/packages/client/src/pages/Home/Section/Filter/index.js @@ -16,6 +16,7 @@ import { FilterType, RoomsType, RoomsProviderType, + RoomsProviderTypeName, } from "@docspace/common/constants"; import Loaders from "@docspace/common/components/Loaders"; import FilterInput from "@docspace/common/components/FilterInput"; @@ -71,7 +72,7 @@ const getType = (filterValues) => { const getProviderType = (filterValues) => { const filterType = filterValues.find( (value) => value.group === FilterGroups.roomFilterProviderType - )?.key[0]; + )?.key; const type = filterType; @@ -380,9 +381,7 @@ const SectionFilterContent = ({ if (roomsFilter.provider) { const provider = +roomsFilter.provider; - const label = Object.entries(RoomsProviderType).find( - (item) => item[1] === provider - )[0]; + const label = RoomsProviderTypeName[provider]; filterValues.push({ key: provider, @@ -531,6 +530,7 @@ const SectionFilterContent = ({ filter.withSubfolders, filter.authorType, filter.filterType, + filter.provider, filter.searchInContent, filter.excludeSubject, roomsFilter.provider, @@ -767,13 +767,19 @@ const SectionFilterContent = ({ } if (connectedThirdParty) { - const thirdPartyOptions = connectedThirdParty.map((thirdParty) => ({ - key: Object.entries(RoomsProviderType).find( + const thirdPartyOptions = connectedThirdParty.map((thirdParty) => { + const key = Object.entries(RoomsProviderType).find( (item) => item[0] === thirdParty - )[1], - group: FilterGroups.roomFilterProviderType, - label: thirdParty, - })); + )[1]; + + const label = RoomsProviderTypeName[key]; + + return { + key, + group: FilterGroups.roomFilterProviderType, + label, + }; + }); filterOptions.push({ key: FilterGroups.roomFilterProviderType, From f59b13cfb84d02cc27fac13ddeda0ad16df8ebe1 Mon Sep 17 00:00:00 2001 From: gazizova-vlada Date: Thu, 13 Oct 2022 13:33:30 +0300 Subject: [PATCH 45/54] Web:Client:Fix last section, fix showing title when there is no content. --- .../src/pages/Home/Section/Filter/index.js | 26 ++++++++++++------- 1 file changed, 16 insertions(+), 10 deletions(-) diff --git a/packages/client/src/pages/Home/Section/Filter/index.js b/packages/client/src/pages/Home/Section/Filter/index.js index 2d40532ec6..8431856510 100644 --- a/packages/client/src/pages/Home/Section/Filter/index.js +++ b/packages/client/src/pages/Home/Section/Filter/index.js @@ -547,6 +547,16 @@ const SectionFilterContent = ({ ]); const getFilterData = React.useCallback(async () => { + const tags = await fetchTags(); + const connectedThirdParty = []; + + providers.forEach((item) => { + if (connectedThirdParty.includes(item.provider_key)) return; + connectedThirdParty.push(item.provider_key); + }); + + const isLastTypeOptionsRooms = !connectedThirdParty.length && !tags.length; + const folders = !isFavoritesFolder && !isRecentFolder ? [ @@ -595,6 +605,7 @@ const SectionFilterContent = ({ group: FilterGroups.roomFilterType, label: t("Common:Type"), isHeader: true, + isLast: isLastTypeOptionsRooms, }, { key: RoomsType.CustomRoom, @@ -733,15 +744,7 @@ const SectionFilterContent = ({ filterOptions.push(...typeOptions); - const tags = await fetchTags(); - const connectedThirdParty = []; - - providers.forEach((item) => { - if (connectedThirdParty.includes(item.provider_key)) return; - connectedThirdParty.push(item.provider_key); - }); - - if (tags) { + if (tags.length > 0) { const tagsOptions = tags.map((tag) => ({ key: tag, group: FilterGroups.roomFilterTags, @@ -756,17 +759,20 @@ const SectionFilterContent = ({ // isMultiSelect: true, // }); + const isLast = connectedThirdParty.length === 0; + filterOptions.push({ key: FilterGroups.roomFilterTags, group: FilterGroups.roomFilterTags, label: t("Tags"), isHeader: true, + isLast, }); filterOptions.push(...tagsOptions); } - if (connectedThirdParty) { + if (connectedThirdParty.length > 0) { const thirdPartyOptions = connectedThirdParty.map((thirdParty) => { const key = Object.entries(RoomsProviderType).find( (item) => item[0] === thirdParty From e76efb6f4306d23a979788e27eadae28d50f463f Mon Sep 17 00:00:00 2001 From: gazizova-vlada Date: Thu, 13 Oct 2022 13:56:45 +0300 Subject: [PATCH 46/54] Web:Client:Fix. --- packages/client/src/pages/Home/Section/Filter/index.js | 1 - 1 file changed, 1 deletion(-) diff --git a/packages/client/src/pages/Home/Section/Filter/index.js b/packages/client/src/pages/Home/Section/Filter/index.js index 8431856510..040b803c36 100644 --- a/packages/client/src/pages/Home/Section/Filter/index.js +++ b/packages/client/src/pages/Home/Section/Filter/index.js @@ -530,7 +530,6 @@ const SectionFilterContent = ({ filter.withSubfolders, filter.authorType, filter.filterType, - filter.provider, filter.searchInContent, filter.excludeSubject, roomsFilter.provider, From 73fa3205e2e498b95d0f9056ae585b8773c0dea4 Mon Sep 17 00:00:00 2001 From: gazizova-vlada Date: Thu, 13 Oct 2022 14:16:27 +0300 Subject: [PATCH 47/54] Web:Client:Add small icon thirdParty. --- .../public/images/icon_box_small.react.svg | 3 ++ .../images/icon_dropbox_small.react.svg | 4 +++ .../images/icon_google_drive_small.react.svg | 30 +++++++++++++++++++ .../public/images/icon_kdrive_small.react.svg | 14 +++++++++ .../images/icon_nextcloud_small.react.svg | 10 +++++++ .../images/icon_onedrive_small.react.svg | 4 +++ .../images/icon_owncloud_small.react.svg | 3 ++ .../images/icon_sharepoint_small.react.svg | 4 +++ .../public/images/icon_webdav_small.react.svg | 3 ++ .../images/icon_yandex_disk_small.react.svg | 12 ++++++++ 10 files changed, 87 insertions(+) create mode 100644 packages/client/public/images/icon_box_small.react.svg create mode 100644 packages/client/public/images/icon_dropbox_small.react.svg create mode 100644 packages/client/public/images/icon_google_drive_small.react.svg create mode 100644 packages/client/public/images/icon_kdrive_small.react.svg create mode 100644 packages/client/public/images/icon_nextcloud_small.react.svg create mode 100644 packages/client/public/images/icon_onedrive_small.react.svg create mode 100644 packages/client/public/images/icon_owncloud_small.react.svg create mode 100644 packages/client/public/images/icon_sharepoint_small.react.svg create mode 100644 packages/client/public/images/icon_webdav_small.react.svg create mode 100644 packages/client/public/images/icon_yandex_disk_small.react.svg diff --git a/packages/client/public/images/icon_box_small.react.svg b/packages/client/public/images/icon_box_small.react.svg new file mode 100644 index 0000000000..0173579ebb --- /dev/null +++ b/packages/client/public/images/icon_box_small.react.svg @@ -0,0 +1,3 @@ + + + diff --git a/packages/client/public/images/icon_dropbox_small.react.svg b/packages/client/public/images/icon_dropbox_small.react.svg new file mode 100644 index 0000000000..a30550fe32 --- /dev/null +++ b/packages/client/public/images/icon_dropbox_small.react.svg @@ -0,0 +1,4 @@ + + + + diff --git a/packages/client/public/images/icon_google_drive_small.react.svg b/packages/client/public/images/icon_google_drive_small.react.svg new file mode 100644 index 0000000000..43d6573376 --- /dev/null +++ b/packages/client/public/images/icon_google_drive_small.react.svg @@ -0,0 +1,30 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/packages/client/public/images/icon_kdrive_small.react.svg b/packages/client/public/images/icon_kdrive_small.react.svg new file mode 100644 index 0000000000..c5b02734e3 --- /dev/null +++ b/packages/client/public/images/icon_kdrive_small.react.svg @@ -0,0 +1,14 @@ + + + + + + + + + + + + + + diff --git a/packages/client/public/images/icon_nextcloud_small.react.svg b/packages/client/public/images/icon_nextcloud_small.react.svg new file mode 100644 index 0000000000..cd2d606ad1 --- /dev/null +++ b/packages/client/public/images/icon_nextcloud_small.react.svg @@ -0,0 +1,10 @@ + + + + + + + + + + diff --git a/packages/client/public/images/icon_onedrive_small.react.svg b/packages/client/public/images/icon_onedrive_small.react.svg new file mode 100644 index 0000000000..81f7c39aa2 --- /dev/null +++ b/packages/client/public/images/icon_onedrive_small.react.svg @@ -0,0 +1,4 @@ + + + + diff --git a/packages/client/public/images/icon_owncloud_small.react.svg b/packages/client/public/images/icon_owncloud_small.react.svg new file mode 100644 index 0000000000..19a1633d53 --- /dev/null +++ b/packages/client/public/images/icon_owncloud_small.react.svg @@ -0,0 +1,3 @@ + + + diff --git a/packages/client/public/images/icon_sharepoint_small.react.svg b/packages/client/public/images/icon_sharepoint_small.react.svg new file mode 100644 index 0000000000..d0e241abde --- /dev/null +++ b/packages/client/public/images/icon_sharepoint_small.react.svg @@ -0,0 +1,4 @@ + + + + diff --git a/packages/client/public/images/icon_webdav_small.react.svg b/packages/client/public/images/icon_webdav_small.react.svg new file mode 100644 index 0000000000..c268423ff5 --- /dev/null +++ b/packages/client/public/images/icon_webdav_small.react.svg @@ -0,0 +1,3 @@ + + + diff --git a/packages/client/public/images/icon_yandex_disk_small.react.svg b/packages/client/public/images/icon_yandex_disk_small.react.svg new file mode 100644 index 0000000000..cbab03d66e --- /dev/null +++ b/packages/client/public/images/icon_yandex_disk_small.react.svg @@ -0,0 +1,12 @@ + + + + + + + + + + + + From f4bf6a9af5bf879aae23e6c7a053fd48a1108df7 Mon Sep 17 00:00:00 2001 From: gazizova-vlada Date: Thu, 13 Oct 2022 14:17:25 +0300 Subject: [PATCH 48/54] Web:Client:Add second argument size in getThirdPartyIcon. --- packages/client/src/store/ThirdPartyStore.js | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/packages/client/src/store/ThirdPartyStore.js b/packages/client/src/store/ThirdPartyStore.js index c081fefe77..d9eb82f3eb 100644 --- a/packages/client/src/store/ThirdPartyStore.js +++ b/packages/client/src/store/ThirdPartyStore.js @@ -89,29 +89,40 @@ class ThirdPartyStore { }); }; - getThirdPartyIcon = (iconName) => { + getThirdPartyIcon = (iconName, size = "big") => { switch (iconName) { case "Box": + if (size === "small") return "images/icon_box_small.react.svg"; return "images/icon_box.react.svg"; case "DropboxV2": + if (size === "small") return "images/icon_dropbox_small.react.svg"; return "images/icon_dropbox.react.svg"; case "GoogleDrive": + if (size === "small") return "images/icon_google_drive_small.react.svg"; return "images/icon_google_drive.react.svg"; case "OneDrive": + if (size === "small") return "images/icon_onedrive_small.react.svg"; return "images/icon_onedrive.react.svg"; case "SharePoint": + if (size === "small") return "images/icon_sharepoint_small.react.svg"; return "images/icon_sharepoint.react.svg"; case "kDrive": + if (size === "small") return "images/icon_kdrive_small.react.svg"; return "images/icon_kdrive.react.svg"; case "Yandex": + if (size === "small") return "images/icon_yandex_disk_small.react.svg"; return "images/icon_yandex_disk.react.svg"; case "OwnCloud": + if (size === "small") return "images/icon_owncloud_small.react.svg"; return "images/icon_owncloud.react.svg"; case "NextCloud": + if (size === "small") return "images/icon_nextcloud_small.react.svg"; return "images/icon_nextcloud.react.svg"; case "OneDriveForBusiness": + if (size === "small") return "images/icon_onedrive_small.react.svg"; return "images/icon_onedrive.react.svg"; case "WebDav": + if (size === "small") return "images/icon_webdav_small.react.svg"; return "images/icon_webdav.react.svg"; default: From 874ccca0af7264688bd8decf6a55e5690b8b1f89 Mon Sep 17 00:00:00 2001 From: gazizova-vlada Date: Thu, 13 Oct 2022 14:17:54 +0300 Subject: [PATCH 49/54] Web:Client:Add size in getThirdPartyIcon. --- packages/client/src/store/FilesStore.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/packages/client/src/store/FilesStore.js b/packages/client/src/store/FilesStore.js index 72f4c856a9..d4fcbb71d1 100644 --- a/packages/client/src/store/FilesStore.js +++ b/packages/client/src/store/FilesStore.js @@ -1988,7 +1988,8 @@ class FilesStore { } = item; const thirdPartyIcon = this.thirdPartyStore.getThirdPartyIcon( - item.providerKey + item.providerKey, + "small" ); const providerType = From 8ccdde14e39a7e243a3d53dd88c78c8a3e70aafa Mon Sep 17 00:00:00 2001 From: gazizova-vlada Date: Thu, 13 Oct 2022 14:18:26 +0300 Subject: [PATCH 50/54] Web:Components:Fix styles third-party-tag. --- packages/components/tag/styled-tag.js | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/packages/components/tag/styled-tag.js b/packages/components/tag/styled-tag.js index a05afad961..1aa527019c 100644 --- a/packages/components/tag/styled-tag.js +++ b/packages/components/tag/styled-tag.js @@ -41,13 +41,8 @@ const StyledTag = styled.div` } .third-party-tag { - width: 20px; - height: 20px; - - svg { - max-width: 100%; - max-height: 100%; - } + width: 16px; + height: 16px; } ${(props) => From 33847ab850672163a99887d85078fd376bdfcb0a Mon Sep 17 00:00:00 2001 From: gazizova-vlada Date: Thu, 13 Oct 2022 18:54:40 +0300 Subject: [PATCH 51/54] Web:Components:Add connectItems from thirdPartyStore. --- .../sub-components/ThirdPartyStorage/index.js | 32 +------------------ 1 file changed, 1 insertion(+), 31 deletions(-) diff --git a/packages/client/src/components/dialogs/CreateEditRoomDialog/sub-components/ThirdPartyStorage/index.js b/packages/client/src/components/dialogs/CreateEditRoomDialog/sub-components/ThirdPartyStorage/index.js index 6f7f41a24f..feab450efa 100644 --- a/packages/client/src/components/dialogs/CreateEditRoomDialog/sub-components/ThirdPartyStorage/index.js +++ b/packages/client/src/components/dialogs/CreateEditRoomDialog/sub-components/ThirdPartyStorage/index.js @@ -180,37 +180,7 @@ export default inject( const thirdPartyStore = settingsStore.thirdPartyStore; - const connectItems = [ - thirdPartyStore.googleConnectItem, - thirdPartyStore.boxConnectItem, - thirdPartyStore.dropboxConnectItem, - thirdPartyStore.oneDriveConnectItem, - thirdPartyStore.nextCloudConnectItem && [ - ...thirdPartyStore.nextCloudConnectItem, - "Nextcloud", - ], - thirdPartyStore.kDriveConnectItem, - thirdPartyStore.yandexConnectItem, - thirdPartyStore.ownCloudConnectItem && [ - ...thirdPartyStore.ownCloudConnectItem, - "ownCloud", - ], - thirdPartyStore.webDavConnectItem, - thirdPartyStore.sharePointConnectItem, - ] - .map( - (item) => - item && { - id: item[0], - providerKey: item[0], - isOauth: item.length > 1 && item[0] !== "WebDav", - oauthHref: item.length > 1 && item[0] !== "WebDav" ? item[1] : "", - ...(item[0] === "WebDav" && { - category: item[item.length - 1], - }), - } - ) - .filter((item) => !!item); + const { connectItems } = thirdPartyStore; return { connectItems, From 1a3f0464aff02cd046f75e097556d5593d97d769 Mon Sep 17 00:00:00 2001 From: gazizova-vlada Date: Thu, 13 Oct 2022 18:56:33 +0300 Subject: [PATCH 52/54] Web:Client:Fix. --- .../sub-components/ThirdPartyStorage/index.js | 32 ++++++++++++++++++- 1 file changed, 31 insertions(+), 1 deletion(-) diff --git a/packages/client/src/components/dialogs/CreateEditRoomDialog/sub-components/ThirdPartyStorage/index.js b/packages/client/src/components/dialogs/CreateEditRoomDialog/sub-components/ThirdPartyStorage/index.js index feab450efa..6f7f41a24f 100644 --- a/packages/client/src/components/dialogs/CreateEditRoomDialog/sub-components/ThirdPartyStorage/index.js +++ b/packages/client/src/components/dialogs/CreateEditRoomDialog/sub-components/ThirdPartyStorage/index.js @@ -180,7 +180,37 @@ export default inject( const thirdPartyStore = settingsStore.thirdPartyStore; - const { connectItems } = thirdPartyStore; + const connectItems = [ + thirdPartyStore.googleConnectItem, + thirdPartyStore.boxConnectItem, + thirdPartyStore.dropboxConnectItem, + thirdPartyStore.oneDriveConnectItem, + thirdPartyStore.nextCloudConnectItem && [ + ...thirdPartyStore.nextCloudConnectItem, + "Nextcloud", + ], + thirdPartyStore.kDriveConnectItem, + thirdPartyStore.yandexConnectItem, + thirdPartyStore.ownCloudConnectItem && [ + ...thirdPartyStore.ownCloudConnectItem, + "ownCloud", + ], + thirdPartyStore.webDavConnectItem, + thirdPartyStore.sharePointConnectItem, + ] + .map( + (item) => + item && { + id: item[0], + providerKey: item[0], + isOauth: item.length > 1 && item[0] !== "WebDav", + oauthHref: item.length > 1 && item[0] !== "WebDav" ? item[1] : "", + ...(item[0] === "WebDav" && { + category: item[item.length - 1], + }), + } + ) + .filter((item) => !!item); return { connectItems, From b5d960cc05c81543edfd406dafa03187dc49684c Mon Sep 17 00:00:00 2001 From: gazizova-vlada Date: Thu, 13 Oct 2022 19:06:59 +0300 Subject: [PATCH 53/54] Web:Client:Add fetchThirdPartyProviders. --- .../src/components/GlobalEvents/CreateRoomEvent.js | 8 +++++++- .../dialogs/CreateEditRoomDialog/CreateRoomDialog.js | 9 ++++++++- 2 files changed, 15 insertions(+), 2 deletions(-) diff --git a/packages/client/src/components/GlobalEvents/CreateRoomEvent.js b/packages/client/src/components/GlobalEvents/CreateRoomEvent.js index 9d4f1220a5..3056932a68 100644 --- a/packages/client/src/components/GlobalEvents/CreateRoomEvent.js +++ b/packages/client/src/components/GlobalEvents/CreateRoomEvent.js @@ -12,6 +12,7 @@ const CreateRoomEvent = ({ createTag, addTagsToRoom, deleteThirdParty, + fetchThirdPartyProviders, calculateRoomLogoParams, uploadRoomLogo, addLogoToRoom, @@ -102,6 +103,7 @@ const CreateRoomEvent = ({ isLoading={isLoading} setIsLoading={setIsLoading} deleteThirdParty={deleteThirdParty} + fetchThirdPartyProviders={fetchThirdPartyProviders} /> ); }; @@ -130,7 +132,10 @@ export default inject( const { connectDialogVisible } = dialogsStore; - const { deleteThirdParty } = settingsStore.thirdPartyStore; + const { + deleteThirdParty, + fetchThirdPartyProviders, + } = settingsStore.thirdPartyStore; return { createRoom, @@ -139,6 +144,7 @@ export default inject( fetchTags, addTagsToRoom, deleteThirdParty, + fetchThirdPartyProviders, calculateRoomLogoParams, uploadRoomLogo, addLogoToRoom, diff --git a/packages/client/src/components/dialogs/CreateEditRoomDialog/CreateRoomDialog.js b/packages/client/src/components/dialogs/CreateEditRoomDialog/CreateRoomDialog.js index 797e383442..1fbedb5f2b 100644 --- a/packages/client/src/components/dialogs/CreateEditRoomDialog/CreateRoomDialog.js +++ b/packages/client/src/components/dialogs/CreateEditRoomDialog/CreateRoomDialog.js @@ -38,6 +38,7 @@ const CreateRoomDialog = ({ setIsLoading, deleteThirdParty, + fetchThirdPartyProviders, }) => { const [isScrollLocked, setIsScrollLocked] = useState(false); const [isOauthWindowOpen, setIsOauthWindowOpen] = useState(false); @@ -91,7 +92,13 @@ const CreateRoomDialog = ({ setIsLoading(true); await deleteThirdParty( roomParams.storageLocation.thirdpartyAccount.providerId - ).finally(() => setIsLoading(false)); + ) + .then(async () => { + await fetchThirdPartyProviders(); + }) + .finally(() => { + setIsLoading(false); + }); } closeEvent(); }; From 75ad9ebe3940dd2fc4bb55c740f2bb818c7cc01f Mon Sep 17 00:00:00 2001 From: gazizova-vlada Date: Thu, 20 Oct 2022 11:22:02 +0300 Subject: [PATCH 54/54] Web:Client:Fix. --- .../dialogs/CreateEditRoomDialog/CreateRoomDialog.js | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/packages/client/src/components/dialogs/CreateEditRoomDialog/CreateRoomDialog.js b/packages/client/src/components/dialogs/CreateEditRoomDialog/CreateRoomDialog.js index 5a9d0c5b35..fcf5fbee1b 100644 --- a/packages/client/src/components/dialogs/CreateEditRoomDialog/CreateRoomDialog.js +++ b/packages/client/src/components/dialogs/CreateEditRoomDialog/CreateRoomDialog.js @@ -92,13 +92,9 @@ const CreateRoomDialog = ({ setIsLoading(true); await deleteThirdParty( roomParams.storageLocation.thirdpartyAccount.providerId - ) - .then(async () => { - await fetchThirdPartyProviders(); - }) - .finally(() => { - setIsLoading(false); - }); + ).finally(() => setIsLoading(false)); + + await fetchThirdPartyProviders(); } onClose(); };