From eccca5ea5fa6825276b36d25616add36b5eeb6a3 Mon Sep 17 00:00:00 2001 From: SuhorukovAnton Date: Tue, 30 Aug 2022 14:16:41 +0300 Subject: [PATCH 01/87] remove waste modules --- .../ASC.Data.Backup.Core/BackupAjaxHandler.cs | 12 +- .../Contracts/BackupServiceModel.cs | 3 - .../EF/Model/BackupSchedule.cs | 12 - .../Events/BackupRequestIntegrationEvent.cs | 5 - .../Service/BackupService.cs | 4 +- .../Service/BackupWorker.cs | 4 +- .../ProgressItems/BackupProgressItem.cs | 9 +- .../ProgressItems/TransferProgressItem.cs | 10 +- .../Tasks/Modules/CalendarModuleSpecifics.cs | 101 ----- .../Tasks/Modules/CommunityModuleSpecifics.cs | 289 -------------- .../Tasks/Modules/CoreModuleSpecifics.cs | 45 --- .../Tasks/Modules/CrmModuleSpecifics.cs | 356 ------------------ .../Tasks/Modules/FilesModuleSpecifics.cs | 17 - .../Tasks/Modules/IModuleSpecifics.cs | 7 - .../Tasks/Modules/MailModuleSpecifics.cs | 304 --------------- .../Tasks/Modules/ModuleProvider.cs | 11 - .../Tasks/Modules/ProjectsModuleSpecifics.cs | 204 ---------- .../Tasks/Modules/WebStudioModuleSpecifics.cs | 6 +- .../BackupRequestedIntegrationEventHandler.cs | 3 +- .../Log/BackupSchedulerServiceLogger.cs | 4 +- .../Services/BackupSchedulerService.cs | 3 +- .../ASC.Data.Backup/Api/BackupController.cs | 5 +- .../ASC.Data.Backup/ApiModels/BackupDto.cs | 1 - .../ApiModels/BackupScheduleDto.cs | 1 - 24 files changed, 15 insertions(+), 1401 deletions(-) delete mode 100644 common/ASC.Data.Backup.Core/Tasks/Modules/CalendarModuleSpecifics.cs delete mode 100644 common/ASC.Data.Backup.Core/Tasks/Modules/CommunityModuleSpecifics.cs delete mode 100644 common/ASC.Data.Backup.Core/Tasks/Modules/CrmModuleSpecifics.cs delete mode 100644 common/ASC.Data.Backup.Core/Tasks/Modules/MailModuleSpecifics.cs delete mode 100644 common/ASC.Data.Backup.Core/Tasks/Modules/ProjectsModuleSpecifics.cs diff --git a/common/ASC.Data.Backup.Core/BackupAjaxHandler.cs b/common/ASC.Data.Backup.Core/BackupAjaxHandler.cs index 8ce98dd2ab..59de7d95f5 100644 --- a/common/ASC.Data.Backup.Core/BackupAjaxHandler.cs +++ b/common/ASC.Data.Backup.Core/BackupAjaxHandler.cs @@ -72,7 +72,7 @@ public class BackupAjaxHandler _tempPath = tempPath; } - public void StartBackup(BackupStorageType storageType, Dictionary storageParams, bool backupMail) + public void StartBackup(BackupStorageType storageType, Dictionary storageParams) { DemandPermissionsBackup(); @@ -80,7 +80,6 @@ public class BackupAjaxHandler { TenantId = GetCurrentTenantId(), UserId = _securityContext.CurrentAccount.ID, - BackupMail = backupMail, StorageType = storageType, StorageParams = storageParams }; @@ -141,7 +140,7 @@ public class BackupAjaxHandler return _backupService.GetBackupHistory(GetCurrentTenantId()); } - public void CreateSchedule(BackupStorageType storageType, Dictionary storageParams, int backupsStored, CronParams cronParams, bool backupMail) + public void CreateSchedule(BackupStorageType storageType, Dictionary storageParams, int backupsStored, CronParams cronParams) { DemandPermissionsBackup(); @@ -155,7 +154,6 @@ public class BackupAjaxHandler var scheduleRequest = new CreateScheduleRequest { TenantId = _tenantManager.GetCurrentTenant().Id, - BackupMail = backupMail, Cron = cronParams.ToString(), NumberOfBackupsStored = backupsStored, StorageType = storageType, @@ -198,7 +196,6 @@ public class BackupAjaxHandler StorageType = response.StorageType, StorageParams = response.StorageParams.ToDictionary(r => r.Key, r => r.Value) ?? new Dictionary(), CronParams = new CronParams(response.Cron), - BackupMail = response.BackupMail.NullIfDefault(), BackupsStored = response.NumberOfBackupsStored.NullIfDefault(), LastBackupTime = response.LastBackupTime }; @@ -224,7 +221,6 @@ public class BackupAjaxHandler var Schedule = new CreateScheduleRequest { TenantId = _tenantManager.GetCurrentTenant().Id, - BackupMail = schedule.BackupMail != null && (bool)schedule.BackupMail, Cron = schedule.CronParams.ToString(), NumberOfBackupsStored = schedule.BackupsStored == null ? 0 : (int)schedule.BackupsStored, StorageType = schedule.StorageType, @@ -337,7 +333,7 @@ public class BackupAjaxHandler #region transfer - public void StartTransfer(string targetRegion, bool notifyUsers, bool transferMail) + public void StartTransfer(string targetRegion, bool notifyUsers) { DemandPermissionsTransfer(); @@ -347,7 +343,6 @@ public class BackupAjaxHandler { TenantId = GetCurrentTenantId(), TargetRegion = targetRegion, - BackupMail = transferMail, NotifyUsers = notifyUsers }); @@ -405,7 +400,6 @@ public class BackupAjaxHandler public BackupStorageType StorageType { get; set; } public Dictionary StorageParams { get; set; } public CronParams CronParams { get; set; } - public bool? BackupMail { get; set; } public int? BackupsStored { get; set; } public DateTime LastBackupTime { get; set; } } diff --git a/common/ASC.Data.Backup.Core/Contracts/BackupServiceModel.cs b/common/ASC.Data.Backup.Core/Contracts/BackupServiceModel.cs index 98b6b5e813..067da15044 100644 --- a/common/ASC.Data.Backup.Core/Contracts/BackupServiceModel.cs +++ b/common/ASC.Data.Backup.Core/Contracts/BackupServiceModel.cs @@ -41,7 +41,6 @@ public class StartBackupRequest { public int TenantId { get; set; } public Guid UserId { get; set; } - public bool BackupMail { get; set; } public BackupStorageType StorageType { get; set; } public string StorageBasePath { get; set; } public Dictionary StorageParams { get; set; } @@ -61,7 +60,6 @@ public class StartTransferRequest public int TenantId { get; set; } public string TargetRegion { get; set; } public bool NotifyUsers { get; set; } - public bool BackupMail { get; set; } } public class TransferRegion @@ -91,7 +89,6 @@ public class ScheduleResponse { public BackupStorageType StorageType { get; set; } public string StorageBasePath { get; set; } - public bool BackupMail { get; set; } public int NumberOfBackupsStored { get; set; } public string Cron { get; set; } public DateTime LastBackupTime { get; set; } diff --git a/common/ASC.Data.Backup.Core/EF/Model/BackupSchedule.cs b/common/ASC.Data.Backup.Core/EF/Model/BackupSchedule.cs index 1d339d9e94..89538979cc 100644 --- a/common/ASC.Data.Backup.Core/EF/Model/BackupSchedule.cs +++ b/common/ASC.Data.Backup.Core/EF/Model/BackupSchedule.cs @@ -30,8 +30,6 @@ public class BackupSchedule : BaseEntity { public int TenantId { get; set; } - public bool BackupMail { get; set; } - public string Cron { get; set; } public int BackupsStored { get; set; } @@ -76,11 +74,6 @@ public static class BackupScheduleExtension .HasColumnType("int(10)") .ValueGeneratedNever(); - entity.Property(e => e.BackupMail) - .HasColumnName("backup_mail") - .HasColumnType("tinyint(1)") - .HasDefaultValueSql("'0'"); - entity.Property(e => e.Cron) .IsRequired() .HasColumnName("cron") @@ -132,11 +125,6 @@ public static class BackupScheduleExtension .HasColumnName("tenant_id") .HasMaxLength(10); - entity.Property(e => e.BackupMail) - .HasColumnName("backup_mail") - .HasMaxLength(10) - .HasDefaultValueSql("'0'"); - entity.Property(e => e.Cron) .IsRequired() .HasColumnName("cron") diff --git a/common/ASC.Data.Backup.Core/IntegrationEvents/Events/BackupRequestIntegrationEvent.cs b/common/ASC.Data.Backup.Core/IntegrationEvents/Events/BackupRequestIntegrationEvent.cs index ec6b89356a..496d829e65 100644 --- a/common/ASC.Data.Backup.Core/IntegrationEvents/Events/BackupRequestIntegrationEvent.cs +++ b/common/ASC.Data.Backup.Core/IntegrationEvents/Events/BackupRequestIntegrationEvent.cs @@ -38,14 +38,12 @@ public record BackupRequestIntegrationEvent : IntegrationEvent int tenantId, Guid createBy, Dictionary storageParams, - bool backupMail, bool isScheduled = false, int backupsStored = 0, string storageBasePath = "") : base(createBy, tenantId) { StorageType = storageType; StorageParams = storageParams; - BackupMail = backupMail; IsScheduled = isScheduled; BackupsStored = backupsStored; StorageBasePath = storageBasePath; @@ -57,9 +55,6 @@ public record BackupRequestIntegrationEvent : IntegrationEvent [ProtoMember(2)] public Dictionary StorageParams { get; private init; } - [ProtoMember(3)] - public bool BackupMail { get; private init; } - [ProtoMember(4)] public bool IsScheduled { get; private init; } diff --git a/common/ASC.Data.Backup.Core/Service/BackupService.cs b/common/ASC.Data.Backup.Core/Service/BackupService.cs index e9be982bc8..f857b33dea 100644 --- a/common/ASC.Data.Backup.Core/Service/BackupService.cs +++ b/common/ASC.Data.Backup.Core/Service/BackupService.cs @@ -126,7 +126,7 @@ public class BackupService : IBackupService public void StartTransfer(StartTransferRequest request) { - var progress = _backupWorker.StartTransfer(request.TenantId, request.TargetRegion, request.BackupMail, request.NotifyUsers); + var progress = _backupWorker.StartTransfer(request.TenantId, request.TargetRegion, request.NotifyUsers); if (!string.IsNullOrEmpty(progress.Error)) { throw new FaultException(); @@ -209,7 +209,6 @@ public class BackupService : IBackupService { TenantId = request.TenantId, Cron = request.Cron, - BackupMail = request.BackupMail, BackupsStored = request.NumberOfBackupsStored, StorageType = request.StorageType, StorageBasePath = request.StorageBasePath, @@ -231,7 +230,6 @@ public class BackupService : IBackupService { StorageType = schedule.StorageType, StorageBasePath = schedule.StorageBasePath, - BackupMail = schedule.BackupMail, NumberOfBackupsStored = schedule.BackupsStored, Cron = schedule.Cron, LastBackupTime = schedule.LastBackupTime, diff --git a/common/ASC.Data.Backup.Core/Service/BackupWorker.cs b/common/ASC.Data.Backup.Core/Service/BackupWorker.cs index 98a43c5444..edf54787f4 100644 --- a/common/ASC.Data.Backup.Core/Service/BackupWorker.cs +++ b/common/ASC.Data.Backup.Core/Service/BackupWorker.cs @@ -209,7 +209,7 @@ public class BackupWorker } } - public BackupProgress StartTransfer(int tenantId, string targetRegion, bool transferMail, bool notify) + public BackupProgress StartTransfer(int tenantId, string targetRegion, bool notify) { lock (_synchRoot) { @@ -223,7 +223,7 @@ public class BackupWorker if (item == null) { item = _serviceProvider.GetService(); - item.Init(targetRegion, transferMail, tenantId, TempFolder, _limit, notify, _currentRegion, _configPaths); + item.Init(targetRegion, tenantId, TempFolder, _limit, notify, _currentRegion, _configPaths); _progressQueue.EnqueueTask(item); } diff --git a/common/ASC.Data.Backup.Core/Service/ProgressItems/BackupProgressItem.cs b/common/ASC.Data.Backup.Core/Service/ProgressItems/BackupProgressItem.cs index 381be2af55..dbb4b898e7 100644 --- a/common/ASC.Data.Backup.Core/Service/ProgressItems/BackupProgressItem.cs +++ b/common/ASC.Data.Backup.Core/Service/ProgressItems/BackupProgressItem.cs @@ -54,7 +54,6 @@ namespace ASC.Data.Backup.Services; [Transient] public class BackupProgressItem : BaseBackupProgressItem { - public bool BackupMail { get; set; } public Dictionary StorageParams { get; set; } public string TempFolder { get; set; } @@ -94,7 +93,6 @@ public class BackupProgressItem : BaseBackupProgressItem TenantId = schedule.TenantId; _storageType = schedule.StorageType; _storageBasePath = schedule.StorageBasePath; - BackupMail = schedule.BackupMail; StorageParams = JsonConvert.DeserializeObject>(schedule.StorageParams); _isScheduled = isScheduled; TempFolder = tempFolder; @@ -109,7 +107,6 @@ public class BackupProgressItem : BaseBackupProgressItem TenantId = request.TenantId; _storageType = request.StorageType; _storageBasePath = request.StorageBasePath; - BackupMail = request.BackupMail; StorageParams = request.StorageParams.ToDictionary(r => r.Key, r => r.Value); _isScheduled = isScheduled; TempFolder = tempFolder; @@ -142,11 +139,7 @@ public class BackupProgressItem : BaseBackupProgressItem { var backupTask = _backupPortalTask; - backupTask.Init(TenantId, _configPaths[_currentRegion], tempFile, _limit); - if (!BackupMail) - { - backupTask.IgnoreModule(ModuleName.Mail); - } + backupTask.Init(TenantId, _configPaths[_currentRegion], tempFile, _limit); backupTask.ProgressChanged += (sender, args) => { diff --git a/common/ASC.Data.Backup.Core/Service/ProgressItems/TransferProgressItem.cs b/common/ASC.Data.Backup.Core/Service/ProgressItems/TransferProgressItem.cs index 9badb4a838..c579208999 100644 --- a/common/ASC.Data.Backup.Core/Service/ProgressItems/TransferProgressItem.cs +++ b/common/ASC.Data.Backup.Core/Service/ProgressItems/TransferProgressItem.cs @@ -74,7 +74,6 @@ public class TransferProgressItem : BaseBackupProgressItem } public string TargetRegion { get; set; } - public bool TransferMail { get; set; } public bool Notify { get; set; } public string TempFolder { get; set; } public Dictionary ConfigPaths { get; set; } @@ -83,7 +82,6 @@ public class TransferProgressItem : BaseBackupProgressItem public void Init( string targetRegion, - bool transferMail, int tenantId, string tempFolder, int limit, @@ -93,7 +91,6 @@ public class TransferProgressItem : BaseBackupProgressItem { TenantId = tenantId; TargetRegion = targetRegion; - TransferMail = transferMail; Notify = notify; TempFolder = tempFolder; ConfigPaths = configPaths; @@ -122,11 +119,8 @@ public class TransferProgressItem : BaseBackupProgressItem { Percentage = args.Progress; PublishChanges(); - }; - if (!TransferMail) - { - transferProgressItem.IgnoreModule(ModuleName.Mail); - } + }; + transferProgressItem.RunJob(); Link = GetLink(alias, false); diff --git a/common/ASC.Data.Backup.Core/Tasks/Modules/CalendarModuleSpecifics.cs b/common/ASC.Data.Backup.Core/Tasks/Modules/CalendarModuleSpecifics.cs deleted file mode 100644 index 96080fe349..0000000000 --- a/common/ASC.Data.Backup.Core/Tasks/Modules/CalendarModuleSpecifics.cs +++ /dev/null @@ -1,101 +0,0 @@ -// (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.Data.Backup.Tasks.Modules; - -public class CalendarModuleSpecifics : ModuleSpecificsBase -{ - public override ModuleName ModuleName => ModuleName.Calendar; - public override IEnumerable Tables => _tables; - public override IEnumerable TableRelations => _tableRelations; - - private readonly RelationInfo[] _tableRelations; - private readonly TableInfo[] _tables = new[] - { - new TableInfo("calendar_calendars", "tenant", "id") {UserIDColumns = new[] {"owner_id"}}, - new TableInfo("calendar_calendar_item"), - new TableInfo("calendar_calendar_user") {UserIDColumns = new[] {"user_id"}}, - new TableInfo("calendar_events", "tenant", "id") - { - UserIDColumns = new[] {"owner_id"}, - DateColumns = new Dictionary {{"start_date", true}, {"end_date", true}} - }, - new TableInfo("calendar_event_history", "tenant"), - new TableInfo("calendar_event_item"), - new TableInfo("calendar_event_user") {UserIDColumns = new[] {"user_id"}}, - new TableInfo("calendar_notifications", "tenant") - { - UserIDColumns = new[] {"user_id"}, - DateColumns = new Dictionary {{"notify_date", true}} - } - }; - - public CalendarModuleSpecifics(Helpers helpers) - : base(helpers) - { - _tableRelations = new[] - { - new RelationInfo("calendar_calendars", "id", "calendar_calendar_item", "calendar_id"), - new RelationInfo("calendar_calendars", "id", "calendar_calendar_user", "calendar_id"), - new RelationInfo("calendar_calendars", "id", "calendar_events", "calendar_id"), - new RelationInfo("calendar_calendars", "id", "calendar_event_history", "calendar_id"), - new RelationInfo("calendar_events", "id", "calendar_event_history", "event_id"), - new RelationInfo("calendar_events", "id", "calendar_event_item", "event_id"), - new RelationInfo("calendar_events", "id", "calendar_event_user", "event_id"), - new RelationInfo("calendar_events", "id", "calendar_notifications", "event_id"), - new RelationInfo("core_user", "id", "calendar_calendar_item", "item_id", typeof(TenantsModuleSpecifics), - x => Convert.ToInt32(x["is_group"]) == 0), - new RelationInfo("core_group", "id", "calendar_calendar_item", "item_id", typeof(TenantsModuleSpecifics), - x => Convert.ToInt32(x["is_group"]) == 1 && !helpers.IsEmptyOrSystemGroup(Convert.ToString(x["item_id"]))), - new RelationInfo("core_user", "id", "calendar_event_item", "item_id", typeof(TenantsModuleSpecifics), - x => Convert.ToInt32(x["is_group"]) == 0), - new RelationInfo("core_group", "id", "calendar_event_item", "item_id", typeof(TenantsModuleSpecifics), - x => Convert.ToInt32(x["is_group"]) == 1 && !helpers.IsEmptyOrSystemGroup(Convert.ToString(x["item_id"]))) - }; - } - - protected override string GetSelectCommandConditionText(int tenantId, TableInfo table) - { - if (table.Name == "calendar_calendar_item" || table.Name == "calendar_calendar_user") - { - return "inner join calendar_calendars as t1 on t1.id = t.calendar_id where t1.tenant = " + tenantId; - } - - if (table.Name == "calendar_event_item" || table.Name == "calendar_event_user") - { - return "inner join calendar_events as t1 on t1.id = t.event_id where t1.tenant = " + tenantId; - } - - if (table.Name == "calendar_event_history") - { - return string.Format( - "inner join calendar_calendars as t1 on t1.id = t.calendar_id and t1.tenant = t.tenant inner join calendar_events as t2 on t2.id = t.event_id where t1.tenant = {0} and t2.tenant = {0}", - tenantId); - } - - return base.GetSelectCommandConditionText(tenantId, table); - } -} diff --git a/common/ASC.Data.Backup.Core/Tasks/Modules/CommunityModuleSpecifics.cs b/common/ASC.Data.Backup.Core/Tasks/Modules/CommunityModuleSpecifics.cs deleted file mode 100644 index a2695c86aa..0000000000 --- a/common/ASC.Data.Backup.Core/Tasks/Modules/CommunityModuleSpecifics.cs +++ /dev/null @@ -1,289 +0,0 @@ -// (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.Data.Backup.Tasks.Modules; - -public class CommunityModuleSpecifics : ModuleSpecificsBase -{ - public override ModuleName ModuleName => ModuleName.Community; - public override IEnumerable Tables => _tables; - public override IEnumerable TableRelations => _tableRelations; - - private readonly TableInfo[] _tables = new[] - { - new TableInfo("bookmarking_bookmark", "Tenant", "ID") - { - UserIDColumns = new[] {"UserCreatorID"}, - DateColumns = new Dictionary {{"Date", false}} - }, - new TableInfo("bookmarking_bookmarktag", "tenant"), - new TableInfo("bookmarking_comment", "tenant", "ID", IdType.Guid) - { - UserIDColumns = new[] {"UserID"}, - DateColumns = new Dictionary {{"Datetime", false}} - }, - new TableInfo("bookmarking_tag", "tenant", "TagID"), - new TableInfo("bookmarking_userbookmark", "tenant", "UserBookmarkID") - { - UserIDColumns = new[] {"UserID"}, - DateColumns = new Dictionary {{"DateAdded", false}, {"LastModified", false}} - }, - new TableInfo("bookmarking_userbookmarktag", "tenant"), - new TableInfo("blogs_comments", "Tenant", "id", IdType.Guid) - { - UserIDColumns = new[] {"created_by"}, - DateColumns = new Dictionary {{"created_when", false}} - }, - new TableInfo("blogs_posts", "Tenant", "post_id", IdType.Autoincrement) - { - UserIDColumns = new[] {"created_by"}, - DateColumns = new Dictionary {{"created_when", false}, {"LastModified", false}} - }, - new TableInfo("blogs_reviewposts", "Tenant") - { - UserIDColumns = new[] {"reviewed_by"}, - DateColumns = new Dictionary {{"timestamp", false}} - }, - new TableInfo("blogs_tags", "Tenant"), - new TableInfo("events_comment", "Tenant", "id") - { - UserIDColumns = new[] {"Creator"}, - DateColumns = new Dictionary {{"Date", false}} - }, - new TableInfo("events_feed", "Tenant", "id") - { - UserIDColumns = new[] {"Creator"}, - DateColumns = new Dictionary {{"Date", false}, {"LastModified", false}} - }, - new TableInfo("events_poll", "Tenant") - { - DateColumns = new Dictionary {{"StartDate", true}, {"EndDate", true}} - }, - new TableInfo("events_pollanswer", "Tenant") {UserIDColumns = new[] {"User"}}, //todo: check //varchar(64)? - new TableInfo("events_pollvariant", "Tenant", "Id"), - new TableInfo("events_reader", "Tenant") {UserIDColumns = new[] {"Reader"}}, //todo: check - new TableInfo("forum_answer", "TenantID", "id") - { - UserIDColumns = new[] {"user_id"}, - DateColumns = new Dictionary {{"create_date", false}} - }, - new TableInfo("forum_answer_variant"), - new TableInfo("forum_attachment", "TenantID", "id") - { - DateColumns = new Dictionary {{"create_date", false}} - }, - new TableInfo("forum_category", "TenantID", "id") - { - UserIDColumns = new[] {"poster_id"}, - DateColumns = new Dictionary {{"create_date", false}} - }, - new TableInfo("forum_lastvisit", "tenantid") - { - UserIDColumns = new[] {"user_id"}, - DateColumns = new Dictionary {{"last_visit", false}} - }, - new TableInfo("forum_post", "TenantID", "id") - { - UserIDColumns = new[] {"poster_id", "editor_id"}, - DateColumns = new Dictionary {{"create_date", false}, {"edit_date", false}, {"LastModified", false}} - }, - new TableInfo("forum_question", "TenantID", "id") {DateColumns = new Dictionary {{"create_date", false}}}, - new TableInfo("forum_tag", "TenantID", "id"), - new TableInfo("forum_thread", "TenantID", "id") - { - UserIDColumns = new[] {"recent_poster_id"}, - DateColumns = new Dictionary {{"recent_post_date", false}} - }, - new TableInfo("forum_topic", "TenantID", "id") - { - UserIDColumns = new[] {"poster_id"}, - DateColumns = new Dictionary {{"create_date", false}, {"LastModified", false}} - }, - new TableInfo("forum_topicwatch", "TenantID") {UserIDColumns = new[] {"UserID"}}, - new TableInfo("forum_topic_tag"), - new TableInfo("forum_variant", idColumn: "id"), - new TableInfo("wiki_categories", "Tenant"), - new TableInfo("wiki_comments", "Tenant", "Id", IdType.Guid) - { - UserIDColumns = new[] {"UserId"}, - DateColumns = new Dictionary {{"Date", false}} - }, - new TableInfo("wiki_files", "Tenant") - { - UserIDColumns = new[] {"UserID"}, - DateColumns = new Dictionary {{"Date", false}} - }, - new TableInfo("wiki_pages", "tenant", "id", IdType.Autoincrement) - { - UserIDColumns = new[] {"modified_by"}, - DateColumns = new Dictionary {{"modified_on", false}} - }, - new TableInfo("wiki_pages_history", "Tenant") - { - UserIDColumns = new[] {"create_by"}, - DateColumns = new Dictionary {{"create_on", false}} - }, - }; - - private readonly RelationInfo[] _tableRelations = new[] - { - new RelationInfo("bookmarking_bookmark", "ID", "bookmarking_bookmarktag", "BookmarkID"), - new RelationInfo("bookmarking_tag", "TagID", "bookmarking_bookmarktag", "TagID"), - new RelationInfo("bookmarking_bookmark", "ID", "bookmarking_comment", "BookmarkID"), - new RelationInfo("bookmarking_comment", "ID", "bookmarking_comment", "Parent"), - new RelationInfo("bookmarking_bookmark", "ID", "bookmarking_userbookmark", "BookmarkID"), - new RelationInfo("bookmarking_tag", "TagID", "bookmarking_userbookmarktag", "TagID"), - new RelationInfo("bookmarking_userbookmark", "UserBookmarkID", "bookmarking_userbookmarktag", "UserBookmarkID"), - new RelationInfo("blogs_comments", "id", "blogs_comments", "parent_id"), - new RelationInfo("blogs_posts", "id", "blogs_comments", "post_id"), - new RelationInfo("blogs_comments", "id", "blogs_posts", "LastCommentId", null, null, RelationImportance.Low), - new RelationInfo("blogs_posts", "id", "blogs_reviewposts", "post_id"), - new RelationInfo("blogs_posts", "id", "blogs_tags", "post_id"), - new RelationInfo("events_feed", "Id", "events_comment", "Feed"), - new RelationInfo("events_comment", "Id", "events_comment", "Parent"), - new RelationInfo("events_feed", "Id", "events_poll", "Id"), - new RelationInfo("events_pollvariant", "Id", "events_pollanswer", "Variant"), - new RelationInfo("events_feed", "Id", "events_pollvariant", "Poll"), - new RelationInfo("events_feed", "Id", "events_reader", "Feed"), - new RelationInfo("forum_question", "id", "forum_answer", "question_id"), - new RelationInfo("forum_answer", "id", "forum_answer_variant", "answer_id"), - new RelationInfo("forum_variant", "id", "forum_answer_variant", "variant_id"), - new RelationInfo("forum_post", "id", "forum_attachment", "post_id"), - new RelationInfo("forum_category", "id", "forum_attachment", "path"), - new RelationInfo("forum_thread", "id", "forum_attachment", "path"), - new RelationInfo("forum_thread", "id", "forum_lastvisit", "thread_id"), - new RelationInfo("forum_topic", "id", "forum_post", "topic_id"), - new RelationInfo("forum_post", "id", "forum_post", "parent_post_id"), - new RelationInfo("forum_topic", "id", "forum_question", "topic_id"), - new RelationInfo("forum_category", "id", "forum_thread", "category_id"), - new RelationInfo("forum_post", "id", "forum_thread", "recent_post_id", null, null, RelationImportance.Low), - new RelationInfo("forum_topic", "id", "forum_thread", "recent_topic_id", null, null, RelationImportance.Low), - new RelationInfo("forum_thread", "id", "forum_topic", "thread_id"), - new RelationInfo("forum_question", "id", "forum_topic", "question_id", null, null, RelationImportance.Low), - new RelationInfo("forum_post", "id", "forum_topic", "recent_post_id", null, null, RelationImportance.Low), - new RelationInfo("forum_topic", "id", "forum_topicwatch", "TopicID"), - new RelationInfo("forum_topic", "id", "forum_topic_tag", "topic_id"), - new RelationInfo("forum_tag", "id", "forum_topic_tag", "tag_id"), - new RelationInfo("forum_question", "id", "forum_variant", "question_id"), - new RelationInfo("wiki_comments", "Id", "wiki_comments", "ParentId") - }; - - public CommunityModuleSpecifics(Helpers helpers) - : base(helpers) { } - - public override bool TryAdjustFilePath(bool dump, ColumnMapper columnMapper, ref string filePath) - { - filePath = PreparePath(dump, columnMapper, "/", filePath); - return filePath != null; - } - - protected override bool TryPrepareValue(bool dump, DbConnection connection, ColumnMapper columnMapper, TableInfo table, string columnName, IEnumerable relations, ref object value) - { - relations = relations.ToList(); - - if (relations.All(x => x.ChildTable == "forum_attachment" && x.ChildColumn == "path")) - { - value = PreparePath(dump, columnMapper, "\\", Convert.ToString(value)); - return value != null; - } - - return base.TryPrepareValue(dump, connection, columnMapper, table, columnName, relations, ref value); - } - - protected override bool TryPrepareValue(DbConnection connection, ColumnMapper columnMapper, TableInfo table, string columnName, ref object value) - { - var column = columnName.ToLowerInvariant(); - if (table.Name == "forum_post" && column == "text" || - table.Name == "events_feed" && column == "text" || - table.Name == "events_comment" && column == "comment" || - table.Name == "blogs_posts" && column == "content" || - table.Name == "blogs_comments" && column == "content" || - table.Name == "bookmarking_comment" && column == "content" || - table.Name == "wiki_comments" && column == "body") - { - value = FCKEditorPathUtility.CorrectStoragePath(value as string, columnMapper.GetTenantMapping()); - return true; - } - return base.TryPrepareValue(connection, columnMapper, table, columnName, ref value); - } - - protected override string GetSelectCommandConditionText(int tenantId, TableInfo table) - { - if (table.Name == "forum_answer_variant") - { - return "inner join forum_answer as t1 on t1.id = t.answer_id where t1.TenantID = " + tenantId; - } - - if (table.Name == "forum_variant") - { - return "inner join forum_question as t1 on t1.id = t.question_id where t1.TenantID = " + tenantId; - } - - if (table.Name == "forum_topic_tag") - { - return "inner join forum_topic as t1 on t1.id = t.topic_id where t1.TenantID = " + tenantId; - } - - return base.GetSelectCommandConditionText(tenantId, table); - } - - private static string PreparePath(bool dump, ColumnMapper columnMapper, string partsSeparator, string path) - { - var parts = path.Split(new[] { partsSeparator }, StringSplitOptions.None); - - if (parts.Length != 4) - { - return null; - } - - var categoryId = columnMapper.GetMapping("forum_category", "id", parts[0]); - if (categoryId == null) - { - if (!dump) - { - return null; - } - - categoryId = parts[0]; - } - - var threadId = columnMapper.GetMapping("forum_thread", "id", parts[1]); - if (threadId == null) - { - if (!dump) - { - return null; - } - - threadId = parts[1]; - } - - parts[0] = categoryId.ToString(); - parts[1] = threadId.ToString(); - - return string.Join(partsSeparator, parts); - } -} diff --git a/common/ASC.Data.Backup.Core/Tasks/Modules/CoreModuleSpecifics.cs b/common/ASC.Data.Backup.Core/Tasks/Modules/CoreModuleSpecifics.cs index 10ccb76e60..3331a94837 100644 --- a/common/ASC.Data.Backup.Core/Tasks/Modules/CoreModuleSpecifics.cs +++ b/common/ASC.Data.Backup.Core/Tasks/Modules/CoreModuleSpecifics.cs @@ -91,51 +91,6 @@ public class CoreModuleSpecifics : ModuleSpecificsBase new RelationInfo("core_group", "id", "core_usergroup", "groupid", typeof(TenantsModuleSpecifics), x => !helpers.IsEmptyOrSystemGroup(Convert.ToString(x["groupid"]))), - new RelationInfo("crm_contact", "id", "core_acl", "object", typeof(CrmModuleSpecifics), - x => Convert.ToString(x["object"]).StartsWith(CrmCompanyAclObjectStart) || Convert.ToString(x["object"]).StartsWith(CrmPersonAclObjectStart)), - - new RelationInfo("crm_deal", "id", "core_acl", "object", typeof(CrmModuleSpecifics), - x => Convert.ToString(x["object"]).StartsWith(CrmDealAclObjectStart)), - - new RelationInfo("crm_case", "id", "core_acl", "object", typeof(CrmModuleSpecifics), - x => Convert.ToString(x["object"]).StartsWith(CrmCasesAclObjectStart)), - - new RelationInfo("crm_relationship_event", "id", "core_acl", "object", typeof(CrmModuleSpecifics2), - x => Convert.ToString(x["object"]).StartsWith(CrmRelationshipEventAclObjectStart)), - - new RelationInfo("calendar_calendars", "id", "core_acl", "object", typeof(CalendarModuleSpecifics), - x => Convert.ToString(x["object"]).StartsWith(CalendarCalendarAclObjectStart)), - - new RelationInfo("calendar_events", "id", "core_acl", "object", typeof(CalendarModuleSpecifics), - x => Convert.ToString(x["object"]).StartsWith(CalendarEventAclObjectStart)), - - new RelationInfo("projects_projects", "id", "core_subscription", "object", typeof(ProjectsModuleSpecifics), - x => ValidateSource(_projectsSourceID, x)), - - new RelationInfo("projects_tasks", "id", "core_subscription", "object", typeof(ProjectsModuleSpecifics), - x => ValidateSource(_projectsSourceID, x) && Convert.ToString(x["object"]).StartsWith("Task_")), - - new RelationInfo("projects_messages", "id", "core_subscription", "object", typeof(ProjectsModuleSpecifics), - x => ValidateSource(_projectsSourceID, x) && Convert.ToString(x["object"]).StartsWith("Message_")), - - new RelationInfo("projects_milestones", "id", "core_subscription", "object", typeof(ProjectsModuleSpecifics), - x => ValidateSource(_projectsSourceID, x) && Convert.ToString(x["object"]).StartsWith("Milestone_")), - - new RelationInfo("bookmarking_bookmark", "ID", "core_subscription", "object", typeof(CommunityModuleSpecifics), - x => ValidateSource(_bookmarksSourceID, x) && !string.IsNullOrEmpty(Convert.ToString(x["object"]))), - - new RelationInfo("forum_topic", "id", "core_subscription", "object", typeof(CommunityModuleSpecifics), - x => ValidateSource(_forumsSourceID, x) && Convert.ToString(x["action"]) == ForumsNewPostInTopicActionID && !string.IsNullOrEmpty(Convert.ToString(x["object"]))), - - new RelationInfo("forum_thread", "id", "core_subscription", "object", typeof(CommunityModuleSpecifics), - x => ValidateSource(_forumsSourceID, x) && Convert.ToString(x["action"]) == ForumsNewPostInThreadActionID && !string.IsNullOrEmpty(Convert.ToString(x["object"]))), - - new RelationInfo("events_feed", "id", "core_subscription", "object", typeof(CommunityModuleSpecifics), - x => ValidateSource(_newsSourceID, x) && Convert.ToString(x["action"]) == NewsNewCommentActionID && !string.IsNullOrEmpty(Convert.ToString(x["object"]))), - - new RelationInfo("blogs_posts", "id", "core_subscription", "object", typeof(CommunityModuleSpecifics), - x => ValidateSource(_blogsSourceID, x) && Convert.ToString(x["action"]) == BlogsNewCommentActionID), - new RelationInfo("core_user", "id", "feed_users", "user_id", typeof(CoreModuleSpecifics)), new RelationInfo("files_folder", "id", "backup_backup", "storage_base_path", typeof(FilesModuleSpecifics), diff --git a/common/ASC.Data.Backup.Core/Tasks/Modules/CrmModuleSpecifics.cs b/common/ASC.Data.Backup.Core/Tasks/Modules/CrmModuleSpecifics.cs deleted file mode 100644 index 1ce515be13..0000000000 --- a/common/ASC.Data.Backup.Core/Tasks/Modules/CrmModuleSpecifics.cs +++ /dev/null @@ -1,356 +0,0 @@ -// (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.Data.Backup.Tasks.Modules; - -public class CrmModuleSpecifics : ModuleSpecificsBase -{ - public override ModuleName ModuleName => ModuleName.Crm; - public override IEnumerable Tables => _tables; - public override IEnumerable TableRelations => _tableRelations; - - private readonly TableInfo[] _tables = new[] - { - new TableInfo("crm_case", "tenant_id", "id") - { - UserIDColumns = new[] {"create_by", "last_modifed_by"}, - DateColumns = new Dictionary {{"create_on", false}, {"last_modifed_on", false}} - }, - new TableInfo("crm_contact", "tenant_id", "id") - { - UserIDColumns = new[] {"create_by", "last_modifed_by"}, - DateColumns = new Dictionary {{"create_on", false}, {"last_modifed_on", false}} - }, - new TableInfo("crm_contact_info", "tenant_id", "id") - { - UserIDColumns = new[] {"last_modifed_by"}, - DateColumns = new Dictionary {{"last_modifed_on", false}} - }, - new TableInfo("crm_deal", "tenant_id", "id") - { - UserIDColumns = new[] {"create_by", "last_modifed_by", "responsible_id"}, - DateColumns = new Dictionary {{"create_on", false}, {"last_modifed_on", false}, {"expected_close_date", true}, {"actual_close_date", true}} - }, - new TableInfo("crm_deal_milestone", "tenant_id", "id"), - new TableInfo("crm_field_description", "tenant_id", "id"), - new TableInfo("crm_list_item", "tenant_id", "id"), - new TableInfo("crm_projects", "tenant_id"), - new TableInfo("crm_tag", "tenant_id", "id"), - new TableInfo("crm_task", "tenant_id", "id") - { - UserIDColumns = new[] {"create_by", "last_modifed_by", "responsible_id"}, - DateColumns = new Dictionary {{"create_on", false}, {"last_modifed_on", false}, {"deadline", true}} - }, - new TableInfo("crm_task_template", "tenant_id", "id") - { - UserIDColumns = new[] {"create_by", "last_modifed_by", "responsible_id"}, - DateColumns = new Dictionary {{"create_on", false}, {"last_modifed_on", false}} - }, - new TableInfo("crm_task_template_container", "tenant_id", "id") - { - UserIDColumns = new[] {"create_by", "last_modifed_by"}, - DateColumns = new Dictionary {{"create_on", false}, {"last_modifed_on", false}} - }, - new TableInfo("crm_task_template_task", "tenant_id"), - new TableInfo("crm_currency_rate", "tenant_id", "id") - { - UserIDColumns = new[] {"create_by", "last_modified_by"}, - DateColumns = new Dictionary {{"create_on", false}, {"last_modified_on", false}} - } - }; - - private readonly RelationInfo[] _tableRelations = new[] - { - new RelationInfo("crm_contact", "id", "crm_contact", "company_id"), - new RelationInfo("crm_list_item", "id", "crm_contact", "status_id"), - new RelationInfo("crm_list_item", "id", "crm_contact", "contact_type_id"), - new RelationInfo("crm_contact", "id", "crm_contact_info", "contact_id"), - new RelationInfo("crm_deal_milestone", "id", "crm_deal", "deal_milestone_id"), - new RelationInfo("crm_contact", "id", "crm_deal", "contact_id"), - new RelationInfo("projects_projects", "id", "crm_projects", "project_id", typeof(ProjectsModuleSpecifics)), - new RelationInfo("crm_contact", "id", "crm_projects", "contact_id"), - new RelationInfo("crm_contact", "id", "crm_task", "entity_id", x => ResolveRelation(x, 0, 4, 5)), - new RelationInfo("crm_deal", "id", "crm_task", "entity_id", x => ResolveRelation(x, 1)), - new RelationInfo("crm_task", "id", "crm_task", "entity_id", x => ResolveRelation(x, 3)), - new RelationInfo("crm_case", "id", "crm_task", "entity_id", x => ResolveRelation(x, 7)), - new RelationInfo("crm_contact", "id", "crm_task", "contact_id"), - new RelationInfo("crm_list_item", "id", "crm_task", "category_id"), - new RelationInfo("crm_list_item", "id", "crm_task_template", "category_id"), - new RelationInfo("crm_task_template_container", "id", "crm_task_template", "container_id"), - new RelationInfo("crm_task", "id", "crm_task_template_task", "task_id"), - new RelationInfo("crm_task_template", "id", "crm_task_template_task", "task_template_id") - }; - - public CrmModuleSpecifics(Helpers helpers) - : base(helpers) { } - - public override bool TryAdjustFilePath(bool dump, ColumnMapper columnMapper, ref string filePath) - { - var pathMatch = Regex.Match(filePath, @"^photos/\d+/\d+/\d+/contact_(?'contactId'\d+)(?'sizeExtension'_\d+_\d+\.\w+)$", RegexOptions.Compiled); - if (pathMatch.Success) - { - var contactId = columnMapper.GetMapping("crm_contact", "id", pathMatch.Groups["contactId"].Value); - if (contactId == null) - { - if (!dump) - { - return false; - } - - contactId = pathMatch.Groups["contactId"].Value; - } - - var s = contactId.ToString().PadLeft(6, '0'); - filePath = string.Format("photos/{0}/{1}/{2}/contact_{3}{4}", s.Substring(0, 2), s.Substring(2, 2), s.Substring(4), contactId, pathMatch.Groups["sizeExtension"].Value); - - return true; - } - - return false; - } - - private static bool ResolveRelation(DataRowInfo row, params int[] matchingTypes) - { - var entityType = Convert.ToInt32(row["entity_type"]); - - return matchingTypes.Contains(entityType); - } -} - -//todo: hack: in future there be no modules only tables!!! -public class CrmModuleSpecifics2 : ModuleSpecificsBase -{ - public override string ConnectionStringName => "crm"; - public override ModuleName ModuleName => ModuleName.Crm2; - public override IEnumerable Tables => _tables; - public override IEnumerable TableRelations => _tableRelations; - - private readonly TableInfo[] _tables = new[] - { - new TableInfo("crm_field_value", "tenant_id", "id", IdType.Autoincrement) {UserIDColumns = new[] {"last_modifed_by"}}, - new TableInfo("crm_entity_contact"), - new TableInfo("crm_entity_tag"), - new TableInfo("crm_relationship_event", "tenant_id", "id") {UserIDColumns = new[] {"create_by", "last_modifed_by"}}, - }; - - private readonly RelationInfo[] _tableRelations = new[] - { - new RelationInfo("crm_contact", "id", "crm_field_value", "entity_id", x => ResolveRelation(x, 0, 4, 5)), - new RelationInfo("crm_deal", "id", "crm_field_value", "entity_id", x => ResolveRelation(x, 1)), - new RelationInfo("crm_task", "id", "crm_field_value", "entity_id", x => ResolveRelation(x, 3)), - new RelationInfo("crm_case", "id", "crm_field_value", "entity_id", x => ResolveRelation(x, 7)), - new RelationInfo("crm_field_description", "id", "crm_field_value", "field_id"), - new RelationInfo("crm_contact", "id", "crm_entity_contact", "entity_id", x => ResolveRelation(x, 0, 4, 5)), - new RelationInfo("crm_deal", "id", "crm_entity_contact", "entity_id", x => ResolveRelation(x, 1)), - new RelationInfo("crm_task", "id", "crm_entity_contact", "entity_id", x => ResolveRelation(x, 3)), - new RelationInfo("crm_case", "id", "crm_entity_contact", "entity_id", x => ResolveRelation(x, 7)), - new RelationInfo("crm_contact", "id", "crm_entity_contact", "contact_id"), - new RelationInfo("crm_contact", "id", "crm_entity_tag", "entity_id", x => ResolveRelation(x, 0, 4, 5)), - new RelationInfo("crm_deal", "id", "crm_entity_tag", "entity_id", x => ResolveRelation(x, 1)), - new RelationInfo("crm_task", "id", "crm_entity_tag", "entity_id", x => ResolveRelation(x, 3)), - new RelationInfo("crm_case", "id", "crm_entity_tag", "entity_id", x => ResolveRelation(x, 7)), - new RelationInfo("crm_tag", "id", "crm_entity_tag", "tag_id"), - new RelationInfo("crm_contact", "id", "crm_relationship_event", "entity_id", typeof(CrmModuleSpecifics), x => ResolveRelation(x, 0, 4, 5)), - new RelationInfo("crm_deal", "id", "crm_relationship_event", "entity_id", typeof(CrmModuleSpecifics), x => ResolveRelation(x, 1)), - new RelationInfo("crm_relationship_event", "id", "crm_relationship_event", "entity_id", typeof(CrmModuleSpecifics), x => ResolveRelation(x, 2)), - new RelationInfo("crm_task", "id", "crm_relationship_event", "entity_id", typeof(CrmModuleSpecifics), x => ResolveRelation(x, 3)), - new RelationInfo("crm_case", "id", "crm_relationship_event", "entity_id", typeof(CrmModuleSpecifics), x => ResolveRelation(x, 7)), - new RelationInfo("crm_contact", "id", "crm_relationship_event", "contact_id", typeof(CrmModuleSpecifics)), - new RelationInfo("crm_list_item", "id", "crm_relationship_event", "category_id", typeof(CrmModuleSpecifics)), - new RelationInfo("crm_relationship_event", "id", "crm_field_value", "entity_id", typeof(CrmModuleSpecifics), x => ResolveRelation(x, 2)), - new RelationInfo("crm_relationship_event", "id", "crm_entity_tag", "entity_id", typeof(CrmModuleSpecifics), x => ResolveRelation(x, 2)), - new RelationInfo("crm_relationship_event", "id", "crm_entity_contact", "entity_id", typeof(CrmModuleSpecifics), x => ResolveRelation(x, 2)), - new RelationInfo("mail_mail", "id", "crm_relationship_event", "content", typeof(MailModuleSpecifics), x => Convert.ToInt32(x["category_id"]) == -3), - }; - - public CrmModuleSpecifics2(Helpers helpers) : base(helpers) { } - - public override bool TryAdjustFilePath(bool dump, ColumnMapper columnMapper, ref string filePath) - { - var match = Regex.Match(filePath, @"(?<=folder_\d+/message_)\d+(?=\.html)"); //todo: - if (match.Success) - { - var mappedMessageId = Convert.ToString(columnMapper.GetMapping("mail_mail", "id", match.Value)); - - if (dump && string.IsNullOrEmpty(mappedMessageId)) - { - mappedMessageId = match.Value; - } - - if (!string.IsNullOrEmpty(mappedMessageId)) - { - filePath = string.Format("folder_{0}/message_{1}.html", (Convert.ToInt32(mappedMessageId) / 1000 + 1) * 1000, mappedMessageId); - } - return true; - } - return base.TryAdjustFilePath(dump, columnMapper, ref filePath); - } - - protected override string GetSelectCommandConditionText(int tenantId, TableInfo table) - { - if (table.Name == "crm_entity_contact") - { - return "inner join crm_contact as t1 on t1.id = t.contact_id where t1.tenant_id = " + tenantId; - } - - if (table.Name == "crm_entity_tag") - { - return "inner join crm_tag as t1 on t1.id = t.tag_id where t1.tenant_id = " + tenantId; - } - - return base.GetSelectCommandConditionText(tenantId, table); - } - - protected override bool TryPrepareValue(DbConnection connection, ColumnMapper columnMapper, RelationInfo relation, ref object value) - { - if (relation.ChildTable == "crm_relationship_event" && relation.ChildColumn == "content") - { - value = Regex.Replace( - Convert.ToString(value), - @"(?<=""message_id"":|/Products/CRM/HttpHandlers/filehandler\.ashx\?action=mailmessage&message_id=)\d+", - match => - { - var mappedMessageId = Convert.ToString(columnMapper.GetMapping(relation.ParentTable, relation.ParentColumn, match.Value)); - var success = !string.IsNullOrEmpty(mappedMessageId); - return success ? mappedMessageId : match.Value; - }); - - return true; - } - return base.TryPrepareValue(connection, columnMapper, relation, ref value); - } - - private static bool ResolveRelation(DataRowInfo row, params int[] matchingTypes) - { - var entityType = Convert.ToInt32(row["entity_type"]); - return matchingTypes.Contains(entityType); - } -} - -public class CrmInvoiceModuleSpecifics : ModuleSpecificsBase -{ - public override ModuleName ModuleName => ModuleName.CrmInvoice; - public override string ConnectionStringName => "crm"; - public override IEnumerable Tables - { - get - { - return new List - { - new TableInfo("crm_organisation_logo", "tenant_id", "id") - { - UserIDColumns = new[] {"create_by"}, - DateColumns = new Dictionary {{"create_on", false}} - }, - new TableInfo("crm_invoice", "tenant_id", "id") - { - UserIDColumns = new[] {"create_by", "last_modified_by"}, - DateColumns = new Dictionary {{"create_on", false}, {"last_modified_on", false}, {"due_date", false}, {"issue_date", false}} - }, - new TableInfo("crm_invoice_item", "tenant_id", "id") - { - UserIDColumns = new[] {"create_by", "last_modified_by"}, - DateColumns = new Dictionary {{"create_on", false}, {"last_modified_on", false}} - }, - new TableInfo("crm_invoice_line", "tenant_id", "id"), - new TableInfo("crm_invoice_tax", "tenant_id", "id") - { - UserIDColumns = new[] {"create_by", "last_modified_by"}, - DateColumns = new Dictionary {{"create_on", false}, {"last_modified_on", false}} - } - }; - } - } - - public override IEnumerable TableRelations - { - get - { - return new List - { - new RelationInfo("crm_contact", "id", "crm_invoice", "contact_id"), - new RelationInfo("crm_contact", "id", "crm_invoice", "consignee_id"), - new RelationInfo("crm_contact", "id", "crm_invoice", "entity_id", x => ResolveRelation(x, 0, 4, 5)), - new RelationInfo("crm_deal", "id", "crm_invoice", "entity_id", x => ResolveRelation(x, 1)), - new RelationInfo("crm_task", "id", "crm_invoice", "entity_id", x => ResolveRelation(x, 3)), - new RelationInfo("crm_case", "id", "crm_invoice", "entity_id", x => ResolveRelation(x, 7)), - new RelationInfo("files_file", "id", "crm_invoice", "file_id", typeof(FilesModuleSpecifics)), - new RelationInfo("crm_invoice_tax", "id", "crm_invoice_item", "invoice_tax1_id"), - new RelationInfo("crm_invoice_tax", "id", "crm_invoice_item", "invoice_tax2_id"), - new RelationInfo("crm_invoice_tax", "id", "crm_invoice_line", "invoice_tax1_id"), - new RelationInfo("crm_invoice_tax", "id", "crm_invoice_line", "invoice_tax2_id"), - new RelationInfo("crm_invoice", "id", "crm_invoice_line", "invoice_id"), - new RelationInfo("crm_invoice_item", "id", "crm_invoice_line", "invoice_item_id"), - }; - } - } - - public CrmInvoiceModuleSpecifics(Helpers helpers) : base(helpers) { } - - protected override bool TryPrepareValue(DbConnection connection, ColumnMapper columnMapper, TableInfo table, string columnName, ref object value) - { - if (value == null) - { - return false; - } - - if (table.Name == "crm_invoice" && columnName == "json_data") - { - var data = JObject.Parse((string)value); - - var oldValue = Convert.ToInt32(data["LogoBase64Id"]); - if (oldValue != 0) - { - data["LogoBase64Id"] = Convert.ToInt32(columnMapper.GetMapping("crm_organisation_logo", "id", oldValue)); - } - - oldValue = Convert.ToInt32(data["DeliveryAddressID"]); - if (oldValue != 0) - { - data["DeliveryAddressID"] = Convert.ToInt32(columnMapper.GetMapping("crm_contact_info", "id", oldValue)); - } - - oldValue = Convert.ToInt32(data["BillingAddressID"]); - if (oldValue != 0) - { - data["BillingAddressID"] = Convert.ToInt32(columnMapper.GetMapping("crm_contact_info", "id", oldValue)); - } - - value = data.ToString(); - - return true; - } - - return base.TryPrepareValue(connection, columnMapper, table, columnName, ref value); - } - - private static bool ResolveRelation(DataRowInfo row, params int[] matchingTypes) - { - var entityType = Convert.ToInt32(row["entity_type"]); - - return matchingTypes.Contains(entityType); - } -} diff --git a/common/ASC.Data.Backup.Core/Tasks/Modules/FilesModuleSpecifics.cs b/common/ASC.Data.Backup.Core/Tasks/Modules/FilesModuleSpecifics.cs index c16df44075..4dfc1be68e 100644 --- a/common/ASC.Data.Backup.Core/Tasks/Modules/FilesModuleSpecifics.cs +++ b/common/ASC.Data.Backup.Core/Tasks/Modules/FilesModuleSpecifics.cs @@ -74,11 +74,6 @@ public class FilesModuleSpecifics : ModuleSpecificsBase }), new RelationInfo("core_user", "id", "files_security", "subject", typeof(TenantsModuleSpecifics)), new RelationInfo("core_group", "id", "files_security", "subject", typeof(TenantsModuleSpecifics)), - new RelationInfo("crm_deal", "id", "files_bunch_objects", "right_node", typeof(CrmModuleSpecifics), - x => Convert.ToString(x["right_node"]).StartsWith(_bunchRightNodeStartCrmOpportunity)), - - new RelationInfo("projects_projects", "id", "files_bunch_objects", "right_node", typeof(ProjectsModuleSpecifics), - x => Convert.ToString(x["right_node"]).StartsWith(_bunchRightNodeStartProject, StringComparison.InvariantCultureIgnoreCase)), new RelationInfo("files_folder", "id", "files_bunch_objects", "left_node"), new RelationInfo("files_folder", "id", "files_file", "folder_id"), @@ -318,18 +313,6 @@ public class FilesModuleSpecifics2 : ModuleSpecificsBase private readonly RelationInfo[] _rels = new[] { - new RelationInfo("projects_messages", "id", "files_tag", "name", typeof(ProjectsModuleSpecifics), - x => Convert.ToString(x["name"]).StartsWith(_tagStartMessage, StringComparison.InvariantCultureIgnoreCase)), - - new RelationInfo("projects_tasks", "id", "files_tag", "name", typeof(ProjectsModuleSpecifics), - x => Convert.ToString(x["name"]).StartsWith(_tagStartTask, StringComparison.InvariantCultureIgnoreCase)), - - new RelationInfo("projects_projects", "id", "files_tag", "name", typeof(ProjectsModuleSpecifics), - x => Convert.ToString(x["name"]).StartsWith(_tagStartProject, StringComparison.InvariantCultureIgnoreCase)), - - new RelationInfo("crm_relationship_event", "id", "files_tag", "name", typeof(CrmModuleSpecifics2), - x => Convert.ToString(x["name"]).StartsWith(_tagStartRelationshipEvent, StringComparison.InvariantCultureIgnoreCase)), - new RelationInfo("files_tag", "id", "files_tag_link", "tag_id", typeof(FilesModuleSpecifics)), new RelationInfo("files_file", "id", "files_tag_link", "entry_id", typeof(FilesModuleSpecifics), diff --git a/common/ASC.Data.Backup.Core/Tasks/Modules/IModuleSpecifics.cs b/common/ASC.Data.Backup.Core/Tasks/Modules/IModuleSpecifics.cs index 12c8680c81..91b887910b 100644 --- a/common/ASC.Data.Backup.Core/Tasks/Modules/IModuleSpecifics.cs +++ b/common/ASC.Data.Backup.Core/Tasks/Modules/IModuleSpecifics.cs @@ -29,16 +29,9 @@ namespace ASC.Data.Backup.Tasks.Modules; public enum ModuleName { Audit, - Calendar, - Community, Core, - Crm, - Crm2, - CrmInvoice, Files, Files2, - Mail, - Projects, Tenants, WebStudio } diff --git a/common/ASC.Data.Backup.Core/Tasks/Modules/MailModuleSpecifics.cs b/common/ASC.Data.Backup.Core/Tasks/Modules/MailModuleSpecifics.cs deleted file mode 100644 index 1f08f03937..0000000000 --- a/common/ASC.Data.Backup.Core/Tasks/Modules/MailModuleSpecifics.cs +++ /dev/null @@ -1,304 +0,0 @@ -// (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.Data.Backup.Tasks.Modules; - -internal class MailModuleSpecifics : ModuleSpecificsBase -{ - public override ModuleName ModuleName => ModuleName.Mail; - public override IEnumerable Tables => _tables; - public override IEnumerable TableRelations => _tableRelations; - - private readonly ILogger _logger; - private readonly Helpers _helpers; - - private readonly TableInfo[] _tables = new[] - { - new TableInfo("mail_attachment", "tenant", "id"), - new TableInfo("mail_chain", "tenant") {UserIDColumns = new[] {"id_user"}}, - new TableInfo("mail_contacts", "tenant", "id") {UserIDColumns = new[] {"id_user"}}, - new TableInfo("mail_folder_counters", "tenant") {UserIDColumns = new[] {"id_user"}}, - new TableInfo("mail_mail", "tenant", "id") - { - UserIDColumns = new[] {"id_user"}, - DateColumns = new Dictionary {{"date_received", false}, {"date_sent", false}, {"chain_date", false}} - }, - new TableInfo("mail_mailbox", "tenant", "id") - { - UserIDColumns = new[] {"id_user"}, - DateColumns = new Dictionary {{"begin_date", false}} - }, - new TableInfo("mail_tag", "tenant", "id") {UserIDColumns = new[] {"id_user"}}, - new TableInfo("mail_tag_addresses", "tenant"), - new TableInfo("mail_tag_mail", "tenant") {UserIDColumns = new[] {"id_user"}}, - new TableInfo("mail_chain_x_crm_entity", "id_tenant"), - new TableInfo("mail_mailbox_signature", "tenant"), - new TableInfo("mail_mailbox_autoreply", "tenant"), - new TableInfo("mail_mailbox_autoreply_history", "tenant"), - new TableInfo("mail_contact_info", "tenant", "id") {UserIDColumns = new[] {"id_user"}}, - new TableInfo("mail_mailbox_provider", idColumn: "id"), - new TableInfo("mail_mailbox_domain", idColumn: "id"), - new TableInfo("mail_mailbox_server", idColumn: "id") - }; - - private readonly RelationInfo[] _tableRelations = new[] - { - new RelationInfo("mail_mail", "id", "mail_attachment", "id_mail"), - new RelationInfo("mail_mailbox", "id", "mail_chain", "id_mailbox"), - new RelationInfo("mail_tag", "id", "mail_chain", "tags"), - new RelationInfo("crm_tag", "id", "mail_chain", "tags", typeof(CrmModuleSpecifics)), - new RelationInfo("mail_mailbox", "id", "mail_mail", "id_mailbox"), - new RelationInfo("crm_tag", "id", "mail_tag", "crm_id", typeof(CrmModuleSpecifics)), - new RelationInfo("mail_tag", "id", "mail_tag_addresses", "id_tag", x => Convert.ToInt32(x["id_tag"]) > 0), - new RelationInfo("crm_tag", "id", "mail_tag_addresses", "id_tag", typeof(CrmModuleSpecifics), x => Convert.ToInt32(x["id_tag"]) < 0), - new RelationInfo("mail_mail", "id", "mail_tag_mail", "id_mail"), - new RelationInfo("mail_tag", "id", "mail_tag_mail", "id_tag", x => Convert.ToInt32(x["id_tag"]) > 0), - new RelationInfo("crm_tag", "id", "mail_tag_mail", "id_tag", typeof(CrmModuleSpecifics), x => Convert.ToInt32(x["id_tag"]) < 0), - new RelationInfo("mail_mailbox", "id", "mail_chain_x_crm_entity", "id_mailbox"), - new RelationInfo("crm_contact", "id", "mail_chain_x_crm_entity", "entity_id", typeof(CrmModuleSpecifics), x => Convert.ToInt32(x["entity_type"]) == 1), - new RelationInfo("crm_case", "id", "mail_chain_x_crm_entity", "entity_id", typeof(CrmModuleSpecifics), x => Convert.ToInt32(x["entity_type"]) == 2), - new RelationInfo("crm_deal", "id", "mail_chain_x_crm_entity", "entity_id", typeof(CrmModuleSpecifics), x => Convert.ToInt32(x["entity_type"]) == 3), - new RelationInfo("mail_mailbox", "id", "mail_mailbox_signature", "id_mailbox"), - new RelationInfo("files_folder", "id", "mail_mailbox", "email_in_folder", typeof(FilesModuleSpecifics)), - new RelationInfo("mail_mailbox", "id", "mail_mailbox_autoreply", "id_mailbox"), - new RelationInfo("mail_mailbox", "id", "mail_mailbox_autoreply_history", "id_mailbox"), - new RelationInfo("mail_contacts", "id", "mail_contact_info", "id_contact"), - new RelationInfo("mail_mailbox_provider", "id", "mail_mailbox_domain", "id_provider"), - new RelationInfo("mail_mailbox_server", "id", "mail_mailbox", "id_smtp_server"), - new RelationInfo("mail_mailbox_server", "id", "mail_mailbox", "id_in_server") - }; - - public MailModuleSpecifics(ILogger logger, Helpers helpers) : base(helpers) - { - _logger = logger; - _helpers = helpers; - } - - public override bool TryAdjustFilePath(bool dump, ColumnMapper columnMapper, ref string filePath) - { - //todo: hack: will be changed later - filePath = Regex.Replace(filePath, @"^[-\w]+(?=/)", match => dump ? match.Value : columnMapper.GetUserMapping(match.Value)); - return !filePath.StartsWith("/"); - } - - public override void PrepareData(DataTable data) - { - if (data.TableName == "mail_mailbox") - { - var address = data.Columns.Cast().Single(c => c.ColumnName == "address"); - var smtp = data.Columns.Cast().Single(c => c.ColumnName == "smtp_password"); - var pop3 = data.Columns.Cast().Single(c => c.ColumnName == "pop3_password"); - var token = data.Columns.Cast().Single(c => c.ColumnName == "token"); - for (var i = 0; i < data.Rows.Count; i++) - { - var row = data.Rows[i]; - try - { - row[smtp] = _helpers.CreateHash2(row[smtp] as string); - row[pop3] = _helpers.CreateHash2(row[pop3] as string); - row[token] = _helpers.CreateHash2(row[token] as string); - } - catch (Exception ex) - { - _logger.ErrorCanNotPrepareData(row[address] as string, ex); - data.Rows.Remove(row); - i--; - } - } - } - } - - public override Stream PrepareData(string key, Stream stream, ColumnMapper columnMapper) - { - if (!key.EndsWith("body.html")) - { - return stream; - } - - using (var streamReader = new StreamReader(stream, Encoding.UTF8, true, 1024, true)) - { - var data = streamReader.ReadToEnd(); - data = Regex.Replace(data, @"(htmleditorfiles|aggregator)(\/0\/|\/[\d]+\/\d\d\/\d\d\/)([-\w]+(?=/))", - match => "/" + TenantPath.CreatePath(columnMapper.GetTenantMapping().ToString()) + "/" + columnMapper.GetUserMapping(match.Groups[3].Value)); - - var content = Encoding.UTF8.GetBytes(data); - - stream.Position = 0; - stream.Write(content, 0, content.Length); - } - - return stream; - } - - protected override string GetSelectCommandConditionText(int tenantId, TableInfo table) - { - //optimization: 1) do not include "deleted" rows, 2) backup mail only for the last 30 days - switch (table.Name) - { - case "mail_mailbox_provider": - return string.Format("where t.id in " + - "(select distinct t2.id_provider from mail_mailbox t1 " + - "inner join mail_mailbox_server t2 on t2.id in (t1.id_in_server, t1.id_smtp_server) and t2.is_user_data = 1 " + - "where t1.tenant = {0} and t1.is_removed = 0)", tenantId); - - // mail_mailbox_domain.id_provider not in index - case "mail_mailbox_domain": - return string.Format("where t.id_provider in " + - "(select distinct t2.id_provider from mail_mailbox t1 " + - "inner join mail_mailbox_server t2 on t2.id in (t1.id_in_server, t1.id_smtp_server) and t2.is_user_data = 1 " + - "where t1.tenant = {0} and t1.is_removed = 0)", tenantId); - - case "mail_mailbox_server": - return string.Format("where t.id in " + - "(select distinct t2.id from mail_mailbox t1 " + - "inner join mail_mailbox_server t2 on t2.id in (t1.id_in_server, t1.id_smtp_server) and t2.is_user_data = 1 " + - "where t1.tenant = {0} and t1.is_removed = 0)", tenantId); - - case "mail_mailbox": - return string.Format("where t.is_removed = 0 and t.tenant = {0}", tenantId); - - //condition on chain_date because of Bug 18855 - transfer mail only for the last 30 days - case "mail_mail": - return string.Format("inner join mail_mailbox t1 on t1.id = t.id_mailbox " + - "where t.tenant = {0} and t1.tenant = {0} and t.is_removed = 0 and t1.is_removed = 0 and t.chain_date > '{1}'", - tenantId, - DateTime.UtcNow.Subtract(TimeSpan.FromDays(30)).ToString("yyyy-MM-dd HH:mm:ss")); - - case "mail_attachment": - case "mail_tag_mail": - return string.Format("inner join mail_mail as t1 on t1.id = t.id_mail " + - "inner join mail_mailbox as t2 on t2.id = t1.id_mailbox " + - "where t1.tenant = {0} and t2.tenant = {0} and t1.is_removed = 0 and t2.is_removed = 0 and t1.chain_date > '{1}'", - tenantId, - DateTime.UtcNow.Subtract(TimeSpan.FromDays(30)).ToString("yyyy-MM-dd HH:mm:ss")); - - case "mail_chain": - return string.Format("inner join mail_mailbox t1 on t1.id = t.id_mailbox " + - "where t.tenant = {0} and t1.is_removed = 0", - tenantId); - - default: - return base.GetSelectCommandConditionText(tenantId, table); - } - } - - protected override string GetDeleteCommandConditionText(int tenantId, TableInfo table) - { - //delete all rows regardless of whether there is is_removed = 1 or not - return base.GetSelectCommandConditionText(tenantId, table); - } - - protected override bool TryPrepareRow(bool dump, DbConnection connection, ColumnMapper columnMapper, TableInfo table, DataRowInfo row, out Dictionary preparedRow) - { - if (table.Name == "mail_mailbox") - { - var boxType = row["is_server_mailbox"]; - if (boxType != null && Convert.ToBoolean(int.Parse(boxType.ToString()))) - { - preparedRow = null; - - return false; - } - } - - return base.TryPrepareRow(dump, connection, columnMapper, table, row, out preparedRow); - } - - protected override bool TryPrepareValue(bool dump, DbConnection connection, ColumnMapper columnMapper, TableInfo table, string columnName, IEnumerable relations, ref object value) - { - relations = relations.ToList(); - if (relations.All(x => x.ChildTable == "mail_chain" && x.ChildColumn == "tags")) - { - var mappedTags = new List(); - - foreach (var tag in value.ToString().Split(new[] { ',' }, StringSplitOptions.RemoveEmptyEntries).Select(x => Convert.ToInt32(x))) - { - object tagId; - if (tag > 0) - { - tagId = columnMapper.GetMapping("mail_tag", "id", tag); - } - else - { - tagId = columnMapper.GetMapping("crm_tag", "id", -tag); - if (tagId != null) - { - tagId = -Convert.ToInt32(tagId); - } - } - if (tagId != null) - { - mappedTags.Add(tagId.ToString()); - } - } - - value = string.Join(",", mappedTags.ToArray()); - - return true; - } - - return base.TryPrepareValue(dump, connection, columnMapper, table, columnName, relations, ref value); - } - - protected override bool TryPrepareValue(DbConnection connection, ColumnMapper columnMapper, RelationInfo relation, ref object value) - { - if (relation.ParentTable == "crm_tag" && relation.ChildColumn == "id_tag" - && (relation.ChildTable == "mail_tag_mail" || relation.ChildTable == "mail_tag_addresses")) - { - var crmTagId = columnMapper.GetMapping(relation.ParentTable, relation.ParentColumn, -Convert.ToInt32(value)); - if (crmTagId == null) - { - return false; - } - - value = -Convert.ToInt32(crmTagId); - - return true; - } - - return base.TryPrepareValue(connection, columnMapper, relation, ref value); - } - - protected override bool TryPrepareValue(DbConnection connection, ColumnMapper columnMapper, TableInfo table, string columnName, ref object value) - { - if (table.Name == "mail_mailbox" && (columnName == "smtp_password" || columnName == "pop3_password") && value != null) - { - try - { - value = _helpers.CreateHash(value as string); // save original hash - } - catch (Exception err) - { - _logger.ErrorCanNotPrepareValue(value, err); - value = null; - } - - return true; - } - - return base.TryPrepareValue(connection, columnMapper, table, columnName, ref value); - } -} diff --git a/common/ASC.Data.Backup.Core/Tasks/Modules/ModuleProvider.cs b/common/ASC.Data.Backup.Core/Tasks/Modules/ModuleProvider.cs index 4320f3a7a4..929e3ca9b7 100644 --- a/common/ASC.Data.Backup.Core/Tasks/Modules/ModuleProvider.cs +++ b/common/ASC.Data.Backup.Core/Tasks/Modules/ModuleProvider.cs @@ -37,15 +37,8 @@ public class ModuleProvider { new TenantsModuleSpecifics(coreSettings,helpers), new AuditModuleSpecifics(helpers), - new CommunityModuleSpecifics(helpers), - new CalendarModuleSpecifics(helpers), - new ProjectsModuleSpecifics(helpers), - new CrmModuleSpecifics(helpers), new FilesModuleSpecifics(logger,helpers), - new MailModuleSpecifics(logger,helpers), - new CrmModuleSpecifics2(helpers), new FilesModuleSpecifics2(helpers), - new CrmInvoiceModuleSpecifics(helpers), new WebStudioModuleSpecifics(helpers), new CoreModuleSpecifics(helpers) } @@ -56,10 +49,6 @@ public class ModuleProvider return storageModuleName switch { "files" => AllModules.FirstOrDefault(m => m.ModuleName == ModuleName.Files), - "projects" => AllModules.FirstOrDefault(m => m.ModuleName == ModuleName.Projects), - "crm" => AllModules.FirstOrDefault(m => m.ModuleName == (storageDomainName == "mail_messages" ? ModuleName.Crm2 : ModuleName.Crm)), - "forum" => AllModules.FirstOrDefault(m => m.ModuleName == ModuleName.Community), - "mailaggregator" => AllModules.FirstOrDefault(m => m.ModuleName == ModuleName.Mail), _ => null, }; } diff --git a/common/ASC.Data.Backup.Core/Tasks/Modules/ProjectsModuleSpecifics.cs b/common/ASC.Data.Backup.Core/Tasks/Modules/ProjectsModuleSpecifics.cs deleted file mode 100644 index 75ca813aea..0000000000 --- a/common/ASC.Data.Backup.Core/Tasks/Modules/ProjectsModuleSpecifics.cs +++ /dev/null @@ -1,204 +0,0 @@ -// (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.Data.Backup.Tasks.Modules; - -public class ProjectsModuleSpecifics : ModuleSpecificsBase -{ - public override ModuleName ModuleName => ModuleName.Projects; - public override IEnumerable Tables => _tables; - public override IEnumerable TableRelations => _tableRelations; - - private readonly TableInfo[] _tables = new[] - { - new TableInfo("projects_comments", "tenant_id", "comment_id", IdType.Autoincrement) {UserIDColumns = new[] {"create_by"}}, - new TableInfo("projects_following_project_participant") {UserIDColumns = new[] {"participant_id"}}, - new TableInfo("projects_messages", "tenant_id", "id") - { - UserIDColumns = new[] {"create_by", "last_modified_by"}, - DateColumns = new Dictionary {{"create_on", false}, {"last_modified_on", false}} - }, - new TableInfo("projects_milestones", "tenant_id", "id") - { - UserIDColumns = new[] {"create_by", "last_modified_by", "responsible_id"}, - DateColumns = new Dictionary {{"deadline", true}, {"status_changed", false}, {"create_on", false}, {"last_modified_on", false}} - }, - new TableInfo("projects_projects", "tenant_id", "id") - { - UserIDColumns = new[] {"create_by", "last_modified_by", "responsible_id"}, - DateColumns = new Dictionary {{"status_changed", false}, {"create_on", false}, {"last_modified_on", false}} - }, - new TableInfo("projects_project_participant", "tenant") {UserIDColumns = new[] {"participant_id"}}, - new TableInfo("projects_project_tag"), - new TableInfo("projects_report_template", "tenant_id", "id") {UserIDColumns = new[] {"create_by"}}, - new TableInfo("projects_subtasks", "tenant_id", "id") - { - UserIDColumns = new[] {"create_by", "last_modified_by", "responsible_id"}, - DateColumns = new Dictionary {{"status_changed", false}, {"create_on", false}, {"last_modified_on", false}} - }, - new TableInfo("projects_tags", "tenant_id", "id"), - new TableInfo("projects_tasks", "tenant_id", "id") - { - UserIDColumns = new[] {"create_by", "last_modified_by", "responsible_id"}, - DateColumns = new Dictionary {{"status_changed", true}, {"deadline", true}, {"create_on", false}, {"last_modified_on", true}, {"start_date", true}} - }, - new TableInfo("projects_tasks_responsible", "tenant_id") {UserIDColumns = new[] {"responsible_id"}}, - new TableInfo("projects_templates", "tenant_id", "id") {UserIDColumns = new[] {"create_by", "last_modified_by"}}, - new TableInfo("projects_time_tracking", "tenant_id", "id") - { - UserIDColumns = new[] {"create_by", "person_id"}, - DateColumns = new Dictionary {{"date", true}, {"create_on", false}, {"status_changed", true}} - }, - new TableInfo("projects_tasks_links", "tenant_id"), - new TableInfo("projects_tasks_order", "tenant_id") - }; - - private readonly RelationInfo[] _tableRelations = new[] - { - new RelationInfo("projects_comments", "id", "projects_comments", "parent_id"), - new RelationInfo("projects_messages", "id", "projects_comments", "target_uniq_id", x => Convert.ToString(x["target_uniq_id"]).StartsWith("Message_", StringComparison.InvariantCultureIgnoreCase)), - new RelationInfo("projects_tasks", "id", "projects_comments", "target_uniq_id", x => Convert.ToString(x["target_uniq_id"]).StartsWith("Task_", StringComparison.InvariantCultureIgnoreCase)), - new RelationInfo("projects_milestones", "id", "projects_comments", "target_uniq_id", x => Convert.ToString(x["target_uniq_id"]).StartsWith("Milestone_", StringComparison.InvariantCultureIgnoreCase)), - new RelationInfo("projects_projects", "id", "projects_following_project_participant", "project_id"), - new RelationInfo("projects_projects", "id", "projects_messages", "project_id"), - new RelationInfo("projects_projects", "id", "projects_milestones", "project_id"), - new RelationInfo("projects_projects", "id", "projects_project_participant", "project_id"), - new RelationInfo("projects_projects", "id", "projects_project_tag", "project_id"), - new RelationInfo("projects_tags", "id", "projects_project_tag", "tag_id"), - new RelationInfo("projects_tasks", "id", "projects_subtasks", "task_id"), - new RelationInfo("projects_projects", "id", "projects_tasks", "project_id"), - new RelationInfo("projects_milestones", "id", "projects_tasks", "milestone_id"), - new RelationInfo("projects_tasks", "id", "projects_tasks_responsible", "task_id"), - new RelationInfo("projects_projects", "id", "projects_time_tracking", "project_id"), - new RelationInfo("projects_tasks", "id", "projects_time_tracking", "relative_task_id"), - new RelationInfo("projects_tasks", "id", "projects_tasks_links", "task_id"), - new RelationInfo("projects_tasks", "id", "projects_tasks_links", "parent_id"), - new RelationInfo("projects_projects", "id", "projects_tasks_order", "project_id"), - new RelationInfo("projects_tasks", "id", "projects_tasks_order", "task_order"), - new RelationInfo("projects_milestones", "id", "projects_tasks_order", "task_order") - }; - - public ProjectsModuleSpecifics(Helpers helpers) : base(helpers) { } - - public override bool TryAdjustFilePath(bool dump, ColumnMapper columnMapper, ref string filePath) - { - var match = Regex.Match(filePath, @"^thumbs/\d+/\d+/\d+/(?'fileId'\d+)\.jpg$"); - if (match.Success) - { - var fileId = columnMapper.GetMapping("files_file", "id", match.Groups["fileId"].Value); - if (fileId == null) - { - if (!dump) - { - return false; - } - - fileId = match.Groups["fileId"].Value; - } - - var s = fileId.ToString().PadRight(6, '0'); - filePath = string.Format("thumbs/{0}/{1}/{2}/{3}.jpg", s.Substring(0, 2), s.Substring(2, 2), s.Substring(4), fileId); - - return true; - } - - return false; - } - - protected override string GetSelectCommandConditionText(int tenantId, TableInfo table) - { - if (table.Name == "projects_project_tag" || table.Name == "projects_following_project_participant") - { - return "inner join projects_projects as t1 on t1.id = t.project_id where t1.tenant_id = " + tenantId; - } - - return base.GetSelectCommandConditionText(tenantId, table); - } - - protected override bool TryPrepareValue(DbConnection connection, ColumnMapper columnMapper, TableInfo table, string columnName, ref object value) - { - - if (table.Name == "projects_comments" && columnName == "content" || - table.Name == "projects_messages" && columnName == "content") - { - value = FCKEditorPathUtility.CorrectStoragePath(value as string, columnMapper.GetTenantMapping()); - - return true; - } - - return base.TryPrepareValue(connection, columnMapper, table, columnName, ref value); - } - - protected override bool TryPrepareValue(DbConnection connection, ColumnMapper columnMapper, RelationInfo relation, ref object value) - { - if (relation.ChildTable == "projects_comments" && relation.ChildColumn == "target_uniq_id") - { - var valParts = value.ToString().Split('_'); - - var entityId = columnMapper.GetMapping(relation.ParentTable, relation.ParentColumn, valParts[1]); - if (entityId == null) - { - return false; - } - - value = string.Format("{0}_{1}", valParts[0], entityId); - - return true; - } - - return base.TryPrepareValue(connection, columnMapper, relation, ref value); - } - - protected override bool TryPrepareValue(bool dump, DbConnection connection, ColumnMapper columnMapper, TableInfo table, string columnName, IEnumerable relations, ref object value) - { - if (table.Name == "projects_tasks_order" && columnName == "task_order") - { - value = Regex.Replace( - Convert.ToString(value), - @"(?<=""tasks"":\[(\d+,)*)\d+,?", - match => - { - var mappedId = Convert.ToString(columnMapper.GetMapping("projects_tasks", "id", match.Value.TrimEnd(','))); - return !string.IsNullOrEmpty(mappedId) && match.Value.EndsWith(',') ? mappedId + "," : mappedId; - }, - RegexOptions.Compiled); - - value = Regex.Replace( - Convert.ToString(value), - @"(?<=""milestones"":\[(\d+,)*)\d+,?", - match => - { - var mappedId = Convert.ToString(columnMapper.GetMapping("projects_milestones", "id", match.Value.TrimEnd(','))); - return !string.IsNullOrEmpty(mappedId) && match.Value.EndsWith(',') ? mappedId + "," : mappedId; - }, - RegexOptions.Compiled); - - return true; - } - - return base.TryPrepareValue(dump, connection, columnMapper, table, columnName, relations, ref value); - } -} diff --git a/common/ASC.Data.Backup.Core/Tasks/Modules/WebStudioModuleSpecifics.cs b/common/ASC.Data.Backup.Core/Tasks/Modules/WebStudioModuleSpecifics.cs index 1ba3054126..687c4e1b08 100644 --- a/common/ASC.Data.Backup.Core/Tasks/Modules/WebStudioModuleSpecifics.cs +++ b/common/ASC.Data.Backup.Core/Tasks/Modules/WebStudioModuleSpecifics.cs @@ -41,11 +41,7 @@ public class WebStudioModuleSpecifics : ModuleSpecificsBase new TableInfo("webstudio_uservisit", "tenantid") {InsertMethod = InsertMethod.None} }; - private readonly RelationInfo[] _relations = new[] - { - new RelationInfo("crm_organisation_logo", "id", "webstudio_settings", "Data", typeof(CrmInvoiceModuleSpecifics), - x => _crmSettingsId == new Guid(Convert.ToString(x["ID"]))) - }; + private readonly RelationInfo[] _relations = new RelationInfo[0]; public WebStudioModuleSpecifics(Helpers helpers) : base(helpers) { } diff --git a/common/services/ASC.Data.Backup.BackgroundTasks/IntegrationEvents/EventHandling/BackupRequestedIntegrationEventHandler.cs b/common/services/ASC.Data.Backup.BackgroundTasks/IntegrationEvents/EventHandling/BackupRequestedIntegrationEventHandler.cs index b29b9397f0..0fedc50970 100644 --- a/common/services/ASC.Data.Backup.BackgroundTasks/IntegrationEvents/EventHandling/BackupRequestedIntegrationEventHandler.cs +++ b/common/services/ASC.Data.Backup.BackgroundTasks/IntegrationEvents/EventHandling/BackupRequestedIntegrationEventHandler.cs @@ -71,7 +71,6 @@ public class BackupRequestedIntegrationEventHandler : IIntegrationEventHandler logger, int count); - [LoggerMessage(Level = LogLevel.Debug, Message = "Start scheduled backup: {tenantId}, {backupMail}, {storageType}, {storageBasePath}")] - public static partial void DebugStartScheduledBackup(this ILogger logger, int tenantId, bool backupMail, BackupStorageType storageType, string storageBasePath); + [LoggerMessage(Level = LogLevel.Debug, Message = "Start scheduled backup: {tenantId}, {storageType}, {storageBasePath}")] + public static partial void DebugStartScheduledBackup(this ILogger logger, int tenantId, BackupStorageType storageType, string storageBasePath); [LoggerMessage(Level = LogLevel.Debug, Message = "Skip portal {tenantId} not paid")] public static partial void DebugNotPaid(this ILogger logger, int tenantId); diff --git a/common/services/ASC.Data.Backup.BackgroundTasks/Services/BackupSchedulerService.cs b/common/services/ASC.Data.Backup.BackgroundTasks/Services/BackupSchedulerService.cs index 8358fe4e2b..63d915120f 100644 --- a/common/services/ASC.Data.Backup.BackgroundTasks/Services/BackupSchedulerService.cs +++ b/common/services/ASC.Data.Backup.BackgroundTasks/Services/BackupSchedulerService.cs @@ -115,14 +115,13 @@ public sealed class BackupSchedulerService : BackgroundService backupRepository.SaveBackupSchedule(schedule); - _logger.DebugStartScheduledBackup(schedule.TenantId, schedule.BackupMail, schedule.StorageType, schedule.StorageBasePath); + _logger.DebugStartScheduledBackup(schedule.TenantId, schedule.StorageType, schedule.StorageBasePath); _eventBus.Publish(new BackupRequestIntegrationEvent( tenantId: schedule.TenantId, storageBasePath: schedule.StorageBasePath, storageParams: JsonConvert.DeserializeObject>(schedule.StorageParams), storageType: schedule.StorageType, - backupMail: schedule.BackupMail, createBy: ASC.Core.Configuration.Constants.CoreSystem.ID, isScheduled: true, backupsStored: schedule.BackupsStored diff --git a/common/services/ASC.Data.Backup/Api/BackupController.cs b/common/services/ASC.Data.Backup/Api/BackupController.cs index f060370dc4..553f0fb5fe 100644 --- a/common/services/ASC.Data.Backup/Api/BackupController.cs +++ b/common/services/ASC.Data.Backup/Api/BackupController.cs @@ -76,7 +76,6 @@ public class BackupController : ControllerBase /// Storage parameters /// Max of the backup's stored copies /// Cron parameters - /// Include mail in the backup /// Backup [HttpPost("createbackupschedule")] public bool CreateBackupSchedule(BackupScheduleDto backupSchedule) @@ -94,7 +93,7 @@ public class BackupController : ControllerBase Hour = backupSchedule.CronParams.Hour == null ? 0 : Int32.Parse(backupSchedule.CronParams.Hour), Day = backupSchedule.CronParams.Day == null ? 0 : Int32.Parse(backupSchedule.CronParams.Day), }; - _backupHandler.CreateSchedule(storageType, storageParams, backupStored, cron, backupSchedule.BackupMail); + _backupHandler.CreateSchedule(storageType, storageParams, backupStored, cron); return true; } @@ -120,7 +119,6 @@ public class BackupController : ControllerBase /// /// Storage Type /// Storage Params - /// Include mail in the backup /// Backup /// Backup Progress [HttpPost("startbackup")] @@ -137,7 +135,6 @@ public class BackupController : ControllerBase tenantId: _tenantId, storageParams: storageParams, storageType: storageType, - backupMail: backup.BackupMail, createBy: _currentUserId )); diff --git a/common/services/ASC.Data.Backup/ApiModels/BackupDto.cs b/common/services/ASC.Data.Backup/ApiModels/BackupDto.cs index 4d7ceb8a57..e2455c2baa 100644 --- a/common/services/ASC.Data.Backup/ApiModels/BackupDto.cs +++ b/common/services/ASC.Data.Backup/ApiModels/BackupDto.cs @@ -29,6 +29,5 @@ namespace ASC.Data.Backup.ApiModels; public class BackupDto { public string StorageType { get; set; } - public bool BackupMail { get; set; } public IEnumerable> StorageParams { get; set; } } diff --git a/common/services/ASC.Data.Backup/ApiModels/BackupScheduleDto.cs b/common/services/ASC.Data.Backup/ApiModels/BackupScheduleDto.cs index a5e73b80a7..ae567b8f36 100644 --- a/common/services/ASC.Data.Backup/ApiModels/BackupScheduleDto.cs +++ b/common/services/ASC.Data.Backup/ApiModels/BackupScheduleDto.cs @@ -32,7 +32,6 @@ public class BackupScheduleDto public IEnumerable> StorageParams { get; set; } public string BackupsStored { get; set; } public Cron CronParams { get; set; } - public bool BackupMail { get; set; } } public class Cron From 939b3651dfc6865a598b35d3792177dbb4c5e505 Mon Sep 17 00:00:00 2001 From: TimofeyBoyko Date: Mon, 12 Sep 2022 11:52:32 +0300 Subject: [PATCH 02/87] Web:Client:Locales: fix translation key for filter header --- packages/client/public/locales/en/Files.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/client/public/locales/en/Files.json b/packages/client/public/locales/en/Files.json index 432c8cbcb8..b6f42e1170 100644 --- a/packages/client/public/locales/en/Files.json +++ b/packages/client/public/locales/en/Files.json @@ -1,5 +1,5 @@ { - "AdvancedFilter": "Advanced search options", + "AdvancedFilter": "Search options", "All": "All", "AllFiles": "All files", "Archives": "Archives", From 492d1bd682a68a213a3be703f9dcacbde633062a Mon Sep 17 00:00:00 2001 From: TimofeyBoyko Date: Mon, 12 Sep 2022 11:52:55 +0300 Subject: [PATCH 03/87] Web:Common:Api: add searchInContent for file filter --- packages/common/api/files/filter.js | 25 ++++++++++++++++++++----- 1 file changed, 20 insertions(+), 5 deletions(-) diff --git a/packages/common/api/files/filter.js b/packages/common/api/files/filter.js index c178b8ed81..90a5d30280 100644 --- a/packages/common/api/files/filter.js +++ b/packages/common/api/files/filter.js @@ -13,6 +13,7 @@ const DEFAULT_SEARCH = null; const DEFAULT_AUTHOR_TYPE = null; const DEFAULT_SELECTED_ITEM = {}; const DEFAULT_FOLDER = "@my"; +const DEFAULT_SEARCH_IN_CONTENT = null; const SEARCH_TYPE = "withSubfolders"; const AUTHOR_TYPE = "authorType"; @@ -25,11 +26,11 @@ const PAGE = "page"; const PAGE_COUNT = "count"; const FOLDER = "folder"; const PREVIEW = "preview"; +const SEARCH_IN_CONTENT = "searchInContent"; // TODO: add next params // subjectGroup bool // subjectID -// searchInContent bool class FilesFilter { static getDefault(total = DEFAULT_TOTAL) { @@ -66,6 +67,8 @@ class FilesFilter { (urlFilter[PAGE_COUNT] && +urlFilter[PAGE_COUNT]) || defaultFilter.pageCount; const folder = urlFilter[FOLDER] || defaultFilter.folder; + const searchInContent = + urlFilter[SEARCH_IN_CONTENT] || defaultFilter.searchInContent; const newFilter = new FilesFilter( page, @@ -79,7 +82,8 @@ class FilesFilter { search, authorType, defaultFilter.selectedItem, - folder + folder, + searchInContent ); return newFilter; @@ -97,7 +101,8 @@ class FilesFilter { search = DEFAULT_SEARCH, authorType = DEFAULT_AUTHOR_TYPE, selectedItem = DEFAULT_SELECTED_ITEM, - folder = DEFAULT_FOLDER + folder = DEFAULT_FOLDER, + searchInContent = DEFAULT_SEARCH_IN_CONTENT ) { this.page = page; this.pageCount = pageCount; @@ -111,6 +116,7 @@ class FilesFilter { this.authorType = authorType; this.selectedItem = selectedItem; this.folder = folder; + this.searchInContent = searchInContent; } getStartIndex = () => { @@ -136,6 +142,7 @@ class FilesFilter { sortOrder, withSubfolders, startIndex, + searchInContent, } = this; const isFilterSet = @@ -157,6 +164,7 @@ class FilesFilter { filterValue: (search ?? "").trim(), withSubfolders: isFilterSet, userIdOrGroupId, + searchInContent, }; const str = toUrlParams(dtoFilter, true); @@ -174,6 +182,7 @@ class FilesFilter { sortBy, sortOrder, withSubfolders, + searchInContent, } = this; const dtoFilter = {}; @@ -206,6 +215,10 @@ class FilesFilter { dtoFilter[PREVIEW] = URLParams.preview; } + if (URLParams.searchInContent) { + dtoFilter[SEARCH_IN_CONTENT] = URLParams.searchInContent; + } + dtoFilter[PAGE] = page + 1; dtoFilter[SORT_BY] = sortBy; dtoFilter[SORT_ORDER] = sortOrder; @@ -231,7 +244,8 @@ class FilesFilter { this.search, this.authorType, this.selectedItem, - this.folder + this.folder, + this.searchInContent ); } @@ -247,7 +261,8 @@ class FilesFilter { this.page === filter.page && this.selectedItem.key === filter.selectedItem.key && this.folder === filter.folder && - this.pageCount === filter.pageCount; + this.pageCount === filter.pageCount && + this.searchInContent === filter.searchInContent; return equals; } From 2000bbc1b45c6d4de2793f80f7d587847ff731c6 Mon Sep 17 00:00:00 2001 From: TimofeyBoyko Date: Mon, 12 Sep 2022 11:53:23 +0300 Subject: [PATCH 04/87] Web:Client:TreeFoldersStore: add isPersonalRoom --- packages/client/src/store/TreeFoldersStore.js | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/packages/client/src/store/TreeFoldersStore.js b/packages/client/src/store/TreeFoldersStore.js index c10d8bc4e4..2cf5cbb14a 100644 --- a/packages/client/src/store/TreeFoldersStore.js +++ b/packages/client/src/store/TreeFoldersStore.js @@ -134,6 +134,10 @@ class TreeFoldersStore { return this.archiveFolder ? this.archiveFolder.id : null; } + get isPersonalRoom() { + return this.myFolder && this.myFolder.id === this.selectedFolderStore.id; + } + get isShareFolder() { return ( this.shareFolder && this.shareFolder.id === this.selectedFolderStore.id From 082e8831bdfbc79858dd468a3833bde8b95fe575 Mon Sep 17 00:00:00 2001 From: Alexey Safronov Date: Mon, 12 Sep 2022 11:56:24 +0300 Subject: [PATCH 05/87] Web: Fix Header position --- .../pages/Settings/Section/Header/index.js | 111 ++++++++++++++++-- 1 file changed, 100 insertions(+), 11 deletions(-) diff --git a/packages/client/src/pages/Settings/Section/Header/index.js b/packages/client/src/pages/Settings/Section/Header/index.js index 6626fd33d3..eefa9afac7 100644 --- a/packages/client/src/pages/Settings/Section/Header/index.js +++ b/packages/client/src/pages/Settings/Section/Header/index.js @@ -1,19 +1,108 @@ import React from "react"; +import styled, { css } from "styled-components"; import Headline from "@docspace/common/components/Headline"; +import { Consumer } from "@docspace/components/utils/context"; +import { isMobile, isMobileOnly } from "react-device-detect"; +import { tablet, mobile } from "@docspace/components/utils/device"; + +const StyledContainer = styled.div` + width: 100%; + height: 69px; + + @media ${tablet} { + height: 61px; + } + + ${isMobile && + css` + height: 61px; + `} + + @media ${mobile} { + height: 53px; + } + + ${isMobileOnly && + css` + height: 53px; + `} + + .header-container { + position: relative; + + width: 100%; + height: 100%; + + display: grid; + align-items: center; + + grid-template-columns: auto auto 1fr; + + @media ${tablet} { + grid-template-columns: 1fr auto; + } + + ${isMobile && + css` + grid-template-columns: 1fr auto; + `} + + .headline-header { + line-height: 24px; + + @media ${tablet} { + line-height: 28px; + } + + ${isMobile && + css` + line-height: 28px; + `} + + @media ${mobile} { + line-height: 24px; + } + + ${isMobile && + css` + line-height: 24px; + `} + } + + .action-button { + margin-left: 16px; + + @media ${tablet} { + display: none; + } + + ${isMobile && + css` + display: none; + `} + } + } +`; const SectionHeaderContent = ({ title }) => { return ( -
- - {title} - -
+ + {(context) => ( + +
+ + {title} + +
+
+ )} +
); }; -export default React.memo(SectionHeaderContent); +export default SectionHeaderContent; From 29c0624224c3a2b5d73b6d31f9b554ba0bf220ac Mon Sep 17 00:00:00 2001 From: Alexey Safronov Date: Mon, 12 Sep 2022 12:05:23 +0300 Subject: [PATCH 06/87] Web: Replaced old tabs --- .../src/pages/Settings/Section/Body/index.js | 110 ++++++++---------- 1 file changed, 50 insertions(+), 60 deletions(-) diff --git a/packages/client/src/pages/Settings/Section/Body/index.js b/packages/client/src/pages/Settings/Section/Body/index.js index 163e261861..cfd4faaf4b 100644 --- a/packages/client/src/pages/Settings/Section/Body/index.js +++ b/packages/client/src/pages/Settings/Section/Body/index.js @@ -1,4 +1,4 @@ -import React from "react"; +import React, { useState, useEffect, useCallback } from "react"; import Error403 from "client/Error403"; import Error520 from "client/Error520"; import ConnectClouds from "./ConnectedClouds"; @@ -6,7 +6,7 @@ import { inject, observer } from "mobx-react"; import { combineUrl } from "@docspace/common/utils"; import { AppServerConfig } from "@docspace/common/constants"; import config from "PACKAGE_FILE"; -import TabsContainer from "@docspace/components/tabs-container"; +import Submenu from "@docspace/components/submenu"; import CommonSettings from "./CommonSettings"; import AdminSettings from "./AdminSettings"; @@ -17,112 +17,102 @@ const SectionBodyContent = ({ settingsIsLoaded, isErrorSettings, history, - setExpandSettingsTree, - setSelectedNode, isPersonal, t, }) => { + const [currentTab, setCurrentTab] = useState(0); + const commonSettings = { + id: "common", + name: t("CommonSettings"), content: , - key: "common", - title: t("CommonSettings"), }; const adminSettings = { + id: "admin", + name: t("Common:AdminSettings"), content: , - key: "admin", - title: t("Common:AdminSettings"), }; const connectedCloud = { + id: "connected-clouds", + name: t("ThirdPartySettings"), content: , - key: "connected-clouds", - title: t("ThirdPartySettings"), }; - const elements = []; + const data = []; - if (isAdmin && !isPersonal) { - elements.push(adminSettings); + if (isAdmin) { + data.push(adminSettings); } - if (!isPersonal) { - elements.push(commonSettings); - } + data.push(commonSettings); if (enableThirdParty) { - elements.push(connectedCloud); + data.push(connectedCloud); } - const onSelect = React.useCallback( - (data) => { - const { key } = data; + const onSelect = useCallback( + (e) => { + const { id } = e; - if (key === setting) return; + if (id === setting) return; - setSelectedNode([key]); - setExpandSettingsTree([key]); + // setSelectedNode([key]); + // setExpandSettingsTree([key]); history.push( - combineUrl( - AppServerConfig.proxyURL, - config.homepage, - `/settings/${key}` - ) + combineUrl(AppServerConfig.proxyURL, config.homepage, `/settings/${id}`) ); }, - [setting, history, setExpandSettingsTree, setSelectedNode] + [setting, history] ); - const selectedTab = React.useCallback(() => { - switch (setting) { - case "common": - return isAdmin ? 1 : 0; - case "admin": - return 0; - case "connected-clouds": - return isPersonal ? 0 : isAdmin ? 2 : 1; - default: - return isAdmin ? 1 : 0; + // const selectedTab = React.useCallback(() => { + // switch (setting) { + // case "common": + // return isAdmin ? 1 : 0; + // case "admin": + // return 0; + // case "connected-clouds": + // return isPersonal ? 0 : isAdmin ? 2 : 1; + // default: + // return isAdmin ? 1 : 0; + // } + // }, [setting, isAdmin, isPersonal]); + + useEffect(() => { + const path = location.pathname; + const currentTab = data.findIndex((item) => path.includes(item.id)); + if (currentTab !== -1) { + setCurrentTab(currentTab); } - }, [setting, isAdmin, isPersonal]); + }, []); return !settingsIsLoaded ? null : (!enableThirdParty && setting === "connected-clouds") || - (!isAdmin && setting === "admin") || - (isPersonal && setting !== "connected-clouds") ? ( + (!isAdmin && setting === "admin") ? ( ) : isErrorSettings ? ( - ) : !isPersonal ? ( + ) : (
-
- ) : ( -
{elements[0].content}
); }; -export default inject(({ auth, treeFoldersStore, settingsStore }) => { - const { - enableThirdParty, - settingsIsLoaded, +export default inject(({ auth, settingsStore }) => { + const { enableThirdParty, settingsIsLoaded } = settingsStore; - setExpandSettingsTree, - } = settingsStore; - - const { setSelectedNode } = treeFoldersStore; return { isAdmin: auth.isAdmin, - isPersonal: auth.settingsStore.personal, enableThirdParty, settingsIsLoaded, - - setExpandSettingsTree, - setSelectedNode, }; })(observer(SectionBodyContent)); From 1fb5c4a6e8e0939f1ef0bba0e4e9a2b6a0d1fad0 Mon Sep 17 00:00:00 2001 From: TimofeyBoyko Date: Mon, 12 Sep 2022 12:25:44 +0300 Subject: [PATCH 07/87] Web:Client:Helpers: add new filter group key --- 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 ba00c037e4..2ef7e42c37 100644 --- a/packages/client/src/helpers/filesConstants.js +++ b/packages/client/src/helpers/filesConstants.js @@ -22,6 +22,7 @@ export const FilterGroups = Object.freeze({ filterType: "filter-filterType", filterAuthor: "filter-author", filterFolders: "filter-folders", + filterContent: "filter-withContent", roomFilterType: "filter-type", roomFilterOwner: "filter-owner", roomFilterTags: "filter-tags", From ccf9386c8e54e78cc8a95dd94b4e3462b842dd88 Mon Sep 17 00:00:00 2001 From: TimofeyBoyko Date: Mon, 12 Sep 2022 12:26:37 +0300 Subject: [PATCH 08/87] Web:Common:Api: fix files filter --- packages/common/api/files/filter.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/common/api/files/filter.js b/packages/common/api/files/filter.js index 90a5d30280..e3f9d082a3 100644 --- a/packages/common/api/files/filter.js +++ b/packages/common/api/files/filter.js @@ -215,8 +215,8 @@ class FilesFilter { dtoFilter[PREVIEW] = URLParams.preview; } - if (URLParams.searchInContent) { - dtoFilter[SEARCH_IN_CONTENT] = URLParams.searchInContent; + if (searchInContent) { + dtoFilter[SEARCH_IN_CONTENT] = searchInContent; } dtoFilter[PAGE] = page + 1; From 9311ec113394780748510bd58076376721998fb0 Mon Sep 17 00:00:00 2001 From: TimofeyBoyko Date: Mon, 12 Sep 2022 14:22:25 +0300 Subject: [PATCH 09/87] Web:Common:Loaders: fix filter loader --- .../StyledFilterBlockLoader.js | 12 +- .../Loaders/FilterBlockLoader/index.js | 201 ++++++++++-------- 2 files changed, 117 insertions(+), 96 deletions(-) diff --git a/packages/common/components/Loaders/FilterBlockLoader/StyledFilterBlockLoader.js b/packages/common/components/Loaders/FilterBlockLoader/StyledFilterBlockLoader.js index 84cd41035e..5b49fc7458 100644 --- a/packages/common/components/Loaders/FilterBlockLoader/StyledFilterBlockLoader.js +++ b/packages/common/components/Loaders/FilterBlockLoader/StyledFilterBlockLoader.js @@ -14,16 +14,22 @@ const StyledContainer = styled.div` const StyledBlock = styled.div` padding: 12px 0 6px; - margin-bottom: 6px; + margin-bottom: 0; width: 100%; - height: auto; + height: 128px; display: flex; + box-sizing: border-box; + flex-direction: column; - border-bottom: 1px solid #eceef1; + ${(props) => + !props.isLast && + css` + border-bottom: 1px solid #eceef1; + `} .row-loader { display: flex; diff --git a/packages/common/components/Loaders/FilterBlockLoader/index.js b/packages/common/components/Loaders/FilterBlockLoader/index.js index 06de3577b1..76be68861d 100644 --- a/packages/common/components/Loaders/FilterBlockLoader/index.js +++ b/packages/common/components/Loaders/FilterBlockLoader/index.js @@ -4,123 +4,138 @@ import RectangleLoader from "../RectangleLoader"; import { StyledBlock, StyledContainer } from "./StyledFilterBlockLoader"; -const FilterBlockLoader = ({ id, className, style, ...rest }) => { +const FilterBlockLoader = ({ + id, + className, + style, + isPersonalRoom, + isRooms, + ...rest +}) => { + console.log(isPersonalRoom, isRooms); + return ( - {/* - - -
+ {!isRooms && ( + -
-
*/} - - - -
- - -
-
- +
+ + +
+ + )} + + {!isPersonalRoom && ( + -
-
+
+ + +
+
+ + +
+ + )} - - -
+ {isRooms && ( + + +
+ + + + + +
- - - - -
- -
+ + )} - + Date: Mon, 12 Sep 2022 16:21:01 +0300 Subject: [PATCH 10/87] Web:Common:FilterInput: update logic for combobox and fix bugs --- .../common/components/FilterInput/index.js | 5 +++++ .../FilterInput/sub-components/FilterBlock.js | 19 ++++++++++++++++--- .../sub-components/FilterBlockItem.js | 8 +++++--- .../sub-components/FilterButton.js | 5 +++++ .../sub-components/StyledFilterBlock.js | 4 ++++ 5 files changed, 35 insertions(+), 6 deletions(-) diff --git a/packages/common/components/FilterInput/index.js b/packages/common/components/FilterInput/index.js index 8e910611c3..e52699ec0d 100644 --- a/packages/common/components/FilterInput/index.js +++ b/packages/common/components/FilterInput/index.js @@ -37,6 +37,9 @@ const FilterInput = React.memo( isRecentFolder, removeSelectedItem, + + isPersonalRoom, + isRooms, }) => { const [viewSettings, setViewSettings] = React.useState([]); const [inputValue, setInputValue] = React.useState(""); @@ -116,6 +119,8 @@ const FilterInput = React.memo( selectedFilterValue={selectedFilterValue} filterHeader={filterHeader} selectorLabel={selectorLabel} + isPersonalRoom={isPersonalRoom} + isRooms={isRooms} /> {!isRecentFolder && ( { const [showSelector, setShowSelector] = React.useState({ show: false, @@ -74,14 +76,22 @@ const FilterBlock = ({ if (groupItem.isMultiSelect) { groupItem.isSelected = currentFilter.key.includes(groupItem.key); } + if (groupItem.withOptions) { + groupItem.isSelected = currentFilter.key.includes(groupItem.key); + } }); } else { - item.groupItem.forEach((groupItem) => { + item.groupItem.forEach((groupItem, idx) => { groupItem.isSelected = false; if (groupItem.isSelector) { groupItem.selectedKey = null; groupItem.selectedLabel = null; } + if (groupItem.withOptions) { + item.groupItem[idx].options.forEach((x, index) => { + item.groupItem[idx].options[index].isSelected = false; + }); + } }); } }); @@ -244,7 +254,7 @@ const FilterBlock = ({ setTimeout(() => { setIsLoading(false); - }, 300); + }, 500); }, []); React.useEffect(() => { @@ -372,7 +382,10 @@ const FilterBlock = ({
{isLoading ? ( - + ) : ( {filterData.map((item) => { diff --git a/packages/common/components/FilterInput/sub-components/FilterBlockItem.js b/packages/common/components/FilterInput/sub-components/FilterBlockItem.js index ccd75e350d..22ebd03dd9 100644 --- a/packages/common/components/FilterInput/sub-components/FilterBlockItem.js +++ b/packages/common/components/FilterInput/sub-components/FilterBlockItem.js @@ -129,21 +129,23 @@ const FilterBlockItem = ({ }; const getWithOptionsItem = (item) => { - const selectedOption = item.options.find((option) => option.isSelected); + const selectedOption = + item.options.find((option) => option.isSelected) || item.options[0]; return ( changeFilterValueAction( data.key, - data.key === selectedOption?.key, + data.key === item.options[0].key, false, item.withOptions ) } options={item.options} - selectedOption={selectedOption ? selectedOption : item.options[0]} + selectedOption={selectedOption} displaySelectedOption={true} scaled={true} scaledOptions={true} diff --git a/packages/common/components/FilterInput/sub-components/FilterButton.js b/packages/common/components/FilterInput/sub-components/FilterButton.js index 844943aa4d..a6028057da 100644 --- a/packages/common/components/FilterInput/sub-components/FilterButton.js +++ b/packages/common/components/FilterInput/sub-components/FilterButton.js @@ -17,6 +17,9 @@ const FilterButton = ({ filterHeader, selectorLabel, + + isPersonalRoom, + isRooms, }) => { const [showFilterBlock, setShowFilterBlock] = React.useState(false); @@ -42,6 +45,8 @@ const FilterButton = ({ getFilterData={getFilterData} onFilter={onFilter} selectorLabel={selectorLabel} + isPersonalRoom={isPersonalRoom} + isRooms={isRooms} /> )} diff --git a/packages/common/components/FilterInput/sub-components/StyledFilterBlock.js b/packages/common/components/FilterInput/sub-components/StyledFilterBlock.js index 834c0372a1..301ff7afa6 100644 --- a/packages/common/components/FilterInput/sub-components/StyledFilterBlock.js +++ b/packages/common/components/FilterInput/sub-components/StyledFilterBlock.js @@ -51,6 +51,10 @@ const StyledFilterBlock = styled.div` .filter-body { height: ${(props) => (props.showFooter ? "calc(100% - 125px)" : "100%")}; + + .combo-button { + justify-content: space-between; + } } `; From fc59f340d8717084649068dba67291aa6827a7ba Mon Sep 17 00:00:00 2001 From: TimofeyBoyko Date: Mon, 12 Sep 2022 17:00:26 +0300 Subject: [PATCH 11/87] Web:Common:FilterInput: fix combobox open --- .../components/FilterInput/sub-components/FilterBlockItem.js | 3 +++ 1 file changed, 3 insertions(+) diff --git a/packages/common/components/FilterInput/sub-components/FilterBlockItem.js b/packages/common/components/FilterInput/sub-components/FilterBlockItem.js index 22ebd03dd9..4342b3bf0f 100644 --- a/packages/common/components/FilterInput/sub-components/FilterBlockItem.js +++ b/packages/common/components/FilterInput/sub-components/FilterBlockItem.js @@ -149,6 +149,9 @@ const FilterBlockItem = ({ displaySelectedOption={true} scaled={true} scaledOptions={true} + isDefaultMode={false} + directionY={"bottom"} + fixedDirection /> ); }; From 5ddcfe6c3aab6a0f26ee4ad96151400893f31e91 Mon Sep 17 00:00:00 2001 From: TimofeyBoyko Date: Mon, 12 Sep 2022 17:06:48 +0300 Subject: [PATCH 12/87] Web:Common:Loaders: delete useless code --- packages/common/components/Loaders/FilterBlockLoader/index.js | 2 -- 1 file changed, 2 deletions(-) diff --git a/packages/common/components/Loaders/FilterBlockLoader/index.js b/packages/common/components/Loaders/FilterBlockLoader/index.js index 76be68861d..d71548e3c6 100644 --- a/packages/common/components/Loaders/FilterBlockLoader/index.js +++ b/packages/common/components/Loaders/FilterBlockLoader/index.js @@ -12,8 +12,6 @@ const FilterBlockLoader = ({ isRooms, ...rest }) => { - console.log(isPersonalRoom, isRooms); - return ( {!isRooms && ( From e6a4637b73d856fed1ca4e1f1aa6ceeda5e35fb3 Mon Sep 17 00:00:00 2001 From: TimofeyBoyko Date: Mon, 12 Sep 2022 18:05:36 +0300 Subject: [PATCH 13/87] Web:Common:FilterInput: add cancel button --- .../components/FilterInput/sub-components/FilterBlock.js | 8 +++++++- .../FilterInput/sub-components/StyledFilterBlock.js | 2 ++ 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/packages/common/components/FilterInput/sub-components/FilterBlock.js b/packages/common/components/FilterInput/sub-components/FilterBlock.js index 650f89f38f..d2dbd3e9c1 100644 --- a/packages/common/components/FilterInput/sub-components/FilterBlock.js +++ b/packages/common/components/FilterInput/sub-components/FilterBlock.js @@ -412,10 +412,16 @@ const FilterBlock = ({
)} diff --git a/packages/common/components/FilterInput/sub-components/FilterBlock.js b/packages/common/components/FilterInput/sub-components/FilterBlock.js index d2dbd3e9c1..c36a9f4f60 100644 --- a/packages/common/components/FilterInput/sub-components/FilterBlock.js +++ b/packages/common/components/FilterInput/sub-components/FilterBlock.js @@ -373,12 +373,14 @@ const FilterBlock = ({ {filterHeader} - + {showFooter && ( + + )}
{isLoading ? ( diff --git a/packages/common/components/FilterInput/sub-components/StyledFilterBlock.js b/packages/common/components/FilterInput/sub-components/StyledFilterBlock.js index 46b3fe09cd..7e64e42cdc 100644 --- a/packages/common/components/FilterInput/sub-components/StyledFilterBlock.js +++ b/packages/common/components/FilterInput/sub-components/StyledFilterBlock.js @@ -54,6 +54,12 @@ const StyledFilterBlock = styled.div` .combo-button { justify-content: space-between; + + .combo-button-label { + font-size: 13px; + font-weight: 400; + line-height: 20px; + } } } `; @@ -76,6 +82,10 @@ const StyledFilterBlockHeader = styled.div` align-items: center; justify-content: ${(props) => (props.isSelector ? "start" : "space-between")}; + h1 { + font-weight: 700; + } + .arrow-button { margin-right: 12px; } @@ -89,7 +99,7 @@ StyledFilterBlockHeader.defaultProps = { theme: Base }; const StyledFilterBlockItem = styled.div` padding: ${(props) => - !props.withoutHeader ? "12px 16px 0px 16px" : "6px 16px 0px 16px"}; + !props.withoutHeader ? "12px 15px 0px 16px" : "5px 15px 0px 16px"}; display: flex; flex-direction: column; @@ -147,8 +157,8 @@ const selectedItemTag = css` `; const StyledFilterBlockItemTag = styled.div` - height: 30px; - max-height: 30px; + height: 28px; + max-height: 28px; display: flex; flex-direction: row; @@ -161,7 +171,7 @@ const StyledFilterBlockItemTag = styled.div` padding: 4px 15px; - margin: 0 6px 12px 0; + margin: 0 7px 8px 0; cursor: pointer; @@ -174,12 +184,13 @@ StyledFilterBlockItemTag.defaultProps = { theme: Base }; const selectedItemTagText = css` color: ${(props) => props.theme.filterInput.filter.selectedItem.color}; + font-weight: 600; `; const StyledFilterBlockItemTagText = styled(Text)` height: 20px; - font-weight: normal; + font-weight: 400; font-size: 13px; line-height: 20px; @@ -226,7 +237,15 @@ const StyledFilterBlockItemToggleButton = styled(ToggleButton)` grid-gap: 0px; `; const StyledFilterBlockItemCheckboxContainer = styled.div` - margin: 7px 0 11px; + margin: 7px 0 13px; + + .checkbox { + margin-right: 8px !important; + } + + .checkbox-text { + line-height: 20px; + } `; const StyledFilterBlockItemSeparator = styled.div` @@ -237,7 +256,7 @@ const StyledFilterBlockItemSeparator = styled.div` background: ${(props) => props.theme.filterInput.filter.separatorColor}; - margin: 2px 0 0 0; + margin: 4px 0 4px 0; `; StyledFilterBlockItemToggleButton.defaultProps = { theme: Base }; From 42d6b3e7d367b026456af13ab819cdb19b6b83fd Mon Sep 17 00:00:00 2001 From: TimofeyBoyko Date: Tue, 13 Sep 2022 13:47:40 +0300 Subject: [PATCH 15/87] Web: add new translation keys --- packages/client/public/locales/en/Files.json | 8 +++++++- public/locales/en/Common.json | 2 ++ 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/packages/client/public/locales/en/Files.json b/packages/client/public/locales/en/Files.json index b6f42e1170..9ce781dc67 100644 --- a/packages/client/public/locales/en/Files.json +++ b/packages/client/public/locales/en/Files.json @@ -24,7 +24,9 @@ "EmptyFolderHeader": "No files in this folder", "EmptyRecycleBin": "Empty Trash", "EmptyScreenFolder": "No docs here yet", + "ExcludeSubfolders": "Exclude subfolders", "FavoritesEmptyContainerDescription": "To mark files as favorites or remove them from this list, use the context menu.", + "FileContents": "File contents", "FileRemoved": "File moved to Trash", "FileRenamed": "The document '{{oldTitle}}' is renamed to '{{newTitle}}'", "FillingFormRooms": "Filling form", @@ -33,6 +35,7 @@ "Folder": "Folder", "FolderRemoved": "Folder moved to Trash", "FolderRenamed": "The folder '{{folderTitle}}' is renamed to '{{newFoldedTitle}}'", + "Forms": "Forms", "FromArchive": "Move from archive", "GoToMyButton": "Go to My Documents", "Images": "Images", @@ -40,6 +43,7 @@ "MarkAsFavorite": "Mark as favorite", "MarkRead": "Mark as read", "MarkedAsFavorite": "Added to favorites", + "MasterForms": "Master forms", "Media": "Media", "MoveItem": "{{title}} moved", "MoveItems": "{{qty}} elements have been moved", @@ -74,6 +78,7 @@ "ReviewRooms": "Review", "RoomRemoved": "Room removed", "RoomsRemoved": "Rooms removed", + "SearchByContent": "Search by file contents", "SendByEmail": "Send by email", "Share": "Share", "SharedEmptyContainerDescription": "The 'Shared with Me' section shows files shared to you by teammates. If you haven't seen the latest changes, they are marked as new. You can remove the files from the list using the context menu. ", @@ -93,5 +98,6 @@ "VersionHistory": "Version history", "ViewList": "List", "ViewOnlyRooms": "View-only", - "ViewTiles": "Tiles" + "ViewTiles": "Tiles", + "WithSubfolders": "With subfolders" } diff --git a/public/locales/en/Common.json b/public/locales/en/Common.json index d776f259c2..0bdf12de5f 100644 --- a/public/locales/en/Common.json +++ b/public/locales/en/Common.json @@ -9,6 +9,7 @@ "AddUsers": "Add users", "AdminSettings": "Admin settings", "Alert": "Alert", + "ApplyButton": "Apply", "Archive": "Archive", "Attention": "Attention", "Audio": "Audio", @@ -18,6 +19,7 @@ "ByLastNameSorting": "By last name", "CancelButton": "Cancel", "ClearButton": "Reset filter", + "ClearAll": "Clear all", "ClearFilter": "Clear search", "CloseButton": "Close", "Color": "Color", From b61440cc4900edb03c7f95802e123127e9d2fe76 Mon Sep 17 00:00:00 2001 From: TimofeyBoyko Date: Tue, 13 Sep 2022 13:49:07 +0300 Subject: [PATCH 16/87] Web:Client:Home: update filter for personal room --- .../src/pages/Home/Section/Filter/index.js | 201 +++++++++++------- 1 file changed, 130 insertions(+), 71 deletions(-) diff --git a/packages/client/src/pages/Home/Section/Filter/index.js b/packages/client/src/pages/Home/Section/Filter/index.js index 5fa9e4e3b4..9d17602b52 100644 --- a/packages/client/src/pages/Home/Section/Filter/index.js +++ b/packages/client/src/pages/Home/Section/Filter/index.js @@ -19,6 +19,7 @@ import { withLayoutSize } from "@docspace/common/utils"; import { getDefaultRoomName } from "@docspace/client/src/helpers/filesUtils"; import withLoader from "../../../../HOCs/withLoader"; +import { toastr } from "@docspace/components"; const getFilterType = (filterValues) => { const filterType = result( @@ -28,7 +29,7 @@ const getFilterType = (filterValues) => { "key" ); - return filterType ? +filterType : null; + return filterType ? (+filterType ? +filterType : filterType) : null; }; const getAuthorType = (filterValues) => { @@ -87,16 +88,16 @@ const getOwner = (filterValues) => { // return filterFolders ? filterFolders : null; // }; -// const getFilterContent = (filterValues) => { -// const filterContent = result( -// find(filterValues, (value) => { -// return value.group === FilterGroups.roomFilterContent; -// }), -// "key" -// ); +const getFilterContent = (filterValues) => { + const filterContent = result( + find(filterValues, (value) => { + return value.group === FilterGroups.filterContent; + }), + "key" + ); -// return filterContent ? filterContent : null; -// }; + return filterContent ? filterContent : null; +}; const getTags = (filterValues) => { const filterTags = filterValues.find( @@ -127,6 +128,7 @@ const SectionFilterContent = ({ infoPanelVisible, isRooms, userId, + isPersonalRoom, setCurrentRoomsFilter, }) => { const onFilter = React.useCallback( @@ -181,18 +183,30 @@ const SectionFilterContent = ({ ); } else { const filterType = getFilterType(data) || null; + const authorType = !!getAuthorType(data) ? getAuthorType(data).includes("user_") ? getAuthorType(data) : `user_${getAuthorType(data)}` : null; const withSubfolders = getSearchParams(data); + const withContent = getFilterContent(data); const newFilter = filter.clone(); newFilter.page = 0; - newFilter.filterType = filterType; + + if (filterType === "master-forms" || filterType === "forms") { + newFilter.filterType = null; + + toastr.warning(`The ${filterType} type is still under development`); + } else { + newFilter.filterType = filterType; + } + newFilter.authorType = authorType; - newFilter.withSubfolders = withSubfolders; + newFilter.withSubfolders = + withSubfolders === FilterKeys.excludeSubfolders ? "false" : "true"; + newFilter.searchInContent = withContent === "true" ? "true" : null; setIsLoading(true); @@ -386,10 +400,26 @@ const SectionFilterContent = ({ }); } } else { + if (filter.withSubfolders === "false") { + filterValues.push({ + key: FilterKeys.excludeSubfolders, + label: t("ExcludeSubfolders"), + group: FilterGroups.filterFolders, + }); + } + + if (filter.searchInContent) { + filterValues.push({ + key: "true", + label: t("FileContents"), + group: FilterGroups.filterContent, + }); + } + if (filter.filterType) { let label = ""; - switch (filter.filterType) { + switch (filter.filterType.toString()) { case FilterType.DocumentsOnly.toString(): label = t("Common:Documents"); break; @@ -414,11 +444,17 @@ const SectionFilterContent = ({ case FilterType.FilesOnly.toString(): label = t("AllFiles"); break; + case "master-forms": + label = t("MasterForms"); + break; + case "forms": + label = t("Forms"); + break; } filterValues.push({ key: `${filter.filterType}`, - label: label, + label: label.toLowerCase(), group: FilterGroups.filterType, }); } @@ -431,14 +467,6 @@ const SectionFilterContent = ({ label: user.displayName, }); } - - if (filter.withSubfolders === "false") { - filterValues.push({ - key: filter.withSubfolders, - label: "Exclude subfolders", - group: FilterGroups.filterFolders, - }); - } } return filterValues; @@ -446,6 +474,7 @@ const SectionFilterContent = ({ filter.withSubfolders, filter.authorType, filter.filterType, + filter.searchInContent, roomsFilter.type, roomsFilter.subjectId, roomsFilter.tags, @@ -465,18 +494,7 @@ const SectionFilterContent = ({ { key: FilterType.FoldersOnly.toString(), group: FilterGroups.filterType, - label: t("Translations:Folders"), - }, - ] - : ""; - - const allFiles = - !isFavoritesFolder && !isRecentFolder - ? [ - { - key: FilterType.FilesOnly.toString(), - group: FilterGroups.filterType, - label: t("AllFiles"), + label: t("Translations:Folders").toLowerCase(), }, ] : ""; @@ -486,7 +504,7 @@ const SectionFilterContent = ({ { key: FilterType.ImagesOnly.toString(), group: FilterGroups.filterType, - label: t("Images"), + label: t("Images").toLowerCase(), }, ] : ""; @@ -496,7 +514,7 @@ const SectionFilterContent = ({ { key: FilterType.ArchiveOnly.toString(), group: FilterGroups.filterType, - label: t("Archives"), + label: t("Archives").toLowerCase(), }, ] : ""; @@ -506,7 +524,7 @@ const SectionFilterContent = ({ { key: FilterType.MediaOnly.toString(), group: FilterGroups.filterType, - label: t("Media"), + label: t("Media").toLowerCase(), }, ] : ""; @@ -551,27 +569,38 @@ const SectionFilterContent = ({ group: FilterGroups.filterType, label: t("Common:Type"), isHeader: true, - }, - { - key: FilterType.DocumentsOnly.toString(), - group: FilterGroups.filterType, - label: t("Common:Documents"), + isLast: true, }, ...folders, { - key: FilterType.SpreadsheetsOnly.toString(), + key: FilterType.DocumentsOnly.toString(), group: FilterGroups.filterType, - label: t("Translations:Spreadsheets"), + label: t("Common:Documents").toLowerCase(), }, - ...archives, { key: FilterType.PresentationsOnly.toString(), group: FilterGroups.filterType, - label: t("Translations:Presentations"), + label: t("Translations:Presentations").toLowerCase(), }, + { + key: FilterType.SpreadsheetsOnly.toString(), + group: FilterGroups.filterType, + label: t("Translations:Spreadsheets").toLowerCase(), + }, + { + key: "master-forms", + group: FilterGroups.filterType, + label: t("MasterForms").toLowerCase(), + }, + { + key: "forms", + group: FilterGroups.filterType, + label: t("Forms").toLowerCase(), + }, + ...archives, + ...images, ...media, - ...allFiles, ]; const ownerOptions = [ @@ -672,7 +701,49 @@ const SectionFilterContent = ({ filterOptions.push(...tagsOptions); } } else { - if (!personal) { + if (!isRecentFolder && !isFavoritesFolder) { + const foldersOptions = [ + { + key: FilterGroups.filterFolders, + group: FilterGroups.filterFolders, + label: t("Common:Search"), + isHeader: true, + withoutSeparator: true, + }, + { + key: "folders", + group: FilterGroups.filterFolders, + label: "", + withOptions: true, + options: [ + { key: FilterKeys.withSubfolders, label: t("WithSubfolders") }, + { + key: FilterKeys.excludeSubfolders, + label: t("ExcludeSubfolders"), + }, + ], + }, + ]; + + const contentOptions = [ + { + key: FilterGroups.filterContent, + group: FilterGroups.filterContent, + isHeader: true, + withoutHeader: true, + }, + { + key: "true", + group: FilterGroups.filterContent, + label: t("SearchByContent"), + isCheckbox: true, + }, + ]; + filterOptions.push(...foldersOptions); + filterOptions.push(...contentOptions); + } + + if (!isPersonalRoom) { filterOptions.push( { key: FilterGroups.filterAuthor, @@ -690,29 +761,10 @@ const SectionFilterContent = ({ } filterOptions.push(...typeOptions); - - if (!isRecentFolder && !isFavoritesFolder) { - filterOptions.push( - { - key: FilterGroups.filterFolders, - group: FilterGroups.filterFolders, - label: t("Translations:Folders"), - isHeader: true, - withoutHeader: true, - isLast: true, - }, - { - key: "false", - group: FilterGroups.filterFolders, - label: t("NoSubfolders"), - isToggle: true, - } - ); - } } return filterOptions; - }, [isFavoritesFolder, isRecentFolder, isRooms, t, personal]); + }, [isFavoritesFolder, isRecentFolder, isRooms, t, personal, isPersonalRoom]); const getViewSettingsData = React.useCallback(() => { const viewSettings = [ @@ -735,14 +787,14 @@ const SectionFilterContent = ({ const getSortData = React.useCallback(() => { const commonOptions = isRooms ? [ - { key: "AZ", label: "Name", default: true }, + { key: "AZ", label: t("Common:Name"), default: true }, { key: "roomType", label: t("Common:Type"), default: true }, { key: "Tags", label: t("Tags"), default: true }, { key: "Author", label: t("Common:Owner"), default: true }, { key: "DateAndTime", label: t("ByLastModifiedDate"), default: true }, ] : [ - { key: "AZ", label: t("ByTitle"), default: true }, + { key: "AZ", label: t("Common:Name"), default: true }, { key: "Type", label: t("Common:Type"), default: true }, { key: "Size", label: t("Common:Size"), default: true }, { @@ -820,7 +872,10 @@ const SectionFilterContent = ({ newFilter.authorType = null; } if (group === FilterGroups.filterFolders) { - newFilter.withSubfolders = null; + newFilter.withSubfolders = "true"; + } + if (group === FilterGroups.filterContent) { + newFilter.searchInContent = null; } newFilter.page = 0; @@ -862,6 +917,8 @@ const SectionFilterContent = ({ view={t("Common:View")} isFavoritesFolder={isFavoritesFolder} isRecentFolder={isRecentFolder} + isPersonalRoom={isPersonalRoom} + isRooms={isRooms} removeSelectedItem={removeSelectedItem} /> ); @@ -890,6 +947,7 @@ export default inject( isRecentFolder, isRoomsFolder, isArchiveFolder, + isPersonalRoom, } = treeFoldersStore; const isRooms = isRoomsFolder || isArchiveFolder; @@ -918,6 +976,7 @@ export default inject( createThumbnails, personal, + isPersonalRoom, infoPanelVisible, setCurrentRoomsFilter, }; From fff60dcdd6ed94da44abe43116af5815e6f1007c Mon Sep 17 00:00:00 2001 From: TimofeyBoyko Date: Tue, 13 Sep 2022 13:59:44 +0300 Subject: [PATCH 17/87] Web:Common:Loaders: fix styles for filter block loader --- .../Loaders/FilterBlockLoader/StyledFilterBlockLoader.js | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/packages/common/components/Loaders/FilterBlockLoader/StyledFilterBlockLoader.js b/packages/common/components/Loaders/FilterBlockLoader/StyledFilterBlockLoader.js index 5b49fc7458..4963e72ff5 100644 --- a/packages/common/components/Loaders/FilterBlockLoader/StyledFilterBlockLoader.js +++ b/packages/common/components/Loaders/FilterBlockLoader/StyledFilterBlockLoader.js @@ -14,10 +14,9 @@ const StyledContainer = styled.div` const StyledBlock = styled.div` padding: 12px 0 6px; - margin-bottom: 0; - width: 100%; - height: 128px; + min-height: 122px; + height: auto; display: flex; From 8030f66036958522123f890ea7b44d0b9f89bd38 Mon Sep 17 00:00:00 2001 From: Alexey Safronov Date: Tue, 13 Sep 2022 17:23:52 +0300 Subject: [PATCH 18/87] Web: Fix translations --- packages/client/public/locales/en/FilesSettings.json | 2 +- public/locales/en/Common.json | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/client/public/locales/en/FilesSettings.json b/packages/client/public/locales/en/FilesSettings.json index a674113ec4..3f1d167a25 100644 --- a/packages/client/public/locales/en/FilesSettings.json +++ b/packages/client/public/locales/en/FilesSettings.json @@ -1,6 +1,6 @@ { "Clouds": "Clouds", - "CommonSettings": "Common settings", + "CommonSettings": "Common", "ConnectAdminDescription": "For successful connection, enter the necessary data on <1>this page.", "ConnectCloud": "Connect cloud", "ConnectDescriptionText": "You haven't connected any third-party clouds yet.", diff --git a/public/locales/en/Common.json b/public/locales/en/Common.json index d776f259c2..f49bcb5ba2 100644 --- a/public/locales/en/Common.json +++ b/public/locales/en/Common.json @@ -7,7 +7,7 @@ "AddButton": "Add", "AddFilter": "Add filter", "AddUsers": "Add users", - "AdminSettings": "Admin settings", + "AdminSettings": "Admin", "Alert": "Alert", "Archive": "Archive", "Attention": "Attention", From 8830d40a3ebfd1988c71714ea81d3f855eb3cd23 Mon Sep 17 00:00:00 2001 From: Alexey Safronov Date: Tue, 13 Sep 2022 17:24:30 +0300 Subject: [PATCH 19/87] Web: Fix styles --- .../Settings/Section/Body/CommonSettings.js | 6 ++-- .../Settings/Section/Body/ConnectedClouds.js | 5 +-- .../Settings/Section/Body/StyledSettings.js | 7 ++-- .../src/pages/Settings/Section/Body/index.js | 33 ++++++++++++------- 4 files changed, 33 insertions(+), 18 deletions(-) diff --git a/packages/client/src/pages/Settings/Section/Body/CommonSettings.js b/packages/client/src/pages/Settings/Section/Body/CommonSettings.js index 5c393b2558..b7e04aafa9 100644 --- a/packages/client/src/pages/Settings/Section/Body/CommonSettings.js +++ b/packages/client/src/pages/Settings/Section/Body/CommonSettings.js @@ -98,18 +98,18 @@ const CommonSettings = ({ onChange={onChangeFavorites} isChecked={favoritesSection} /> - console.log(e)} isChecked={false} - /> + /> */} )} {!isVisitor && ( <> - + {t("StoringFileVersion")} + {!!providers.length ? ( <>
From d961c9a21e595c4610542204ee2d2f7db3098444 Mon Sep 17 00:00:00 2001 From: TimofeyBoyko Date: Tue, 13 Sep 2022 18:17:05 +0300 Subject: [PATCH 21/87] Web:Client:Home/AccountsHome: move table version for table view fo const --- packages/client/src/helpers/constants.js | 10 ++++++++++ .../Section/Body/TableView/TableContainer.js | 6 +++--- .../Home/Section/Body/TableView/TableContainer.js | 15 +++++++-------- 3 files changed, 20 insertions(+), 11 deletions(-) diff --git a/packages/client/src/helpers/constants.js b/packages/client/src/helpers/constants.js index 3f28d88ec9..f17faed70e 100644 --- a/packages/client/src/helpers/constants.js +++ b/packages/client/src/helpers/constants.js @@ -51,6 +51,16 @@ export const CategoryType = Object.freeze({ Trash: 7, }); +/** + * Enum for table columns version + * @readonly + */ +export const TableVersions = Object.freeze({ + Files: "2", + Rooms: "1", + Accounts: "2", +}); + export const BINDING_POST = "urn:oasis:names:tc:SAML:2.0:bindings:HTTP-POST"; export const BINDING_REDIRECT = "urn:oasis:names:tc:SAML:2.0:bindings:HTTP-Redirect"; diff --git a/packages/client/src/pages/AccountsHome/Section/Body/TableView/TableContainer.js b/packages/client/src/pages/AccountsHome/Section/Body/TableView/TableContainer.js index c23756d4de..5717a8742d 100644 --- a/packages/client/src/pages/AccountsHome/Section/Body/TableView/TableContainer.js +++ b/packages/client/src/pages/AccountsHome/Section/Body/TableView/TableContainer.js @@ -11,10 +11,10 @@ import EmptyScreen from "../EmptyScreen"; import TableRow from "./TableRow"; import TableHeader from "./TableHeader"; import { Base } from "@docspace/components/themes"; +import { TableVersions } from "SRC_DIR/helpers/constants"; -const TABLE_VERSION = "2"; -const COLUMNS_SIZE = `peopleColumnsSize_ver-${TABLE_VERSION}`; -const INFO_PANEL_COLUMNS_SIZE = `infoPanelPeopleColumnsSize_ver-${TABLE_VERSION}`; +const COLUMNS_SIZE = `peopleColumnsSize_ver-${TableVersions.Accounts}`; +const INFO_PANEL_COLUMNS_SIZE = `infoPanelPeopleColumnsSize_ver-${TableVersions.Accounts}`; const marginCss = css` margin-top: -1px; diff --git a/packages/client/src/pages/Home/Section/Body/TableView/TableContainer.js b/packages/client/src/pages/Home/Section/Body/TableView/TableContainer.js index 15cd0f43fa..ab6362a041 100644 --- a/packages/client/src/pages/Home/Section/Body/TableView/TableContainer.js +++ b/packages/client/src/pages/Home/Section/Body/TableView/TableContainer.js @@ -8,6 +8,7 @@ import TableBody from "@docspace/components/table-container/TableBody"; import { isMobile } from "react-device-detect"; import styled, { css } from "styled-components"; import { Base } from "@docspace/components/themes"; +import { TableVersions } from "SRC_DIR/helpers/constants"; const marginCss = css` margin-top: -1px; @@ -98,15 +99,13 @@ const StyledTableContainer = styled(TableContainer)` StyledTableContainer.defaultProps = { theme: Base }; -const TABLE_VERSION = "2"; -const TABLE_COLUMNS = `filesTableColumns_ver-${TABLE_VERSION}`; -const COLUMNS_SIZE = `filesColumnsSize_ver-${TABLE_VERSION}`; -const COLUMNS_SIZE_INFO_PANEL = `filesColumnsSizeInfoPanel_ver-${TABLE_VERSION}`; +const TABLE_COLUMNS = `filesTableColumns_ver-${TableVersions.Files}`; +const COLUMNS_SIZE = `filesColumnsSize_ver-${TableVersions.Files}`; +const COLUMNS_SIZE_INFO_PANEL = `filesColumnsSizeInfoPanel_ver-${TableVersions.Files}`; -const TABLE_ROOMS_VERSION = "1"; -const TABLE_ROOMS_COLUMNS = `roomsTableColumns_ver-${TABLE_ROOMS_VERSION}`; -const COLUMNS_ROOMS_SIZE = `roomsColumnsSize_ver-${TABLE_ROOMS_VERSION}`; -const COLUMNS_ROOMS_SIZE_INFO_PANEL = `roomsColumnsSizeInfoPanel_ver-${TABLE_ROOMS_VERSION}`; +const TABLE_ROOMS_COLUMNS = `roomsTableColumns_ver-${TableVersions.Rooms}`; +const COLUMNS_ROOMS_SIZE = `roomsColumnsSize_ver-${TableVersions.Rooms}`; +const COLUMNS_ROOMS_SIZE_INFO_PANEL = `roomsColumnsSizeInfoPanel_ver-${TableVersions.Rooms}`; const Table = ({ filesList, From b15c61067cceefb559e2ddc0357f04175ba906cb Mon Sep 17 00:00:00 2001 From: TimofeyBoyko Date: Tue, 13 Sep 2022 18:17:48 +0300 Subject: [PATCH 22/87] Web:Client:Helpers: add new event 'change column' --- 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 2ef7e42c37..ac42c2ce17 100644 --- a/packages/client/src/helpers/filesConstants.js +++ b/packages/client/src/helpers/filesConstants.js @@ -16,6 +16,7 @@ export const Events = Object.freeze({ RENAME: "rename", ROOM_CREATE: "create_room", ROOM_EDIT: "edit_room", + CHANGE_COLUMN: "change_column", }); export const FilterGroups = Object.freeze({ From 28a3096a25f03d5cb5e0f37e54675c0d1b2d526f Mon Sep 17 00:00:00 2001 From: Alexey Safronov Date: Wed, 14 Sep 2022 12:37:33 +0300 Subject: [PATCH 23/87] Web: Files: Settings: styling + new translations --- .../public/locales/en/FilesSettings.json | 7 +- .../public/locales/ru/FilesSettings.json | 8 +- .../Settings/Section/Body/AdminSettings.js | 36 ++++++--- .../Settings/Section/Body/CommonSettings.js | 77 +++++++++++-------- .../Settings/Section/Body/StyledSettings.js | 11 ++- public/locales/ru/Common.json | 2 +- 6 files changed, 86 insertions(+), 55 deletions(-) diff --git a/packages/client/public/locales/en/FilesSettings.json b/packages/client/public/locales/en/FilesSettings.json index 3f1d167a25..7f73dda492 100644 --- a/packages/client/public/locales/en/FilesSettings.json +++ b/packages/client/public/locales/en/FilesSettings.json @@ -1,4 +1,5 @@ { + "AdditionalSections": "Additional sections", "Clouds": "Clouds", "CommonSettings": "Common", "ConnectAdminDescription": "For successful connection, enter the necessary data on <1>this page.", @@ -15,8 +16,10 @@ "IntermediateVersion": "Keep all saved intermediate versions", "KeepIntermediateVersion": "Keep intermediate versions when editing", "OriginalCopy": "Save the file copy in the original format as well", - "StoringFileVersion": "Storing file versions", + + "ThirdPartyAccounts": "Third-party accounts", "ThirdPartyBtn": "Allow users to connect third-party storages", "ThirdPartySettings": "Connected clouds", - "UpdateOrCreate": "Update the file version for the existing file with the same name. Otherwise, a copy of the file will be created." + "UpdateOrCreate": "Update the file version for the existing file with the same name. Otherwise, a copy of the file will be created.", + "StoringFileVersion": "Storing file versions" } diff --git a/packages/client/public/locales/ru/FilesSettings.json b/packages/client/public/locales/ru/FilesSettings.json index 499ab0b98e..f69750758f 100644 --- a/packages/client/public/locales/ru/FilesSettings.json +++ b/packages/client/public/locales/ru/FilesSettings.json @@ -1,6 +1,7 @@ { + "AdditionalSections": "Дополнительные разделы", "Clouds": "Облака", - "CommonSettings": "Общие настройки", + "CommonSettings": "Общие", "ConnectAdminDescription": "Для успешного подключения введите нужные данные на <1>этой странице.", "ConnectCloud": "Подключить облако", "ConnectDescriptionText": "Вы еще не подключили сторонние облачные сервисы.", @@ -15,8 +16,9 @@ "IntermediateVersion": "Хранить все сохраненные промежуточные версии", "KeepIntermediateVersion": "Хранить промежуточные версии при редактировании", "OriginalCopy": "Сохранять также копию файла в исходном формате", - "StoringFileVersion": "Хранение версий файлов", + "ThirdPartyAccounts": "Сторонние аккаунты", "ThirdPartyBtn": "Разрешить пользователям подключать сторонние хранилища", "ThirdPartySettings": "Подключенные облака", - "UpdateOrCreate": "Обновлять версию файла для существующего файла с таким же именем. В противном случае будет создаваться копия файла." + "UpdateOrCreate": "Обновлять версию файла для существующего файла с таким же именем. В противном случае будет создаваться копия файла.", + "StoringFileVersion": "Хранение версий файлов" } diff --git a/packages/client/src/pages/Settings/Section/Body/AdminSettings.js b/packages/client/src/pages/Settings/Section/Body/AdminSettings.js index 482fd040e6..17d825d95e 100644 --- a/packages/client/src/pages/Settings/Section/Body/AdminSettings.js +++ b/packages/client/src/pages/Settings/Section/Body/AdminSettings.js @@ -1,6 +1,8 @@ import React from "react"; import { inject, observer } from "mobx-react"; import ToggleButton from "@docspace/components/toggle-button"; +import Heading from "@docspace/components/heading"; +import Box from "@docspace/components/box"; import StyledSettings from "./StyledSettings"; const AdminSettings = ({ @@ -20,18 +22,28 @@ const AdminSettings = ({ return ( - - + + + {t("StoringFileVersion")} + + + + + + {t("ThirdPartyAccounts")} + + + ); }; diff --git a/packages/client/src/pages/Settings/Section/Body/CommonSettings.js b/packages/client/src/pages/Settings/Section/Body/CommonSettings.js index b7e04aafa9..62d97b4dff 100644 --- a/packages/client/src/pages/Settings/Section/Body/CommonSettings.js +++ b/packages/client/src/pages/Settings/Section/Body/CommonSettings.js @@ -3,7 +3,7 @@ import { inject, observer } from "mobx-react"; import ToggleButton from "@docspace/components/toggle-button"; import Heading from "@docspace/components/heading"; - +import Box from "@docspace/components/box"; import StyledSettings from "./StyledSettings"; const CommonSettings = ({ @@ -69,20 +69,26 @@ const CommonSettings = ({ return ( - - + + + + + {!isVisitor && ( - <> + + + {t("AdditionalSections")} + console.log(e)} isChecked={false} /> */} - - )} - {!isVisitor && ( - <> - - {t("StoringFileVersion")} - - - - + )} + + + {!isVisitor && ( + <> + + {t("StoringFileVersion")} + + + + + )} + ); }; diff --git a/packages/client/src/pages/Settings/Section/Body/StyledSettings.js b/packages/client/src/pages/Settings/Section/Body/StyledSettings.js index 392a3d19bb..5513224e60 100644 --- a/packages/client/src/pages/Settings/Section/Body/StyledSettings.js +++ b/packages/client/src/pages/Settings/Section/Body/StyledSettings.js @@ -1,11 +1,11 @@ import styled from "styled-components"; const StyledSettings = styled.div` - margin-top: 15px; + margin-top: 10px; width: 100%; display: grid; - grid-gap: 19px; + grid-gap: 32px; .toggle-btn { position: relative; @@ -13,12 +13,17 @@ const StyledSettings = styled.div` .heading { margin-bottom: -2px; - margin-top: 3px; + margin-top: 0; } .toggle-button-text { margin-top: -1px; } + + .settings-section { + display: grid; + grid-gap: 18px; + } `; export default StyledSettings; diff --git a/public/locales/ru/Common.json b/public/locales/ru/Common.json index 81dc460d2c..30ce6268f5 100644 --- a/public/locales/ru/Common.json +++ b/public/locales/ru/Common.json @@ -6,7 +6,7 @@ "AddButton": "Добавить", "AddFilter": "Добавить фильтр", "AddUsers": "Добавить пользователей", - "AdminSettings": "Настройки администратора", + "AdminSettings": "Администратора", "Alert": "Предупреждение", "Archive": "Архив", "Attention": "Внимание", From fbcb8113e15104b3bffb1f6783de2a3487f1f602 Mon Sep 17 00:00:00 2001 From: Alexey Safronov Date: Wed, 14 Sep 2022 13:06:32 +0300 Subject: [PATCH 24/87] Web: Files: Settings: increased font-size for Header on table --- packages/client/src/pages/Settings/Section/Header/index.js | 1 + 1 file changed, 1 insertion(+) diff --git a/packages/client/src/pages/Settings/Section/Header/index.js b/packages/client/src/pages/Settings/Section/Header/index.js index eefa9afac7..61a1290595 100644 --- a/packages/client/src/pages/Settings/Section/Header/index.js +++ b/packages/client/src/pages/Settings/Section/Header/index.js @@ -51,6 +51,7 @@ const StyledContainer = styled.div` line-height: 24px; @media ${tablet} { + font-size: 21px; line-height: 28px; } From a1c30b4ad354b76705d9761752c4937f33c84bbe Mon Sep 17 00:00:00 2001 From: Alexey Safronov Date: Wed, 14 Sep 2022 13:52:38 +0300 Subject: [PATCH 25/87] Web: Files: Settings: fix primary url loading + refactoring --- .../src/pages/Settings/Section/Body/index.js | 37 ++------- .../pages/Settings/Section/Header/index.js | 6 +- packages/client/src/pages/Settings/index.js | 79 ++++++------------- packages/client/src/store/SettingsStore.js | 50 ++++++------ 4 files changed, 56 insertions(+), 116 deletions(-) diff --git a/packages/client/src/pages/Settings/Section/Body/index.js b/packages/client/src/pages/Settings/Section/Body/index.js index f6b3180aab..655db47557 100644 --- a/packages/client/src/pages/Settings/Section/Body/index.js +++ b/packages/client/src/pages/Settings/Section/Body/index.js @@ -1,5 +1,7 @@ -import React, { useState, useEffect, useCallback } from "react"; +import React, { useCallback } from "react"; +import { useTranslation } from "react-i18next"; import styled, { css } from "styled-components"; +import { withRouter } from "react-router"; import Error403 from "client/Error403"; import Error520 from "client/Error520"; //import ConnectClouds from "./ConnectedClouds"; @@ -28,10 +30,8 @@ const SectionBodyContent = ({ settingsIsLoaded, isErrorSettings, history, - isPersonal, - t, }) => { - const [currentTab, setCurrentTab] = useState(0); + const { t } = useTranslation(["FilesSettings", "Common"]); const commonSettings = { id: "common", @@ -69,9 +69,6 @@ const SectionBodyContent = ({ if (id === setting) return; - // setSelectedNode([key]); - // setExpandSettingsTree([key]); - history.push( combineUrl(AppServerConfig.proxyURL, config.homepage, `/settings/${id}`) ); @@ -79,27 +76,6 @@ const SectionBodyContent = ({ [setting, history] ); - // const selectedTab = React.useCallback(() => { - // switch (setting) { - // case "common": - // return isAdmin ? 1 : 0; - // case "admin": - // return 0; - // case "connected-clouds": - // return isPersonal ? 0 : isAdmin ? 2 : 1; - // default: - // return isAdmin ? 1 : 0; - // } - // }, [setting, isAdmin, isPersonal]); - - useEffect(() => { - const path = location.pathname; - const currentTab = data.findIndex((item) => path.includes(item.id)); - if (currentTab !== -1) { - setCurrentTab(currentTab); - } - }, []); - return !settingsIsLoaded ? null : (!enableThirdParty && setting === "connected-clouds") || (!isAdmin && setting === "admin") ? ( @@ -110,9 +86,8 @@ const SectionBodyContent = ({ ); @@ -126,4 +101,4 @@ export default inject(({ auth, settingsStore }) => { enableThirdParty, settingsIsLoaded, }; -})(observer(SectionBodyContent)); +})(withRouter(observer(SectionBodyContent))); diff --git a/packages/client/src/pages/Settings/Section/Header/index.js b/packages/client/src/pages/Settings/Section/Header/index.js index 61a1290595..ed31ce84e0 100644 --- a/packages/client/src/pages/Settings/Section/Header/index.js +++ b/packages/client/src/pages/Settings/Section/Header/index.js @@ -1,5 +1,6 @@ import React from "react"; import styled, { css } from "styled-components"; +import { useTranslation } from "react-i18next"; import Headline from "@docspace/common/components/Headline"; import { Consumer } from "@docspace/components/utils/context"; import { isMobile, isMobileOnly } from "react-device-detect"; @@ -85,7 +86,8 @@ const StyledContainer = styled.div` } `; -const SectionHeaderContent = ({ title }) => { +const SectionHeaderContent = () => { + const { t } = useTranslation("Common"); return ( {(context) => ( @@ -97,7 +99,7 @@ const SectionHeaderContent = ({ title }) => { type="content" truncate={true} > - {title} + {t("Common:Settings")}
diff --git a/packages/client/src/pages/Settings/index.js b/packages/client/src/pages/Settings/index.js index fbbb037157..13b70553a4 100644 --- a/packages/client/src/pages/Settings/index.js +++ b/packages/client/src/pages/Settings/index.js @@ -1,6 +1,4 @@ -import React, { useEffect, useState } from "react"; - -import { withRouter } from "react-router"; +import React, { useEffect } from "react"; import Section from "@docspace/common/components/Section"; import Loaders from "@docspace/common/components/Loaders"; import { showLoader, hideLoader } from "@docspace/common/utils"; @@ -13,27 +11,17 @@ import { inject, observer } from "mobx-react"; const PureSettings = ({ match, t, + tReady, isLoading, isLoadedSettingsTree, - history, setFirstLoad, - capabilities, - tReady, - isPersonal, }) => { - const [title, setTitle] = useState(""); const { setting } = match.params; useEffect(() => { setFirstLoad(false); }, [setFirstLoad]); - useEffect(() => { - isPersonal - ? setTitle(t("ThirdPartySettings")) - : setTitle(t("Common:Settings")); - }, [t, tReady]); - useEffect(() => { if (isLoading) { showLoader(); @@ -45,36 +33,22 @@ const PureSettings = ({ //console.log("render settings"); useEffect(() => { - setDocumentTitle(title); - }, [title, t]); + setDocumentTitle(t("Common:Settings")); + }, [t, tReady]); + + const inLoad = (!isLoadedSettingsTree && isLoading) || isLoading || !tReady; return (
- {(!isLoadedSettingsTree && isLoading) || isLoading || !tReady ? ( - - ) : ( - - )} + {inLoad ? : } - {(!isLoadedSettingsTree && isLoading) || - isLoading || - !tReady || - !capabilities ? ( - setting === "thirdParty" ? ( - - ) : ( - - ) + {inLoad ? ( + ) : ( - + )}
@@ -83,25 +57,16 @@ const PureSettings = ({ const Settings = withTranslation(["FilesSettings", "Common"])(PureSettings); -export default inject( - ({ auth, filesStore, settingsStore, treeFoldersStore }) => { - const { setFirstLoad, isLoading } = filesStore; - const { setSelectedNode } = treeFoldersStore; - const { - getFilesSettings, - isLoadedSettingsTree, - thirdPartyStore, - } = settingsStore; - const { capabilities } = thirdPartyStore; +export default inject(({ filesStore, settingsStore, treeFoldersStore }) => { + const { setFirstLoad, isLoading } = filesStore; + const { setSelectedNode } = treeFoldersStore; + const { getFilesSettings, isLoadedSettingsTree } = settingsStore; - return { - isLoading, - isLoadedSettingsTree, - setFirstLoad, - setSelectedNode, - getFilesSettings, - capabilities, - isPersonal: auth.settingsStore.personal, - }; - } -)(withRouter(observer(Settings))); + return { + isLoading, + isLoadedSettingsTree, + setFirstLoad, + setSelectedNode, + getFilesSettings, + }; +})(observer(Settings)); diff --git a/packages/client/src/store/SettingsStore.js b/packages/client/src/store/SettingsStore.js index c339742ec4..04c18c8e19 100644 --- a/packages/client/src/store/SettingsStore.js +++ b/packages/client/src/store/SettingsStore.js @@ -93,32 +93,30 @@ class SettingsStore { }; getFilesSettings = () => { - if (!this.isLoadedSettingsTree) { - return api.files - .getSettingsFiles() - .then((settings) => { - this.setFilesSettings(settings); - if (settings.enableThirdParty) { - this.setIsLoaded(true); - return axios - .all([ - api.files.getThirdPartyCapabilities(), - api.files.getThirdPartyList(), - ]) - .then(([capabilities, providers]) => { - for (let item of capabilities) { - item.splice(1, 1); - } - this.thirdPartyStore.setThirdPartyCapabilities(capabilities); //TODO: Out of bounds read: 1 - this.thirdPartyStore.setThirdPartyProviders(providers); - }); - } - return this.setIsLoaded(true); - }) - .catch(() => this.setIsErrorSettings(true)); - } else { - return Promise.resolve(); - } + if (this.isLoadedSettingsTree) return Promise.resolve(); + + return api.files + .getSettingsFiles() + .then((settings) => { + this.setFilesSettings(settings); + this.setIsLoaded(true); + + if (!settings.enableThirdParty) return; + + return axios + .all([ + api.files.getThirdPartyCapabilities(), + api.files.getThirdPartyList(), + ]) + .then(([capabilities, providers]) => { + for (let item of capabilities) { + item.splice(1, 1); + } + this.thirdPartyStore.setThirdPartyCapabilities(capabilities); //TODO: Out of bounds read: 1 + this.thirdPartyStore.setThirdPartyProviders(providers); + }); + }) + .catch(() => this.setIsErrorSettings(true)); }; setFilesSetting = (setting, val) => { From 45a79a0eff97c5828d3bfee4fab76815f519bfa9 Mon Sep 17 00:00:00 2001 From: Alexey Safronov Date: Wed, 14 Sep 2022 14:03:01 +0300 Subject: [PATCH 26/87] Web: ThirdParty: Fix saveThirdParty call --- packages/client/src/components/dialogs/ConnectDialog/index.js | 1 + 1 file changed, 1 insertion(+) diff --git a/packages/client/src/components/dialogs/ConnectDialog/index.js b/packages/client/src/components/dialogs/ConnectDialog/index.js index c772665f84..bbe79f59c6 100644 --- a/packages/client/src/components/dialogs/ConnectDialog/index.js +++ b/packages/client/src/components/dialogs/ConnectDialog/index.js @@ -153,6 +153,7 @@ const PureConnectDialogContainer = (props) => { loginValue, passwordValue, oAuthToken, + false, customerTitle, provider_key || key, provider_id, From 94859dfd240022e401fc1394980bb3cac8e30ea7 Mon Sep 17 00:00:00 2001 From: Alexey Safronov Date: Wed, 14 Sep 2022 14:54:02 +0300 Subject: [PATCH 27/87] Web: Files: Settings: fix routing --- packages/client/src/Shell.jsx | 2 +- packages/client/src/pages/Files.jsx | 10 ++++++++-- .../client/src/pages/Settings/Section/Body/index.js | 11 +++-------- 3 files changed, 12 insertions(+), 11 deletions(-) diff --git a/packages/client/src/Shell.jsx b/packages/client/src/Shell.jsx index 2dcc0edf47..6d8a47f972 100644 --- a/packages/client/src/Shell.jsx +++ b/packages/client/src/Shell.jsx @@ -447,7 +447,7 @@ const Shell = ({ items = [], page = "home", ...rest }) => { "/settings", "/settings/common", "/settings/admin", - "/settings/connected-clouds", + //"/settings/connected-clouds", ]} component={FilesRoute} /> diff --git a/packages/client/src/pages/Files.jsx b/packages/client/src/pages/Files.jsx index a2466a04ea..594b6a4b31 100644 --- a/packages/client/src/pages/Files.jsx +++ b/packages/client/src/pages/Files.jsx @@ -78,7 +78,11 @@ const FilesSection = React.memo(() => { {/**/} {/* */} - + } + /> { /> + ); diff --git a/packages/client/src/pages/Settings/Section/Body/index.js b/packages/client/src/pages/Settings/Section/Body/index.js index 655db47557..8d8d1fbf22 100644 --- a/packages/client/src/pages/Settings/Section/Body/index.js +++ b/packages/client/src/pages/Settings/Section/Body/index.js @@ -26,7 +26,7 @@ const StyledContainer = styled.div` const SectionBodyContent = ({ setting, isAdmin, - enableThirdParty, + //enableThirdParty, settingsIsLoaded, isErrorSettings, history, @@ -76,11 +76,7 @@ const SectionBodyContent = ({ [setting, history] ); - return !settingsIsLoaded ? null : (!enableThirdParty && - setting === "connected-clouds") || - (!isAdmin && setting === "admin") ? ( - - ) : isErrorSettings ? ( + return isErrorSettings ? ( ) : ( @@ -94,11 +90,10 @@ const SectionBodyContent = ({ }; export default inject(({ auth, settingsStore }) => { - const { enableThirdParty, settingsIsLoaded } = settingsStore; + const { settingsIsLoaded } = settingsStore; return { isAdmin: auth.isAdmin, - enableThirdParty, settingsIsLoaded, }; })(withRouter(observer(SectionBodyContent))); From 81b8e0ce3bedece9f9f8a0ac7ec1d1cc0ab7d64d Mon Sep 17 00:00:00 2001 From: Alexey Safronov Date: Wed, 14 Sep 2022 15:10:13 +0300 Subject: [PATCH 28/87] Web: Fix: Error on additionalResources is null --- .../common/settingsBranding/additionalResources.js | 12 ++++++------ packages/client/src/store/ProfileActionsStore.js | 14 ++++++++------ 2 files changed, 14 insertions(+), 12 deletions(-) diff --git a/packages/client/src/pages/PortalSettings/categories/common/settingsBranding/additionalResources.js b/packages/client/src/pages/PortalSettings/categories/common/settingsBranding/additionalResources.js index 1c8490db57..2d7c5ced44 100644 --- a/packages/client/src/pages/PortalSettings/categories/common/settingsBranding/additionalResources.js +++ b/packages/client/src/pages/PortalSettings/categories/common/settingsBranding/additionalResources.js @@ -55,15 +55,15 @@ const AdditionalResources = (props) => { } = props; const [feedbackAndSupportEnabled, setShowFeedback] = useState( - additionalResourcesData.feedbackAndSupportEnabled + additionalResourcesData?.feedbackAndSupportEnabled ); const [videoGuidesEnabled, setShowVideoGuides] = useState( - additionalResourcesData.videoGuidesEnabled + additionalResourcesData?.videoGuidesEnabled ); const [helpCenterEnabled, setShowHelpCenter] = useState( - additionalResourcesData.helpCenterEnabled + additionalResourcesData?.helpCenterEnabled ); const [hasChange, setHasChange] = useState(false); @@ -77,9 +77,9 @@ const AdditionalResources = (props) => { ); useEffect(() => { - setShowFeedback(additionalResourcesData.feedbackAndSupportEnabled); - setShowVideoGuides(additionalResourcesData.videoGuidesEnabled); - setShowHelpCenter(additionalResourcesData.helpCenterEnabled); + setShowFeedback(additionalResourcesData?.feedbackAndSupportEnabled); + setShowVideoGuides(additionalResourcesData?.videoGuidesEnabled); + setShowHelpCenter(additionalResourcesData?.helpCenterEnabled); }, [additionalResourcesData]); useEffect(() => { diff --git a/packages/client/src/store/ProfileActionsStore.js b/packages/client/src/store/ProfileActionsStore.js index 1e25b88af7..361db3e983 100644 --- a/packages/client/src/store/ProfileActionsStore.js +++ b/packages/client/src/store/ProfileActionsStore.js @@ -224,27 +224,29 @@ class ProfileActionsStore { const actionsArray = actions; const feedbackAndSupportEnabled = this.authStore.settingsStore - .additionalResourcesData.feedbackAndSupportEnabled; + .additionalResourcesData?.feedbackAndSupportEnabled; const videoGuidesEnabled = this.authStore.settingsStore - .additionalResourcesData.videoGuidesEnabled; + .additionalResourcesData?.videoGuidesEnabled; const helpCenterEnabled = this.authStore.settingsStore - .additionalResourcesData.helpCenterEnabled; + .additionalResourcesData?.helpCenterEnabled; if (!feedbackAndSupportEnabled) { - const index = actionsArray.findIndex((item) => item.key === "SupportBtn"); + const index = actionsArray.findIndex( + (item) => item?.key === "SupportBtn" + ); actionsArray.splice(index, 1); } if (!videoGuidesEnabled) { - const index = actionsArray.findIndex((item) => item.key === "VideoBtn"); + const index = actionsArray.findIndex((item) => item?.key === "VideoBtn"); actionsArray.splice(index, 1); } if (!helpCenterEnabled) { const index = actionsArray.findIndex( - (item) => item.key === "HelpCenterBtn" + (item) => item?.key === "HelpCenterBtn" ); actionsArray.splice(index, 1); From d0e200437e11f3c066bce91ef2805ae32ac73c95 Mon Sep 17 00:00:00 2001 From: TimofeyBoyko Date: Wed, 14 Sep 2022 15:26:28 +0300 Subject: [PATCH 29/87] Web:Client:Home: hide option from sort button when this option hide in table header --- .../Section/Body/TableView/TableHeader.js | 5 + .../src/pages/Home/Section/Filter/index.js | 158 +++++++++++++++--- packages/common/store/InfoPanelStore.js | 11 ++ 3 files changed, 148 insertions(+), 26 deletions(-) diff --git a/packages/client/src/pages/Home/Section/Body/TableView/TableHeader.js b/packages/client/src/pages/Home/Section/Body/TableView/TableHeader.js index 7e296add5f..9181a889c0 100644 --- a/packages/client/src/pages/Home/Section/Body/TableView/TableHeader.js +++ b/packages/client/src/pages/Home/Section/Body/TableView/TableHeader.js @@ -2,6 +2,7 @@ import React from "react"; import TableHeader from "@docspace/components/table-container/TableHeader"; import { inject, observer } from "mobx-react"; import { withTranslation } from "react-i18next"; +import { Events } from "SRC_DIR/helpers/filesConstants"; class FilesTableHeader extends React.Component { constructor(props) { @@ -246,6 +247,10 @@ class FilesTableHeader extends React.Component { const tableColumns = columns.map((c) => c.enable && c.key); this.setTableColumns(tableColumns); + + const event = new Event(Events.CHANGE_COLUMN); + + window.dispatchEvent(event); }; onFilter = (sortBy) => { diff --git a/packages/client/src/pages/Home/Section/Filter/index.js b/packages/client/src/pages/Home/Section/Filter/index.js index 9d17602b52..cad6d92542 100644 --- a/packages/client/src/pages/Home/Section/Filter/index.js +++ b/packages/client/src/pages/Home/Section/Filter/index.js @@ -20,6 +20,7 @@ import { getDefaultRoomName } from "@docspace/client/src/helpers/filesUtils"; import withLoader from "../../../../HOCs/withLoader"; import { toastr } from "@docspace/components"; +import { TableVersions } from "SRC_DIR/helpers/constants"; const getFilterType = (filterValues) => { const filterType = result( @@ -109,6 +110,14 @@ const getTags = (filterValues) => { return tags; }; +const TABLE_COLUMNS = `filesTableColumns_ver-${TableVersions.Files}`; +const COLUMNS_SIZE = `filesColumnsSize_ver-${TableVersions.Files}`; +const COLUMNS_SIZE_INFO_PANEL = `filesColumnsSizeInfoPanel_ver-${TableVersions.Files}`; + +const TABLE_ROOMS_COLUMNS = `roomsTableColumns_ver-${TableVersions.Rooms}`; +const COLUMNS_ROOMS_SIZE = `roomsColumnsSize_ver-${TableVersions.Rooms}`; +const COLUMNS_ROOMS_SIZE_INFO_PANEL = `roomsColumnsSizeInfoPanel_ver-${TableVersions.Rooms}`; + const SectionFilterContent = ({ t, filter, @@ -785,35 +794,132 @@ const SectionFilterContent = ({ }, [createThumbnails]); const getSortData = React.useCallback(() => { - const commonOptions = isRooms - ? [ - { key: "AZ", label: t("Common:Name"), default: true }, - { key: "roomType", label: t("Common:Type"), default: true }, - { key: "Tags", label: t("Tags"), default: true }, - { key: "Author", label: t("Common:Owner"), default: true }, - { key: "DateAndTime", label: t("ByLastModifiedDate"), default: true }, - ] - : [ - { key: "AZ", label: t("Common:Name"), default: true }, - { key: "Type", label: t("Common:Type"), default: true }, - { key: "Size", label: t("Common:Size"), default: true }, - { - key: "DateAndTimeCreation", - label: t("ByCreationDate"), - default: true, - }, - { key: "DateAndTime", label: t("ByLastModifiedDate"), default: true }, - ]; + const commonOptions = []; - if (!personal && !isRooms) { - commonOptions.splice(1, 0, { - key: "Author", - label: t("ByAuthor"), - default: true, - }); + const name = { key: "AZ", label: t("Common:Name"), default: true }; + const modifiedDate = { + key: "DateAndTime", + label: t("ByLastModifiedDate"), + default: true, + }; + + const type = { key: "Type", label: t("Common:Type"), default: true }; + const size = { key: "Size", label: t("Common:Size"), default: true }; + const creationDate = { + key: "DateAndTimeCreation", + label: t("ByCreationDate"), + default: true, + }; + const authorOption = { + key: "Author", + label: t("ByAuthor"), + default: true, + }; + + const owner = { key: "Author", label: t("Common:Owner"), default: true }; + const tags = { key: "Tags", label: t("Tags"), default: true }; + const roomType = { + key: "roomType", + label: t("Common:Type"), + default: true, + }; + + commonOptions.push(name); + + if (viewAs === "table") { + if (isRooms) { + const availableSort = localStorage + .getItem(`${TABLE_ROOMS_COLUMNS}=${userId}`) + .split(","); + + const infoPanelColumnsSize = localStorage + ?.getItem(`${COLUMNS_SIZE_INFO_PANEL}=${userId}`) + ?.split(" "); + + if (availableSort.includes("Type")) { + const idx = availableSort.findIndex((x) => x === "Type"); + const hide = infoPanelVisible && infoPanelColumnsSize[idx] === "0px"; + + !hide && commonOptions.push(roomType); + } + + if (availableSort.includes("Tags")) { + const idx = availableSort.findIndex((x) => x === "Tags"); + const hide = infoPanelVisible && infoPanelColumnsSize[idx] === "0px"; + + !hide && commonOptions.push(tags); + } + + if (availableSort.includes("Owner")) { + const idx = availableSort.findIndex((x) => x === "Owner"); + const hide = infoPanelVisible && infoPanelColumnsSize[idx] === "0px"; + + !hide && commonOptions.push(owner); + } + + if (availableSort.includes("Activity")) { + const idx = availableSort.findIndex((x) => x === "Activity"); + const hide = infoPanelVisible && infoPanelColumnsSize[idx] === "0px"; + + !hide && commonOptions.push(modifiedDate); + } + } else { + const availableSort = localStorage + .getItem(`${TABLE_COLUMNS}=${userId}`) + .split(","); + + const infoPanelColumnsSize = localStorage + ?.getItem(`${COLUMNS_SIZE_INFO_PANEL}=${userId}`) + ?.split(" "); + + if (availableSort.includes("Author") && !isPersonalRoom) { + const idx = availableSort.findIndex((x) => x === "Author"); + const hide = infoPanelVisible && infoPanelColumnsSize[idx] === "0px"; + + !hide && commonOptions.push(authorOption); + } + if (availableSort.includes("Create")) { + const idx = availableSort.findIndex((x) => x === "Create"); + const hide = infoPanelVisible && infoPanelColumnsSize[idx] === "0px"; + + !hide && commonOptions.push(creationDate); + } + if (availableSort.includes("Modified")) { + const idx = availableSort.findIndex((x) => x === "Modified"); + const hide = infoPanelVisible && infoPanelColumnsSize[idx] === "0px"; + + !hide && commonOptions.push(modifiedDate); + } + if (availableSort.includes("Size")) { + const idx = availableSort.findIndex((x) => x === "Size"); + const hide = infoPanelVisible && infoPanelColumnsSize[idx] === "0px"; + + !hide && commonOptions.push(size); + } + if (availableSort.includes("Type")) { + const idx = availableSort.findIndex((x) => x === "Type"); + const hide = infoPanelVisible && infoPanelColumnsSize[idx] === "0px"; + + !hide && commonOptions.push(type); + } + } + } else { + if (isRooms) { + commonOptions.push(roomType); + commonOptions.push(tags); + commonOptions.push(owner); + commonOptions.push(modifiedDate); + } else { + commonOptions.push(authorOption); + commonOptions.push(creationDate); + commonOptions.push(modifiedDate); + commonOptions.push(size); + commonOptions.push(type); + } } + return commonOptions; - }, [personal, isRooms, t]); + }, [personal, isRooms, t, userId, infoPanelVisible, viewAs, isPersonalRoom]); const removeSelectedItem = React.useCallback( ({ key, group }) => { diff --git a/packages/common/store/InfoPanelStore.js b/packages/common/store/InfoPanelStore.js index b04a1c018a..ccfcce92d2 100644 --- a/packages/common/store/InfoPanelStore.js +++ b/packages/common/store/InfoPanelStore.js @@ -1,4 +1,5 @@ import { makeAutoObservable } from "mobx"; +import { Events } from "SRC_DIR/helpers/filesConstants"; class InfoPanelStore { isVisible = false; @@ -9,14 +10,24 @@ class InfoPanelStore { toggleIsVisible = () => { this.isVisible = !this.isVisible; + const event = new Event(Events.CHANGE_COLUMN); + + window.dispatchEvent(event); }; setVisible = () => { this.isVisible = true; + const event = new Event(Events.CHANGE_COLUMN); + + window.dispatchEvent(event); }; setIsVisible = (bool) => { this.isVisible = bool; + + const event = new Event(Events.CHANGE_COLUMN); + + window.dispatchEvent(event); }; } From a7bf07c0ab0f06bb8a3d2d8953c780d060ba871b Mon Sep 17 00:00:00 2001 From: Alexey Safronov Date: Wed, 14 Sep 2022 15:29:14 +0300 Subject: [PATCH 30/87] Web: Files: Settings: Added display settings for none-admin user --- .../Settings/Section/Body/CommonSettings.js | 6 ++++ .../src/pages/Settings/Section/Body/index.js | 36 ++++++++----------- packages/client/src/pages/Settings/index.js | 9 +---- 3 files changed, 22 insertions(+), 29 deletions(-) diff --git a/packages/client/src/pages/Settings/Section/Body/CommonSettings.js b/packages/client/src/pages/Settings/Section/Body/CommonSettings.js index 62d97b4dff..6c1957e5e2 100644 --- a/packages/client/src/pages/Settings/Section/Body/CommonSettings.js +++ b/packages/client/src/pages/Settings/Section/Body/CommonSettings.js @@ -27,6 +27,7 @@ const CommonSettings = ({ setRecentSetting, t, + showTitle, }) => { const [isLoadingFavorites, setIsLoadingFavorites] = React.useState(false); const [isLoadingRecent, setIsLoadingRecent] = React.useState(false); @@ -70,6 +71,11 @@ const CommonSettings = ({ return ( + {showTitle && ( + + {t("CommonSettings")} + + )} { +const SectionBodyContent = ({ isAdmin, isErrorSettings, history }) => { const { t } = useTranslation(["FilesSettings", "Common"]); + const setting = window.location.pathname.endsWith("/settings/common") + ? "common" + : "admin"; + const commonSettings = { id: "common", name: t("CommonSettings"), @@ -51,13 +47,7 @@ const SectionBodyContent = ({ // content: , // }; - const data = []; - - if (isAdmin) { - data.push(adminSettings); - } - - data.push(commonSettings); + const data = [adminSettings, commonSettings]; // if (enableThirdParty) { // data.push(connectedCloud); @@ -80,11 +70,15 @@ const SectionBodyContent = ({ ) : ( - + {!isAdmin ? ( + + ) : ( + + )} ); }; diff --git a/packages/client/src/pages/Settings/index.js b/packages/client/src/pages/Settings/index.js index 13b70553a4..618bba0270 100644 --- a/packages/client/src/pages/Settings/index.js +++ b/packages/client/src/pages/Settings/index.js @@ -9,15 +9,12 @@ import { setDocumentTitle } from "@docspace/client/src/helpers/filesUtils"; import { inject, observer } from "mobx-react"; const PureSettings = ({ - match, t, tReady, isLoading, isLoadedSettingsTree, setFirstLoad, }) => { - const { setting } = match.params; - useEffect(() => { setFirstLoad(false); }, [setFirstLoad]); @@ -45,11 +42,7 @@ const PureSettings = ({ - {inLoad ? ( - - ) : ( - - )} + {inLoad ? : } ); From 9d49a1f753abc3a949a1a94c0d89a5ae0293fe8e Mon Sep 17 00:00:00 2001 From: TimofeyBoyko Date: Wed, 14 Sep 2022 16:30:26 +0300 Subject: [PATCH 31/87] Web:Common:FilterInput: fix item styles --- .../FilterInput/sub-components/FilterBlock.js | 4 +++- .../sub-components/FilterBlockItem.js | 10 ++++++++-- .../FilterInput/sub-components/SortButton.js | 13 +++++++++++-- .../sub-components/StyledFilterBlock.js | 19 +++++++------------ 4 files changed, 29 insertions(+), 17 deletions(-) diff --git a/packages/common/components/FilterInput/sub-components/FilterBlock.js b/packages/common/components/FilterInput/sub-components/FilterBlock.js index c36a9f4f60..cd434a0363 100644 --- a/packages/common/components/FilterInput/sub-components/FilterBlock.js +++ b/packages/common/components/FilterInput/sub-components/FilterBlock.js @@ -390,7 +390,7 @@ const FilterBlock = ({ /> ) : ( - {filterData.map((item) => { + {filterData.map((item, index) => { return ( ); })} diff --git a/packages/common/components/FilterInput/sub-components/FilterBlockItem.js b/packages/common/components/FilterInput/sub-components/FilterBlockItem.js index 4342b3bf0f..3bed7d1cf3 100644 --- a/packages/common/components/FilterInput/sub-components/FilterBlockItem.js +++ b/packages/common/components/FilterInput/sub-components/FilterBlockItem.js @@ -34,6 +34,8 @@ const FilterBlockItem = ({ withoutSeparator, changeFilterValue, showSelector, + isFirst, + withMultiItems, }) => { const changeFilterValueAction = ( key, @@ -192,14 +194,18 @@ const FilterBlockItem = ({ }; return ( - + {!withoutHeader && ( {label} )} - + {groupItem.map((item) => { if (item.isSelector === true) return getSelectorItem(item); if (item.isToggle === true) return getToggleItem(item); diff --git a/packages/common/components/FilterInput/sub-components/SortButton.js b/packages/common/components/FilterInput/sub-components/SortButton.js index 9247845ce5..74019d69f0 100644 --- a/packages/common/components/FilterInput/sub-components/SortButton.js +++ b/packages/common/components/FilterInput/sub-components/SortButton.js @@ -14,6 +14,7 @@ import { Base } from "@docspace/components/themes"; import SortDesc from "../../../../../public/images/sort.desc.react.svg"; import Backdrop from "@docspace/components/backdrop"; +import { Events } from "SRC_DIR/helpers/filesConstants"; const selectedViewIcon = css` svg { @@ -191,7 +192,7 @@ const SortButton = ({ sortId: null, }); - React.useEffect(() => { + const getSortDataAction = React.useCallback(() => { const value = getSortData && getSortData(); const selectedValue = getSelectedSortData && getSelectedSortData(); @@ -212,7 +213,15 @@ const SortButton = ({ sortDirection: selectedValue.sortDirection, sortId: selectedValue.sortId, }); - }, [getSortData, getSelectedSortData]); + }, [getSortData, getSelectedSortData, viewAs]); + + React.useEffect(() => { + window.addEventListener(Events.CHANGE_COLUMN, getSortDataAction); + getSortDataAction(); + + return () => + window.removeEventListener(Events.CHANGE_COLUMN, getSortDataAction); + }, [getSortDataAction]); const toggleCombobox = React.useCallback(() => { setIsOpen((val) => !val); diff --git a/packages/common/components/FilterInput/sub-components/StyledFilterBlock.js b/packages/common/components/FilterInput/sub-components/StyledFilterBlock.js index 7e64e42cdc..1ee3f18dbe 100644 --- a/packages/common/components/FilterInput/sub-components/StyledFilterBlock.js +++ b/packages/common/components/FilterInput/sub-components/StyledFilterBlock.js @@ -98,8 +98,9 @@ const StyledFilterBlockHeader = styled.div` StyledFilterBlockHeader.defaultProps = { theme: Base }; const StyledFilterBlockItem = styled.div` - padding: ${(props) => - !props.withoutHeader ? "12px 15px 0px 16px" : "5px 15px 0px 16px"}; + margin: ${(props) => + props.withoutHeader ? "0" : props.isFirst ? "12px 0 0 0" : "16px 0 0 0"}; + padding: 0 15px 0 16px; display: flex; flex-direction: column; @@ -116,8 +117,8 @@ const StyledFilterBlockItemHeader = styled.div` `; const StyledFilterBlockItemContent = styled.div` - margin-top: ${(props) => !props.withoutHeader && "12px"}; - margin-right: -16px; + margin: ${(props) => + props.withoutSeparator ? "12px -16px 0 0" : "12px -16px 16px 0"}; height: fit-content; @@ -125,6 +126,8 @@ const StyledFilterBlockItemContent = styled.div` flex-direction: row; align-items: center; flex-wrap: wrap; + + gap: ${(props) => (props.withMultiItems ? "12px 8px" : "8px")}; `; const StyledFilterBlockItemSelector = styled.div` @@ -134,8 +137,6 @@ const StyledFilterBlockItemSelector = styled.div` display: flex; flex-direction: row; align-items: center; - - margin: 0 0 11px; `; const StyledFilterBlockItemSelectorText = styled(Text)` @@ -171,8 +172,6 @@ const StyledFilterBlockItemTag = styled.div` padding: 4px 15px; - margin: 0 7px 8px 0; - cursor: pointer; ${(props) => props.isSelected && selectedItemTag} @@ -237,8 +236,6 @@ const StyledFilterBlockItemToggleButton = styled(ToggleButton)` grid-gap: 0px; `; const StyledFilterBlockItemCheckboxContainer = styled.div` - margin: 7px 0 13px; - .checkbox { margin-right: 8px !important; } @@ -255,8 +252,6 @@ const StyledFilterBlockItemSeparator = styled.div` margin-right: 16px; background: ${(props) => props.theme.filterInput.filter.separatorColor}; - - margin: 4px 0 4px 0; `; StyledFilterBlockItemToggleButton.defaultProps = { theme: Base }; From 8f92a90ab6086c9a21f2020bb0e632f1d5867c58 Mon Sep 17 00:00:00 2001 From: TimofeyBoyko Date: Wed, 14 Sep 2022 16:30:48 +0300 Subject: [PATCH 32/87] Web:Common:Loaders: fix styles for filter block loader --- .../StyledFilterBlockLoader.js | 18 ++++---- .../Loaders/FilterBlockLoader/index.js | 44 +++++++++---------- 2 files changed, 30 insertions(+), 32 deletions(-) diff --git a/packages/common/components/Loaders/FilterBlockLoader/StyledFilterBlockLoader.js b/packages/common/components/Loaders/FilterBlockLoader/StyledFilterBlockLoader.js index 4963e72ff5..af5c330ab0 100644 --- a/packages/common/components/Loaders/FilterBlockLoader/StyledFilterBlockLoader.js +++ b/packages/common/components/Loaders/FilterBlockLoader/StyledFilterBlockLoader.js @@ -1,7 +1,5 @@ import styled, { css } from "styled-components"; -import RectangleLoader from "../RectangleLoader"; - const StyledContainer = styled.div` width: 100%; height: 100%; @@ -12,18 +10,20 @@ const StyledContainer = styled.div` `; const StyledBlock = styled.div` - padding: 12px 0 6px; + padding: 12px 0 16px; + + margin-bottom: 4px; width: 100%; - min-height: 122px; height: auto; display: flex; + flex-direction: column; + + gap: 12px 8px; box-sizing: border-box; - flex-direction: column; - ${(props) => !props.isLast && css` @@ -34,11 +34,9 @@ const StyledBlock = styled.div` display: flex; align-items: center; - } + flex-wrap: wrap; - .loader-item { - margin-bottom: 12px; - margin-right: 8px; + gap: 8px; } `; diff --git a/packages/common/components/Loaders/FilterBlockLoader/index.js b/packages/common/components/Loaders/FilterBlockLoader/index.js index d71548e3c6..4d95e5cc78 100644 --- a/packages/common/components/Loaders/FilterBlockLoader/index.js +++ b/packages/common/components/Loaders/FilterBlockLoader/index.js @@ -97,39 +97,39 @@ const FilterBlockLoader = ({ width={"79"} height={"28"} borderRadius={"16"} - className={"loader-item"} + className={"loader-item tag-item"} /> + - )} @@ -145,39 +145,39 @@ const FilterBlockLoader = ({ width={"79"} height={"28"} borderRadius={"16"} - className={"loader-item"} + className={"loader-item tag-item"} /> + - ); From d65255f47d376f010ab8bc66ba6cdce645854e6e Mon Sep 17 00:00:00 2001 From: TimofeyBoyko Date: Wed, 14 Sep 2022 16:31:20 +0300 Subject: [PATCH 33/87] Web:Client:Home: chage translation key 'MasterForms' to 'FormsTemplates' --- packages/client/public/locales/en/Files.json | 2 +- packages/client/src/pages/Home/Section/Filter/index.js | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/packages/client/public/locales/en/Files.json b/packages/client/public/locales/en/Files.json index 9ce781dc67..b95ec7e660 100644 --- a/packages/client/public/locales/en/Files.json +++ b/packages/client/public/locales/en/Files.json @@ -43,7 +43,7 @@ "MarkAsFavorite": "Mark as favorite", "MarkRead": "Mark as read", "MarkedAsFavorite": "Added to favorites", - "MasterForms": "Master forms", + "FormsTemplates": "Forms templates", "Media": "Media", "MoveItem": "{{title}} moved", "MoveItems": "{{qty}} elements have been moved", diff --git a/packages/client/src/pages/Home/Section/Filter/index.js b/packages/client/src/pages/Home/Section/Filter/index.js index cad6d92542..8cc9883e60 100644 --- a/packages/client/src/pages/Home/Section/Filter/index.js +++ b/packages/client/src/pages/Home/Section/Filter/index.js @@ -454,7 +454,7 @@ const SectionFilterContent = ({ label = t("AllFiles"); break; case "master-forms": - label = t("MasterForms"); + label = t("FormsTemplates"); break; case "forms": label = t("Forms"); @@ -618,6 +618,7 @@ const SectionFilterContent = ({ group: FilterGroups.roomFilterOwner, label: t("Common:Owner"), isHeader: true, + withMultiItems: true, }, { key: FilterKeys.me, From ee7db82c3adb2d5bae3f9faa5c78357f0529d95b Mon Sep 17 00:00:00 2001 From: TimofeyBoyko Date: Wed, 14 Sep 2022 16:55:23 +0300 Subject: [PATCH 34/87] Web:Client:AccountsHome: fix filter loader --- .../AccountsHome/Section/Filter/index.js | 1 + .../common/components/FilterInput/index.js | 2 + .../FilterInput/sub-components/FilterBlock.js | 2 + .../sub-components/FilterButton.js | 2 + .../Loaders/FilterBlockLoader/index.js | 87 ++++++++++--------- 5 files changed, 55 insertions(+), 39 deletions(-) diff --git a/packages/client/src/pages/AccountsHome/Section/Filter/index.js b/packages/client/src/pages/AccountsHome/Section/Filter/index.js index 8888f0fb18..410387f0ac 100644 --- a/packages/client/src/pages/AccountsHome/Section/Filter/index.js +++ b/packages/client/src/pages/AccountsHome/Section/Filter/index.js @@ -338,6 +338,7 @@ const SectionFilterContent = ({ viewAs={viewAs} viewSelectorVisible={false} removeSelectedItem={removeSelectedItem} + isAccounts={true} /> ) : ( diff --git a/packages/common/components/FilterInput/index.js b/packages/common/components/FilterInput/index.js index 3a4754ff86..e8675fffe9 100644 --- a/packages/common/components/FilterInput/index.js +++ b/packages/common/components/FilterInput/index.js @@ -41,6 +41,7 @@ const FilterInput = React.memo( isPersonalRoom, isRooms, + isAccounts, }) => { const [viewSettings, setViewSettings] = React.useState([]); const [inputValue, setInputValue] = React.useState(""); @@ -122,6 +123,7 @@ const FilterInput = React.memo( selectorLabel={selectorLabel} isPersonalRoom={isPersonalRoom} isRooms={isRooms} + isAccounts={isAccounts} /> {!isRecentFolder && ( { const [showSelector, setShowSelector] = React.useState({ show: false, @@ -387,6 +388,7 @@ const FilterBlock = ({ ) : ( diff --git a/packages/common/components/FilterInput/sub-components/FilterButton.js b/packages/common/components/FilterInput/sub-components/FilterButton.js index a6028057da..99e0aa36f5 100644 --- a/packages/common/components/FilterInput/sub-components/FilterButton.js +++ b/packages/common/components/FilterInput/sub-components/FilterButton.js @@ -20,6 +20,7 @@ const FilterButton = ({ isPersonalRoom, isRooms, + isAccounts, }) => { const [showFilterBlock, setShowFilterBlock] = React.useState(false); @@ -47,6 +48,7 @@ const FilterButton = ({ selectorLabel={selectorLabel} isPersonalRoom={isPersonalRoom} isRooms={isRooms} + isAccounts={isAccounts} /> )} diff --git a/packages/common/components/Loaders/FilterBlockLoader/index.js b/packages/common/components/Loaders/FilterBlockLoader/index.js index 4d95e5cc78..8c86f7062d 100644 --- a/packages/common/components/Loaders/FilterBlockLoader/index.js +++ b/packages/common/components/Loaders/FilterBlockLoader/index.js @@ -10,11 +10,12 @@ const FilterBlockLoader = ({ style, isPersonalRoom, isRooms, + isAccounts, ...rest }) => { return ( - {!isRooms && ( + {!isRooms && !isAccounts && ( )} - {!isPersonalRoom && ( + {!isPersonalRoom && !isAccounts && ( )} - {isRooms && ( + {(isRooms || isAccounts) && ( - - - + {!isAccounts && ( + <> + + + + + )} )} @@ -159,24 +164,28 @@ const FilterBlockLoader = ({ borderRadius={"16"} className={"loader-item tag-item"} /> - - - + {!isAccounts && ( + <> + + + + + )} From 74bf6d4dabe96b147aef31a0f5fd57533f03b508 Mon Sep 17 00:00:00 2001 From: TimofeyBoyko Date: Wed, 14 Sep 2022 16:55:38 +0300 Subject: [PATCH 35/87] Web:Client:Home: fix filter translation key --- packages/client/src/pages/Home/Section/Filter/index.js | 2 +- 1 file changed, 1 insertion(+), 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 8cc9883e60..e336bc4a13 100644 --- a/packages/client/src/pages/Home/Section/Filter/index.js +++ b/packages/client/src/pages/Home/Section/Filter/index.js @@ -599,7 +599,7 @@ const SectionFilterContent = ({ { key: "master-forms", group: FilterGroups.filterType, - label: t("MasterForms").toLowerCase(), + label: t("FormsTemplates").toLowerCase(), }, { key: "forms", From 3558845932246a14ed7b76558a5b8a28346b1f67 Mon Sep 17 00:00:00 2001 From: TimofeyBoyko Date: Wed, 14 Sep 2022 17:13:15 +0300 Subject: [PATCH 36/87] Web:Common:Loaders: fix --- .../Loaders/FilterBlockLoader/index.js | 191 +++++++++++++----- 1 file changed, 143 insertions(+), 48 deletions(-) diff --git a/packages/common/components/Loaders/FilterBlockLoader/index.js b/packages/common/components/Loaders/FilterBlockLoader/index.js index 8c86f7062d..aac5f2e4ea 100644 --- a/packages/common/components/Loaders/FilterBlockLoader/index.js +++ b/packages/common/components/Loaders/FilterBlockLoader/index.js @@ -24,7 +24,7 @@ const FilterBlockLoader = ({ className={"loader-item"} />
- - - - {!isAccounts && ( + {isAccounts ? ( <> + ) : isRooms ? ( + <> + + + + + + + ) : ( + <> )}
@@ -146,40 +163,118 @@ const FilterBlockLoader = ({ className={"loader-item"} />
- - - - {!isAccounts && ( + {isAccounts ? ( <> + + ) : isRooms ? ( + <> + + + + + + + + ) : ( + <> + + + + + + + + + Date: Wed, 14 Sep 2022 18:25:46 +0300 Subject: [PATCH 37/87] Web: Files: Settings: Added new loaders --- .../Settings/Section/Body/CommonSettings.js | 2 +- .../Settings/Section/Body/StyledSettings.js | 2 +- packages/client/src/pages/Settings/index.js | 53 ++++++--- .../components/Loaders/SettingsFilesLoader.js | 34 ------ .../SettingsLoader/SettingsAdminLoader.js | 104 +++++++++++++++++ .../SettingsLoader/SettingsCommonLoader.js | 106 ++++++++++++++++++ .../SettingsLoader/SettingsHeaderLoader.js | 20 ++++ packages/common/components/Loaders/index.js | 12 +- .../Section/sub-components/section-body.js | 6 + 9 files changed, 286 insertions(+), 53 deletions(-) delete mode 100644 packages/common/components/Loaders/SettingsFilesLoader.js create mode 100644 packages/common/components/Loaders/SettingsLoader/SettingsAdminLoader.js create mode 100644 packages/common/components/Loaders/SettingsLoader/SettingsCommonLoader.js create mode 100644 packages/common/components/Loaders/SettingsLoader/SettingsHeaderLoader.js diff --git a/packages/client/src/pages/Settings/Section/Body/CommonSettings.js b/packages/client/src/pages/Settings/Section/Body/CommonSettings.js index 6c1957e5e2..e08ca0b156 100644 --- a/packages/client/src/pages/Settings/Section/Body/CommonSettings.js +++ b/packages/client/src/pages/Settings/Section/Body/CommonSettings.js @@ -69,7 +69,7 @@ const CommonSettings = ({ ); return ( - + {showTitle && ( diff --git a/packages/client/src/pages/Settings/Section/Body/StyledSettings.js b/packages/client/src/pages/Settings/Section/Body/StyledSettings.js index 5513224e60..594bc88828 100644 --- a/packages/client/src/pages/Settings/Section/Body/StyledSettings.js +++ b/packages/client/src/pages/Settings/Section/Body/StyledSettings.js @@ -1,7 +1,7 @@ import styled from "styled-components"; const StyledSettings = styled.div` - margin-top: 10px; + margin-top: ${(props) => (props.showTitle ? 24 : 34)}px; width: 100%; display: grid; diff --git a/packages/client/src/pages/Settings/index.js b/packages/client/src/pages/Settings/index.js index 618bba0270..fd1cc619c4 100644 --- a/packages/client/src/pages/Settings/index.js +++ b/packages/client/src/pages/Settings/index.js @@ -14,6 +14,7 @@ const PureSettings = ({ isLoading, isLoadedSettingsTree, setFirstLoad, + isAdmin, }) => { useEffect(() => { setFirstLoad(false); @@ -35,31 +36,53 @@ const PureSettings = ({ const inLoad = (!isLoadedSettingsTree && isLoading) || isLoading || !tReady; + const setting = window.location.pathname.endsWith("/settings/common") + ? "common" + : "admin"; + return ( -
+
- {inLoad ? : } + {inLoad ? : } - {inLoad ? : } + {inLoad ? ( + setting === "common" ? ( + + ) : ( + + ) + ) : ( + + )}
); }; +/* +SettingsHeader, + SettingsAdmin, + SettingsCommon + +*/ + const Settings = withTranslation(["FilesSettings", "Common"])(PureSettings); -export default inject(({ filesStore, settingsStore, treeFoldersStore }) => { - const { setFirstLoad, isLoading } = filesStore; - const { setSelectedNode } = treeFoldersStore; - const { getFilesSettings, isLoadedSettingsTree } = settingsStore; +export default inject( + ({ auth, filesStore, settingsStore, treeFoldersStore }) => { + const { setFirstLoad, isLoading } = filesStore; + const { setSelectedNode } = treeFoldersStore; + const { getFilesSettings, isLoadedSettingsTree } = settingsStore; - return { - isLoading, - isLoadedSettingsTree, - setFirstLoad, - setSelectedNode, - getFilesSettings, - }; -})(observer(Settings)); + return { + isLoading, + isLoadedSettingsTree, + setFirstLoad, + setSelectedNode, + getFilesSettings, + isAdmin: auth.isAdmin, + }; + } +)(observer(Settings)); diff --git a/packages/common/components/Loaders/SettingsFilesLoader.js b/packages/common/components/Loaders/SettingsFilesLoader.js deleted file mode 100644 index d246eac674..0000000000 --- a/packages/common/components/Loaders/SettingsFilesLoader.js +++ /dev/null @@ -1,34 +0,0 @@ -import React from "react"; -import ContentLoader from "react-content-loader"; -import { LoaderStyle } from "../../constants"; - -const SettingsFilesLoader = () => ( -
- - - - - - - - - - - - - - - - -
-); - -export default SettingsFilesLoader; diff --git a/packages/common/components/Loaders/SettingsLoader/SettingsAdminLoader.js b/packages/common/components/Loaders/SettingsLoader/SettingsAdminLoader.js new file mode 100644 index 0000000000..8672979a40 --- /dev/null +++ b/packages/common/components/Loaders/SettingsLoader/SettingsAdminLoader.js @@ -0,0 +1,104 @@ +import React from "react"; +import { LoaderStyle } from "../../../constants"; +import RectangleLoader from "../RectangleLoader"; +import Box from "@docspace/components/box"; + +const speed = 2; +const heightText = "20px"; +const heightRadio = "16px"; +const sectionGap = "16px"; +const sectionsGap = "32px"; + +const Setting = ({ width = "280px" }) => ( + + + + +); + +const SectionTitle = ({ height = 16, width = 141 }) => ( + +); + +const SettingsSection = ({ width }) => ( + + + + +); + +const SettingsTabs = () => ( + + + + +); + +const SettingsAdminLoader = () => ( + + + + + +); + +export default SettingsAdminLoader; diff --git a/packages/common/components/Loaders/SettingsLoader/SettingsCommonLoader.js b/packages/common/components/Loaders/SettingsLoader/SettingsCommonLoader.js new file mode 100644 index 0000000000..27bde3b351 --- /dev/null +++ b/packages/common/components/Loaders/SettingsLoader/SettingsCommonLoader.js @@ -0,0 +1,106 @@ +import React from "react"; +import { LoaderStyle } from "../../../constants"; +import RectangleLoader from "../RectangleLoader"; +import Box from "@docspace/components/box"; + +const speed = 2; +const heightText = "20px"; +const heightRadio = "16px"; +const sectionGap = "16px"; +const sectionsGap = "32px"; + +const Setting = ({ width = "280px" }) => ( + + + + +); + +const SectionTitle = ({ height = 16, width = 62 }) => ( + +); + +const SettingsSection = ({ width1, width2, withTitle = true }) => ( + + {withTitle && } + + + +); + +const SettingsTabs = () => ( + + + + +); + +const SettingsCommonLoader = ({ isAdmin = false }) => ( + + {isAdmin && } + + + + +); + +export default SettingsCommonLoader; diff --git a/packages/common/components/Loaders/SettingsLoader/SettingsHeaderLoader.js b/packages/common/components/Loaders/SettingsLoader/SettingsHeaderLoader.js new file mode 100644 index 0000000000..5dc8d109ac --- /dev/null +++ b/packages/common/components/Loaders/SettingsLoader/SettingsHeaderLoader.js @@ -0,0 +1,20 @@ +import React from "react"; +import { LoaderStyle } from "../../../constants"; +import RectangleLoader from "../RectangleLoader"; + +const speed = 2; + +const SettingsHeaderLoader = () => ( + +); + +export default SettingsHeaderLoader; diff --git a/packages/common/components/Loaders/index.js b/packages/common/components/Loaders/index.js index 42dcbea3f9..89a8c6a78e 100644 --- a/packages/common/components/Loaders/index.js +++ b/packages/common/components/Loaders/index.js @@ -15,7 +15,7 @@ import Text from "./TextLoader"; import Filter from "./FilterLoader"; import FilterBlock from "./FilterBlockLoader"; import ProfileView from "./ProfileViewLoader"; -import SettingsFiles from "./SettingsFilesLoader"; + import Group from "./GroupLoader"; import HistoryRows from "./HistoryRowsLoader"; import Tile from "./TileLoader"; @@ -37,6 +37,10 @@ import RestoreBackupLoader from "./RestoreBackupLoader"; import SelectorSearchLoader from "./SelectorSearchLoader"; import SelectorRowLoader from "./SelectorRowLoader"; +import SettingsHeader from "./SettingsLoader/SettingsHeaderLoader"; +import SettingsAdmin from "./SettingsLoader/SettingsAdminLoader"; +import SettingsCommon from "./SettingsLoader/SettingsCommonLoader"; + export default { Rectangle, Circle, @@ -51,7 +55,7 @@ export default { Filter, FilterBlock, ProfileView, - SettingsFiles, + Group, HistoryRows, Tile, @@ -76,4 +80,8 @@ export default { RestoreBackupLoader, SelectorSearchLoader, SelectorRowLoader, + + SettingsHeader, + SettingsAdmin, + SettingsCommon, }; diff --git a/packages/common/components/Section/sub-components/section-body.js b/packages/common/components/Section/sub-components/section-body.js index 13513d3b4e..0a9588f3d5 100644 --- a/packages/common/components/Section/sub-components/section-body.js +++ b/packages/common/components/Section/sub-components/section-body.js @@ -90,6 +90,12 @@ const commonStyles = css` padding-left: 20px; `} + ${(props) => + props.viewAs == "settings" && + css` + padding-top: 0; + `} + .section-wrapper { display: flex; flex-direction: column; From c5b50e5d4a85332aae8e546a4f3079bd6b1bb591 Mon Sep 17 00:00:00 2001 From: TimofeyBoyko Date: Thu, 15 Sep 2022 11:38:59 +0300 Subject: [PATCH 38/87] Web:Common:Constants: add new filter types and file types for oform and docx --- packages/common/constants/index.js | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/packages/common/constants/index.js b/packages/common/constants/index.js index d0c8afa426..793cc5e2ab 100644 --- a/packages/common/constants/index.js +++ b/packages/common/constants/index.js @@ -45,6 +45,8 @@ export const FilterType = Object.freeze({ ArchiveOnly: 10, ByExtension: 11, MediaOnly: 12, + OFormTemplateOnly: 18, + OFormOnly: 19, }); /** * Enum for file type. @@ -59,6 +61,8 @@ export const FileType = Object.freeze({ Spreadsheet: 5, Presentation: 6, Document: 7, + OFormTemplate: 8, + OForm: 9, }); /** * Enum for room type. From aef2200080e7e7486baca74795b14f95fe0410ce Mon Sep 17 00:00:00 2001 From: Alexey Safronov Date: Thu, 15 Sep 2022 11:40:55 +0300 Subject: [PATCH 39/87] Web: Files: Settings: fix margin on tablet/mobile --- .../src/pages/Settings/Section/Body/StyledSettings.js | 6 ++++++ packages/client/src/pages/Settings/Section/Body/index.js | 9 ++++----- 2 files changed, 10 insertions(+), 5 deletions(-) diff --git a/packages/client/src/pages/Settings/Section/Body/StyledSettings.js b/packages/client/src/pages/Settings/Section/Body/StyledSettings.js index 594bc88828..17e8ca9226 100644 --- a/packages/client/src/pages/Settings/Section/Body/StyledSettings.js +++ b/packages/client/src/pages/Settings/Section/Body/StyledSettings.js @@ -1,7 +1,13 @@ import styled from "styled-components"; +import { tablet } from "@docspace/components/utils/device"; const StyledSettings = styled.div` margin-top: ${(props) => (props.showTitle ? 24 : 34)}px; + + @media ${tablet} { + margin-top: 8px; + } + width: 100%; display: grid; diff --git a/packages/client/src/pages/Settings/Section/Body/index.js b/packages/client/src/pages/Settings/Section/Body/index.js index 0d585e9dd8..ab24b4b964 100644 --- a/packages/client/src/pages/Settings/Section/Body/index.js +++ b/packages/client/src/pages/Settings/Section/Body/index.js @@ -11,15 +11,14 @@ import config from "PACKAGE_FILE"; import Submenu from "@docspace/components/submenu"; import CommonSettings from "./CommonSettings"; import AdminSettings from "./AdminSettings"; -import { isDesktop } from "@docspace/components/utils/device"; +import { tablet } from "@docspace/components/utils/device"; const StyledContainer = styled.div` margin-top: -22px; - ${isDesktop && - css` - margin-top: -19px; - `} + @media ${tablet} { + margin-top: 0px; + } `; const SectionBodyContent = ({ isAdmin, isErrorSettings, history }) => { From 0e041de3155089c9081257e97953ee70b841bec0 Mon Sep 17 00:00:00 2001 From: TimofeyBoyko Date: Thu, 15 Sep 2022 11:41:13 +0300 Subject: [PATCH 40/87] Web:Client:Home: add new filter type for file type --- .../src/pages/Home/Section/Filter/index.js | 22 +++++++------------ 1 file changed, 8 insertions(+), 14 deletions(-) diff --git a/packages/client/src/pages/Home/Section/Filter/index.js b/packages/client/src/pages/Home/Section/Filter/index.js index e336bc4a13..516cc1a8d3 100644 --- a/packages/client/src/pages/Home/Section/Filter/index.js +++ b/packages/client/src/pages/Home/Section/Filter/index.js @@ -111,11 +111,11 @@ const getTags = (filterValues) => { }; const TABLE_COLUMNS = `filesTableColumns_ver-${TableVersions.Files}`; -const COLUMNS_SIZE = `filesColumnsSize_ver-${TableVersions.Files}`; + const COLUMNS_SIZE_INFO_PANEL = `filesColumnsSizeInfoPanel_ver-${TableVersions.Files}`; const TABLE_ROOMS_COLUMNS = `roomsTableColumns_ver-${TableVersions.Rooms}`; -const COLUMNS_ROOMS_SIZE = `roomsColumnsSize_ver-${TableVersions.Rooms}`; + const COLUMNS_ROOMS_SIZE_INFO_PANEL = `roomsColumnsSizeInfoPanel_ver-${TableVersions.Rooms}`; const SectionFilterContent = ({ @@ -204,13 +204,7 @@ const SectionFilterContent = ({ const newFilter = filter.clone(); newFilter.page = 0; - if (filterType === "master-forms" || filterType === "forms") { - newFilter.filterType = null; - - toastr.warning(`The ${filterType} type is still under development`); - } else { - newFilter.filterType = filterType; - } + newFilter.filterType = filterType; newFilter.authorType = authorType; newFilter.withSubfolders = @@ -453,10 +447,10 @@ const SectionFilterContent = ({ case FilterType.FilesOnly.toString(): label = t("AllFiles"); break; - case "master-forms": + case FilterType.OFormTemplateOnly.toString(): label = t("FormsTemplates"); break; - case "forms": + case FilterType.OFormOnly.toString(): label = t("Forms"); break; } @@ -597,12 +591,12 @@ const SectionFilterContent = ({ label: t("Translations:Spreadsheets").toLowerCase(), }, { - key: "master-forms", + key: FilterType.OFormTemplateOnly.toString(), group: FilterGroups.filterType, label: t("FormsTemplates").toLowerCase(), }, { - key: "forms", + key: FilterType.OFormOnly.toString(), group: FilterGroups.filterType, label: t("Forms").toLowerCase(), }, @@ -834,7 +828,7 @@ const SectionFilterContent = ({ .split(","); const infoPanelColumnsSize = localStorage - ?.getItem(`${COLUMNS_SIZE_INFO_PANEL}=${userId}`) + ?.getItem(`${COLUMNS_ROOMS_SIZE_INFO_PANEL}=${userId}`) ?.split(" "); if (availableSort.includes("Type")) { From 756af118d485c9b38a74eb7e85ef18aad2f90042 Mon Sep 17 00:00:00 2001 From: Alexey Safronov Date: Thu, 15 Sep 2022 11:44:48 +0300 Subject: [PATCH 41/87] Web: Files: Hide ThirdPartyList --- packages/client/src/components/Article/Body/index.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/client/src/components/Article/Body/index.js b/packages/client/src/components/Article/Body/index.js index 39bb59d1b2..21166c3f10 100644 --- a/packages/client/src/components/Article/Body/index.js +++ b/packages/client/src/components/Article/Body/index.js @@ -13,7 +13,7 @@ import SettingsItem from "./SettingsItem"; import AccountsItem from "./AccountsItem"; import { combineUrl } from "@docspace/common/utils"; import { isDesktop, isTablet, isMobileOnly } from "react-device-detect"; -import ThirdPartyList from "./ThirdPartyList"; +//import ThirdPartyList from "./ThirdPartyList"; import DownloadAppList from "./DownloadAppList"; import Banner from "./Banner"; import { showLoader, hideLoader } from "@docspace/common/utils"; @@ -163,7 +163,7 @@ const ArticleBodyContent = (props) => { {!personal && !firstLoad && } {!isDesktopClient && showText && !docSpace && ( - {enableThirdParty && !isVisitor && } + {/* {enableThirdParty && !isVisitor && } */} {(isDesktop || isTablet) && personal && From c93a0b485e182f800608a68d2a811c057efa46f7 Mon Sep 17 00:00:00 2001 From: TimofeyBoyko Date: Thu, 15 Sep 2022 11:47:57 +0300 Subject: [PATCH 42/87] Web:Components:TableContainer: add disabled state for items --- packages/components/table-container/TableSettings.js | 2 ++ 1 file changed, 2 insertions(+) diff --git a/packages/components/table-container/TableSettings.js b/packages/components/table-container/TableSettings.js index 9b584fdc0d..b0c07d3c04 100644 --- a/packages/components/table-container/TableSettings.js +++ b/packages/components/table-container/TableSettings.js @@ -43,6 +43,8 @@ const TableSettings = ({ columns, infoPanelVisible }) => { withBackdrop={false} > {columns.map((column) => { + if (column.isDisabled) return; + const onChange = (e) => column.onChange && column.onChange(column.key, e); From b85484a731fbac4715d528edb2969e69ea350b04 Mon Sep 17 00:00:00 2001 From: Alexey Safronov Date: Thu, 15 Sep 2022 11:59:38 +0300 Subject: [PATCH 43/87] Web: Files: Settings: Fix sticky submenu --- packages/client/src/components/Article/Body/index.js | 4 ++-- .../components/Section/sub-components/section-container.js | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/packages/client/src/components/Article/Body/index.js b/packages/client/src/components/Article/Body/index.js index 21166c3f10..ccc8d96845 100644 --- a/packages/client/src/components/Article/Body/index.js +++ b/packages/client/src/components/Article/Body/index.js @@ -39,8 +39,8 @@ const ArticleBodyContent = (props) => { firstLoad, showText, isDesktopClient, - enableThirdParty, - isVisitor, + // enableThirdParty, + // isVisitor, FirebaseHelper, theme, toggleArticleOpen, diff --git a/packages/common/components/Section/sub-components/section-container.js b/packages/common/components/Section/sub-components/section-container.js index 5dc576e15f..6a10bbfb19 100644 --- a/packages/common/components/Section/sub-components/section-container.js +++ b/packages/common/components/Section/sub-components/section-container.js @@ -25,7 +25,7 @@ const tabletProps = css` `} ${(props) => - props.settingsStudio && + (props.settingsStudio || props.viewAs == "settings") && isMobileOnly && css` background: ${(props) => props.theme.section.header.backgroundColor}; From b4009910a33d4eb9392ca9c7e71483aa32a20f84 Mon Sep 17 00:00:00 2001 From: gopienkonikita Date: Thu, 15 Sep 2022 12:02:50 +0300 Subject: [PATCH 44/87] Web: Components: fixed tap selection --- packages/components/submenu/styled-submenu.js | 2 ++ 1 file changed, 2 insertions(+) diff --git a/packages/components/submenu/styled-submenu.js b/packages/components/submenu/styled-submenu.js index b5fc1c0386..1c78da5a7c 100644 --- a/packages/components/submenu/styled-submenu.js +++ b/packages/components/submenu/styled-submenu.js @@ -78,6 +78,8 @@ export const StyledSubmenuItem = styled.div.attrs((props) => ({ padding-top: 4px; line-height: 20px; margin-right: 17px; + + -webkit-tap-highlight-color: rgba(0, 0, 0, 0); `; export const StyledSubmenuItemText = styled.div` From 94f6cc8682e21d297d8259e5cc6a74e1253cfbb8 Mon Sep 17 00:00:00 2001 From: Alexey Safronov Date: Thu, 15 Sep 2022 12:06:22 +0300 Subject: [PATCH 45/87] Web: Files: Settings: fix padding on tablet --- .../common/components/Section/sub-components/section-body.js | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/packages/common/components/Section/sub-components/section-body.js b/packages/common/components/Section/sub-components/section-body.js index 0a9588f3d5..65a47a5a39 100644 --- a/packages/common/components/Section/sub-components/section-body.js +++ b/packages/common/components/Section/sub-components/section-body.js @@ -94,6 +94,10 @@ const commonStyles = css` props.viewAs == "settings" && css` padding-top: 0; + + @media ${tablet} { + padding-top: 0; + } `} .section-wrapper { From 791dfb055ca645b77a58cfb8c97a10cb1347ae1f Mon Sep 17 00:00:00 2001 From: Alexey Safronov Date: Thu, 15 Sep 2022 12:39:13 +0300 Subject: [PATCH 46/87] Web: Files: Settings: fix margin on mobile devices --- .../src/pages/Settings/Section/Body/StyledSettings.js | 8 +++++++- packages/client/src/pages/Settings/Section/Body/index.js | 6 ++++++ 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/packages/client/src/pages/Settings/Section/Body/StyledSettings.js b/packages/client/src/pages/Settings/Section/Body/StyledSettings.js index 17e8ca9226..066a1dfb60 100644 --- a/packages/client/src/pages/Settings/Section/Body/StyledSettings.js +++ b/packages/client/src/pages/Settings/Section/Body/StyledSettings.js @@ -1,5 +1,6 @@ -import styled from "styled-components"; +import styled, { css } from "styled-components"; import { tablet } from "@docspace/components/utils/device"; +import { isMobile } from "react-device-detect"; const StyledSettings = styled.div` margin-top: ${(props) => (props.showTitle ? 24 : 34)}px; @@ -8,6 +9,11 @@ const StyledSettings = styled.div` margin-top: 8px; } + ${isMobile && + css` + margin-top: 8px; + `} + width: 100%; display: grid; diff --git a/packages/client/src/pages/Settings/Section/Body/index.js b/packages/client/src/pages/Settings/Section/Body/index.js index ab24b4b964..57b23cd934 100644 --- a/packages/client/src/pages/Settings/Section/Body/index.js +++ b/packages/client/src/pages/Settings/Section/Body/index.js @@ -12,6 +12,7 @@ import Submenu from "@docspace/components/submenu"; import CommonSettings from "./CommonSettings"; import AdminSettings from "./AdminSettings"; import { tablet } from "@docspace/components/utils/device"; +import { isMobile } from "react-device-detect"; const StyledContainer = styled.div` margin-top: -22px; @@ -19,6 +20,11 @@ const StyledContainer = styled.div` @media ${tablet} { margin-top: 0px; } + + ${isMobile && + css` + margin-top: 0px; + `} `; const SectionBodyContent = ({ isAdmin, isErrorSettings, history }) => { From c93ad9e96f5c478d2b6d34a2cc2ecb75a116ce7c Mon Sep 17 00:00:00 2001 From: TimofeyBoyko Date: Thu, 15 Sep 2022 12:49:08 +0300 Subject: [PATCH 47/87] Web:Client:Home: fix displaying author column after moved from personal --- .../Section/Body/TableView/TableHeader.js | 73 ++++++++++++++++--- 1 file changed, 62 insertions(+), 11 deletions(-) diff --git a/packages/client/src/pages/Home/Section/Body/TableView/TableHeader.js b/packages/client/src/pages/Home/Section/Body/TableView/TableHeader.js index 9181a889c0..7c97fdb646 100644 --- a/packages/client/src/pages/Home/Section/Body/TableView/TableHeader.js +++ b/packages/client/src/pages/Home/Section/Body/TableView/TableHeader.js @@ -4,6 +4,8 @@ import { inject, observer } from "mobx-react"; import { withTranslation } from "react-i18next"; import { Events } from "SRC_DIR/helpers/filesConstants"; +const WITH_AUTHOR = "withAuthorColumn"; + class FilesTableHeader extends React.Component { constructor(props) { super(props); @@ -14,9 +16,16 @@ class FilesTableHeader extends React.Component { } getTableColumns = (fromUpdate = false) => { - const { t, personal, tableStorageName, isRooms } = this.props; + const { + t, + personal, + tableStorageName, + isRooms, + isPersonalRoom, + } = this.props; const defaultColumns = []; + if (isRooms) { const columns = [ { @@ -69,6 +78,22 @@ class FilesTableHeader extends React.Component { defaultColumns.push(...columns); } else { + const authorOption = { + key: "Author", + title: t("ByAuthor"), + enable: false, + resizable: true, + sortBy: "Author", + + isDisabled: isPersonalRoom, + onClick: this.onFilter, + onChange: this.onColumnChange, + }; + + if (isPersonalRoom) { + authorOption.defaultSize = 0; + } + const columns = [ { key: "Name", @@ -80,15 +105,7 @@ class FilesTableHeader extends React.Component { minWidth: 210, onClick: this.onFilter, }, - { - key: "Author", - title: t("ByAuthor"), - enable: false, - resizable: true, - sortBy: "Author", - onClick: this.onFilter, - onChange: this.onColumnChange, - }, + authorOption, { key: "Created", title: t("ByCreationDate"), @@ -152,12 +169,14 @@ class FilesTableHeader extends React.Component { columns: columns, resetColumnsSize: resetColumnsSize, isRooms: isRooms, + isPersonalRoom: isPersonalRoom, }); } else { this.state = { columns: columns, resetColumnsSize: resetColumnsSize, isRooms: isRooms, + isPersonalRoom: isPersonalRoom, }; } }; @@ -199,6 +218,10 @@ class FilesTableHeader extends React.Component { return this.getTableColumns(true); } + if (this.props.isPersonalRoom !== this.state.isPersonalRoom) { + return this.getTableColumns(true); + } + const { columns } = this.state; if (this.props.withContent !== prevProps.withContent) { const columnIndex = columns.findIndex((c) => c.key === "Share"); @@ -221,6 +244,8 @@ class FilesTableHeader extends React.Component { this.customScrollElm.removeEventListener("scroll", this.onBeginScroll); } getColumns = (defaultColumns, splitColumns) => { + const { isPersonalRoom, isRooms } = this.props; + const columns = []; if (splitColumns) { @@ -228,6 +253,22 @@ class FilesTableHeader extends React.Component { const column = splitColumns.find((key) => key === col.key); column ? (col.enable = true) : (col.enable = false); + if (!isRooms) { + if (column === "Author" && isPersonalRoom) { + col.enable = false; + } + + if (col.key === "Author" && !isPersonalRoom) { + if (!col.enable) { + const withAuthor = localStorage.getItem(WITH_AUTHOR); + + if (withAuthor === "true") { + col.enable = true; + } + } + } + } + columns.push(col); } return columns; @@ -248,6 +289,10 @@ class FilesTableHeader extends React.Component { const tableColumns = columns.map((c) => c.enable && c.key); this.setTableColumns(tableColumns); + if (key === "Author") { + localStorage.setItem(WITH_AUTHOR, columns[columnIndex].enable); + } + const event = new Event(Events.CHANGE_COLUMN); window.dispatchEvent(event); @@ -366,7 +411,11 @@ export default inject( roomsFilter, fetchRooms, } = filesStore; - const { isPrivacyFolder, isRecentFolder } = treeFoldersStore; + const { + isPrivacyFolder, + isRecentFolder, + isPersonalRoom, + } = treeFoldersStore; const withContent = canShare || (canShare && isPrivacyFolder && isDesktop); const sortingVisible = !isRecentFolder; @@ -391,6 +440,8 @@ export default inject( infoPanelVisible, withPaging, + + isPersonalRoom, }; } )( From 72af5e7549092df5b74b9d4798b17615a52759cb Mon Sep 17 00:00:00 2001 From: TimofeyBoyko Date: Thu, 15 Sep 2022 13:24:18 +0300 Subject: [PATCH 48/87] Web: mode global events constants from client to common --- packages/client/src/HOCs/withHotkeys.js | 2 +- .../src/components/Article/MainButton/index.js | 2 +- .../client/src/components/EmptyContainer/index.js | 2 +- packages/client/src/components/GlobalEvents/index.js | 2 +- packages/client/src/helpers/filesConstants.js | 8 -------- .../pages/Home/Section/Body/TableView/TableHeader.js | 2 +- .../client/src/pages/Home/Section/Header/index.js | 2 +- packages/client/src/pages/Home/index.js | 2 +- packages/client/src/store/ContextOptionsStore.js | 2 +- packages/client/src/store/DialogsStore.js | 2 +- .../FilterInput/sub-components/SortButton.js | 2 +- packages/common/constants/index.js | 12 ++++++++++++ packages/common/store/InfoPanelStore.js | 2 +- 13 files changed, 23 insertions(+), 19 deletions(-) diff --git a/packages/client/src/HOCs/withHotkeys.js b/packages/client/src/HOCs/withHotkeys.js index d33350f8c6..af057fd04f 100644 --- a/packages/client/src/HOCs/withHotkeys.js +++ b/packages/client/src/HOCs/withHotkeys.js @@ -1,7 +1,7 @@ import React, { useEffect } from "react"; import { useHotkeys } from "react-hotkeys-hook"; import { observer, inject } from "mobx-react"; -import { Events } from "@docspace/client/src/helpers/filesConstants"; +import { Events } from "@docspace/common/constants"; import toastr from "@docspace/components/toast/toastr"; import throttle from "lodash/throttle"; diff --git a/packages/client/src/components/Article/MainButton/index.js b/packages/client/src/components/Article/MainButton/index.js index 752e4843e3..c17ccad13e 100644 --- a/packages/client/src/components/Article/MainButton/index.js +++ b/packages/client/src/components/Article/MainButton/index.js @@ -14,7 +14,7 @@ import MobileView from "./MobileView"; import { combineUrl } from "@docspace/common/utils"; import config from "PACKAGE_FILE"; import withLoader from "../../../HOCs/withLoader"; -import { Events } from "@docspace/client/src/helpers/filesConstants"; +import { Events } from "@docspace/common/constants"; import { getMainButtonItems } from "SRC_DIR/helpers/plugins"; import toastr from "@docspace/components/toast/toastr"; diff --git a/packages/client/src/components/EmptyContainer/index.js b/packages/client/src/components/EmptyContainer/index.js index 3d852f696d..406fc283c1 100644 --- a/packages/client/src/components/EmptyContainer/index.js +++ b/packages/client/src/components/EmptyContainer/index.js @@ -5,7 +5,7 @@ import EmptyFilterContainer from "./EmptyFilterContainer"; import EmptyFolderContainer from "./EmptyFolderContainer"; import { FileAction } from "@docspace/common/constants"; import { isMobile } from "react-device-detect"; -import { Events } from "@docspace/client/src/helpers/filesConstants"; +import { Events } from "@docspace/common/constants"; const linkStyles = { isHovered: true, diff --git a/packages/client/src/components/GlobalEvents/index.js b/packages/client/src/components/GlobalEvents/index.js index fa1933a9db..a54cbe24cd 100644 --- a/packages/client/src/components/GlobalEvents/index.js +++ b/packages/client/src/components/GlobalEvents/index.js @@ -1,7 +1,7 @@ import React, { useState, useEffect, useCallback, memo } from "react"; import { FileAction } from "@docspace/common/constants"; -import { Events } from "@docspace/client/src/helpers/filesConstants"; +import { Events } from "@docspace/common/constants"; import CreateEvent from "./CreateEvent"; import RenameEvent from "./RenameEvent"; diff --git a/packages/client/src/helpers/filesConstants.js b/packages/client/src/helpers/filesConstants.js index ac42c2ce17..e2b38d1dba 100644 --- a/packages/client/src/helpers/filesConstants.js +++ b/packages/client/src/helpers/filesConstants.js @@ -11,14 +11,6 @@ export const thumbnailStatuses = { export const ADS_TIMEOUT = 300000; // 5 min -export const Events = Object.freeze({ - CREATE: "create", - RENAME: "rename", - ROOM_CREATE: "create_room", - ROOM_EDIT: "edit_room", - CHANGE_COLUMN: "change_column", -}); - export const FilterGroups = Object.freeze({ filterType: "filter-filterType", filterAuthor: "filter-author", diff --git a/packages/client/src/pages/Home/Section/Body/TableView/TableHeader.js b/packages/client/src/pages/Home/Section/Body/TableView/TableHeader.js index 7c97fdb646..7bcabec0d9 100644 --- a/packages/client/src/pages/Home/Section/Body/TableView/TableHeader.js +++ b/packages/client/src/pages/Home/Section/Body/TableView/TableHeader.js @@ -2,7 +2,7 @@ import React from "react"; import TableHeader from "@docspace/components/table-container/TableHeader"; import { inject, observer } from "mobx-react"; import { withTranslation } from "react-i18next"; -import { Events } from "SRC_DIR/helpers/filesConstants"; +import { Events } from "@docspace/common/constants"; const WITH_AUTHOR = "withAuthorColumn"; diff --git a/packages/client/src/pages/Home/Section/Header/index.js b/packages/client/src/pages/Home/Section/Header/index.js index 37e1359ed3..c490bfd77d 100644 --- a/packages/client/src/pages/Home/Section/Header/index.js +++ b/packages/client/src/pages/Home/Section/Header/index.js @@ -18,7 +18,7 @@ import { Consumer } from "@docspace/components/utils/context"; import { inject, observer } from "mobx-react"; import TableGroupMenu from "@docspace/components/table-container/TableGroupMenu"; import Navigation from "@docspace/common/components/Navigation"; -import { Events } from "@docspace/client/src/helpers/filesConstants"; +import { Events } from "@docspace/common/constants"; import config from "PACKAGE_FILE"; import { combineUrl } from "@docspace/common/utils"; import RoomsFilter from "@docspace/common/api/rooms/filter"; diff --git a/packages/client/src/pages/Home/index.js b/packages/client/src/pages/Home/index.js index 524ec59f31..a14b104560 100644 --- a/packages/client/src/pages/Home/index.js +++ b/packages/client/src/pages/Home/index.js @@ -29,7 +29,7 @@ import DragTooltip from "../../components/DragTooltip"; import { observer, inject } from "mobx-react"; //import config from "PACKAGE_FILE"; import { Consumer } from "@docspace/components/utils/context"; -import { Events } from "@docspace/client/src/helpers/filesConstants"; +import { Events } from "@docspace/common/constants"; import RoomsFilter from "@docspace/common/api/rooms/filter"; import { getCategoryType } from "SRC_DIR/helpers/utils"; import { CategoryType } from "SRC_DIR/helpers/constants"; diff --git a/packages/client/src/store/ContextOptionsStore.js b/packages/client/src/store/ContextOptionsStore.js index 7ce27fe1e9..0f02c576f7 100644 --- a/packages/client/src/store/ContextOptionsStore.js +++ b/packages/client/src/store/ContextOptionsStore.js @@ -10,7 +10,7 @@ import { isMobile as isMobileUtils, isTablet as isTabletUtils, } from "@docspace/components/utils/device"; -import { Events } from "@docspace/client/src/helpers/filesConstants"; +import { Events } from "@docspace/common/constants"; import { getContextMenuItems } from "SRC_DIR/helpers/plugins"; class ContextOptionsStore { diff --git a/packages/client/src/store/DialogsStore.js b/packages/client/src/store/DialogsStore.js index d89842bbd8..611aa62865 100644 --- a/packages/client/src/store/DialogsStore.js +++ b/packages/client/src/store/DialogsStore.js @@ -1,7 +1,7 @@ import { getNewFiles } from "@docspace/common/api/files"; import { FileAction } from "@docspace/common/constants"; import { makeAutoObservable } from "mobx"; -import { Events } from "@docspace/client/src/helpers/filesConstants"; +import { Events } from "@docspace/common/constants"; class DialogsStore { authStore; diff --git a/packages/common/components/FilterInput/sub-components/SortButton.js b/packages/common/components/FilterInput/sub-components/SortButton.js index 74019d69f0..04dfe6feee 100644 --- a/packages/common/components/FilterInput/sub-components/SortButton.js +++ b/packages/common/components/FilterInput/sub-components/SortButton.js @@ -14,7 +14,7 @@ import { Base } from "@docspace/components/themes"; import SortDesc from "../../../../../public/images/sort.desc.react.svg"; import Backdrop from "@docspace/components/backdrop"; -import { Events } from "SRC_DIR/helpers/filesConstants"; +import { Events } from "@docspace/common/constants"; const selectedViewIcon = css` svg { diff --git a/packages/common/constants/index.js b/packages/common/constants/index.js index 793cc5e2ab..4eef0f545b 100644 --- a/packages/common/constants/index.js +++ b/packages/common/constants/index.js @@ -248,3 +248,15 @@ export const ThemeKeys = Object.freeze({ System: "2", SystemStr: "System", }); + +/** + * Enum for global events. + * @readonly + */ +export const Events = Object.freeze({ + CREATE: "create", + RENAME: "rename", + ROOM_CREATE: "create_room", + ROOM_EDIT: "edit_room", + CHANGE_COLUMN: "change_column", +}); diff --git a/packages/common/store/InfoPanelStore.js b/packages/common/store/InfoPanelStore.js index ccfcce92d2..1359a95001 100644 --- a/packages/common/store/InfoPanelStore.js +++ b/packages/common/store/InfoPanelStore.js @@ -1,5 +1,5 @@ import { makeAutoObservable } from "mobx"; -import { Events } from "SRC_DIR/helpers/filesConstants"; +import { Events } from "@docspace/common/constants"; class InfoPanelStore { isVisible = false; From 977dc1f7ed95045cc69c604e4fbaf0f180cdb829 Mon Sep 17 00:00:00 2001 From: TimofeyBoyko Date: Thu, 15 Sep 2022 14:02:53 +0300 Subject: [PATCH 49/87] Web:Client: change translation key 'ByCreationDate' to 'ByCreation' --- packages/client/public/locales/az/Files.json | 2 +- packages/client/public/locales/bg/Files.json | 2 +- packages/client/public/locales/cs/Files.json | 2 +- packages/client/public/locales/de/Files.json | 2 +- packages/client/public/locales/el-GR/Files.json | 2 +- packages/client/public/locales/en/Files.json | 2 +- packages/client/public/locales/es/Files.json | 2 +- packages/client/public/locales/fi/Files.json | 2 +- packages/client/public/locales/fr/Files.json | 2 +- packages/client/public/locales/hy-AM/Files.json | 2 +- packages/client/public/locales/it/Files.json | 2 +- packages/client/public/locales/ja-JP/Files.json | 2 +- packages/client/public/locales/ko-KR/Files.json | 2 +- packages/client/public/locales/lo-LA/Files.json | 2 +- packages/client/public/locales/lv/Files.json | 2 +- packages/client/public/locales/nl/Files.json | 2 +- packages/client/public/locales/pl/Files.json | 2 +- packages/client/public/locales/pt-BR/Files.json | 2 +- packages/client/public/locales/pt/Files.json | 2 +- packages/client/public/locales/ro/Files.json | 2 +- packages/client/public/locales/ru/Files.json | 2 +- packages/client/public/locales/sk/Files.json | 2 +- packages/client/public/locales/sl/Files.json | 2 +- packages/client/public/locales/tr/Files.json | 2 +- packages/client/public/locales/uk-UA/Files.json | 2 +- packages/client/public/locales/vi/Files.json | 2 +- packages/client/public/locales/zh-CN/Files.json | 2 +- packages/client/src/pages/Home/InfoPanel/Body/SingleItem.js | 2 +- .../client/src/pages/Home/Section/Body/TableView/TableHeader.js | 2 +- packages/client/src/pages/Home/Section/Filter/index.js | 2 +- 30 files changed, 30 insertions(+), 30 deletions(-) diff --git a/packages/client/public/locales/az/Files.json b/packages/client/public/locales/az/Files.json index 63eea95758..783357d26d 100644 --- a/packages/client/public/locales/az/Files.json +++ b/packages/client/public/locales/az/Files.json @@ -4,7 +4,7 @@ "Archives": "Arxivlər", "BackToParentFolderButton": "Ana qovluğa qayıt", "ByAuthor": "Müəllif", - "ByCreationDate": "Yaradıldı", + "ByCreation": "Yaradıldı", "ByLastModifiedDate": "Dəyişdirilib", "ByTitle": "Başlıq", "CommonEmptyContainerDescription": "'Ümumi' bölməsi portal inzibatçısı tərəfindən bütün istifadəçilərlə paylaşılan faylları ehtiva edir. Orada yalnız portal inzibatçıları fayl yarada bilər. İstifadəçilərə bölmə daxilində müəyyən bir qovluğa tam giriş verilə bilər. Bu şəkildə bu qovluqda fayllar yarada/yükləyə biləcəklər.", diff --git a/packages/client/public/locales/bg/Files.json b/packages/client/public/locales/bg/Files.json index 01644afac2..dee29830d9 100644 --- a/packages/client/public/locales/bg/Files.json +++ b/packages/client/public/locales/bg/Files.json @@ -4,7 +4,7 @@ "Archives": "Архиви", "BackToParentFolderButton": "Обратно към родителската папка", "ByAuthor": "Автор", - "ByCreationDate": "Създаден", + "ByCreation": "Създаден", "ByLastModifiedDate": "Модифициран", "ByTitle": "Заглавие", "CommonEmptyContainerDescription": "Разделът 'Често срещани' съдържа файлове, които са споделени с всички потребители от администратора на портала. Само администраторите на портала могат да създават файлове там. Потребителите могат да се сдобият с Пълен достъп до определена папка в рамките на раздела. По този начин те ще могат да създават/качват файлове във всяка папка.", diff --git a/packages/client/public/locales/cs/Files.json b/packages/client/public/locales/cs/Files.json index 6fe0f2e54e..4693f3a78a 100644 --- a/packages/client/public/locales/cs/Files.json +++ b/packages/client/public/locales/cs/Files.json @@ -4,7 +4,7 @@ "Archives": "Archivy", "BackToParentFolderButton": "Zpět do nadřazené složky", "ByAuthor": "Autor", - "ByCreationDate": "Vytvořeno", + "ByCreation": "Vytvořeno", "ByLastModifiedDate": "Upraveno", "ByTitle": "Název", "CommonEmptyContainerDescription": "Sekce 'Sdílené' obsahuje soubory, které správce portálu sdílí se všemi uživateli. Soubory v ní mohou vytvářet pouze správci portálu. Uživatelům lze v rámci sekce udělit plný přístup k určité složce. Tímto způsobem budou moci vytvářet/nahrávat soubory právě v této složce. ", diff --git a/packages/client/public/locales/de/Files.json b/packages/client/public/locales/de/Files.json index 6854169cca..1a69ac88e2 100644 --- a/packages/client/public/locales/de/Files.json +++ b/packages/client/public/locales/de/Files.json @@ -4,7 +4,7 @@ "Archives": "Archive", "BackToParentFolderButton": "Zurück zum übergeordneten Ordner", "ByAuthor": "Verfasser", - "ByCreationDate": "Erstellt", + "ByCreation": "Erstellt", "ByLastModifiedDate": "Verändert", "ByTitle": "Titel", "CommonEmptyContainerDescription": "In gemeinsamen Dokumenten finden Sie Dateien, auf denen alle Benutzer Zugriff haben. Nur Portaladministratoren können dort Dateien erstellen. Benutzern kann der vollständigen Zugriff auf einen bestimmten Ordner innerhalb des Abschnitts erteilt werden. Dann können Sie Dateien in diesem Ordner erstellen / hochladen.", diff --git a/packages/client/public/locales/el-GR/Files.json b/packages/client/public/locales/el-GR/Files.json index 952410d9f1..f7b26b3eb9 100644 --- a/packages/client/public/locales/el-GR/Files.json +++ b/packages/client/public/locales/el-GR/Files.json @@ -4,7 +4,7 @@ "Archives": "Αρχειοθετήσεις", "BackToParentFolderButton": "Επιστροφή στον γονικό φάκελο", "ByAuthor": "Δημιουργός", - "ByCreationDate": "Δημιουργήθηκε", + "ByCreation": "Δημιουργήθηκε", "ByLastModifiedDate": "Τροποποιήθηκε", "ByTitle": "Τίτλος", "CommonEmptyContainerDescription": "Η ενότητα «Κοινά» περιέχει αρχεία που μοιράζονται σε όλους τους χρήστες από τον διαχειριστή της πύλης. Μόνο οι διαχειριστές της πύλης μπορούν να δημιουργήσουν αρχεία εκεί. Οι χρήστες μπορούν να έχουν πλήρη πρόσβαση σε έναν συγκεκριμένο φάκελο εντός της ενότητας. Έτσι, θα μπορούν να δημιουργούν/μεταφορτώνουν αρχεία σε αυτόν τον φάκελο.", diff --git a/packages/client/public/locales/en/Files.json b/packages/client/public/locales/en/Files.json index b95ec7e660..a64124679e 100644 --- a/packages/client/public/locales/en/Files.json +++ b/packages/client/public/locales/en/Files.json @@ -5,7 +5,7 @@ "Archives": "Archives", "BackToParentFolderButton": "Back to parent folder", "ByAuthor": "Author", - "ByCreationDate": "Created", + "ByCreation": "Created", "ByLastModifiedDate": "Modified", "ByOwner": "Owner", "ByTitle": "Title", diff --git a/packages/client/public/locales/es/Files.json b/packages/client/public/locales/es/Files.json index 15293b1ef1..66d77a124d 100644 --- a/packages/client/public/locales/es/Files.json +++ b/packages/client/public/locales/es/Files.json @@ -4,7 +4,7 @@ "Archives": "Archivos", "BackToParentFolderButton": "Volver a la carpeta principal", "ByAuthor": "Autor", - "ByCreationDate": "Creado", + "ByCreation": "Creado", "ByLastModifiedDate": "Modificado", "ByTitle": "Título", "CommonEmptyContainerDescription": "La sección 'Documentos comunes' contiene archivos compartidos por el administrador del portal con todos los usuarios. Sólo los administradores del portal pueden crear archivos allí. Los usuarios pueden tener acceso completo a una determinada carpeta dentro de la sección. De esta manera podrán crear/subir archivos en esta misma carpeta. ", diff --git a/packages/client/public/locales/fi/Files.json b/packages/client/public/locales/fi/Files.json index be75c55a8e..c315aee086 100644 --- a/packages/client/public/locales/fi/Files.json +++ b/packages/client/public/locales/fi/Files.json @@ -4,7 +4,7 @@ "Archives": "Arkistot", "BackToParentFolderButton": "Takaisin pääkansioon", "ByAuthor": "Tekijä", - "ByCreationDate": "Luotu", + "ByCreation": "Luotu", "ByLastModifiedDate": "Muokattu", "ByTitle": "Otsikko", "CommonEmptyContainerDescription": "’Yleinen’ -osio sisältää tiedostoja, jotka portaalin ylläpitäjä on jakanut kaikille käyttäjille. Vain portaalin ylläpitäjät voivat luoda tiedostoja sinne. Käyttäjille voidaan myöntää täysi käyttöoikeus tiettyyn osion kansioon. Tällä tavalla he voivat luoda/ladata tiedostoja juuri tähän kansioon. ", diff --git a/packages/client/public/locales/fr/Files.json b/packages/client/public/locales/fr/Files.json index 8b2c0fa571..60c9201fc4 100644 --- a/packages/client/public/locales/fr/Files.json +++ b/packages/client/public/locales/fr/Files.json @@ -4,7 +4,7 @@ "Archives": "Archives", "BackToParentFolderButton": "Retour vers le dossier précédent", "ByAuthor": "Auteur", - "ByCreationDate": "Créé", + "ByCreation": "Créé", "ByLastModifiedDate": "Modifié", "ByTitle": "Titre", "CommonEmptyContainerDescription": "La section \"Documents Communs\" contient des fichiers partagés par l'administrateur du portail avec tous les utilisateurs. Seuls les administrateurs du portail peuvent y créer des fichiers. Les utilisateurs peuvent obtenir un accès complet à un certain dossier de la section. Ainsi, ils pourront créer/télécharger des fichiers dans ce même dossier. ", diff --git a/packages/client/public/locales/hy-AM/Files.json b/packages/client/public/locales/hy-AM/Files.json index 4d71aeb6f4..20712c6119 100644 --- a/packages/client/public/locales/hy-AM/Files.json +++ b/packages/client/public/locales/hy-AM/Files.json @@ -4,7 +4,7 @@ "Archives": "Արխիվներ", "BackToParentFolderButton": "Վերադառնալ ծնող պանակ", "ByAuthor": "Հեղինակ", - "ByCreationDate": "Ստեղծված", + "ByCreation": "Ստեղծված", "ByLastModifiedDate": "Փոփոխված", "ByTitle": "Անվանում", "CommonEmptyContainerDescription": "'Ընդհանուր'բաժինը պարունակում է ֆայլեր, որոնք կայքէջի ադմինիստրատորի կողմից համօգտագործվում են բոլոր օգտատերերին: Միայն կայքէջի ադմինիստրատորները կարող են այնտեղ ֆայլեր ստեղծել։ Օգտագործողներին կարող է տրվել ամբողջական մուտք դեպի որոշակի պանակ այս բաժնում: Այս կերպ նրանք կկարողանան ստեղծել/վերբեռնել ֆայլեր հենց այս պանակում:", diff --git a/packages/client/public/locales/it/Files.json b/packages/client/public/locales/it/Files.json index e88a09bf28..f3cb88c525 100644 --- a/packages/client/public/locales/it/Files.json +++ b/packages/client/public/locales/it/Files.json @@ -4,7 +4,7 @@ "Archives": "Archivi", "BackToParentFolderButton": "Vai alla cartella superiore", "ByAuthor": "Autore", - "ByCreationDate": "Creato", + "ByCreation": "Creato", "ByLastModifiedDate": "Modificato", "ByTitle": "Titolo", "CommonEmptyContainerDescription": "La sezione \"Comune\" contiene i file condivisi con tutti gli utenti di tipo amministratore del portale. Solo gli amministratori del portale possono creare file nel posto \"Comune\". Agli utenti può essere concesso l'accesso completo a una determinata cartella all'interno della sezione. In questo modo potranno creare / caricare file in questa stessa cartella.", diff --git a/packages/client/public/locales/ja-JP/Files.json b/packages/client/public/locales/ja-JP/Files.json index 291906533f..091e8ce4db 100644 --- a/packages/client/public/locales/ja-JP/Files.json +++ b/packages/client/public/locales/ja-JP/Files.json @@ -4,7 +4,7 @@ "Archives": "アーカイブ", "BackToParentFolderButton": "親フォルダに戻る", "ByAuthor": "作成者", - "ByCreationDate": "作成", + "ByCreation": "作成", "ByLastModifiedDate": "変更", "ByTitle": "タイトル", "CommonEmptyContainerDescription": "「共通」セクションには、ポータル管理者が全ユーザに共有するファイルがあります。ここにファイルを作成できるのは、ポータル管理者のみです。ユーザーは、セクション内の特定のフォルダへのフルアクセスを許可することができます。この場合、ユーザーは、このフォルダにファイルを作成/アップロードすることができます。 ", diff --git a/packages/client/public/locales/ko-KR/Files.json b/packages/client/public/locales/ko-KR/Files.json index b974b5ff8d..e50798489d 100644 --- a/packages/client/public/locales/ko-KR/Files.json +++ b/packages/client/public/locales/ko-KR/Files.json @@ -4,7 +4,7 @@ "Archives": "아카이브", "BackToParentFolderButton": "상위 폴더로 돌아가기", "ByAuthor": "생성자", - "ByCreationDate": "생성일", + "ByCreation": "생성일", "ByLastModifiedDate": "수정일", "ByTitle": "제목", "CommonEmptyContainerDescription": "'공통' 섹션은 포털 관리자에 의해 모든 사용자에게 공유된 파일을 포함합니다. 포털 관리자만 공통 섹션에 파일을 생성할 수 있습니다. 사용자는 해당 섹션 내 특정 폴더에 대한 전체 액세스 권한을 부여 받을 수 있습니다. 그리고 이러한 방식으로 해당 폴더에 파일을 생성/업로드할 수 있습니다.", diff --git a/packages/client/public/locales/lo-LA/Files.json b/packages/client/public/locales/lo-LA/Files.json index acb3ec5681..0677f88707 100644 --- a/packages/client/public/locales/lo-LA/Files.json +++ b/packages/client/public/locales/lo-LA/Files.json @@ -4,7 +4,7 @@ "Archives": "ຮວບຮວມ", "BackToParentFolderButton": "ກັບໄປທີ່ແຟ້ມຫຼັກ", "ByAuthor": "ຜູ້ຂຽນ", - "ByCreationDate": "ສ້າງ", + "ByCreation": "ສ້າງ", "ByLastModifiedDate": "ແກ້ໄຂ", "ByTitle": "ຫົວຂໍ້", "CommonEmptyContainerDescription": "ສ່ວນ common 'ມີເອກະສານທີ່ແບ່ງປັນໃຫ້ຜູ້ຊົມໃຊ້ທັງໝົດ ໂດຍ Portal admin. ມີພຽງແຕ່ Portal ເປັນຜູ້ຮັບຮອງເທົ່ານັ້ນທີ່ສາມາດສ້າງເອກະສານຢູ່ບ່ອນນັ້ນ. ຜູ້ໃຊ້ສາມາດໄດ້ຮັບການອະນຸຍາດເຂົ້າເຖິງໂຟນເດີທີ່ແນ່ນອນພາຍໃນພາກສ່ວນໃດໜື່ງ. ວິທີນີ້ພວກເຂົາຈະສາມາດສ້າງ / ອັບໂຫລດເອກະສານໃນໂຟນເດີນັ້ນໄດ້.", diff --git a/packages/client/public/locales/lv/Files.json b/packages/client/public/locales/lv/Files.json index 90b51a1422..9405034dfa 100644 --- a/packages/client/public/locales/lv/Files.json +++ b/packages/client/public/locales/lv/Files.json @@ -4,7 +4,7 @@ "Archives": "Arhīvi", "BackToParentFolderButton": "Atpakaļ uz vecāku mapi", "ByAuthor": "Autors", - "ByCreationDate": "Izveidots", + "ByCreation": "Izveidots", "ByLastModifiedDate": "Modificēts", "ByTitle": "Nosaukums", "CommonEmptyContainerDescription": "Sadaļā 'Kopējs' ir faili, kurus visiem lietotājiem ir kopīgojis portāla administrators. Failus tur var izveidot tikai portāla administratori. Lietotājiem var piešķirt pilnu piekļuvi noteiktai sadaļas mapei. Tādā veidā viņi varēs izveidot/augšupielādēt failus tieši šajā mapē. ", diff --git a/packages/client/public/locales/nl/Files.json b/packages/client/public/locales/nl/Files.json index 770104f7b7..50ef7575df 100644 --- a/packages/client/public/locales/nl/Files.json +++ b/packages/client/public/locales/nl/Files.json @@ -4,7 +4,7 @@ "Archives": "Archieven", "BackToParentFolderButton": "Terug naar bovenliggende map", "ByAuthor": "Auteur", - "ByCreationDate": "Aangemaakt", + "ByCreation": "Aangemaakt", "ByLastModifiedDate": "Gewijzigd", "ByTitle": "Titel", "CommonEmptyContainerDescription": "'Algemene' sectie bevat bestanden die door de portaal beheerder worden gedeeld met alle gebruikers. Alleen portaal beheerders kunnen daar bestanden aanmaken. Gebruikers kunnen volledige toegang krijgen tot een bepaalde map binnen de sectie. Op deze manier kunnen ze bestanden maken/uploaden in deze map. ", diff --git a/packages/client/public/locales/pl/Files.json b/packages/client/public/locales/pl/Files.json index dc8c9f4fcc..34088ee328 100644 --- a/packages/client/public/locales/pl/Files.json +++ b/packages/client/public/locales/pl/Files.json @@ -4,7 +4,7 @@ "Archives": "Archiwa", "BackToParentFolderButton": "Wróć do folderu nadrzędnego", "ByAuthor": "Autor", - "ByCreationDate": "Utworzono", + "ByCreation": "Utworzono", "ByLastModifiedDate": "Zmodyfikowano", "ByTitle": "Tytuł", "CommonEmptyContainerDescription": "Sekcja 'Wspólne' zawiera pliki udostępnione wszystkim użytkownikom przez administratora portalu. Tylko on może tworzyć w niej nowe pliki. Użytkownicy mogą uzyskać pełen dostęp do pewnych folderów znajdujących się w tej sekcji. Dzięki temu będą w stanie tworzyć/wgrywać w nich dowolne pliki. ", diff --git a/packages/client/public/locales/pt-BR/Files.json b/packages/client/public/locales/pt-BR/Files.json index d299be80d2..785db595a8 100644 --- a/packages/client/public/locales/pt-BR/Files.json +++ b/packages/client/public/locales/pt-BR/Files.json @@ -4,7 +4,7 @@ "Archives": "Arquivos", "BackToParentFolderButton": "Voltar para pasta principal", "ByAuthor": "Autor", - "ByCreationDate": "Criado", + "ByCreation": "Criado", "ByLastModifiedDate": "Modificado", "ByTitle": "Titulo", "CommonEmptyContainerDescription": "A seção 'Comum' contém arquivos compartilhados a todos os usuários pelo administrador do portal. Somente os administradores do portal podem criar arquivos lá. Os usuários podem ter acesso total a uma determinada pasta dentro da seção. Desta forma, eles poderão criar/enviar arquivos nesta mesma pasta.", diff --git a/packages/client/public/locales/pt/Files.json b/packages/client/public/locales/pt/Files.json index 377816bc7e..1ba6145c7d 100644 --- a/packages/client/public/locales/pt/Files.json +++ b/packages/client/public/locales/pt/Files.json @@ -4,7 +4,7 @@ "Archives": "Arquivos", "BackToParentFolderButton": "Voltar à pasta principal", "ByAuthor": "Autor", - "ByCreationDate": "Criado", + "ByCreation": "Criado", "ByLastModifiedDate": "Modificado", "ByTitle": "Titulo", "CommonEmptyContainerDescription": "A secção 'Comum' contém ficheiro partilhados a todos os utilizadores pelo administrador do portal. Apenas os administradores do portal podem criar lá ficheiros. Os utilizadores podem ter acesso total a uma determinada pasta dentro da secção. Desta forma, eles poderão criar/enviar ficheiros nesta mesma pasta.", diff --git a/packages/client/public/locales/ro/Files.json b/packages/client/public/locales/ro/Files.json index 81c582328c..9f63de9a09 100644 --- a/packages/client/public/locales/ro/Files.json +++ b/packages/client/public/locales/ro/Files.json @@ -4,7 +4,7 @@ "Archives": "Arhive", "BackToParentFolderButton": "Revenire la folderul părinte", "ByAuthor": "Autor", - "ByCreationDate": "A fost creat la", + "ByCreation": "A fost creat la", "ByLastModifiedDate": "Modificat", "ByTitle": "Titlu", "CommonEmptyContainerDescription": "Secțiunea Comune conține fișiere partajate cu alți utilizatori de către administratorul portalului. Numai administratorii portalului pot crea fișiere acolo. Utilizatorii pot primi acces complet la un anumit dosar din secțiunea. În acest mod, utilizatorii pot crea/încărca fișiere în acest dosar.", diff --git a/packages/client/public/locales/ru/Files.json b/packages/client/public/locales/ru/Files.json index 7099f797c2..46635f38eb 100644 --- a/packages/client/public/locales/ru/Files.json +++ b/packages/client/public/locales/ru/Files.json @@ -4,7 +4,7 @@ "Archives": "Архивы", "BackToParentFolderButton": "Вернуться в папку на уровень выше", "ByAuthor": "Автор", - "ByCreationDate": "Создан", + "ByCreation": "Создан", "ByLastModifiedDate": "Изменен", "ByTitle": "Название", "CollaborationRooms": "Совместное редактирование", diff --git a/packages/client/public/locales/sk/Files.json b/packages/client/public/locales/sk/Files.json index 2101731075..9d5e1a2dbd 100644 --- a/packages/client/public/locales/sk/Files.json +++ b/packages/client/public/locales/sk/Files.json @@ -4,7 +4,7 @@ "Archives": "Archívy", "BackToParentFolderButton": "Späť do nadradeného priečinka", "ByAuthor": "Autor", - "ByCreationDate": "Vytvorené", + "ByCreation": "Vytvorené", "ByLastModifiedDate": "Upravené", "ByTitle": "Názov", "CommonEmptyContainerDescription": "Sekcia 'Spoločné' obsahuje súbory zdieľané všetkým používateľom správcom portálu. Súbory tam môžu vytvárať iba správcovia portálu. Používateľom môže byť udelený úplný prístup k určitému priečinku v rámci sekcie. Týmto spôsobom budú môcť vytvárať/nahrávať súbory práve do tohto priečinka.", diff --git a/packages/client/public/locales/sl/Files.json b/packages/client/public/locales/sl/Files.json index b9b5f52d93..20fda76a80 100644 --- a/packages/client/public/locales/sl/Files.json +++ b/packages/client/public/locales/sl/Files.json @@ -4,7 +4,7 @@ "Archives": "Arhivi", "BackToParentFolderButton": "Nazaj na starševsko mapo", "ByAuthor": "Avtor", - "ByCreationDate": "Ustvarjeno", + "ByCreation": "Ustvarjeno", "ByLastModifiedDate": "Popravljeno", "ByTitle": "Naslov", "CommonEmptyContainerDescription": "'Skupen' razdelek vsebuje datoteke, ki jih skrbnik portala deli z vsemi uporabniki. Samo skrbniki portala lahko tam ustvarjajo datoteke. Uporabniki lahko dobijo popoln dostop do določene mape v razdelku. Tako bodo lahko ustvarili/naložili datoteke ravno v tej mapi. ", diff --git a/packages/client/public/locales/tr/Files.json b/packages/client/public/locales/tr/Files.json index 8a4dd4fb1d..d8a42bc685 100644 --- a/packages/client/public/locales/tr/Files.json +++ b/packages/client/public/locales/tr/Files.json @@ -4,7 +4,7 @@ "Archives": "Arşivler", "BackToParentFolderButton": "Üst klasöre geri dön", "ByAuthor": "Yazar", - "ByCreationDate": "Oluşturuldu", + "ByCreation": "Oluşturuldu", "ByLastModifiedDate": "Değiştirilmiş", "ByTitle": "Başlık", "CommonEmptyContainerDescription": "'Ortak' bölüm, portal yöneticisi tarafından tüm kullanıcılarla paylaşılan dosyaları içerir. Burada yalnızca portal yöneticileri dosya oluşturabilir. Bu bölüm içinde kullanıcılara belirli bir klasöre Tam erişim verilebilir. Bu şekilde, bu klasörde dosya oluşturabilecek/yükleyebileceklerdir.", diff --git a/packages/client/public/locales/uk-UA/Files.json b/packages/client/public/locales/uk-UA/Files.json index 0687897c45..5bbd906e28 100644 --- a/packages/client/public/locales/uk-UA/Files.json +++ b/packages/client/public/locales/uk-UA/Files.json @@ -4,7 +4,7 @@ "Archives": "Архіви", "BackToParentFolderButton": "Назад до батьківської папки", "ByAuthor": "Автор", - "ByCreationDate": "Створено", + "ByCreation": "Створено", "ByLastModifiedDate": "Змінено", "ByTitle": "Заголовок", "CommonEmptyContainerDescription": "Розділ \"Загальне\" містить файли, до яких адміністратор порталу надав доступ усім користувачам. Тільки адміністратори порталу можуть створювати тут файли. Користувачам може бути наданий повний доступ до певної папки в розділі. Це дозволить їм створювати файли в цій папці та передавати їх до неї.", diff --git a/packages/client/public/locales/vi/Files.json b/packages/client/public/locales/vi/Files.json index c57c8271e0..80d893d8ca 100644 --- a/packages/client/public/locales/vi/Files.json +++ b/packages/client/public/locales/vi/Files.json @@ -4,7 +4,7 @@ "Archives": "Lưu trữ", "BackToParentFolderButton": "Quay lại thư mục gốc", "ByAuthor": "Tác giả", - "ByCreationDate": "Đã tạo", + "ByCreation": "Đã tạo", "ByLastModifiedDate": "Đã sửa đổi", "ByTitle": "Tiêu đề", "CommonEmptyContainerDescription": "Phần Chung chứa các tệp được quản trị viên cổng thông tin chia sẻ cho tất cả người dùng. Chỉ quản trị viên cổng thông tin mới có thể tạo ệp ở đó. Người dùng có thể được cấp toàn quyền truy cập vào một thư mục nhất định trong phần này. Bằng cách này họ sẽ có thể tạo/tải lên các tệp trong chính thư mục này.", diff --git a/packages/client/public/locales/zh-CN/Files.json b/packages/client/public/locales/zh-CN/Files.json index 95abb9da46..18e75140ed 100644 --- a/packages/client/public/locales/zh-CN/Files.json +++ b/packages/client/public/locales/zh-CN/Files.json @@ -4,7 +4,7 @@ "Archives": "归档", "BackToParentFolderButton": "返回父文件夹", "ByAuthor": "作者", - "ByCreationDate": "创建日期", + "ByCreation": "创建日期", "ByLastModifiedDate": "修改日期", "ByTitle": "标题", "CommonEmptyContainerDescription": "'Common'部分包含由门户管理员分享给所有用户的文件。仅门户管理员可在此处创建文件。用户将被授予该部分中特定文件夹的完整访问权限。这样其就能在该文件夹中创建/上传文件了。", diff --git a/packages/client/src/pages/Home/InfoPanel/Body/SingleItem.js b/packages/client/src/pages/Home/InfoPanel/Body/SingleItem.js index 99336e58ce..2869958ecf 100644 --- a/packages/client/src/pages/Home/InfoPanel/Body/SingleItem.js +++ b/packages/client/src/pages/Home/InfoPanel/Body/SingleItem.js @@ -163,7 +163,7 @@ const SingleItem = (props) => { }, { id: "ByCreationDate", - title: t("Files:ByCreationDate"), + title: t("Files:ByCreation"), content: styledText(parseAndFormatDate(item.created)), }, ]; diff --git a/packages/client/src/pages/Home/Section/Body/TableView/TableHeader.js b/packages/client/src/pages/Home/Section/Body/TableView/TableHeader.js index 7bcabec0d9..54fb2037c8 100644 --- a/packages/client/src/pages/Home/Section/Body/TableView/TableHeader.js +++ b/packages/client/src/pages/Home/Section/Body/TableView/TableHeader.js @@ -108,7 +108,7 @@ class FilesTableHeader extends React.Component { authorOption, { key: "Created", - title: t("ByCreationDate"), + title: t("ByCreation"), enable: true, resizable: true, sortBy: "DateAndTimeCreation", diff --git a/packages/client/src/pages/Home/Section/Filter/index.js b/packages/client/src/pages/Home/Section/Filter/index.js index 516cc1a8d3..3f28162bbe 100644 --- a/packages/client/src/pages/Home/Section/Filter/index.js +++ b/packages/client/src/pages/Home/Section/Filter/index.js @@ -802,7 +802,7 @@ const SectionFilterContent = ({ const size = { key: "Size", label: t("Common:Size"), default: true }; const creationDate = { key: "DateAndTimeCreation", - label: t("ByCreationDate"), + label: t("ByCreation"), default: true, }; const authorOption = { From 1ca5819e0f9604a0657fcc96c376ebc3c0ac2c88 Mon Sep 17 00:00:00 2001 From: TimofeyBoyko Date: Thu, 15 Sep 2022 14:05:51 +0300 Subject: [PATCH 50/87] Web:Client:Home: add new translation key 'ByCreationDate' for filter sort --- packages/client/public/locales/en/Files.json | 1 + packages/client/src/pages/Home/Section/Filter/index.js | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/packages/client/public/locales/en/Files.json b/packages/client/public/locales/en/Files.json index a64124679e..a7baf43bde 100644 --- a/packages/client/public/locales/en/Files.json +++ b/packages/client/public/locales/en/Files.json @@ -6,6 +6,7 @@ "BackToParentFolderButton": "Back to parent folder", "ByAuthor": "Author", "ByCreation": "Created", + "ByCreationDate": "Creation date", "ByLastModifiedDate": "Modified", "ByOwner": "Owner", "ByTitle": "Title", diff --git a/packages/client/src/pages/Home/Section/Filter/index.js b/packages/client/src/pages/Home/Section/Filter/index.js index 3f28162bbe..516cc1a8d3 100644 --- a/packages/client/src/pages/Home/Section/Filter/index.js +++ b/packages/client/src/pages/Home/Section/Filter/index.js @@ -802,7 +802,7 @@ const SectionFilterContent = ({ const size = { key: "Size", label: t("Common:Size"), default: true }; const creationDate = { key: "DateAndTimeCreation", - label: t("ByCreation"), + label: t("ByCreationDate"), default: true, }; const authorOption = { From fe9836206605ab6112eaae42854e107a45881492 Mon Sep 17 00:00:00 2001 From: TimofeyBoyko Date: Thu, 15 Sep 2022 14:07:02 +0300 Subject: [PATCH 51/87] Web:Client: change translation key 'ByLastModifiedDate' to 'ByLastModified' --- packages/client/public/locales/az/Files.json | 2 +- packages/client/public/locales/bg/Files.json | 2 +- packages/client/public/locales/cs/Files.json | 2 +- packages/client/public/locales/de/Files.json | 2 +- packages/client/public/locales/el-GR/Files.json | 2 +- packages/client/public/locales/en/Files.json | 2 +- packages/client/public/locales/es/Files.json | 2 +- packages/client/public/locales/fi/Files.json | 2 +- packages/client/public/locales/fr/Files.json | 2 +- packages/client/public/locales/hy-AM/Files.json | 2 +- packages/client/public/locales/it/Files.json | 2 +- packages/client/public/locales/ja-JP/Files.json | 2 +- packages/client/public/locales/ko-KR/Files.json | 2 +- packages/client/public/locales/lo-LA/Files.json | 2 +- packages/client/public/locales/lv/Files.json | 2 +- packages/client/public/locales/nl/Files.json | 2 +- packages/client/public/locales/pl/Files.json | 2 +- packages/client/public/locales/pt-BR/Files.json | 2 +- packages/client/public/locales/pt/Files.json | 2 +- packages/client/public/locales/ro/Files.json | 2 +- packages/client/public/locales/ru/Files.json | 2 +- packages/client/public/locales/sk/Files.json | 2 +- packages/client/public/locales/sl/Files.json | 2 +- packages/client/public/locales/tr/Files.json | 2 +- packages/client/public/locales/uk-UA/Files.json | 2 +- packages/client/public/locales/vi/Files.json | 2 +- packages/client/public/locales/zh-CN/Files.json | 2 +- packages/client/src/pages/Home/InfoPanel/Body/GalleryItem.js | 4 +--- packages/client/src/pages/Home/InfoPanel/Body/SingleItem.js | 2 +- .../src/pages/Home/Section/Body/TableView/TableHeader.js | 4 ++-- packages/client/src/pages/Home/Section/Filter/index.js | 2 +- 31 files changed, 32 insertions(+), 34 deletions(-) diff --git a/packages/client/public/locales/az/Files.json b/packages/client/public/locales/az/Files.json index 783357d26d..8e0acd6f2f 100644 --- a/packages/client/public/locales/az/Files.json +++ b/packages/client/public/locales/az/Files.json @@ -5,7 +5,7 @@ "BackToParentFolderButton": "Ana qovluğa qayıt", "ByAuthor": "Müəllif", "ByCreation": "Yaradıldı", - "ByLastModifiedDate": "Dəyişdirilib", + "ByLastModified": "Dəyişdirilib", "ByTitle": "Başlıq", "CommonEmptyContainerDescription": "'Ümumi' bölməsi portal inzibatçısı tərəfindən bütün istifadəçilərlə paylaşılan faylları ehtiva edir. Orada yalnız portal inzibatçıları fayl yarada bilər. İstifadəçilərə bölmə daxilində müəyyən bir qovluğa tam giriş verilə bilər. Bu şəkildə bu qovluqda fayllar yarada/yükləyə biləcəklər.", "ContainsSpecCharacter": "Başlıqda aşağıdakı simvollardan heç biri ola bilməz: *+: \"<>? |/ ", diff --git a/packages/client/public/locales/bg/Files.json b/packages/client/public/locales/bg/Files.json index dee29830d9..426029df3c 100644 --- a/packages/client/public/locales/bg/Files.json +++ b/packages/client/public/locales/bg/Files.json @@ -5,7 +5,7 @@ "BackToParentFolderButton": "Обратно към родителската папка", "ByAuthor": "Автор", "ByCreation": "Създаден", - "ByLastModifiedDate": "Модифициран", + "ByLastModified": "Модифициран", "ByTitle": "Заглавие", "CommonEmptyContainerDescription": "Разделът 'Често срещани' съдържа файлове, които са споделени с всички потребители от администратора на портала. Само администраторите на портала могат да създават файлове там. Потребителите могат да се сдобият с Пълен достъп до определена папка в рамките на раздела. По този начин те ще могат да създават/качват файлове във всяка папка.", "ContainsSpecCharacter": "Заглавието не може да съдържа някой от следните символи: *+:\"<>?|/", diff --git a/packages/client/public/locales/cs/Files.json b/packages/client/public/locales/cs/Files.json index 4693f3a78a..cfb55385ad 100644 --- a/packages/client/public/locales/cs/Files.json +++ b/packages/client/public/locales/cs/Files.json @@ -5,7 +5,7 @@ "BackToParentFolderButton": "Zpět do nadřazené složky", "ByAuthor": "Autor", "ByCreation": "Vytvořeno", - "ByLastModifiedDate": "Upraveno", + "ByLastModified": "Upraveno", "ByTitle": "Název", "CommonEmptyContainerDescription": "Sekce 'Sdílené' obsahuje soubory, které správce portálu sdílí se všemi uživateli. Soubory v ní mohou vytvářet pouze správci portálu. Uživatelům lze v rámci sekce udělit plný přístup k určité složce. Tímto způsobem budou moci vytvářet/nahrávat soubory právě v této složce. ", "ContainsSpecCharacter": "Název nesmí obsahovat žádný z následujících znaků: *+:\"<>?|/", diff --git a/packages/client/public/locales/de/Files.json b/packages/client/public/locales/de/Files.json index 1a69ac88e2..563e009710 100644 --- a/packages/client/public/locales/de/Files.json +++ b/packages/client/public/locales/de/Files.json @@ -5,7 +5,7 @@ "BackToParentFolderButton": "Zurück zum übergeordneten Ordner", "ByAuthor": "Verfasser", "ByCreation": "Erstellt", - "ByLastModifiedDate": "Verändert", + "ByLastModified": "Verändert", "ByTitle": "Titel", "CommonEmptyContainerDescription": "In gemeinsamen Dokumenten finden Sie Dateien, auf denen alle Benutzer Zugriff haben. Nur Portaladministratoren können dort Dateien erstellen. Benutzern kann der vollständigen Zugriff auf einen bestimmten Ordner innerhalb des Abschnitts erteilt werden. Dann können Sie Dateien in diesem Ordner erstellen / hochladen.", "ContainsSpecCharacter": "Der Titel darf diese Symbole nicht beinhalten: *+:\"<>?|/", diff --git a/packages/client/public/locales/el-GR/Files.json b/packages/client/public/locales/el-GR/Files.json index f7b26b3eb9..b999b20642 100644 --- a/packages/client/public/locales/el-GR/Files.json +++ b/packages/client/public/locales/el-GR/Files.json @@ -5,7 +5,7 @@ "BackToParentFolderButton": "Επιστροφή στον γονικό φάκελο", "ByAuthor": "Δημιουργός", "ByCreation": "Δημιουργήθηκε", - "ByLastModifiedDate": "Τροποποιήθηκε", + "ByLastModified": "Τροποποιήθηκε", "ByTitle": "Τίτλος", "CommonEmptyContainerDescription": "Η ενότητα «Κοινά» περιέχει αρχεία που μοιράζονται σε όλους τους χρήστες από τον διαχειριστή της πύλης. Μόνο οι διαχειριστές της πύλης μπορούν να δημιουργήσουν αρχεία εκεί. Οι χρήστες μπορούν να έχουν πλήρη πρόσβαση σε έναν συγκεκριμένο φάκελο εντός της ενότητας. Έτσι, θα μπορούν να δημιουργούν/μεταφορτώνουν αρχεία σε αυτόν τον φάκελο.", "ContainsSpecCharacter": "Ο τίτλος δεν μπορεί να περιέχει τους ακόλουθους χαρακτήρες: *+:\"<>?|/", diff --git a/packages/client/public/locales/en/Files.json b/packages/client/public/locales/en/Files.json index a7baf43bde..583da4a1dc 100644 --- a/packages/client/public/locales/en/Files.json +++ b/packages/client/public/locales/en/Files.json @@ -7,7 +7,7 @@ "ByAuthor": "Author", "ByCreation": "Created", "ByCreationDate": "Creation date", - "ByLastModifiedDate": "Modified", + "ByLastModified": "Modified", "ByOwner": "Owner", "ByTitle": "Title", "CollaborationRooms": "Collaboration", diff --git a/packages/client/public/locales/es/Files.json b/packages/client/public/locales/es/Files.json index 66d77a124d..b7d54a8b79 100644 --- a/packages/client/public/locales/es/Files.json +++ b/packages/client/public/locales/es/Files.json @@ -5,7 +5,7 @@ "BackToParentFolderButton": "Volver a la carpeta principal", "ByAuthor": "Autor", "ByCreation": "Creado", - "ByLastModifiedDate": "Modificado", + "ByLastModified": "Modificado", "ByTitle": "Título", "CommonEmptyContainerDescription": "La sección 'Documentos comunes' contiene archivos compartidos por el administrador del portal con todos los usuarios. Sólo los administradores del portal pueden crear archivos allí. Los usuarios pueden tener acceso completo a una determinada carpeta dentro de la sección. De esta manera podrán crear/subir archivos en esta misma carpeta. ", "ContainsSpecCharacter": "El título no puede contener ninguno de los siguientes caracteres: *+:\"<>?|/", diff --git a/packages/client/public/locales/fi/Files.json b/packages/client/public/locales/fi/Files.json index c315aee086..b43252b0c3 100644 --- a/packages/client/public/locales/fi/Files.json +++ b/packages/client/public/locales/fi/Files.json @@ -5,7 +5,7 @@ "BackToParentFolderButton": "Takaisin pääkansioon", "ByAuthor": "Tekijä", "ByCreation": "Luotu", - "ByLastModifiedDate": "Muokattu", + "ByLastModified": "Muokattu", "ByTitle": "Otsikko", "CommonEmptyContainerDescription": "’Yleinen’ -osio sisältää tiedostoja, jotka portaalin ylläpitäjä on jakanut kaikille käyttäjille. Vain portaalin ylläpitäjät voivat luoda tiedostoja sinne. Käyttäjille voidaan myöntää täysi käyttöoikeus tiettyyn osion kansioon. Tällä tavalla he voivat luoda/ladata tiedostoja juuri tähän kansioon. ", "ContainsSpecCharacter": "Otsikko ei voi sisältää mitään seuraavista merkeistä: *+: \"<>? |/", diff --git a/packages/client/public/locales/fr/Files.json b/packages/client/public/locales/fr/Files.json index 60c9201fc4..37e490f0f9 100644 --- a/packages/client/public/locales/fr/Files.json +++ b/packages/client/public/locales/fr/Files.json @@ -5,7 +5,7 @@ "BackToParentFolderButton": "Retour vers le dossier précédent", "ByAuthor": "Auteur", "ByCreation": "Créé", - "ByLastModifiedDate": "Modifié", + "ByLastModified": "Modifié", "ByTitle": "Titre", "CommonEmptyContainerDescription": "La section \"Documents Communs\" contient des fichiers partagés par l'administrateur du portail avec tous les utilisateurs. Seuls les administrateurs du portail peuvent y créer des fichiers. Les utilisateurs peuvent obtenir un accès complet à un certain dossier de la section. Ainsi, ils pourront créer/télécharger des fichiers dans ce même dossier. ", "ContainsSpecCharacter": "Le titre ne peut contenir aucun des caractères suivants : *+ :\"<>?|/", diff --git a/packages/client/public/locales/hy-AM/Files.json b/packages/client/public/locales/hy-AM/Files.json index 20712c6119..ae5dd764da 100644 --- a/packages/client/public/locales/hy-AM/Files.json +++ b/packages/client/public/locales/hy-AM/Files.json @@ -5,7 +5,7 @@ "BackToParentFolderButton": "Վերադառնալ ծնող պանակ", "ByAuthor": "Հեղինակ", "ByCreation": "Ստեղծված", - "ByLastModifiedDate": "Փոփոխված", + "ByLastModified": "Փոփոխված", "ByTitle": "Անվանում", "CommonEmptyContainerDescription": "'Ընդհանուր'բաժինը պարունակում է ֆայլեր, որոնք կայքէջի ադմինիստրատորի կողմից համօգտագործվում են բոլոր օգտատերերին: Միայն կայքէջի ադմինիստրատորները կարող են այնտեղ ֆայլեր ստեղծել։ Օգտագործողներին կարող է տրվել ամբողջական մուտք դեպի որոշակի պանակ այս բաժնում: Այս կերպ նրանք կկարողանան ստեղծել/վերբեռնել ֆայլեր հենց այս պանակում:", "ContainsSpecCharacter": "Վերնագիրը չի կարող պարունակել հետևյալ նիշերից որևէ մեկը՝ *+:\"<>?|/", diff --git a/packages/client/public/locales/it/Files.json b/packages/client/public/locales/it/Files.json index f3cb88c525..30eb8d44b7 100644 --- a/packages/client/public/locales/it/Files.json +++ b/packages/client/public/locales/it/Files.json @@ -5,7 +5,7 @@ "BackToParentFolderButton": "Vai alla cartella superiore", "ByAuthor": "Autore", "ByCreation": "Creato", - "ByLastModifiedDate": "Modificato", + "ByLastModified": "Modificato", "ByTitle": "Titolo", "CommonEmptyContainerDescription": "La sezione \"Comune\" contiene i file condivisi con tutti gli utenti di tipo amministratore del portale. Solo gli amministratori del portale possono creare file nel posto \"Comune\". Agli utenti può essere concesso l'accesso completo a una determinata cartella all'interno della sezione. In questo modo potranno creare / caricare file in questa stessa cartella.", "ContainsSpecCharacter": "Il titolo non può contenere nessuno dei seguenti caratteri: *+:\"<>?|/", diff --git a/packages/client/public/locales/ja-JP/Files.json b/packages/client/public/locales/ja-JP/Files.json index 091e8ce4db..f655117d36 100644 --- a/packages/client/public/locales/ja-JP/Files.json +++ b/packages/client/public/locales/ja-JP/Files.json @@ -5,7 +5,7 @@ "BackToParentFolderButton": "親フォルダに戻る", "ByAuthor": "作成者", "ByCreation": "作成", - "ByLastModifiedDate": "変更", + "ByLastModified": "変更", "ByTitle": "タイトル", "CommonEmptyContainerDescription": "「共通」セクションには、ポータル管理者が全ユーザに共有するファイルがあります。ここにファイルを作成できるのは、ポータル管理者のみです。ユーザーは、セクション内の特定のフォルダへのフルアクセスを許可することができます。この場合、ユーザーは、このフォルダにファイルを作成/アップロードすることができます。 ", "ContainsSpecCharacter": "タイトルには以下の文字*+:\"<>?|/は使用できません。", diff --git a/packages/client/public/locales/ko-KR/Files.json b/packages/client/public/locales/ko-KR/Files.json index e50798489d..a6bdd3618f 100644 --- a/packages/client/public/locales/ko-KR/Files.json +++ b/packages/client/public/locales/ko-KR/Files.json @@ -5,7 +5,7 @@ "BackToParentFolderButton": "상위 폴더로 돌아가기", "ByAuthor": "생성자", "ByCreation": "생성일", - "ByLastModifiedDate": "수정일", + "ByLastModified": "수정일", "ByTitle": "제목", "CommonEmptyContainerDescription": "'공통' 섹션은 포털 관리자에 의해 모든 사용자에게 공유된 파일을 포함합니다. 포털 관리자만 공통 섹션에 파일을 생성할 수 있습니다. 사용자는 해당 섹션 내 특정 폴더에 대한 전체 액세스 권한을 부여 받을 수 있습니다. 그리고 이러한 방식으로 해당 폴더에 파일을 생성/업로드할 수 있습니다.", "ContainsSpecCharacter": "제목에는 다음 문자가 포함될 수 없습니다: *+:\"<>?|/", diff --git a/packages/client/public/locales/lo-LA/Files.json b/packages/client/public/locales/lo-LA/Files.json index 0677f88707..41f250d713 100644 --- a/packages/client/public/locales/lo-LA/Files.json +++ b/packages/client/public/locales/lo-LA/Files.json @@ -5,7 +5,7 @@ "BackToParentFolderButton": "ກັບໄປທີ່ແຟ້ມຫຼັກ", "ByAuthor": "ຜູ້ຂຽນ", "ByCreation": "ສ້າງ", - "ByLastModifiedDate": "ແກ້ໄຂ", + "ByLastModified": "ແກ້ໄຂ", "ByTitle": "ຫົວຂໍ້", "CommonEmptyContainerDescription": "ສ່ວນ common 'ມີເອກະສານທີ່ແບ່ງປັນໃຫ້ຜູ້ຊົມໃຊ້ທັງໝົດ ໂດຍ Portal admin. ມີພຽງແຕ່ Portal ເປັນຜູ້ຮັບຮອງເທົ່ານັ້ນທີ່ສາມາດສ້າງເອກະສານຢູ່ບ່ອນນັ້ນ. ຜູ້ໃຊ້ສາມາດໄດ້ຮັບການອະນຸຍາດເຂົ້າເຖິງໂຟນເດີທີ່ແນ່ນອນພາຍໃນພາກສ່ວນໃດໜື່ງ. ວິທີນີ້ພວກເຂົາຈະສາມາດສ້າງ / ອັບໂຫລດເອກະສານໃນໂຟນເດີນັ້ນໄດ້.", "ContainsSpecCharacter": "ຫົວຂໍ້ບໍ່ສາມາດມີຕົວອັກສອນຕໍ່ໄປນີ້: * +: \"<>? | /", diff --git a/packages/client/public/locales/lv/Files.json b/packages/client/public/locales/lv/Files.json index 9405034dfa..d6673c9018 100644 --- a/packages/client/public/locales/lv/Files.json +++ b/packages/client/public/locales/lv/Files.json @@ -5,7 +5,7 @@ "BackToParentFolderButton": "Atpakaļ uz vecāku mapi", "ByAuthor": "Autors", "ByCreation": "Izveidots", - "ByLastModifiedDate": "Modificēts", + "ByLastModified": "Modificēts", "ByTitle": "Nosaukums", "CommonEmptyContainerDescription": "Sadaļā 'Kopējs' ir faili, kurus visiem lietotājiem ir kopīgojis portāla administrators. Failus tur var izveidot tikai portāla administratori. Lietotājiem var piešķirt pilnu piekļuvi noteiktai sadaļas mapei. Tādā veidā viņi varēs izveidot/augšupielādēt failus tieši šajā mapē. ", "ContainsSpecCharacter": "Nosaukumā nedrīkst būt neviena no šīm rakstzīmēm: *+:\"<>?|/", diff --git a/packages/client/public/locales/nl/Files.json b/packages/client/public/locales/nl/Files.json index 50ef7575df..925dd897df 100644 --- a/packages/client/public/locales/nl/Files.json +++ b/packages/client/public/locales/nl/Files.json @@ -5,7 +5,7 @@ "BackToParentFolderButton": "Terug naar bovenliggende map", "ByAuthor": "Auteur", "ByCreation": "Aangemaakt", - "ByLastModifiedDate": "Gewijzigd", + "ByLastModified": "Gewijzigd", "ByTitle": "Titel", "CommonEmptyContainerDescription": "'Algemene' sectie bevat bestanden die door de portaal beheerder worden gedeeld met alle gebruikers. Alleen portaal beheerders kunnen daar bestanden aanmaken. Gebruikers kunnen volledige toegang krijgen tot een bepaalde map binnen de sectie. Op deze manier kunnen ze bestanden maken/uploaden in deze map. ", "ContainsSpecCharacter": "De titel mag geen van de volgende tekens bevatten: *+:\"<>?|/", diff --git a/packages/client/public/locales/pl/Files.json b/packages/client/public/locales/pl/Files.json index 34088ee328..2eba1ff7da 100644 --- a/packages/client/public/locales/pl/Files.json +++ b/packages/client/public/locales/pl/Files.json @@ -5,7 +5,7 @@ "BackToParentFolderButton": "Wróć do folderu nadrzędnego", "ByAuthor": "Autor", "ByCreation": "Utworzono", - "ByLastModifiedDate": "Zmodyfikowano", + "ByLastModified": "Zmodyfikowano", "ByTitle": "Tytuł", "CommonEmptyContainerDescription": "Sekcja 'Wspólne' zawiera pliki udostępnione wszystkim użytkownikom przez administratora portalu. Tylko on może tworzyć w niej nowe pliki. Użytkownicy mogą uzyskać pełen dostęp do pewnych folderów znajdujących się w tej sekcji. Dzięki temu będą w stanie tworzyć/wgrywać w nich dowolne pliki. ", "ContainsSpecCharacter": "Tytuł nie może zawierać następujących znaków: *+:\"<>?|/", diff --git a/packages/client/public/locales/pt-BR/Files.json b/packages/client/public/locales/pt-BR/Files.json index 785db595a8..be1be6d21e 100644 --- a/packages/client/public/locales/pt-BR/Files.json +++ b/packages/client/public/locales/pt-BR/Files.json @@ -5,7 +5,7 @@ "BackToParentFolderButton": "Voltar para pasta principal", "ByAuthor": "Autor", "ByCreation": "Criado", - "ByLastModifiedDate": "Modificado", + "ByLastModified": "Modificado", "ByTitle": "Titulo", "CommonEmptyContainerDescription": "A seção 'Comum' contém arquivos compartilhados a todos os usuários pelo administrador do portal. Somente os administradores do portal podem criar arquivos lá. Os usuários podem ter acesso total a uma determinada pasta dentro da seção. Desta forma, eles poderão criar/enviar arquivos nesta mesma pasta.", "ContainsSpecCharacter": "O título não pode conter nenhum dos seguintes caracteres: *+:\"<>?|/", diff --git a/packages/client/public/locales/pt/Files.json b/packages/client/public/locales/pt/Files.json index 1ba6145c7d..27fe513ff1 100644 --- a/packages/client/public/locales/pt/Files.json +++ b/packages/client/public/locales/pt/Files.json @@ -5,7 +5,7 @@ "BackToParentFolderButton": "Voltar à pasta principal", "ByAuthor": "Autor", "ByCreation": "Criado", - "ByLastModifiedDate": "Modificado", + "ByLastModified": "Modificado", "ByTitle": "Titulo", "CommonEmptyContainerDescription": "A secção 'Comum' contém ficheiro partilhados a todos os utilizadores pelo administrador do portal. Apenas os administradores do portal podem criar lá ficheiros. Os utilizadores podem ter acesso total a uma determinada pasta dentro da secção. Desta forma, eles poderão criar/enviar ficheiros nesta mesma pasta.", "ContainsSpecCharacter": "O título não pode conter nenhum dos seguintes caracteres: *+:\"<>?|/", diff --git a/packages/client/public/locales/ro/Files.json b/packages/client/public/locales/ro/Files.json index 9f63de9a09..6ea8e02aa1 100644 --- a/packages/client/public/locales/ro/Files.json +++ b/packages/client/public/locales/ro/Files.json @@ -5,7 +5,7 @@ "BackToParentFolderButton": "Revenire la folderul părinte", "ByAuthor": "Autor", "ByCreation": "A fost creat la", - "ByLastModifiedDate": "Modificat", + "ByLastModified": "Modificat", "ByTitle": "Titlu", "CommonEmptyContainerDescription": "Secțiunea Comune conține fișiere partajate cu alți utilizatori de către administratorul portalului. Numai administratorii portalului pot crea fișiere acolo. Utilizatorii pot primi acces complet la un anumit dosar din secțiunea. În acest mod, utilizatorii pot crea/încărca fișiere în acest dosar.", "ContainsSpecCharacter": "Numele nu poate conține niciun din caractere următoare: *+:\"<>?|/ ", diff --git a/packages/client/public/locales/ru/Files.json b/packages/client/public/locales/ru/Files.json index 46635f38eb..3bf851de65 100644 --- a/packages/client/public/locales/ru/Files.json +++ b/packages/client/public/locales/ru/Files.json @@ -5,7 +5,7 @@ "BackToParentFolderButton": "Вернуться в папку на уровень выше", "ByAuthor": "Автор", "ByCreation": "Создан", - "ByLastModifiedDate": "Изменен", + "ByLastModified": "Изменен", "ByTitle": "Название", "CollaborationRooms": "Совместное редактирование", "CommonEmptyContainerDescription": "В разделе «Общие документы» отображаются все документы, которыми администратор портала предоставил общий доступ. Только администраторы портала могут создавать папки в этом разделе, но с предоставленным доступом пользователи портала также могут загружать свои файлы здесь. Перетащите файлы со своего компьютера сюда, чтобы загрузить их на свой портал еще проще.", diff --git a/packages/client/public/locales/sk/Files.json b/packages/client/public/locales/sk/Files.json index 9d5e1a2dbd..bedfcf2218 100644 --- a/packages/client/public/locales/sk/Files.json +++ b/packages/client/public/locales/sk/Files.json @@ -5,7 +5,7 @@ "BackToParentFolderButton": "Späť do nadradeného priečinka", "ByAuthor": "Autor", "ByCreation": "Vytvorené", - "ByLastModifiedDate": "Upravené", + "ByLastModified": "Upravené", "ByTitle": "Názov", "CommonEmptyContainerDescription": "Sekcia 'Spoločné' obsahuje súbory zdieľané všetkým používateľom správcom portálu. Súbory tam môžu vytvárať iba správcovia portálu. Používateľom môže byť udelený úplný prístup k určitému priečinku v rámci sekcie. Týmto spôsobom budú môcť vytvárať/nahrávať súbory práve do tohto priečinka.", "ContainsSpecCharacter": "Názov nemôže obsahovať žiadne z nasledujúcich znakov: *+:\"<>?|/", diff --git a/packages/client/public/locales/sl/Files.json b/packages/client/public/locales/sl/Files.json index 20fda76a80..8287df60cd 100644 --- a/packages/client/public/locales/sl/Files.json +++ b/packages/client/public/locales/sl/Files.json @@ -5,7 +5,7 @@ "BackToParentFolderButton": "Nazaj na starševsko mapo", "ByAuthor": "Avtor", "ByCreation": "Ustvarjeno", - "ByLastModifiedDate": "Popravljeno", + "ByLastModified": "Popravljeno", "ByTitle": "Naslov", "CommonEmptyContainerDescription": "'Skupen' razdelek vsebuje datoteke, ki jih skrbnik portala deli z vsemi uporabniki. Samo skrbniki portala lahko tam ustvarjajo datoteke. Uporabniki lahko dobijo popoln dostop do določene mape v razdelku. Tako bodo lahko ustvarili/naložili datoteke ravno v tej mapi. ", "ContainsSpecCharacter": "Naslov ne sme vsebovati nobenega od naslednjih znakov: *+:\"<>?|/", diff --git a/packages/client/public/locales/tr/Files.json b/packages/client/public/locales/tr/Files.json index d8a42bc685..34d9c5fe5f 100644 --- a/packages/client/public/locales/tr/Files.json +++ b/packages/client/public/locales/tr/Files.json @@ -5,7 +5,7 @@ "BackToParentFolderButton": "Üst klasöre geri dön", "ByAuthor": "Yazar", "ByCreation": "Oluşturuldu", - "ByLastModifiedDate": "Değiştirilmiş", + "ByLastModified": "Değiştirilmiş", "ByTitle": "Başlık", "CommonEmptyContainerDescription": "'Ortak' bölüm, portal yöneticisi tarafından tüm kullanıcılarla paylaşılan dosyaları içerir. Burada yalnızca portal yöneticileri dosya oluşturabilir. Bu bölüm içinde kullanıcılara belirli bir klasöre Tam erişim verilebilir. Bu şekilde, bu klasörde dosya oluşturabilecek/yükleyebileceklerdir.", "ContainsSpecCharacter": "Başlık şu karakterlerden herhangi birini içeremez:: *+:\"<>?|/", diff --git a/packages/client/public/locales/uk-UA/Files.json b/packages/client/public/locales/uk-UA/Files.json index 5bbd906e28..ed3be21db7 100644 --- a/packages/client/public/locales/uk-UA/Files.json +++ b/packages/client/public/locales/uk-UA/Files.json @@ -5,7 +5,7 @@ "BackToParentFolderButton": "Назад до батьківської папки", "ByAuthor": "Автор", "ByCreation": "Створено", - "ByLastModifiedDate": "Змінено", + "ByLastModified": "Змінено", "ByTitle": "Заголовок", "CommonEmptyContainerDescription": "Розділ \"Загальне\" містить файли, до яких адміністратор порталу надав доступ усім користувачам. Тільки адміністратори порталу можуть створювати тут файли. Користувачам може бути наданий повний доступ до певної папки в розділі. Це дозволить їм створювати файли в цій папці та передавати їх до неї.", "ContainsSpecCharacter": "Заголовок не може містити жодного з цих символів: *+:\"<>?|/", diff --git a/packages/client/public/locales/vi/Files.json b/packages/client/public/locales/vi/Files.json index 80d893d8ca..5330947d23 100644 --- a/packages/client/public/locales/vi/Files.json +++ b/packages/client/public/locales/vi/Files.json @@ -5,7 +5,7 @@ "BackToParentFolderButton": "Quay lại thư mục gốc", "ByAuthor": "Tác giả", "ByCreation": "Đã tạo", - "ByLastModifiedDate": "Đã sửa đổi", + "ByLastModified": "Đã sửa đổi", "ByTitle": "Tiêu đề", "CommonEmptyContainerDescription": "Phần Chung chứa các tệp được quản trị viên cổng thông tin chia sẻ cho tất cả người dùng. Chỉ quản trị viên cổng thông tin mới có thể tạo ệp ở đó. Người dùng có thể được cấp toàn quyền truy cập vào một thư mục nhất định trong phần này. Bằng cách này họ sẽ có thể tạo/tải lên các tệp trong chính thư mục này.", "ContainsSpecCharacter": "Tiêu đề không được chứa bất kỳ ký tự nào sau đây: *+:\"<>?|/", diff --git a/packages/client/public/locales/zh-CN/Files.json b/packages/client/public/locales/zh-CN/Files.json index 18e75140ed..42db798bf1 100644 --- a/packages/client/public/locales/zh-CN/Files.json +++ b/packages/client/public/locales/zh-CN/Files.json @@ -5,7 +5,7 @@ "BackToParentFolderButton": "返回父文件夹", "ByAuthor": "作者", "ByCreation": "创建日期", - "ByLastModifiedDate": "修改日期", + "ByLastModified": "修改日期", "ByTitle": "标题", "CommonEmptyContainerDescription": "'Common'部分包含由门户管理员分享给所有用户的文件。仅门户管理员可在此处创建文件。用户将被授予该部分中特定文件夹的完整访问权限。这样其就能在该文件夹中创建/上传文件了。", "ContainsSpecCharacter": "标题中不得包含任意以下字符:*+:\"<>?|/", diff --git a/packages/client/src/pages/Home/InfoPanel/Body/GalleryItem.js b/packages/client/src/pages/Home/InfoPanel/Body/GalleryItem.js index 6f504a9b29..b68f082cdd 100644 --- a/packages/client/src/pages/Home/InfoPanel/Body/GalleryItem.js +++ b/packages/client/src/pages/Home/InfoPanel/Body/GalleryItem.js @@ -56,9 +56,7 @@ const SingleItem = (props) => {
- - {t("Files:ByLastModifiedDate")} - + {t("Files:ByLastModified")} {parseAndFormatDate(selectedItem.attributes.updatedAt)} diff --git a/packages/client/src/pages/Home/InfoPanel/Body/SingleItem.js b/packages/client/src/pages/Home/InfoPanel/Body/SingleItem.js index 2869958ecf..1e1ac1d44f 100644 --- a/packages/client/src/pages/Home/InfoPanel/Body/SingleItem.js +++ b/packages/client/src/pages/Home/InfoPanel/Body/SingleItem.js @@ -148,7 +148,7 @@ const SingleItem = (props) => { }, { id: "ByLastModifiedDate", - title: t("Files:ByLastModifiedDate"), + title: t("Files:ByLastModified"), content: styledText(parseAndFormatDate(item.updated)), }, { diff --git a/packages/client/src/pages/Home/Section/Body/TableView/TableHeader.js b/packages/client/src/pages/Home/Section/Body/TableView/TableHeader.js index 54fb2037c8..847d212456 100644 --- a/packages/client/src/pages/Home/Section/Body/TableView/TableHeader.js +++ b/packages/client/src/pages/Home/Section/Body/TableView/TableHeader.js @@ -67,7 +67,7 @@ class FilesTableHeader extends React.Component { }, { key: "Activity", - title: t("ByLastModifiedDate"), + title: t("ByLastModified"), enable: true, resizable: true, sortBy: "DateAndTime", @@ -117,7 +117,7 @@ class FilesTableHeader extends React.Component { }, { key: "Modified", - title: t("ByLastModifiedDate"), + title: t("ByLastModified"), enable: true, resizable: true, sortBy: "DateAndTime", diff --git a/packages/client/src/pages/Home/Section/Filter/index.js b/packages/client/src/pages/Home/Section/Filter/index.js index 516cc1a8d3..1f5f5fb1c8 100644 --- a/packages/client/src/pages/Home/Section/Filter/index.js +++ b/packages/client/src/pages/Home/Section/Filter/index.js @@ -794,7 +794,7 @@ const SectionFilterContent = ({ const name = { key: "AZ", label: t("Common:Name"), default: true }; const modifiedDate = { key: "DateAndTime", - label: t("ByLastModifiedDate"), + label: t("ByLastModified"), default: true, }; From 8480a1f525b5c27d66a1e262f855ba6bf59827de Mon Sep 17 00:00:00 2001 From: TimofeyBoyko Date: Thu, 15 Sep 2022 14:08:18 +0300 Subject: [PATCH 52/87] Web:Client:Home: add new translation key 'ByLastModifiedDate' for filter sort --- packages/client/public/locales/en/Files.json | 1 + packages/client/src/pages/Home/Section/Filter/index.js | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/packages/client/public/locales/en/Files.json b/packages/client/public/locales/en/Files.json index 583da4a1dc..5adde17917 100644 --- a/packages/client/public/locales/en/Files.json +++ b/packages/client/public/locales/en/Files.json @@ -8,6 +8,7 @@ "ByCreation": "Created", "ByCreationDate": "Creation date", "ByLastModified": "Modified", + "ByLastModifiedDate": "Last modified", "ByOwner": "Owner", "ByTitle": "Title", "CollaborationRooms": "Collaboration", diff --git a/packages/client/src/pages/Home/Section/Filter/index.js b/packages/client/src/pages/Home/Section/Filter/index.js index 1f5f5fb1c8..516cc1a8d3 100644 --- a/packages/client/src/pages/Home/Section/Filter/index.js +++ b/packages/client/src/pages/Home/Section/Filter/index.js @@ -794,7 +794,7 @@ const SectionFilterContent = ({ const name = { key: "AZ", label: t("Common:Name"), default: true }; const modifiedDate = { key: "DateAndTime", - label: t("ByLastModified"), + label: t("ByLastModifiedDate"), default: true, }; From 4f3f32a3a767e18f8e6e073935abed762c3fbbcc Mon Sep 17 00:00:00 2001 From: TimofeyBoyko Date: Thu, 15 Sep 2022 14:14:24 +0300 Subject: [PATCH 53/87] Web:Client:Home: delete useless code from filter --- packages/client/src/pages/Home/Section/Filter/index.js | 3 +-- 1 file changed, 1 insertion(+), 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 516cc1a8d3..74e5cd22b8 100644 --- a/packages/client/src/pages/Home/Section/Filter/index.js +++ b/packages/client/src/pages/Home/Section/Filter/index.js @@ -19,7 +19,6 @@ import { withLayoutSize } from "@docspace/common/utils"; import { getDefaultRoomName } from "@docspace/client/src/helpers/filesUtils"; import withLoader from "../../../../HOCs/withLoader"; -import { toastr } from "@docspace/components"; import { TableVersions } from "SRC_DIR/helpers/constants"; const getFilterType = (filterValues) => { @@ -30,7 +29,7 @@ const getFilterType = (filterValues) => { "key" ); - return filterType ? (+filterType ? +filterType : filterType) : null; + return filterType ? +filterType : null; }; const getAuthorType = (filterValues) => { From 74fa95d843a2efdb830af67c16bbba15151e3c49 Mon Sep 17 00:00:00 2001 From: gopienkonikita Date: Thu, 15 Sep 2022 17:14:34 +0300 Subject: [PATCH 54/87] Web: Components: fixed styles of infinite tiles --- .../TilesView/sub-components/InfiniteGrid.js | 11 +++++----- .../infinite-loader/InfiniteLoader.js | 22 ++++++++++++++++--- .../infinite-loader/infiniteLoaderUtils.js | 21 ++++++++++++++++++ 3 files changed, 46 insertions(+), 8 deletions(-) create mode 100644 packages/components/infinite-loader/infiniteLoaderUtils.js diff --git a/packages/client/src/pages/Home/Section/Body/TilesView/sub-components/InfiniteGrid.js b/packages/client/src/pages/Home/Section/Body/TilesView/sub-components/InfiniteGrid.js index 0fe57b3960..0cf8f4f250 100644 --- a/packages/client/src/pages/Home/Section/Body/TilesView/sub-components/InfiniteGrid.js +++ b/packages/client/src/pages/Home/Section/Body/TilesView/sub-components/InfiniteGrid.js @@ -129,12 +129,11 @@ const InfiniteGrid = (props) => { }); const type = checkType(!!cards.length); - const otherClassName = type; if (hasMoreFiles) { // If cards elements are full, it will add the full line of loaders if (cards.length === countTilesInRow) { - addItemToList("loaded-row", otherClassName, true); + addItemToList("loaded-row", type, true); } // Added line of loaders @@ -143,17 +142,17 @@ const InfiniteGrid = (props) => { cards.push( ); } - addItemToList("loaded-row", otherClassName); + addItemToList("loaded-row", type); } else if (cards.length) { // Adds loaders until the row is full const listKey = uniqueid("list-item_"); - addItemToList(listKey, otherClassName); + addItemToList(listKey, type); } // console.log("InfiniteGrid render", list); @@ -184,6 +183,7 @@ export default inject( fetchMoreFiles, getCountTilesInRow, roomsFilterTotal, + isLoading, } = filesStore; const { isRoomsFolder, isArchiveFolder } = treeFoldersStore; @@ -199,6 +199,7 @@ export default inject( filesLength, getCountTilesInRow, selectedFolderId: selectedFolderStore.id, + isLoading, }; } )(observer(InfiniteGrid)); diff --git a/packages/components/infinite-loader/InfiniteLoader.js b/packages/components/infinite-loader/InfiniteLoader.js index 90efe12484..67f7998935 100644 --- a/packages/components/infinite-loader/InfiniteLoader.js +++ b/packages/components/infinite-loader/InfiniteLoader.js @@ -1,12 +1,16 @@ -import React from "react"; +import React, { useEffect } from "react"; import PropTypes from "prop-types"; import { isMobileOnly } from "react-device-detect"; import ListComponent from "./List"; import GridComponent from "./Grid"; import { isMobile } from "../utils/device"; +import Loader from "../loader"; +import { showLoader, hideLoader } from "./infiniteLoaderUtils"; const InfiniteLoaderComponent = (props) => { - const { viewAs } = props; + const { viewAs, isLoading } = props; + + useEffect(() => (isLoading ? showLoader() : hideLoader()), [isLoading]); const scroll = isMobileOnly ? document.querySelector("#customScrollBar > .scroll-body") @@ -16,7 +20,15 @@ const InfiniteLoaderComponent = (props) => { scroll.style.paddingRight = isMobile() ? "8px" : "17px"; } - return viewAs === "tile" ? ( + return isLoading ? ( + + ) : viewAs === "tile" ? ( ) : ( @@ -34,4 +46,8 @@ InfiniteLoaderComponent.propTypes = { onScroll: PropTypes.func, }; +InfiniteLoaderComponent.defaultProps = { + isLoading: false, +}; + export default InfiniteLoaderComponent; diff --git a/packages/components/infinite-loader/infiniteLoaderUtils.js b/packages/components/infinite-loader/infiniteLoaderUtils.js new file mode 100644 index 0000000000..64468785ba --- /dev/null +++ b/packages/components/infinite-loader/infiniteLoaderUtils.js @@ -0,0 +1,21 @@ +let timer = null; + +const startInterval = () => { + const elem = document.getElementById("infinite-page-loader"); + elem.style.display = "block"; +}; + +export function showLoader() { + hideLoader(); + timer = setTimeout(() => startInterval(), 300); +} + +export function hideLoader() { + if (timer) { + clearTimeout(timer); + timer = null; + } + + const elem = document.getElementById("infinite-page-loader"); + if (elem) elem.style.display = "none"; +} From 9af39bd7c9b41da99cefc702f6e99cb94991b379 Mon Sep 17 00:00:00 2001 From: gopienkonikita Date: Thu, 15 Sep 2022 17:16:19 +0300 Subject: [PATCH 55/87] Web: Files: fixed infinite loading --- packages/client/src/components/Article/Body/index.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/packages/client/src/components/Article/Body/index.js b/packages/client/src/components/Article/Body/index.js index ccc8d96845..b9c3796117 100644 --- a/packages/client/src/components/Article/Body/index.js +++ b/packages/client/src/components/Article/Body/index.js @@ -47,6 +47,8 @@ const ArticleBodyContent = (props) => { categoryType, isAdmin, filesIsLoading, + roomsFolderId, + archiveFolderId, } = props; const campaigns = (localStorage.getItem("campaigns") || "") @@ -65,8 +67,6 @@ const ArticleBodyContent = (props) => { homepage, history, - roomsFolderId, - archiveFolderId, } = props; if (filesIsLoading) return; @@ -144,7 +144,7 @@ const ArticleBodyContent = (props) => { }); } }, - [categoryType] + [categoryType, roomsFolderId, archiveFolderId] ); const onShowNewFilesPanel = React.useCallback((folderId) => { From 24ea0edf19b80ca462b00aa128ea795244cbdcc4 Mon Sep 17 00:00:00 2001 From: TimofeyBoyko Date: Thu, 15 Sep 2022 17:24:33 +0300 Subject: [PATCH 56/87] Web:Client:Home: add catch error if available sort is undefiened at filter --- .../src/pages/Home/Section/Filter/index.js | 26 +++++++++---------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/packages/client/src/pages/Home/Section/Filter/index.js b/packages/client/src/pages/Home/Section/Filter/index.js index 74e5cd22b8..d9f245510b 100644 --- a/packages/client/src/pages/Home/Section/Filter/index.js +++ b/packages/client/src/pages/Home/Section/Filter/index.js @@ -823,35 +823,35 @@ const SectionFilterContent = ({ if (viewAs === "table") { if (isRooms) { const availableSort = localStorage - .getItem(`${TABLE_ROOMS_COLUMNS}=${userId}`) - .split(","); + ?.getItem(`${TABLE_ROOMS_COLUMNS}=${userId}`) + ?.split(","); const infoPanelColumnsSize = localStorage ?.getItem(`${COLUMNS_ROOMS_SIZE_INFO_PANEL}=${userId}`) ?.split(" "); - if (availableSort.includes("Type")) { + if (availableSort?.includes("Type")) { const idx = availableSort.findIndex((x) => x === "Type"); const hide = infoPanelVisible && infoPanelColumnsSize[idx] === "0px"; !hide && commonOptions.push(roomType); } - if (availableSort.includes("Tags")) { + if (availableSort?.includes("Tags")) { const idx = availableSort.findIndex((x) => x === "Tags"); const hide = infoPanelVisible && infoPanelColumnsSize[idx] === "0px"; !hide && commonOptions.push(tags); } - if (availableSort.includes("Owner")) { + if (availableSort?.includes("Owner")) { const idx = availableSort.findIndex((x) => x === "Owner"); const hide = infoPanelVisible && infoPanelColumnsSize[idx] === "0px"; !hide && commonOptions.push(owner); } - if (availableSort.includes("Activity")) { + if (availableSort?.includes("Activity")) { const idx = availableSort.findIndex((x) => x === "Activity"); const hide = infoPanelVisible && infoPanelColumnsSize[idx] === "0px"; @@ -859,38 +859,38 @@ const SectionFilterContent = ({ } } else { const availableSort = localStorage - .getItem(`${TABLE_COLUMNS}=${userId}`) - .split(","); + ?.getItem(`${TABLE_COLUMNS}=${userId}`) + ?.split(","); const infoPanelColumnsSize = localStorage ?.getItem(`${COLUMNS_SIZE_INFO_PANEL}=${userId}`) ?.split(" "); - if (availableSort.includes("Author") && !isPersonalRoom) { + if (availableSort?.includes("Author") && !isPersonalRoom) { const idx = availableSort.findIndex((x) => x === "Author"); const hide = infoPanelVisible && infoPanelColumnsSize[idx] === "0px"; !hide && commonOptions.push(authorOption); } - if (availableSort.includes("Create")) { + if (availableSort?.includes("Create")) { const idx = availableSort.findIndex((x) => x === "Create"); const hide = infoPanelVisible && infoPanelColumnsSize[idx] === "0px"; !hide && commonOptions.push(creationDate); } - if (availableSort.includes("Modified")) { + if (availableSort?.includes("Modified")) { const idx = availableSort.findIndex((x) => x === "Modified"); const hide = infoPanelVisible && infoPanelColumnsSize[idx] === "0px"; !hide && commonOptions.push(modifiedDate); } - if (availableSort.includes("Size")) { + if (availableSort?.includes("Size")) { const idx = availableSort.findIndex((x) => x === "Size"); const hide = infoPanelVisible && infoPanelColumnsSize[idx] === "0px"; !hide && commonOptions.push(size); } - if (availableSort.includes("Type")) { + if (availableSort?.includes("Type")) { const idx = availableSort.findIndex((x) => x === "Type"); const hide = infoPanelVisible && infoPanelColumnsSize[idx] === "0px"; From afaa0db5c18d4346d4adf6fb8a3ee82d0018d5a3 Mon Sep 17 00:00:00 2001 From: TimofeyBoyko Date: Thu, 15 Sep 2022 17:29:48 +0300 Subject: [PATCH 57/87] Web:Client:Home: fix type for OFORM and DOCXF at table view --- .../Home/Section/Body/TableView/sub-components/TypeCell.js | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/packages/client/src/pages/Home/Section/Body/TableView/sub-components/TypeCell.js b/packages/client/src/pages/Home/Section/Body/TableView/sub-components/TypeCell.js index 1959312feb..23a954b7e0 100644 --- a/packages/client/src/pages/Home/Section/Body/TableView/sub-components/TypeCell.js +++ b/packages/client/src/pages/Home/Section/Body/TableView/sub-components/TypeCell.js @@ -22,6 +22,10 @@ const TypeCell = ({ t, item, sideColor }) => { return t("Presentation"); case FileType.Document: return t("Document"); + case FileType.OForm: + return t("Document"); + case FileType.OFormTemplate: + return t("Document"); default: return t("Folder"); From d21c9108429fe90787778c9225c57ba73db87b78 Mon Sep 17 00:00:00 2001 From: gopienkonikita Date: Thu, 15 Sep 2022 17:31:19 +0300 Subject: [PATCH 58/87] Web: Components: InfiniteLoader: removed useless selectedFolderId prop --- .../Body/RowsView/FilesRowContainer.js | 57 +++++++-------- .../Section/Body/TableView/TableContainer.js | 69 +++++++++---------- .../TilesView/sub-components/InfiniteGrid.js | 51 +++++++------- packages/components/infinite-loader/Grid.js | 5 -- packages/components/infinite-loader/List.js | 5 -- packages/components/row-container/index.js | 2 - .../components/table-container/TableBody.js | 2 - 7 files changed, 81 insertions(+), 110 deletions(-) diff --git a/packages/client/src/pages/Home/Section/Body/RowsView/FilesRowContainer.js b/packages/client/src/pages/Home/Section/Body/RowsView/FilesRowContainer.js index 68ee98a1f0..e896bb84bb 100644 --- a/packages/client/src/pages/Home/Section/Body/RowsView/FilesRowContainer.js +++ b/packages/client/src/pages/Home/Section/Body/RowsView/FilesRowContainer.js @@ -68,7 +68,6 @@ const FilesRowContainer = ({ fetchMoreFiles, hasMoreFiles, isRooms, - selectedFolderId, withPaging, }) => { useEffect(() => { @@ -95,7 +94,6 @@ const FilesRowContainer = ({ hasMoreFiles={hasMoreFiles} draggable useReactWindow={!withPaging} - selectedFolderId={selectedFolderId} itemHeight={58} > {filesList.map((item, index) => ( @@ -111,34 +109,31 @@ const FilesRowContainer = ({ ); }; -export default inject( - ({ filesStore, auth, treeFoldersStore, selectedFolderStore }) => { - const { - filesList, - viewAs, - setViewAs, - filterTotal, - fetchMoreFiles, - hasMoreFiles, - roomsFilterTotal, - } = filesStore; - const { isVisible: infoPanelVisible } = auth.infoPanelStore; - const { isRoomsFolder, isArchiveFolder } = treeFoldersStore; - const { withPaging } = auth.settingsStore; +export default inject(({ filesStore, auth, treeFoldersStore }) => { + const { + filesList, + viewAs, + setViewAs, + filterTotal, + fetchMoreFiles, + hasMoreFiles, + roomsFilterTotal, + } = filesStore; + const { isVisible: infoPanelVisible } = auth.infoPanelStore; + const { isRoomsFolder, isArchiveFolder } = treeFoldersStore; + const { withPaging } = auth.settingsStore; - const isRooms = isRoomsFolder || isArchiveFolder; + const isRooms = isRoomsFolder || isArchiveFolder; - return { - filesList, - viewAs, - setViewAs, - infoPanelVisible, - filterTotal: isRooms ? roomsFilterTotal : filterTotal, - fetchMoreFiles, - hasMoreFiles, - isRooms, - selectedFolderId: selectedFolderStore.id, - withPaging, - }; - } -)(observer(FilesRowContainer)); + return { + filesList, + viewAs, + setViewAs, + infoPanelVisible, + filterTotal: isRooms ? roomsFilterTotal : filterTotal, + fetchMoreFiles, + hasMoreFiles, + isRooms, + withPaging, + }; +})(observer(FilesRowContainer)); diff --git a/packages/client/src/pages/Home/Section/Body/TableView/TableContainer.js b/packages/client/src/pages/Home/Section/Body/TableView/TableContainer.js index 15cd0f43fa..8539a6d2a9 100644 --- a/packages/client/src/pages/Home/Section/Body/TableView/TableContainer.js +++ b/packages/client/src/pages/Home/Section/Body/TableView/TableContainer.js @@ -122,7 +122,6 @@ const Table = ({ hasMoreFiles, filterTotal, isRooms, - selectedFolderId, withPaging, }) => { const [tagCount, setTagCount] = React.useState(null); @@ -208,7 +207,6 @@ const Table = ({ useReactWindow={!withPaging} infoPanelVisible={infoPanelVisible} columnInfoPanelStorageName={columnInfoPanelStorageName} - selectedFolderId={selectedFolderId} itemHeight={49} > {filesList.map((item, index) => { @@ -250,43 +248,40 @@ const Table = ({ ); }; -export default inject( - ({ filesStore, treeFoldersStore, auth, selectedFolderStore }) => { - const { isVisible: infoPanelVisible } = auth.infoPanelStore; +export default inject(({ filesStore, treeFoldersStore, auth }) => { + const { isVisible: infoPanelVisible } = auth.infoPanelStore; - const { isRoomsFolder, isArchiveFolder } = treeFoldersStore; + const { isRoomsFolder, isArchiveFolder } = treeFoldersStore; - const isRooms = isRoomsFolder || isArchiveFolder; + const isRooms = isRoomsFolder || isArchiveFolder; - const { - filesList, - viewAs, - setViewAs, - setFirsElemChecked, - setHeaderBorder, - fetchMoreFiles, - hasMoreFiles, - filterTotal, - roomsFilterTotal, - } = filesStore; + const { + filesList, + viewAs, + setViewAs, + setFirsElemChecked, + setHeaderBorder, + fetchMoreFiles, + hasMoreFiles, + filterTotal, + roomsFilterTotal, + } = filesStore; - const { withPaging, theme } = auth.settingsStore; + const { withPaging, theme } = auth.settingsStore; - return { - filesList, - viewAs, - setViewAs, - setFirsElemChecked, - setHeaderBorder, - theme, - userId: auth.userStore.user.id, - infoPanelVisible, - fetchMoreFiles, - hasMoreFiles, - filterTotal: isRooms ? roomsFilterTotal : filterTotal, - isRooms, - selectedFolderId: selectedFolderStore.id, - withPaging, - }; - } -)(observer(Table)); + return { + filesList, + viewAs, + setViewAs, + setFirsElemChecked, + setHeaderBorder, + theme, + userId: auth.userStore.user.id, + infoPanelVisible, + fetchMoreFiles, + hasMoreFiles, + filterTotal: isRooms ? roomsFilterTotal : filterTotal, + isRooms, + withPaging, + }; +})(observer(Table)); diff --git a/packages/client/src/pages/Home/Section/Body/TilesView/sub-components/InfiniteGrid.js b/packages/client/src/pages/Home/Section/Body/TilesView/sub-components/InfiniteGrid.js index 0cf8f4f250..ff68a786ce 100644 --- a/packages/client/src/pages/Home/Section/Body/TilesView/sub-components/InfiniteGrid.js +++ b/packages/client/src/pages/Home/Section/Body/TilesView/sub-components/InfiniteGrid.js @@ -60,7 +60,6 @@ const InfiniteGrid = (props) => { filesLength, className, getCountTilesInRow, - selectedFolderId, ...rest } = props; @@ -166,7 +165,6 @@ const InfiniteGrid = (props) => { itemCount={hasMoreFiles ? list.length + 1 : list.length} loadMoreItems={fetchMoreFiles} className={`TileList ${className}`} - selectedFolderId={selectedFolderId} {...rest} > {list} @@ -174,32 +172,29 @@ const InfiniteGrid = (props) => { ); }; -export default inject( - ({ filesStore, selectedFolderStore, treeFoldersStore }) => { - const { - filesList, - hasMoreFiles, - filterTotal, - fetchMoreFiles, - getCountTilesInRow, - roomsFilterTotal, - isLoading, - } = filesStore; +export default inject(({ filesStore, treeFoldersStore }) => { + const { + filesList, + hasMoreFiles, + filterTotal, + fetchMoreFiles, + getCountTilesInRow, + roomsFilterTotal, + isLoading, + } = filesStore; - const { isRoomsFolder, isArchiveFolder } = treeFoldersStore; + const { isRoomsFolder, isArchiveFolder } = treeFoldersStore; - const filesLength = filesList.length; - const isRooms = isRoomsFolder || isArchiveFolder; + const filesLength = filesList.length; + const isRooms = isRoomsFolder || isArchiveFolder; - return { - filesList, - hasMoreFiles, - filterTotal: isRooms ? roomsFilterTotal : filterTotal, - fetchMoreFiles, - filesLength, - getCountTilesInRow, - selectedFolderId: selectedFolderStore.id, - isLoading, - }; - } -)(observer(InfiniteGrid)); + return { + filesList, + hasMoreFiles, + filterTotal: isRooms ? roomsFilterTotal : filterTotal, + fetchMoreFiles, + filesLength, + getCountTilesInRow, + isLoading, + }; +})(observer(InfiniteGrid)); diff --git a/packages/components/infinite-loader/Grid.js b/packages/components/infinite-loader/Grid.js index e610176ea0..a0f40a206b 100644 --- a/packages/components/infinite-loader/Grid.js +++ b/packages/components/infinite-loader/Grid.js @@ -12,14 +12,9 @@ const GridComponent = ({ children, className, scroll, - selectedFolderId, }) => { const loaderRef = createRef(); - useEffect(() => { - setTimeout(() => loaderRef?.current?.resetLoadMoreRowsCache(true), 1000); - }, [loaderRef, selectedFolderId, filesLength]); - const isItemLoaded = useCallback( ({ index }) => { return !hasMoreFiles || (index + 1) * countTilesInRow < filesLength; diff --git a/packages/components/infinite-loader/List.js b/packages/components/infinite-loader/List.js index a153152938..2e757c9eac 100644 --- a/packages/components/infinite-loader/List.js +++ b/packages/components/infinite-loader/List.js @@ -17,14 +17,9 @@ const ListComponent = ({ className, scroll, infoPanelVisible, - selectedFolderId, }) => { const loaderRef = createRef(); - useEffect(() => { - setTimeout(() => loaderRef?.current?.resetLoadMoreRowsCache(true), 1000); - }, [loaderRef, selectedFolderId, filesLength]); - const renderRow = ({ key, index, style }) => { const isLoaded = isItemLoaded({ index }); if (!isLoaded) return getLoader(style, key); diff --git a/packages/components/row-container/index.js b/packages/components/row-container/index.js index 54e504fe67..34cc2cf707 100644 --- a/packages/components/row-container/index.js +++ b/packages/components/row-container/index.js @@ -19,7 +19,6 @@ class RowContainer extends React.PureComponent { itemCount, fetchMoreFiles, hasMoreFiles, - selectedFolderId, } = this.props; return ( @@ -40,7 +39,6 @@ class RowContainer extends React.PureComponent { loadMoreItems={fetchMoreFiles} itemSize={itemHeight} onScroll={onScroll} - selectedFolderId={selectedFolderId} > {children} diff --git a/packages/components/table-container/TableBody.js b/packages/components/table-container/TableBody.js index a88fd17f1b..630a4d3eab 100644 --- a/packages/components/table-container/TableBody.js +++ b/packages/components/table-container/TableBody.js @@ -15,7 +15,6 @@ const TableBody = (props) => { useReactWindow, onScroll, infoPanelVisible, - selectedFolderId, } = props; return useReactWindow ? ( @@ -35,7 +34,6 @@ const TableBody = (props) => { itemSize={itemHeight} onScroll={onScroll} infoPanelVisible={infoPanelVisible} - selectedFolderId={selectedFolderId} > {children} From b557ad512790d849070950afdfd3f302f0a4bd8a Mon Sep 17 00:00:00 2001 From: TimofeyBoyko Date: Thu, 15 Sep 2022 17:35:41 +0300 Subject: [PATCH 59/87] Web:Client:Home: refactoring type cell at table view --- .../Home/Section/Body/TableView/sub-components/TypeCell.js | 2 -- 1 file changed, 2 deletions(-) diff --git a/packages/client/src/pages/Home/Section/Body/TableView/sub-components/TypeCell.js b/packages/client/src/pages/Home/Section/Body/TableView/sub-components/TypeCell.js index 23a954b7e0..580b0637b9 100644 --- a/packages/client/src/pages/Home/Section/Body/TableView/sub-components/TypeCell.js +++ b/packages/client/src/pages/Home/Section/Body/TableView/sub-components/TypeCell.js @@ -21,9 +21,7 @@ const TypeCell = ({ t, item, sideColor }) => { case FileType.Presentation: return t("Presentation"); case FileType.Document: - return t("Document"); case FileType.OForm: - return t("Document"); case FileType.OFormTemplate: return t("Document"); From ee27ad4437ee5e83027c939f5624c75e71461f72 Mon Sep 17 00:00:00 2001 From: Alexey Bannov Date: Thu, 15 Sep 2022 17:44:04 +0300 Subject: [PATCH 60/87] nlog: support target aws cloudfront. refactoring startup.cs. added applicationContext,integrationEventContext property --- common/ASC.Api.Core/ASC.Api.Core.csproj | 2 +- common/ASC.Api.Core/Core/BaseStartup.cs | 32 -------- .../ConfigurationManagerExtension.cs | 19 +++-- .../Extensions/HostBuilderExtension.cs | 10 ++- .../Extensions/ISetupBuilderExtension.cs | 67 ++++++++++++++++ common/ASC.Common/ASC.Common.csproj | 3 +- .../ASC.Common/Logging/Nlog/NLogSettings.cs | 5 +- ...StorageRequestedIntegrationEventHandler.cs | 19 +++-- common/ASC.Migration/Program.cs | 59 +++++++++++--- common/ASC.Migration/Startup.cs | 1 + common/services/ASC.ClearEvents/Program.cs | 51 ++++++++++-- .../ConfigurationManagerExtension.cs | 6 +- .../GlobalUsings.cs | 2 +- ...heldureRequestedIntegrationEventHandler.cs | 15 ++-- .../BackupRequestedIntegrationEventHandler.cs | 51 ++++++------ ...RestoreRequestedIntegrationEventHandler.cs | 33 ++++---- .../Program.cs | 78 ++++++++++++------- .../ConfigurationManagerExtension.cs | 4 +- .../services/ASC.Data.Backup/GlobalUsings.cs | 6 ++ common/services/ASC.Data.Backup/Program.cs | 63 +++++++++++---- common/services/ASC.Data.Backup/Startup.cs | 2 +- .../ConfigurationManagerExtension.cs | 6 +- ...dMethodRequestedIntegrationEventHandler.cs | 15 ++-- ...MessageRequestedIntegrationEventHandler.cs | 9 ++- common/services/ASC.Notify/Program.cs | 58 ++++++++++---- .../ConfigurationManagerExtension.cs | 6 +- common/services/ASC.Studio.Notify/Program.cs | 60 +++++++++++--- common/services/ASC.Studio.Notify/Startup.cs | 2 + .../ConfigurationManagerExtension.cs | 4 +- ...MessageRequestedIntegrationEventHandler.cs | 7 +- .../services/ASC.TelegramService/Program.cs | 58 ++++++++++---- .../ConfigurationManagerExtension.cs | 2 +- .../services/ASC.Webhooks.Service/Program.cs | 61 +++++++++++---- config/nlog.config | 65 +++++++++++----- .../ConfigurationManagerExtension.cs | 4 +- products/ASC.Files/Server/GlobalUsings.cs | 2 +- products/ASC.Files/Server/Program.cs | 70 +++++++++++++---- .../ConfigurationManagerExtension.cs | 10 +-- products/ASC.Files/Service/Program.cs | 55 ++++++++++--- ...umbnailRequestedIntegrationEventHandler.cs | 25 +++--- products/ASC.People/Server/Program.cs | 59 +++++++++++--- web/ASC.Web.Api/Program.cs | 59 +++++++++++--- web/ASC.Web.Studio/Program.cs | 59 +++++++++++--- 43 files changed, 880 insertions(+), 344 deletions(-) create mode 100644 common/ASC.Api.Core/Extensions/ISetupBuilderExtension.cs diff --git a/common/ASC.Api.Core/ASC.Api.Core.csproj b/common/ASC.Api.Core/ASC.Api.Core.csproj index e9697161c6..f9bd664cde 100644 --- a/common/ASC.Api.Core/ASC.Api.Core.csproj +++ b/common/ASC.Api.Core/ASC.Api.Core.csproj @@ -21,7 +21,7 @@ - + diff --git a/common/ASC.Api.Core/Core/BaseStartup.cs b/common/ASC.Api.Core/Core/BaseStartup.cs index 276446c7fe..11f27a5646 100644 --- a/common/ASC.Api.Core/Core/BaseStartup.cs +++ b/common/ASC.Api.Core/Core/BaseStartup.cs @@ -273,35 +273,3 @@ public abstract class BaseStartup } } -public static class LogNLogConfigureExtenstion -{ - private static LoggingConfiguration GetXmlLoggingConfiguration(IHostEnvironment hostEnvironment, IConfiguration configuration) - { - var loggerConfiguration = new XmlLoggingConfiguration(CrossPlatform.PathCombine(configuration["pathToConf"], "nlog.config")); - - var settings = new ConfigurationExtension(configuration).GetSetting("log"); - - if (!string.IsNullOrEmpty(settings.Name)) - { - loggerConfiguration.Variables["name"] = settings.Name; - } - - if (!string.IsNullOrEmpty(settings.Dir)) - { - var dir = Path.IsPathRooted(settings.Dir) ? settings.Dir : CrossPlatform.PathCombine(hostEnvironment.ContentRootPath, settings.Dir); - loggerConfiguration.Variables["dir"] = dir.TrimEnd('/').TrimEnd('\\') + Path.DirectorySeparatorChar; - } - - return loggerConfiguration; - } - - public static IHostBuilder ConfigureNLogLogging(this IHostBuilder hostBuilder) - { - return hostBuilder.ConfigureLogging((hostBuildexContext, r) => - { - LogManager.ThrowConfigExceptions = false; - - r.AddNLog(GetXmlLoggingConfiguration(hostBuildexContext.HostingEnvironment, hostBuildexContext.Configuration)); - }); - } -} \ No newline at end of file diff --git a/common/ASC.Api.Core/Extensions/ConfigurationManagerExtension.cs b/common/ASC.Api.Core/Extensions/ConfigurationManagerExtension.cs index b2bb51eac4..79df0e4421 100644 --- a/common/ASC.Api.Core/Extensions/ConfigurationManagerExtension.cs +++ b/common/ASC.Api.Core/Extensions/ConfigurationManagerExtension.cs @@ -47,16 +47,15 @@ public static class ConfigurationManagerExtension {"pathToConf", path } }); - config.AddJsonFile("appsettings.json") - .AddJsonFile($"appsettings.{env.EnvironmentName}.json", true) - .AddJsonFile("storage.json") - .AddJsonFile("kafka.json") - .AddJsonFile($"kafka.{env.EnvironmentName}.json", true) - .AddJsonFile("rabbitmq.json") - .AddJsonFile($"rabbitmq.{env.EnvironmentName}.json", true) - .AddJsonFile("redis.json") - .AddJsonFile($"redis.{env.EnvironmentName}.json", true); - + config.AddJsonFile("appsettings.json", optional: false, reloadOnChange: true) + .AddJsonFile($"appsettings.{env.EnvironmentName}.json", optional: true, reloadOnChange: true) + .AddJsonFile("storage.json", optional: false, reloadOnChange: true) + .AddJsonFile("kafka.json", optional: true, reloadOnChange: true) + .AddJsonFile($"kafka.{env.EnvironmentName}.json", optional: true, reloadOnChange: true) + .AddJsonFile("rabbitmq.json", optional: true, reloadOnChange: true) + .AddJsonFile($"rabbitmq.{env.EnvironmentName}.json", optional: true, reloadOnChange: true) + .AddJsonFile("redis.json", optional: true, reloadOnChange: true) + .AddJsonFile($"redis.{env.EnvironmentName}.json", optional: true, reloadOnChange: true); return config; } diff --git a/common/ASC.Api.Core/Extensions/HostBuilderExtension.cs b/common/ASC.Api.Core/Extensions/HostBuilderExtension.cs index 22d2bdd935..0cd027aed3 100644 --- a/common/ASC.Api.Core/Extensions/HostBuilderExtension.cs +++ b/common/ASC.Api.Core/Extensions/HostBuilderExtension.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 NLog.Web; + namespace ASC.Api.Core.Extensions; public static class HostBuilderExtension @@ -33,8 +35,10 @@ public static class HostBuilderExtension hostBuilder.UseSystemd(); hostBuilder.UseWindowsService(); hostBuilder.UseServiceProviderFactory(new AutofacServiceProviderFactory()); - hostBuilder.ConfigureNLogLogging(); - + hostBuilder.UseNLog(); + return hostBuilder; - } + } + + } \ No newline at end of file diff --git a/common/ASC.Api.Core/Extensions/ISetupBuilderExtension.cs b/common/ASC.Api.Core/Extensions/ISetupBuilderExtension.cs new file mode 100644 index 0000000000..71812f914e --- /dev/null +++ b/common/ASC.Api.Core/Extensions/ISetupBuilderExtension.cs @@ -0,0 +1,67 @@ +// (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 + +using NLog.AWS.Logger; + +namespace ASC.Api.Core.Extensions; +public static class ISetupBuilderExtension +{ + public static ISetupBuilder LoadConfiguration(this ISetupBuilder loggingBuilder, IConfiguration configuration, IHostEnvironment hostEnvironment) + { + var conf = new XmlLoggingConfiguration(CrossPlatform.PathCombine(configuration["pathToConf"], "nlog.config")); + + var settings = new ConfigurationExtension(configuration).GetSetting("log"); + + if (!string.IsNullOrEmpty(settings.Name)) + { + conf.Variables["name"] = settings.Name; + } + + if (!string.IsNullOrEmpty(settings.Dir)) + { + var dir = Path.IsPathRooted(settings.Dir) ? settings.Dir : CrossPlatform.PathCombine(hostEnvironment.ContentRootPath, settings.Dir); + conf.Variables["dir"] = dir.TrimEnd('/').TrimEnd('\\') + Path.DirectorySeparatorChar; + } + + if (!string.IsNullOrEmpty(settings.AWSSecretAccessKey)) + { + foreach (var targetName in new[] { "aws", "aws_sql" }) + { + var awsTarget = conf.FindTargetByName(targetName); + + //hack + if (!string.IsNullOrEmpty(settings.Name)) + { + awsTarget.LogGroup = awsTarget.LogGroup.Replace("${var:name}", settings.Name); + } + + awsTarget.Credentials = new Amazon.Runtime.BasicAWSCredentials(settings.AWSAccessKeyId, settings.AWSSecretAccessKey); + } + } + + return loggingBuilder.LoadConfiguration(conf); + } +} \ No newline at end of file diff --git a/common/ASC.Common/ASC.Common.csproj b/common/ASC.Common/ASC.Common.csproj index 6620124d33..b458cb5543 100644 --- a/common/ASC.Common/ASC.Common.csproj +++ b/common/ASC.Common/ASC.Common.csproj @@ -29,6 +29,7 @@ + @@ -54,7 +55,7 @@ all runtime; build; native; contentfiles; analyzers; buildtransitive --> - + diff --git a/common/ASC.Common/Logging/Nlog/NLogSettings.cs b/common/ASC.Common/Logging/Nlog/NLogSettings.cs index aaa5b469fc..86b5b5aede 100644 --- a/common/ASC.Common/Logging/Nlog/NLogSettings.cs +++ b/common/ASC.Common/Logging/Nlog/NLogSettings.cs @@ -30,5 +30,8 @@ namespace ASC.Common.Logging; public class NLogSettings { public string Name { get; set; } - public string Dir { get; set; } + public string Dir { get; set; } + public string AWSAccessKeyId { get; set; } + public string AWSSecretAccessKey {get; set;} + } diff --git a/common/ASC.Data.Storage/Encryption/IntegrationEvents/EventHandling/EncryptionDataStorageRequestedIntegrationEventHandler.cs b/common/ASC.Data.Storage/Encryption/IntegrationEvents/EventHandling/EncryptionDataStorageRequestedIntegrationEventHandler.cs index 1c11556782..f2dd57cef3 100644 --- a/common/ASC.Data.Storage/Encryption/IntegrationEvents/EventHandling/EncryptionDataStorageRequestedIntegrationEventHandler.cs +++ b/common/ASC.Data.Storage/Encryption/IntegrationEvents/EventHandling/EncryptionDataStorageRequestedIntegrationEventHandler.cs @@ -24,25 +24,32 @@ // 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.EventBus.Log; + namespace ASC.Notify.IntegrationEvents.EventHandling; [Scope] public class EncryptionDataStorageRequestedIntegrationEventHandler : IIntegrationEventHandler { + private readonly ILogger _logger; private readonly EncryptionWorker _encryptionWorker; - - public EncryptionDataStorageRequestedIntegrationEventHandler(EncryptionWorker encryptionWorker) + + public EncryptionDataStorageRequestedIntegrationEventHandler(EncryptionWorker encryptionWorker, + ILogger logger) { _encryptionWorker = encryptionWorker; + _logger = logger; } public async Task Handle(EncryptionDataStorageRequestedIntegration @event) { +// using (_logger.BeginScope(new[] { new KeyValuePair("integrationEventContext", $"{@event.Id}-{Program.AppName}") })) + // { + // _logger.InformationHandlingIntegrationEvent(@event.Id, Program.AppName, @event); - // _logger.InformationHandlingIntegrationEvent(@event.Id, Program.AppName, @event); + _encryptionWorker.Start(@event.EncryptionSettings, @event.ServerRootPath); - _encryptionWorker.Start(@event.EncryptionSettings, @event.ServerRootPath); - - await Task.CompletedTask; + await Task.CompletedTask; + // } } } \ No newline at end of file diff --git a/common/ASC.Migration/Program.cs b/common/ASC.Migration/Program.cs index 3314139872..b091fad474 100644 --- a/common/ASC.Migration/Program.cs +++ b/common/ASC.Migration/Program.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 NLog; + var options = new WebApplicationOptions { Args = args, @@ -32,24 +34,57 @@ var options = new WebApplicationOptions var builder = WebApplication.CreateBuilder(options); -builder.Host.ConfigureDefault(); builder.Configuration.AddDefaultConfiguration(builder.Environment) .AddEnvironmentVariables() .AddCommandLine(args); -builder.WebHost.ConfigureDefaultKestrel(); +var logger = NLog.LogManager.Setup() + .SetupExtensions(s => + { + s.RegisterLayoutRenderer("application-context", (logevent) => Program.AppName); + }) + .LoadConfiguration(builder.Configuration, builder.Environment) + .GetLogger(typeof(Startup).Namespace); -var startup = new Startup(builder.Configuration, builder.Environment); - -startup.ConfigureServices(builder.Services); - -builder.Host.ConfigureContainer(containerBuilder => +try { - startup.ConfigureContainer(containerBuilder); -}); + logger.Info("Configuring web host ({applicationContext})...", Program.AppName); + builder.Host.ConfigureDefault(); + builder.WebHost.ConfigureDefaultKestrel(); -var app = builder.Build(); + var startup = new Startup(builder.Configuration, builder.Environment); -startup.Configure(app, app.Environment); + startup.ConfigureServices(builder.Services); -await app.RunWithTasksAsync(); \ No newline at end of file + builder.Host.ConfigureContainer(containerBuilder => + { + startup.ConfigureContainer(containerBuilder); + }); + + var app = builder.Build(); + + startup.Configure(app, app.Environment); + + logger.Info("Starting web host ({applicationContext})...", Program.AppName); + await app.RunWithTasksAsync(); +} +catch (Exception ex) +{ + if (logger != null) + { + logger.Error(ex, "Program terminated unexpectedly ({applicationContext})!", Program.AppName); + } + + throw; +} +finally +{ + // Ensure to flush and stop internal timers/threads before application-exit (Avoid segmentation fault on Linux) + NLog.LogManager.Shutdown(); +} + +public partial class Program +{ + public static string Namespace = typeof(Startup).Namespace; + public static string AppName = Namespace.Substring(Namespace.LastIndexOf('.') + 1); +} \ No newline at end of file diff --git a/common/ASC.Migration/Startup.cs b/common/ASC.Migration/Startup.cs index c89739e76b..5025a551e0 100644 --- a/common/ASC.Migration/Startup.cs +++ b/common/ASC.Migration/Startup.cs @@ -24,6 +24,7 @@ // 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.Migration.Core; public class Startup : BaseStartup { diff --git a/common/services/ASC.ClearEvents/Program.cs b/common/services/ASC.ClearEvents/Program.cs index f6fc00de27..fd0150a435 100644 --- a/common/services/ASC.ClearEvents/Program.cs +++ b/common/services/ASC.ClearEvents/Program.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 NLog; + var options = new WebApplicationOptions { Args = args, @@ -32,19 +34,52 @@ var options = new WebApplicationOptions var builder = WebApplication.CreateBuilder(options); -builder.Host.ConfigureDefault(); builder.Configuration.AddDefaultConfiguration(builder.Environment) .AddEnvironmentVariables() .AddCommandLine(args); -builder.Services.AddClearEventsServices(); +var logger = NLog.LogManager.Setup() + .SetupExtensions(s => + { + s.RegisterLayoutRenderer("application-context", (logevent) => Program.AppName); + }) + .LoadConfiguration(builder.Configuration, builder.Environment) + .GetLogger("ASC.ClearEvents"); - -builder.Host.ConfigureContainer((context, builder) => +try { - builder.Register(context.Configuration, false, false); -}); + logger.Info("Configuring web host ({applicationContext})...", Program.AppName); + builder.Host.ConfigureDefault(); + builder.Services.AddClearEventsServices(); -var app = builder.Build(); + builder.Host.ConfigureContainer((context, builder) => + { + builder.Register(context.Configuration, false, false); + }); + + var app = builder.Build(); + + logger.Info("Starting web host ({applicationContext})...", Program.AppName); + await app.RunWithTasksAsync(); +} +catch (Exception ex) +{ + if (logger != null) + { + logger.Error(ex, "Program terminated unexpectedly ({applicationContext})!", Program.AppName); + } + + throw; +} +finally +{ + // Ensure to flush and stop internal timers/threads before application-exit (Avoid segmentation fault on Linux) + NLog.LogManager.Shutdown(); +} + +public partial class Program +{ + public static string Namespace = "ASC.ClearEvents"; + public static string AppName = Namespace.Substring(Namespace.LastIndexOf('.') + 1); +} -await app.RunWithTasksAsync(); \ No newline at end of file diff --git a/common/services/ASC.Data.Backup.BackgroundTasks/Extensions/ConfigurationManagerExtension.cs b/common/services/ASC.Data.Backup.BackgroundTasks/Extensions/ConfigurationManagerExtension.cs index 9c668e9405..cda1f0ab1a 100644 --- a/common/services/ASC.Data.Backup.BackgroundTasks/Extensions/ConfigurationManagerExtension.cs +++ b/common/services/ASC.Data.Backup.BackgroundTasks/Extensions/ConfigurationManagerExtension.cs @@ -32,9 +32,9 @@ public static class ConfigurationManagerExtension this ConfigurationManager config, IHostEnvironment env) { - config.AddJsonFile("notify.json") - .AddJsonFile($"notify.{env.EnvironmentName}.json", true) - .AddJsonFile("backup.json"); + config.AddJsonFile("notify.json", optional: false, reloadOnChange: true) + .AddJsonFile($"notify.{env.EnvironmentName}.json", optional: true, reloadOnChange: true) + .AddJsonFile("backup.json", optional: false, reloadOnChange: true); return config; } diff --git a/common/services/ASC.Data.Backup.BackgroundTasks/GlobalUsings.cs b/common/services/ASC.Data.Backup.BackgroundTasks/GlobalUsings.cs index a8ebb0ca17..f2ee65fb7d 100644 --- a/common/services/ASC.Data.Backup.BackgroundTasks/GlobalUsings.cs +++ b/common/services/ASC.Data.Backup.BackgroundTasks/GlobalUsings.cs @@ -62,5 +62,5 @@ global using Microsoft.Extensions.DependencyInjection; global using Microsoft.Extensions.Hosting; global using Microsoft.Extensions.Hosting.WindowsServices; global using Microsoft.Extensions.Logging; - global using Newtonsoft.Json; +global using ASC.Data.Backup.Extension; diff --git a/common/services/ASC.Data.Backup.BackgroundTasks/IntegrationEvents/EventHandling/BackupDeleteScheldureRequestedIntegrationEventHandler.cs b/common/services/ASC.Data.Backup.BackgroundTasks/IntegrationEvents/EventHandling/BackupDeleteScheldureRequestedIntegrationEventHandler.cs index 78409e5268..e0708f885e 100644 --- a/common/services/ASC.Data.Backup.BackgroundTasks/IntegrationEvents/EventHandling/BackupDeleteScheldureRequestedIntegrationEventHandler.cs +++ b/common/services/ASC.Data.Backup.BackgroundTasks/IntegrationEvents/EventHandling/BackupDeleteScheldureRequestedIntegrationEventHandler.cs @@ -41,11 +41,14 @@ public class BackupDeleteScheldureRequestedIntegrationEventHandler : IIntegratio } public async Task Handle(IntegrationEvent @event) - { - _logger.InformationHandlingIntegrationEvent(@event.Id, Program.AppName, @event); - - _backupService.DeleteSchedule(@event.TenantId); - - await Task.CompletedTask; + { + using (_logger.BeginScope(new[] { new KeyValuePair("integrationEventContext", $"{@event.Id}-{Program.AppName}") })) + { + _logger.InformationHandlingIntegrationEvent(@event.Id, Program.AppName, @event); + + _backupService.DeleteSchedule(@event.TenantId); + + await Task.CompletedTask; + } } } \ No newline at end of file diff --git a/common/services/ASC.Data.Backup.BackgroundTasks/IntegrationEvents/EventHandling/BackupRequestedIntegrationEventHandler.cs b/common/services/ASC.Data.Backup.BackgroundTasks/IntegrationEvents/EventHandling/BackupRequestedIntegrationEventHandler.cs index b29b9397f0..ebec485bab 100644 --- a/common/services/ASC.Data.Backup.BackgroundTasks/IntegrationEvents/EventHandling/BackupRequestedIntegrationEventHandler.cs +++ b/common/services/ASC.Data.Backup.BackgroundTasks/IntegrationEvents/EventHandling/BackupRequestedIntegrationEventHandler.cs @@ -54,36 +54,39 @@ public class BackupRequestedIntegrationEventHandler : IIntegrationEventHandler("integrationEventContext", $"{@event.Id}-{Program.AppName}") })) { - if (_backupWorker.IsInstanceTooBusy()) + _logger.InformationHandlingIntegrationEvent(@event.Id, Program.AppName, @event); + + if (!@event.Redelivered) { - throw new IntegrationEventRejectExeption(@event.Id); + if (_backupWorker.IsInstanceTooBusy()) + { + throw new IntegrationEventRejectExeption(@event.Id); + } } - } - _tenantManager.SetCurrentTenant(@event.TenantId); - _securityContext.AuthenticateMeWithoutCookie(_authManager.GetAccountByID(@event.TenantId, @event.CreateBy)); + _tenantManager.SetCurrentTenant(@event.TenantId); + _securityContext.AuthenticateMeWithoutCookie(_authManager.GetAccountByID(@event.TenantId, @event.CreateBy)); - if (@event.IsScheduled) - { - _backupWorker.StartScheduledBackup(new EF.Model.BackupSchedule + if (@event.IsScheduled) { - BackupMail = @event.BackupMail, - BackupsStored = @event.BackupsStored, - StorageBasePath = @event.StorageBasePath, - StorageParams = JsonConvert.SerializeObject(@event.StorageParams), - StorageType = @event.StorageType, - TenantId = @event.TenantId - }); - } - else - { - _backupAjaxHandler.StartBackup(@event.StorageType, @event.StorageParams, @event.BackupMail); - } + _backupWorker.StartScheduledBackup(new EF.Model.BackupSchedule + { + BackupMail = @event.BackupMail, + BackupsStored = @event.BackupsStored, + StorageBasePath = @event.StorageBasePath, + StorageParams = JsonConvert.SerializeObject(@event.StorageParams), + StorageType = @event.StorageType, + TenantId = @event.TenantId + }); + } + else + { + _backupAjaxHandler.StartBackup(@event.StorageType, @event.StorageParams, @event.BackupMail); + } - await Task.CompletedTask; + await Task.CompletedTask; + } } } \ No newline at end of file diff --git a/common/services/ASC.Data.Backup.BackgroundTasks/IntegrationEvents/EventHandling/BackupRestoreRequestedIntegrationEventHandler.cs b/common/services/ASC.Data.Backup.BackgroundTasks/IntegrationEvents/EventHandling/BackupRestoreRequestedIntegrationEventHandler.cs index cf8285f4e7..ec09069baa 100644 --- a/common/services/ASC.Data.Backup.BackgroundTasks/IntegrationEvents/EventHandling/BackupRestoreRequestedIntegrationEventHandler.cs +++ b/common/services/ASC.Data.Backup.BackgroundTasks/IntegrationEvents/EventHandling/BackupRestoreRequestedIntegrationEventHandler.cs @@ -54,24 +54,27 @@ public class BackupRestoreRequestedIntegrationEventHandler : IIntegrationEventHa public async Task Handle(BackupRestoreRequestIntegrationEvent @event) { - _logger.InformationHandlingIntegrationEvent(@event.Id, Program.AppName, @event); - - if (!@event.Redelivered) + using (_logger.BeginScope(new[] { new KeyValuePair("integrationEventContext", $"{@event.Id}-{Program.AppName}") })) { - if (_backupWorker.IsInstanceTooBusy()) + _logger.InformationHandlingIntegrationEvent(@event.Id, Program.AppName, @event); + + if (!@event.Redelivered) { - throw new IntegrationEventRejectExeption(@event.Id); + if (_backupWorker.IsInstanceTooBusy()) + { + throw new IntegrationEventRejectExeption(@event.Id); + } } + + _tenantManager.SetCurrentTenant(@event.TenantId); + _securityContext.AuthenticateMeWithoutCookie(_authManager.GetAccountByID(@event.TenantId, @event.CreateBy)); + + _backupAjaxHandler.StartRestore(@event.BackupId, + @event.StorageType, + @event.StorageParams, + @event.Notify); + + await Task.CompletedTask; } - - _tenantManager.SetCurrentTenant(@event.TenantId); - _securityContext.AuthenticateMeWithoutCookie(_authManager.GetAccountByID(@event.TenantId, @event.CreateBy)); - - _backupAjaxHandler.StartRestore(@event.BackupId, - @event.StorageType, - @event.StorageParams, - @event.Notify); - - await Task.CompletedTask; } } \ No newline at end of file diff --git a/common/services/ASC.Data.Backup.BackgroundTasks/Program.cs b/common/services/ASC.Data.Backup.BackgroundTasks/Program.cs index 8a876118f9..b0953ab3b1 100644 --- a/common/services/ASC.Data.Backup.BackgroundTasks/Program.cs +++ b/common/services/ASC.Data.Backup.BackgroundTasks/Program.cs @@ -24,7 +24,7 @@ // 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.Data.Backup.Extension; +using NLog; var options = new WebApplicationOptions { @@ -34,36 +34,62 @@ var options = new WebApplicationOptions var builder = WebApplication.CreateBuilder(options); -builder.Host.ConfigureDefault(); - builder.Configuration.AddDefaultConfiguration(builder.Environment) .AddBackupBackgroundTasksConfiguration(builder.Environment) .AddEnvironmentVariables() .AddCommandLine(args); -builder.WebHost.ConfigureDefaultKestrel(); - -var startup = new Startup(builder.Configuration, builder.Environment); - -startup.ConfigureServices(builder.Services); - -builder.Host.ConfigureContainer(containerBuilder => -{ - startup.ConfigureContainer(containerBuilder); -}); - -var app = builder.Build(); - -startup.Configure(app, app.Environment); - -var eventBus = ((IApplicationBuilder)app).ApplicationServices.GetRequiredService(); - -eventBus.Subscribe(); -eventBus.Subscribe(); -eventBus.Subscribe(); - -await app.RunWithTasksAsync(); - +var logger = NLog.LogManager.Setup() + .SetupExtensions(s => + { + s.RegisterLayoutRenderer("application-context", (logevent) => Program.AppName); + }) + .LoadConfiguration(builder.Configuration, builder.Environment) + .GetLogger(typeof(Startup).Namespace); + +try +{ + logger.Info("Configuring web host ({applicationContext})...", Program.AppName); + builder.Host.ConfigureDefault(); + builder.WebHost.ConfigureDefaultKestrel(); + + var startup = new Startup(builder.Configuration, builder.Environment); + + startup.ConfigureServices(builder.Services); + + builder.Host.ConfigureContainer(containerBuilder => + { + startup.ConfigureContainer(containerBuilder); + }); + + var app = builder.Build(); + + startup.Configure(app, app.Environment); + + var eventBus = ((IApplicationBuilder)app).ApplicationServices.GetRequiredService(); + + eventBus.Subscribe(); + eventBus.Subscribe(); + eventBus.Subscribe(); + + logger.Info("Starting web host ({applicationContext})...", Program.AppName); + await app.RunWithTasksAsync(); +} +catch (Exception ex) +{ + if (logger != null) + { + logger.Error(ex, "Program terminated unexpectedly ({applicationContext})!", Program.AppName); + } + + throw; +} +finally +{ + // Ensure to flush and stop internal timers/threads before application-exit (Avoid segmentation fault on Linux) + NLog.LogManager.Shutdown(); +} + public partial class Program { diff --git a/common/services/ASC.Data.Backup/Extensions/ConfigurationManagerExtension.cs b/common/services/ASC.Data.Backup/Extensions/ConfigurationManagerExtension.cs index 2250197316..d93d85d118 100644 --- a/common/services/ASC.Data.Backup/Extensions/ConfigurationManagerExtension.cs +++ b/common/services/ASC.Data.Backup/Extensions/ConfigurationManagerExtension.cs @@ -32,8 +32,8 @@ public static class ConfigurationManagerExtension this ConfigurationManager config, IHostEnvironment env) { - config.AddJsonFile("notify.json") - .AddJsonFile($"notify.{env.EnvironmentName}.json", true); + config.AddJsonFile("notify.json", optional: false, reloadOnChange: true) + .AddJsonFile($"notify.{env.EnvironmentName}.json", optional: true, reloadOnChange: true); return config; } diff --git a/common/services/ASC.Data.Backup/GlobalUsings.cs b/common/services/ASC.Data.Backup/GlobalUsings.cs index bd33a8c885..9423bc1dfc 100644 --- a/common/services/ASC.Data.Backup/GlobalUsings.cs +++ b/common/services/ASC.Data.Backup/GlobalUsings.cs @@ -58,3 +58,9 @@ global using Microsoft.Extensions.Hosting; global using Microsoft.Extensions.Hosting.WindowsServices; global using static ASC.Data.Backup.BackupAjaxHandler; + +global using ASC.Data.Backup.Extension; + +global using NLog.Extensions.Logging; +global using NLog.Web; +global using NLog.AWS.Logger; \ No newline at end of file diff --git a/common/services/ASC.Data.Backup/Program.cs b/common/services/ASC.Data.Backup/Program.cs index 26afb5e343..f30891d80f 100644 --- a/common/services/ASC.Data.Backup/Program.cs +++ b/common/services/ASC.Data.Backup/Program.cs @@ -24,7 +24,7 @@ // 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.Data.Backup.Extension; +using NLog; var options = new WebApplicationOptions { @@ -34,26 +34,59 @@ var options = new WebApplicationOptions var builder = WebApplication.CreateBuilder(options); -builder.Host.ConfigureDefault(); - builder.Configuration.AddDefaultConfiguration(builder.Environment) .AddBackupConfiguration(builder.Environment) .AddEnvironmentVariables() .AddCommandLine(args); -builder.WebHost.ConfigureDefaultKestrel(); - -var startup = new Startup(builder.Configuration, builder.Environment); - -startup.ConfigureServices(builder.Services); - -builder.Host.ConfigureContainer(containerBuilder => +var logger = NLog.LogManager.Setup() + .SetupExtensions(s => + { + s.RegisterLayoutRenderer("application-context", (logevent) => Program.AppName); + }) + .LoadConfiguration(builder.Configuration, builder.Environment) + .GetLogger(typeof(Startup).Namespace); +try { - startup.ConfigureContainer(containerBuilder); -}); + logger.Info("Configuring web host ({applicationContext})...", Program.AppName); -var app = builder.Build(); + builder.Host.ConfigureDefault(); + builder.WebHost.ConfigureDefaultKestrel(); -startup.Configure(app, app.Environment); + var startup = new Startup(builder.Configuration, builder.Environment); -await app.RunWithTasksAsync(); \ No newline at end of file + startup.ConfigureServices(builder.Services); + + builder.Host.ConfigureContainer(containerBuilder => + { + startup.ConfigureContainer(containerBuilder); + }); + + var app = builder.Build(); + + startup.Configure(app, app.Environment); + + logger.Info("Starting web host ({applicationContext})...", Program.AppName); + + await app.RunWithTasksAsync(); +} +catch (Exception ex) +{ + if (logger != null) + { + logger.Error(ex, "Program terminated unexpectedly ({applicationContext})!", Program.AppName); + } + + throw; +} +finally +{ + // Ensure to flush and stop internal timers/threads before application-exit (Avoid segmentation fault on Linux) + NLog.LogManager.Shutdown(); +} + +public partial class Program +{ + public static string Namespace = typeof(Startup).Namespace; + public static string AppName = Namespace.Substring(Namespace.LastIndexOf('.') + 1).ToLower(); +} \ No newline at end of file diff --git a/common/services/ASC.Data.Backup/Startup.cs b/common/services/ASC.Data.Backup/Startup.cs index a0001b2702..0fd8242c7d 100644 --- a/common/services/ASC.Data.Backup/Startup.cs +++ b/common/services/ASC.Data.Backup/Startup.cs @@ -55,7 +55,7 @@ public class Startup : BaseStartup app.MapWhen( context => context.Request.Path.ToString().EndsWith("backupFileUpload.ashx"), appBranch => - { + { appBranch.UseBackupFileUploadHandler(); }); } diff --git a/common/services/ASC.Notify/Extensions/ConfigurationManagerExtension.cs b/common/services/ASC.Notify/Extensions/ConfigurationManagerExtension.cs index 5d2cbcf49b..fb601bf4bd 100644 --- a/common/services/ASC.Notify/Extensions/ConfigurationManagerExtension.cs +++ b/common/services/ASC.Notify/Extensions/ConfigurationManagerExtension.cs @@ -32,9 +32,9 @@ public static class ConfigurationManagerExtension this ConfigurationManager config, IHostEnvironment env) { - config.AddJsonFile($"appsettings.services.json", true) - .AddJsonFile("notify.json") - .AddJsonFile($"notify.{env.EnvironmentName}.json", true); + config.AddJsonFile($"appsettings.services.json", optional: false, reloadOnChange: true) + .AddJsonFile("notify.json", optional: false, reloadOnChange: true) + .AddJsonFile($"notify.{env.EnvironmentName}.json", optional: true, reloadOnChange: true); return config; diff --git a/common/services/ASC.Notify/IntegrationEvents/EventHandling/NotifyInvokeSendMethodRequestedIntegrationEventHandler.cs b/common/services/ASC.Notify/IntegrationEvents/EventHandling/NotifyInvokeSendMethodRequestedIntegrationEventHandler.cs index 43992b11a2..f7fa84d4fd 100644 --- a/common/services/ASC.Notify/IntegrationEvents/EventHandling/NotifyInvokeSendMethodRequestedIntegrationEventHandler.cs +++ b/common/services/ASC.Notify/IntegrationEvents/EventHandling/NotifyInvokeSendMethodRequestedIntegrationEventHandler.cs @@ -74,11 +74,14 @@ public class NotifyInvokeSendMethodRequestedIntegrationEventHandler : IIntegrati public async Task Handle(NotifyInvokeSendMethodRequestedIntegrationEvent @event) - { - _logger.InformationHandlingIntegrationEvent(@event.Id, Program.AppName, @event); - - InvokeSendMethod(@event.NotifyInvoke); - - await Task.CompletedTask; + { + using (_logger.BeginScope(new[] { new KeyValuePair("integrationEventContext", $"{@event.Id}-{Program.AppName}") })) + { + _logger.InformationHandlingIntegrationEvent(@event.Id, Program.AppName, @event); + + InvokeSendMethod(@event.NotifyInvoke); + + await Task.CompletedTask; + } } } \ No newline at end of file diff --git a/common/services/ASC.Notify/IntegrationEvents/EventHandling/NotifySendMessageRequestedIntegrationEventHandler.cs b/common/services/ASC.Notify/IntegrationEvents/EventHandling/NotifySendMessageRequestedIntegrationEventHandler.cs index 8d625c6046..54a8497570 100644 --- a/common/services/ASC.Notify/IntegrationEvents/EventHandling/NotifySendMessageRequestedIntegrationEventHandler.cs +++ b/common/services/ASC.Notify/IntegrationEvents/EventHandling/NotifySendMessageRequestedIntegrationEventHandler.cs @@ -54,10 +54,13 @@ public class NotifySendMessageRequestedIntegrationEventHandler : IIntegrationEve public async Task Handle(NotifySendMessageRequestedIntegrationEvent @event) { - _logger.InformationHandlingIntegrationEvent(@event.Id, Program.AppName, @event); + using (_logger.BeginScope(new[] { new KeyValuePair("integrationEventContext", $"{@event.Id}-{Program.AppName}") })) + { + _logger.InformationHandlingIntegrationEvent(@event.Id, Program.AppName, @event); - SendNotifyMessage(@event.NotifyMessage); + SendNotifyMessage(@event.NotifyMessage); - await Task.CompletedTask; + await Task.CompletedTask; + } } } \ No newline at end of file diff --git a/common/services/ASC.Notify/Program.cs b/common/services/ASC.Notify/Program.cs index bc6f2ea550..4ade092dbf 100644 --- a/common/services/ASC.Notify/Program.cs +++ b/common/services/ASC.Notify/Program.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 NLog; + var options = new WebApplicationOptions { Args = args, @@ -32,33 +34,63 @@ var options = new WebApplicationOptions var builder = WebApplication.CreateBuilder(options); -builder.Host.ConfigureDefault(); builder.Configuration.AddDefaultConfiguration(builder.Environment) .AddNotifyConfiguration(builder.Environment) .AddEnvironmentVariables() .AddCommandLine(args); -var startup = new Startup(builder.Configuration, builder.Environment); +var logger = NLog.LogManager.Setup() + .SetupExtensions(s => + { + s.RegisterLayoutRenderer("application-context", (logevent) => Program.AppName); + }) + .LoadConfiguration(builder.Configuration, builder.Environment) + .GetLogger(typeof(Startup).Namespace); -startup.ConfigureServices(builder.Services); -builder.Host.ConfigureContainer((context, builder) => +try { - builder.Register(context.Configuration); -}); + logger.Info("Configuring web host ({applicationContext})...", Program.AppName); + builder.Host.ConfigureDefault(); -var app = builder.Build(); + var startup = new Startup(builder.Configuration, builder.Environment); -startup.Configure(app); + startup.ConfigureServices(builder.Services); -var eventBus = ((IApplicationBuilder)app).ApplicationServices.GetRequiredService(); + builder.Host.ConfigureContainer((context, builder) => + { + builder.Register(context.Configuration); + }); -eventBus.Subscribe(); -eventBus.Subscribe(); + var app = builder.Build(); -await app.RunWithTasksAsync(); + startup.Configure(app); + + var eventBus = ((IApplicationBuilder)app).ApplicationServices.GetRequiredService(); + + eventBus.Subscribe(); + eventBus.Subscribe(); + + logger.Info("Starting web host ({applicationContext})...", Program.AppName); + await app.RunWithTasksAsync(); +} +catch (Exception ex) +{ + if (logger != null) + { + logger.Error(ex, "Program terminated unexpectedly ({applicationContext})!", Program.AppName); + } + + throw; +} +finally +{ + // Ensure to flush and stop internal timers/threads before application-exit (Avoid segmentation fault on Linux) + NLog.LogManager.Shutdown(); +} public partial class Program { - public static string AppName = Assembly.GetExecutingAssembly().GetName().Name; + public static string Namespace = typeof(Startup).Namespace; + public static string AppName = Namespace.Substring(Namespace.LastIndexOf('.') + 1); } \ No newline at end of file diff --git a/common/services/ASC.Studio.Notify/Extensions/ConfigurationManagerExtension.cs b/common/services/ASC.Studio.Notify/Extensions/ConfigurationManagerExtension.cs index 68f27c39c1..7c4d77c67c 100644 --- a/common/services/ASC.Studio.Notify/Extensions/ConfigurationManagerExtension.cs +++ b/common/services/ASC.Studio.Notify/Extensions/ConfigurationManagerExtension.cs @@ -32,9 +32,9 @@ public static class ConfigurationManagerExtension this ConfigurationManager config, IHostEnvironment env) { - config.AddJsonFile($"appsettings.services.json", true) - .AddJsonFile("notify.json") - .AddJsonFile($"notify.{env.EnvironmentName}.json", true); + config.AddJsonFile($"appsettings.services.json", optional: false, reloadOnChange: true) + .AddJsonFile("notify.json", optional: false, reloadOnChange: true) + .AddJsonFile($"notify.{env.EnvironmentName}.json", optional: true, reloadOnChange: true); return config; diff --git a/common/services/ASC.Studio.Notify/Program.cs b/common/services/ASC.Studio.Notify/Program.cs index ced2369bb1..cb85e1baf9 100644 --- a/common/services/ASC.Studio.Notify/Program.cs +++ b/common/services/ASC.Studio.Notify/Program.cs @@ -25,6 +25,9 @@ // International. See the License terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode using ASC.Notify.Extension; +using ASC.Studio.Notify; + +using NLog; var options = new WebApplicationOptions { @@ -34,25 +37,58 @@ var options = new WebApplicationOptions var builder = WebApplication.CreateBuilder(options); -builder.Host.ConfigureDefault(); builder.Configuration.AddDefaultConfiguration(builder.Environment) .AddStudioNotifyConfiguration(builder.Environment) .AddEnvironmentVariables() .AddCommandLine(args); -builder.WebHost.ConfigureDefaultKestrel(); +var logger = NLog.LogManager.Setup() + .SetupExtensions(s => + { + s.RegisterLayoutRenderer("application-context", (logevent) => Program.AppName); + }) + .LoadConfiguration(builder.Configuration, builder.Environment) + .GetLogger(typeof(Startup).Namespace); -var startup = new Startup(builder.Configuration, builder.Environment); - -startup.ConfigureServices(builder.Services); - -builder.Host.ConfigureContainer((context, builder) => +try { - builder.Register(context.Configuration); -}); + logger.Info("Configuring web host ({applicationContext})...", Program.AppName); + builder.Host.ConfigureDefault(); + builder.WebHost.ConfigureDefaultKestrel(); -var app = builder.Build(); + var startup = new Startup(builder.Configuration, builder.Environment); -startup.Configure(app); + startup.ConfigureServices(builder.Services); -await app.RunWithTasksAsync(); \ No newline at end of file + builder.Host.ConfigureContainer((context, builder) => + { + builder.Register(context.Configuration); + }); + + var app = builder.Build(); + + startup.Configure(app); + + logger.Info("Starting web host ({applicationContext})...", Program.AppName); + await app.RunWithTasksAsync(); +} +catch (Exception ex) +{ + if (logger != null) + { + logger.Error(ex, "Program terminated unexpectedly ({applicationContext})!", Program.AppName); + } + + throw; +} +finally +{ + // Ensure to flush and stop internal timers/threads before application-exit (Avoid segmentation fault on Linux) + NLog.LogManager.Shutdown(); +} + +public partial class Program +{ + public static string Namespace = typeof(Startup).Namespace; + public static string AppName = Namespace.Substring(Namespace.LastIndexOf('.', Namespace.LastIndexOf('.') - 1) + 1); +} \ No newline at end of file diff --git a/common/services/ASC.Studio.Notify/Startup.cs b/common/services/ASC.Studio.Notify/Startup.cs index 76eb8e6852..a4dc076652 100644 --- a/common/services/ASC.Studio.Notify/Startup.cs +++ b/common/services/ASC.Studio.Notify/Startup.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 +namespace ASC.Studio.Notify; + public class Startup : BaseWorkerStartup { public Startup(IConfiguration configuration, IHostEnvironment hostEnvironment) diff --git a/common/services/ASC.TelegramService/Extensions/ConfigurationManagerExtension.cs b/common/services/ASC.TelegramService/Extensions/ConfigurationManagerExtension.cs index fa8ce2779f..67882a895d 100644 --- a/common/services/ASC.TelegramService/Extensions/ConfigurationManagerExtension.cs +++ b/common/services/ASC.TelegramService/Extensions/ConfigurationManagerExtension.cs @@ -32,8 +32,8 @@ public static class ConfigurationManagerExtension this ConfigurationManager config, IHostEnvironment env) { - config.AddJsonFile("notify.json") - .AddJsonFile($"notify.{env.EnvironmentName}.json", true); + config.AddJsonFile("notify.json", optional: false, reloadOnChange: true) + .AddJsonFile($"notify.{env.EnvironmentName}.json", optional: true, reloadOnChange: true); return config; } diff --git a/common/services/ASC.TelegramService/IntegrationEvents/EventHandling/TelegramSendMessageRequestedIntegrationEventHandler.cs b/common/services/ASC.TelegramService/IntegrationEvents/EventHandling/TelegramSendMessageRequestedIntegrationEventHandler.cs index 03b9e22de1..201b3f6e15 100644 --- a/common/services/ASC.TelegramService/IntegrationEvents/EventHandling/TelegramSendMessageRequestedIntegrationEventHandler.cs +++ b/common/services/ASC.TelegramService/IntegrationEvents/EventHandling/TelegramSendMessageRequestedIntegrationEventHandler.cs @@ -48,8 +48,11 @@ public class TelegramSendMessageRequestedIntegrationEventHandler : IIntegrationE public async Task Handle(NotifySendTelegramMessageRequestedIntegrationEvent @event) { - _logger.InformationHandlingIntegrationEvent(@event.Id, Program.AppName, @event); + using (_logger.BeginScope(new[] { new KeyValuePair("integrationEventContext", $"{@event.Id}-{Program.AppName}") })) + { + _logger.InformationHandlingIntegrationEvent(@event.Id, Program.AppName, @event); - await _telegramHandler.SendMessage(@event.NotifyMessage); + await _telegramHandler.SendMessage(@event.NotifyMessage); + } } } diff --git a/common/services/ASC.TelegramService/Program.cs b/common/services/ASC.TelegramService/Program.cs index 513122b309..afbff9c675 100644 --- a/common/services/ASC.TelegramService/Program.cs +++ b/common/services/ASC.TelegramService/Program.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 NLog; + var options = new WebApplicationOptions { Args = args, @@ -32,34 +34,60 @@ var options = new WebApplicationOptions var builder = WebApplication.CreateBuilder(options); -builder.Host.ConfigureDefault(); builder.Configuration.AddDefaultConfiguration(builder.Environment) .AddTelegramConfiguration(builder.Environment) .AddEnvironmentVariables() .AddCommandLine(args); -builder.WebHost.ConfigureDefaultKestrel(); +var logger = NLog.LogManager.Setup() + .SetupExtensions(s => + { + s.RegisterLayoutRenderer("application-context", (logevent) => Program.AppName); + }) + .LoadConfiguration(builder.Configuration, builder.Environment) + .GetLogger(typeof(Startup).Namespace); -var startup = new Startup(builder.Configuration, builder.Environment); - -startup.ConfigureServices(builder.Services); - -builder.Host.ConfigureContainer(containerBuilder => +try { - startup.ConfigureContainer(containerBuilder); -}); + builder.Host.ConfigureDefault(); + builder.WebHost.ConfigureDefaultKestrel(); -var app = builder.Build(); + var startup = new Startup(builder.Configuration, builder.Environment); -startup.Configure(app, app.Environment); + startup.ConfigureServices(builder.Services); -var eventBus = ((IApplicationBuilder)app).ApplicationServices.GetRequiredService(); + builder.Host.ConfigureContainer(containerBuilder => + { + startup.ConfigureContainer(containerBuilder); + }); -eventBus.Subscribe(); + var app = builder.Build(); -await app.RunWithTasksAsync(); + startup.Configure(app, app.Environment); + + var eventBus = ((IApplicationBuilder)app).ApplicationServices.GetRequiredService(); + + eventBus.Subscribe(); + + await app.RunWithTasksAsync(); +} +catch (Exception ex) +{ + if (logger != null) + { + logger.Error(ex, "Program terminated unexpectedly ({applicationContext})!", Program.AppName); + } + + throw; +} +finally +{ + // Ensure to flush and stop internal timers/threads before application-exit (Avoid segmentation fault on Linux) + NLog.LogManager.Shutdown(); +} public partial class Program { - public static string AppName = Assembly.GetExecutingAssembly().GetName().Name; + public static string Namespace = typeof(Startup).Namespace; + public static string AppName = Namespace.Substring(Namespace.LastIndexOf('.') + 1); } \ No newline at end of file diff --git a/common/services/ASC.Webhooks.Service/Extensions/ConfigurationManagerExtension.cs b/common/services/ASC.Webhooks.Service/Extensions/ConfigurationManagerExtension.cs index 40dd81a211..3bbfaaab53 100644 --- a/common/services/ASC.Webhooks.Service/Extensions/ConfigurationManagerExtension.cs +++ b/common/services/ASC.Webhooks.Service/Extensions/ConfigurationManagerExtension.cs @@ -31,7 +31,7 @@ public static class ConfigurationManagerExtension public static ConfigurationManager AddWebhookConfiguration( this ConfigurationManager config) { - config.AddJsonFile($"appsettings.services.json", true); + config.AddJsonFile($"appsettings.services.json", optional: false, reloadOnChange: true); return config; } diff --git a/common/services/ASC.Webhooks.Service/Program.cs b/common/services/ASC.Webhooks.Service/Program.cs index 86d9f66bef..c23f56a082 100644 --- a/common/services/ASC.Webhooks.Service/Program.cs +++ b/common/services/ASC.Webhooks.Service/Program.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 NLog; + var options = new WebApplicationOptions { Args = args, @@ -32,21 +34,54 @@ var options = new WebApplicationOptions var builder = WebApplication.CreateBuilder(options); -builder.Host.ConfigureDefault(); - builder.Configuration.AddDefaultConfiguration(builder.Environment) .AddWebhookConfiguration() .AddEnvironmentVariables() .AddCommandLine(args); -builder.WebHost.ConfigureDefaultKestrel(); - -var startup = new Startup(builder.Configuration, builder.Environment); - -startup.ConfigureServices(builder.Services); - -var app = builder.Build(); - -startup.Configure(app); - -await app.RunWithTasksAsync(); \ No newline at end of file +var logger = NLog.LogManager.Setup() + .SetupExtensions(s => + { + s.RegisterLayoutRenderer("application-context", (logevent) => Program.AppName); + }) + .LoadConfiguration(builder.Configuration, builder.Environment) + .GetLogger(typeof(Startup).Namespace); + +try +{ + logger.Info("Configuring web host ({applicationContext})...", Program.AppName); + builder.Host.ConfigureDefault(); + builder.WebHost.ConfigureDefaultKestrel(); + + var startup = new Startup(builder.Configuration, builder.Environment); + + startup.ConfigureServices(builder.Services); + + var app = builder.Build(); + + startup.Configure(app); + + logger.Info("Starting web host ({applicationContext})...", Program.AppName); + await app.RunWithTasksAsync(); +} +catch (Exception ex) +{ + if (logger != null) + { + logger.Error(ex, "Program terminated unexpectedly ({applicationContext})!", Program.AppName); + } + + throw; +} +finally +{ + // Ensure to flush and stop internal timers/threads before application-exit (Avoid segmentation fault on Linux) + NLog.LogManager.Shutdown(); +} + +public partial class Program +{ + public static string Namespace = typeof(Startup).Namespace; + public static string AppName = Namespace.Substring(Namespace.LastIndexOf('.') + 1); +} + diff --git a/config/nlog.config b/config/nlog.config index 4357a8a90f..f6c1c230e5 100644 --- a/config/nlog.config +++ b/config/nlog.config @@ -1,25 +1,48 @@  - + + + + + - - - + + + - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/products/ASC.Files/Server/Extensions/ConfigurationManagerExtension.cs b/products/ASC.Files/Server/Extensions/ConfigurationManagerExtension.cs index b60fff3ca3..0897df0ed7 100644 --- a/products/ASC.Files/Server/Extensions/ConfigurationManagerExtension.cs +++ b/products/ASC.Files/Server/Extensions/ConfigurationManagerExtension.cs @@ -33,8 +33,8 @@ public static class ConfigurationManagerExtension IHostEnvironment env) { config - .AddJsonFile("elastic.json", true) - .AddJsonFile($"elastic.{env.EnvironmentName}.json", true); + .AddJsonFile("elastic.json", optional: false, reloadOnChange: true) + .AddJsonFile($"elastic.{env.EnvironmentName}.json", optional: false, reloadOnChange: true); return config; } diff --git a/products/ASC.Files/Server/GlobalUsings.cs b/products/ASC.Files/Server/GlobalUsings.cs index 69e0b04fa6..04f4e82f12 100644 --- a/products/ASC.Files/Server/GlobalUsings.cs +++ b/products/ASC.Files/Server/GlobalUsings.cs @@ -90,4 +90,4 @@ global using Microsoft.Extensions.Hosting.WindowsServices; global using Microsoft.Extensions.Logging; global using Newtonsoft.Json.Linq; -global using ASC.Files.Extension; +global using ASC.Files.Extension; \ No newline at end of file diff --git a/products/ASC.Files/Server/Program.cs b/products/ASC.Files/Server/Program.cs index 7eed512fe7..992323c003 100644 --- a/products/ASC.Files/Server/Program.cs +++ b/products/ASC.Files/Server/Program.cs @@ -24,6 +24,10 @@ // 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; + +using NLog; + var options = new WebApplicationOptions { Args = args, @@ -32,31 +36,65 @@ var options = new WebApplicationOptions var builder = WebApplication.CreateBuilder(options); -builder.Host.ConfigureDefault(); builder.Configuration.AddDefaultConfiguration(builder.Environment) .AddFilesConfiguration(builder.Environment) .AddEnvironmentVariables() .AddCommandLine(args); -builder.WebHost.ConfigureDefaultKestrel((hostingContext, serverOptions) => +var logger = NLog.LogManager.Setup() + .SetupExtensions(s => + { + s.RegisterLayoutRenderer("application-context", (logevent) => Program.AppName); + }) + .LoadConfiguration(builder.Configuration, builder.Environment) + .GetLogger(typeof(Startup).Namespace); + +try { - serverOptions.Limits.MaxRequestBodySize = 100 * 1024 * 1024; - serverOptions.Limits.MaxRequestBufferSize = 100 * 1024 * 1024; - serverOptions.Limits.MinRequestBodyDataRate = null; - serverOptions.Limits.MinResponseDataRate = null; -}); + logger.Info("Configuring web host ({applicationContext})...", Program.AppName); + builder.Host.ConfigureDefault(); -var startup = new ASC.Files.Startup(builder.Configuration, builder.Environment); + builder.WebHost.ConfigureDefaultKestrel((hostingContext, serverOptions) => + { + serverOptions.Limits.MaxRequestBodySize = 100 * 1024 * 1024; + serverOptions.Limits.MaxRequestBufferSize = 100 * 1024 * 1024; + serverOptions.Limits.MinRequestBodyDataRate = null; + serverOptions.Limits.MinResponseDataRate = null; + }); -startup.ConfigureServices(builder.Services); + var startup = new ASC.Files.Startup(builder.Configuration, builder.Environment); -builder.Host.ConfigureContainer(containerBuilder => + startup.ConfigureServices(builder.Services); + + builder.Host.ConfigureContainer(containerBuilder => + { + startup.ConfigureContainer(containerBuilder); + }); + + var app = builder.Build(); + + startup.Configure(app, app.Environment); + + logger.Info("Starting web host ({applicationContext})...", Program.AppName); + await app.RunWithTasksAsync(); +} +catch (Exception ex) { - startup.ConfigureContainer(containerBuilder); -}); + if (logger != null) + { + logger.Error(ex, "Program terminated unexpectedly ({applicationContext})!", Program.AppName); + } -var app = builder.Build(); + throw; +} +finally +{ + // Ensure to flush and stop internal timers/threads before application-exit (Avoid segmentation fault on Linux) + NLog.LogManager.Shutdown(); +} -startup.Configure(app, app.Environment); - -await app.RunWithTasksAsync(); \ No newline at end of file +public partial class Program +{ + public static string Namespace = typeof(Startup).Namespace; + public static string AppName = Namespace.Substring(Namespace.LastIndexOf('.') + 1); +} \ No newline at end of file diff --git a/products/ASC.Files/Service/Extensions/ConfigurationManagerExtension.cs b/products/ASC.Files/Service/Extensions/ConfigurationManagerExtension.cs index 41768e4bdf..60b941f60e 100644 --- a/products/ASC.Files/Service/Extensions/ConfigurationManagerExtension.cs +++ b/products/ASC.Files/Service/Extensions/ConfigurationManagerExtension.cs @@ -32,11 +32,11 @@ public static class ConfigurationManagerExtension this ConfigurationManager config, IHostEnvironment env) { - config.AddJsonFile($"appsettings.services.json", true) - .AddJsonFile("notify.json") - .AddJsonFile($"notify.{env.EnvironmentName}.json", true) - .AddJsonFile("elastic.json", true) - .AddJsonFile($"elastic.{env.EnvironmentName}.json", true); + config.AddJsonFile($"appsettings.services.json", optional: false, reloadOnChange: true) + .AddJsonFile("notify.json", optional: false, reloadOnChange: true) + .AddJsonFile($"notify.{env.EnvironmentName}.json", optional: true, reloadOnChange: true) + .AddJsonFile("elastic.json", optional: false, reloadOnChange: true) + .AddJsonFile($"elastic.{env.EnvironmentName}.json", optional: true, reloadOnChange: true); return config; diff --git a/products/ASC.Files/Service/Program.cs b/products/ASC.Files/Service/Program.cs index 4038eecdc5..2ec938f2b3 100644 --- a/products/ASC.Files/Service/Program.cs +++ b/products/ASC.Files/Service/Program.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 NLog; + var options = new WebApplicationOptions { Args = args, @@ -32,32 +34,61 @@ var options = new WebApplicationOptions var builder = WebApplication.CreateBuilder(options); -builder.Host.ConfigureDefault(); builder.Configuration.AddDefaultConfiguration(builder.Environment) .AddFilesServiceConfiguration(builder.Environment) .AddEnvironmentVariables() .AddCommandLine(args); -builder.Host.ConfigureContainer((context, builder) => +var logger = NLog.LogManager.Setup() + .SetupExtensions(s => + { + s.RegisterLayoutRenderer("application-context", (logevent) => Program.AppName); + }) + .LoadConfiguration(builder.Configuration, builder.Environment) + .GetLogger(typeof(Startup).Namespace); + +try { - builder.Register(context.Configuration, true, false, "search.json", "feed.json"); -}); + logger.Info("Configuring web host ({applicationContext})...", Program.AppName); -var startup = new Startup(builder.Configuration, builder.Environment); + builder.Host.ConfigureDefault(); + builder.Host.ConfigureContainer((context, builder) => + { + builder.Register(context.Configuration, true, false, "search.json", "feed.json"); + }); -startup.ConfigureServices(builder.Services); + var startup = new Startup(builder.Configuration, builder.Environment); -var app = builder.Build(); + startup.ConfigureServices(builder.Services); -startup.Configure(app); + var app = builder.Build(); -var eventBus = ((IApplicationBuilder)app).ApplicationServices.GetRequiredService(); + startup.Configure(app); -eventBus.Subscribe(); + var eventBus = ((IApplicationBuilder)app).ApplicationServices.GetRequiredService(); -await app.RunWithTasksAsync(); + eventBus.Subscribe(); + + logger.Info("Starting web host ({applicationContext})...", Program.AppName); + await app.RunWithTasksAsync(); +} +catch (Exception ex) +{ + if (logger != null) + { + logger.Error(ex, "Program terminated unexpectedly ({applicationContext})!", Program.AppName); + } + + throw; +} +finally +{ + // Ensure to flush and stop internal timers/threads before application-exit (Avoid segmentation fault on Linux) + NLog.LogManager.Shutdown(); +} public partial class Program { - public static string AppName = Assembly.GetExecutingAssembly().GetName().Name; + public static string Namespace = typeof(Startup).Namespace; + public static string AppName = Namespace.Substring(Namespace.LastIndexOf('.', Namespace.LastIndexOf('.') - 1) + 1); } \ No newline at end of file diff --git a/products/ASC.Files/Service/Thumbnail/IntegrationEvents/EventHandling/ThumbnailRequestedIntegrationEventHandler.cs b/products/ASC.Files/Service/Thumbnail/IntegrationEvents/EventHandling/ThumbnailRequestedIntegrationEventHandler.cs index 42e0f79887..8a2713db5f 100644 --- a/products/ASC.Files/Service/Thumbnail/IntegrationEvents/EventHandling/ThumbnailRequestedIntegrationEventHandler.cs +++ b/products/ASC.Files/Service/Thumbnail/IntegrationEvents/EventHandling/ThumbnailRequestedIntegrationEventHandler.cs @@ -42,16 +42,19 @@ public class ThumbnailRequestedIntegrationEventHandler : IIntegrationEventHandle } public async Task Handle(ThumbnailRequestedIntegrationEvent @event) - { - _logger.InformationHandlingIntegrationEvent(@event.Id, Program.AppName, @event); - - foreach (var fileId in @event.FileIds) - { - var fileData = new FileData(@event.TenantId, Convert.ToInt32(fileId), @event.BaseUrl); - - FileDataQueue.Queue.TryAdd(fileId, fileData); - } - - await Task.CompletedTask; + { + using (_logger.BeginScope(new[] { new KeyValuePair("integrationEventContext", $"{@event.Id}-{Program.AppName}") })) + { + _logger.InformationHandlingIntegrationEvent(@event.Id, Program.AppName, @event); + + foreach (var fileId in @event.FileIds) + { + var fileData = new FileData(@event.TenantId, Convert.ToInt32(fileId), @event.BaseUrl); + + FileDataQueue.Queue.TryAdd(fileId, fileData); + } + + await Task.CompletedTask; + } } } diff --git a/products/ASC.People/Server/Program.cs b/products/ASC.People/Server/Program.cs index 3314139872..59ea75d6fd 100644 --- a/products/ASC.People/Server/Program.cs +++ b/products/ASC.People/Server/Program.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 NLog; + var options = new WebApplicationOptions { Args = args, @@ -32,24 +34,57 @@ var options = new WebApplicationOptions var builder = WebApplication.CreateBuilder(options); -builder.Host.ConfigureDefault(); builder.Configuration.AddDefaultConfiguration(builder.Environment) .AddEnvironmentVariables() .AddCommandLine(args); -builder.WebHost.ConfigureDefaultKestrel(); +var logger = NLog.LogManager.Setup() + .SetupExtensions(s => + { + s.RegisterLayoutRenderer("application-context", (logevent) => Program.AppName); + }) + .LoadConfiguration(builder.Configuration, builder.Environment) + .GetLogger(typeof(Startup).Namespace); -var startup = new Startup(builder.Configuration, builder.Environment); - -startup.ConfigureServices(builder.Services); - -builder.Host.ConfigureContainer(containerBuilder => +try { - startup.ConfigureContainer(containerBuilder); -}); + logger.Info("Configuring web host ({applicationContext})...", Program.AppName); + builder.Host.ConfigureDefault(); + builder.WebHost.ConfigureDefaultKestrel(); -var app = builder.Build(); + var startup = new Startup(builder.Configuration, builder.Environment); -startup.Configure(app, app.Environment); + startup.ConfigureServices(builder.Services); -await app.RunWithTasksAsync(); \ No newline at end of file + builder.Host.ConfigureContainer(containerBuilder => + { + startup.ConfigureContainer(containerBuilder); + }); + + var app = builder.Build(); + + startup.Configure(app, app.Environment); + + logger.Info("Starting web host ({applicationContext})...", Program.AppName); + await app.RunWithTasksAsync(); +} +catch (Exception ex) +{ + if (logger != null) + { + logger.Error(ex, "Program terminated unexpectedly ({applicationContext})!", Program.AppName); + } + + throw; +} +finally +{ + // Ensure to flush and stop internal timers/threads before application-exit (Avoid segmentation fault on Linux) + NLog.LogManager.Shutdown(); +} + +public partial class Program +{ + public static string Namespace = typeof(Startup).Namespace; + public static string AppName = Namespace.Substring(Namespace.LastIndexOf('.') + 1); +} \ No newline at end of file diff --git a/web/ASC.Web.Api/Program.cs b/web/ASC.Web.Api/Program.cs index 3be36f038c..93fd4592fe 100644 --- a/web/ASC.Web.Api/Program.cs +++ b/web/ASC.Web.Api/Program.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 NLog; + var options = new WebApplicationOptions { Args = args, @@ -32,24 +34,57 @@ var options = new WebApplicationOptions var builder = WebApplication.CreateBuilder(options); -builder.Host.ConfigureDefault(); builder.Configuration.AddDefaultConfiguration(builder.Environment) .AddEnvironmentVariables() .AddCommandLine(args); -builder.WebHost.ConfigureDefaultKestrel(); +var logger = NLog.LogManager.Setup() + .SetupExtensions(s => + { + s.RegisterLayoutRenderer("application-context", (logevent) => Program.AppName); + }) + .LoadConfiguration(builder.Configuration, builder.Environment) + .GetLogger(typeof(Startup).Namespace); -var startup = new Startup(builder.Configuration, builder.Environment); - -startup.ConfigureServices(builder.Services); - -builder.Host.ConfigureContainer(containerBuilder => +try { - startup.ConfigureContainer(containerBuilder); -}); + logger.Info("Configuring web host ({applicationContext})...", Program.AppName); + builder.Host.ConfigureDefault(); + builder.WebHost.ConfigureDefaultKestrel(); -var app = builder.Build(); + var startup = new Startup(builder.Configuration, builder.Environment); -startup.Configure(app, app.Environment); + startup.ConfigureServices(builder.Services); -await app.RunWithTasksAsync(); \ No newline at end of file + builder.Host.ConfigureContainer(containerBuilder => + { + startup.ConfigureContainer(containerBuilder); + }); + + var app = builder.Build(); + + startup.Configure(app, app.Environment); + + logger.Info("Starting web host ({applicationContext})...", Program.AppName); + await app.RunWithTasksAsync(); +} +catch (Exception ex) +{ + if (logger != null) + { + logger.Error(ex, "Program terminated unexpectedly ({applicationContext})!", Program.AppName); + } + + throw; +} +finally +{ + // Ensure to flush and stop internal timers/threads before application-exit (Avoid segmentation fault on Linux) + NLog.LogManager.Shutdown(); +} + +public partial class Program +{ + public static string Namespace = typeof(Startup).Namespace; + public static string AppName = Namespace.Substring(Namespace.LastIndexOf('.') + 1); +} \ No newline at end of file diff --git a/web/ASC.Web.Studio/Program.cs b/web/ASC.Web.Studio/Program.cs index 3314139872..59ea75d6fd 100644 --- a/web/ASC.Web.Studio/Program.cs +++ b/web/ASC.Web.Studio/Program.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 NLog; + var options = new WebApplicationOptions { Args = args, @@ -32,24 +34,57 @@ var options = new WebApplicationOptions var builder = WebApplication.CreateBuilder(options); -builder.Host.ConfigureDefault(); builder.Configuration.AddDefaultConfiguration(builder.Environment) .AddEnvironmentVariables() .AddCommandLine(args); -builder.WebHost.ConfigureDefaultKestrel(); +var logger = NLog.LogManager.Setup() + .SetupExtensions(s => + { + s.RegisterLayoutRenderer("application-context", (logevent) => Program.AppName); + }) + .LoadConfiguration(builder.Configuration, builder.Environment) + .GetLogger(typeof(Startup).Namespace); -var startup = new Startup(builder.Configuration, builder.Environment); - -startup.ConfigureServices(builder.Services); - -builder.Host.ConfigureContainer(containerBuilder => +try { - startup.ConfigureContainer(containerBuilder); -}); + logger.Info("Configuring web host ({applicationContext})...", Program.AppName); + builder.Host.ConfigureDefault(); + builder.WebHost.ConfigureDefaultKestrel(); -var app = builder.Build(); + var startup = new Startup(builder.Configuration, builder.Environment); -startup.Configure(app, app.Environment); + startup.ConfigureServices(builder.Services); -await app.RunWithTasksAsync(); \ No newline at end of file + builder.Host.ConfigureContainer(containerBuilder => + { + startup.ConfigureContainer(containerBuilder); + }); + + var app = builder.Build(); + + startup.Configure(app, app.Environment); + + logger.Info("Starting web host ({applicationContext})...", Program.AppName); + await app.RunWithTasksAsync(); +} +catch (Exception ex) +{ + if (logger != null) + { + logger.Error(ex, "Program terminated unexpectedly ({applicationContext})!", Program.AppName); + } + + throw; +} +finally +{ + // Ensure to flush and stop internal timers/threads before application-exit (Avoid segmentation fault on Linux) + NLog.LogManager.Shutdown(); +} + +public partial class Program +{ + public static string Namespace = typeof(Startup).Namespace; + public static string AppName = Namespace.Substring(Namespace.LastIndexOf('.') + 1); +} \ No newline at end of file From 98ce868db02add135fb4078544d7c9ce4346666e Mon Sep 17 00:00:00 2001 From: TimofeyBoyko Date: Thu, 15 Sep 2022 17:48:15 +0300 Subject: [PATCH 61/87] Web:Client:Home: fix type of oform and docxf at info-panel --- packages/client/src/pages/Home/InfoPanel/Body/SingleItem.js | 2 ++ 1 file changed, 2 insertions(+) diff --git a/packages/client/src/pages/Home/InfoPanel/Body/SingleItem.js b/packages/client/src/pages/Home/InfoPanel/Body/SingleItem.js index 1e1ac1d44f..14f64f470f 100644 --- a/packages/client/src/pages/Home/InfoPanel/Body/SingleItem.js +++ b/packages/client/src/pages/Home/InfoPanel/Body/SingleItem.js @@ -106,6 +106,8 @@ const SingleItem = (props) => { case FileType.Presentation: return t("Home:Presentation"); case FileType.Document: + case FileType.OForm: + case FileType.OFormTemplate: return t("Home:Document"); default: return t("Home:Folder"); From 25188c57b86ca29ec3ccb5d6759559f724bf3291 Mon Sep 17 00:00:00 2001 From: TimofeyBoyko Date: Thu, 15 Sep 2022 18:06:00 +0300 Subject: [PATCH 62/87] Web:Client:Home: fix clear search --- packages/client/src/pages/Home/Section/Filter/index.js | 8 +++++++- packages/common/components/FilterInput/index.js | 2 +- 2 files changed, 8 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 d9f245510b..6f0ec5263c 100644 --- a/packages/client/src/pages/Home/Section/Filter/index.js +++ b/packages/client/src/pages/Home/Section/Filter/index.js @@ -312,7 +312,13 @@ const SectionFilterContent = ({ ); const getSelectedInputValue = React.useCallback(() => { - return isRooms ? roomsFilter.filterValue : filter.search; + return isRooms + ? roomsFilter.filterValue + ? roomsFilter.filterValue + : "" + : filter.search + ? filter.search + : ""; }, [isRooms, roomsFilter.filterValue, filter.search]); const getSelectedSortData = React.useCallback(() => { diff --git a/packages/common/components/FilterInput/index.js b/packages/common/components/FilterInput/index.js index e8675fffe9..0863148f0c 100644 --- a/packages/common/components/FilterInput/index.js +++ b/packages/common/components/FilterInput/index.js @@ -57,7 +57,7 @@ const FilterInput = React.memo( React.useEffect(() => { const value = getSelectedInputValue && getSelectedInputValue(); - if (value) setInputValue(value); + setInputValue(value); }, [getSelectedInputValue]); React.useEffect(() => { From ab5de603c1197ca35e68b73d22e377cd5ced22bc Mon Sep 17 00:00:00 2001 From: Alexey Bannov Date: Thu, 15 Sep 2022 18:17:23 +0300 Subject: [PATCH 63/87] nlog: fixed config --- .../Server/Extensions/ConfigurationManagerExtension.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/products/ASC.Files/Server/Extensions/ConfigurationManagerExtension.cs b/products/ASC.Files/Server/Extensions/ConfigurationManagerExtension.cs index 0897df0ed7..8d8d2f414b 100644 --- a/products/ASC.Files/Server/Extensions/ConfigurationManagerExtension.cs +++ b/products/ASC.Files/Server/Extensions/ConfigurationManagerExtension.cs @@ -34,7 +34,7 @@ public static class ConfigurationManagerExtension { config .AddJsonFile("elastic.json", optional: false, reloadOnChange: true) - .AddJsonFile($"elastic.{env.EnvironmentName}.json", optional: false, reloadOnChange: true); + .AddJsonFile($"elastic.{env.EnvironmentName}.json", optional: true, reloadOnChange: true); return config; } From ca485bc41d82beb44c17542cc81b1483ea269b9e Mon Sep 17 00:00:00 2001 From: TimofeyBoyko Date: Thu, 15 Sep 2022 18:18:36 +0300 Subject: [PATCH 64/87] Web:Client:Home: fix clearAll --- .../client/src/pages/Home/Section/Filter/index.js | 15 +++++++++++++++ packages/common/components/FilterInput/index.js | 3 ++- 2 files changed, 17 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 6f0ec5263c..ebc65e875a 100644 --- a/packages/client/src/pages/Home/Section/Filter/index.js +++ b/packages/client/src/pages/Home/Section/Filter/index.js @@ -11,6 +11,8 @@ import { FilterKeys, } from "@docspace/client/src/helpers/filesConstants"; +import FilesFilter from "@docspace/common/api/people/filter"; +import RoomsFilter from "@docspace/common/api/rooms/filter"; import { getUser } from "@docspace/common/api/people"; import { FilterType, RoomsType } from "@docspace/common/constants"; import Loaders from "@docspace/common/components/Loaders"; @@ -1003,6 +1005,18 @@ const SectionFilterContent = ({ ] ); + const clearAll = () => { + if (isRooms) { + setIsLoading(true); + + fetchRooms(selectedFolderId).finally(() => setIsLoading(false)); + } else { + setIsLoading(true); + + fetchFiles(selectedFolderId).finally(() => setIsLoading(false)); + } + }; + return ( ); }; diff --git a/packages/common/components/FilterInput/index.js b/packages/common/components/FilterInput/index.js index 0863148f0c..df5590f4c1 100644 --- a/packages/common/components/FilterInput/index.js +++ b/packages/common/components/FilterInput/index.js @@ -35,6 +35,7 @@ const FilterInput = React.memo( filterHeader, selectorLabel, + clearAll, isRecentFolder, removeSelectedItem, @@ -174,7 +175,7 @@ const FilterInput = React.memo( fontWeight={600} isSemitransparent type="action" - onClick={() => onFilter([])} + onClick={clearAll} > {t("Common:ClearAll")} From 2d1e18b33707459c3510e1bd897e591dd4c25a02 Mon Sep 17 00:00:00 2001 From: TimofeyBoyko Date: Thu, 15 Sep 2022 18:21:04 +0300 Subject: [PATCH 65/87] Web:Client:Accounts: add clearAll --- .../client/src/pages/AccountsHome/Section/Filter/index.js | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/packages/client/src/pages/AccountsHome/Section/Filter/index.js b/packages/client/src/pages/AccountsHome/Section/Filter/index.js index 410387f0ac..12bf635134 100644 --- a/packages/client/src/pages/AccountsHome/Section/Filter/index.js +++ b/packages/client/src/pages/AccountsHome/Section/Filter/index.js @@ -320,6 +320,11 @@ const SectionFilterContent = ({ fetchPeople(newFilter).finally(() => setIsLoading(false)); }; + const clearAll = () => { + setIsLoading(true); + fetchPeople().finally(() => setIsLoading(false)); + }; + return isLoaded && tReady ? ( ) : ( From a3d2bc47f76192ea5d114d90d05db2cc626676eb Mon Sep 17 00:00:00 2001 From: TimofeyBoyko Date: Thu, 15 Sep 2022 18:24:38 +0300 Subject: [PATCH 66/87] Web:Client:Home: delete useless --- packages/client/src/pages/Home/Section/Filter/index.js | 2 -- 1 file changed, 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 ebc65e875a..2aae6fe5d7 100644 --- a/packages/client/src/pages/Home/Section/Filter/index.js +++ b/packages/client/src/pages/Home/Section/Filter/index.js @@ -11,8 +11,6 @@ import { FilterKeys, } from "@docspace/client/src/helpers/filesConstants"; -import FilesFilter from "@docspace/common/api/people/filter"; -import RoomsFilter from "@docspace/common/api/rooms/filter"; import { getUser } from "@docspace/common/api/people"; import { FilterType, RoomsType } from "@docspace/common/constants"; import Loaders from "@docspace/common/components/Loaders"; From 30618e3e22771571b64028eea34f5a7ed8694451 Mon Sep 17 00:00:00 2001 From: Alexey Safronov Date: Thu, 15 Sep 2022 20:43:35 +0300 Subject: [PATCH 67/87] Web: Files: Fix translation --- packages/client/public/locales/en/Files.json | 1 - packages/client/src/pages/Home/InfoPanel/Body/SingleItem.js | 2 +- packages/client/src/pages/Home/Section/Filter/index.js | 2 +- 3 files changed, 2 insertions(+), 3 deletions(-) diff --git a/packages/client/public/locales/en/Files.json b/packages/client/public/locales/en/Files.json index 5adde17917..583da4a1dc 100644 --- a/packages/client/public/locales/en/Files.json +++ b/packages/client/public/locales/en/Files.json @@ -8,7 +8,6 @@ "ByCreation": "Created", "ByCreationDate": "Creation date", "ByLastModified": "Modified", - "ByLastModifiedDate": "Last modified", "ByOwner": "Owner", "ByTitle": "Title", "CollaborationRooms": "Collaboration", diff --git a/packages/client/src/pages/Home/InfoPanel/Body/SingleItem.js b/packages/client/src/pages/Home/InfoPanel/Body/SingleItem.js index 14f64f470f..c008cfc6a4 100644 --- a/packages/client/src/pages/Home/InfoPanel/Body/SingleItem.js +++ b/packages/client/src/pages/Home/InfoPanel/Body/SingleItem.js @@ -149,7 +149,7 @@ const SingleItem = (props) => { content: styledText(itemSize), }, { - id: "ByLastModifiedDate", + id: "ByLastModified", title: t("Files:ByLastModified"), content: styledText(parseAndFormatDate(item.updated)), }, diff --git a/packages/client/src/pages/Home/Section/Filter/index.js b/packages/client/src/pages/Home/Section/Filter/index.js index 2aae6fe5d7..f432ab4c1e 100644 --- a/packages/client/src/pages/Home/Section/Filter/index.js +++ b/packages/client/src/pages/Home/Section/Filter/index.js @@ -799,7 +799,7 @@ const SectionFilterContent = ({ const name = { key: "AZ", label: t("Common:Name"), default: true }; const modifiedDate = { key: "DateAndTime", - label: t("ByLastModifiedDate"), + label: t("ByLastModified"), default: true, }; From 6438bca15da92144465edf2e8d27fccd5d2edefd Mon Sep 17 00:00:00 2001 From: Alexey Safronov Date: Thu, 15 Sep 2022 20:47:04 +0300 Subject: [PATCH 68/87] Web: Files: Fix translation --- packages/client/public/locales/en/Files.json | 1 - packages/client/src/pages/Home/InfoPanel/Body/SingleItem.js | 2 +- packages/client/src/pages/Home/Section/Filter/index.js | 2 +- 3 files changed, 2 insertions(+), 3 deletions(-) diff --git a/packages/client/public/locales/en/Files.json b/packages/client/public/locales/en/Files.json index 583da4a1dc..77d58b2666 100644 --- a/packages/client/public/locales/en/Files.json +++ b/packages/client/public/locales/en/Files.json @@ -6,7 +6,6 @@ "BackToParentFolderButton": "Back to parent folder", "ByAuthor": "Author", "ByCreation": "Created", - "ByCreationDate": "Creation date", "ByLastModified": "Modified", "ByOwner": "Owner", "ByTitle": "Title", diff --git a/packages/client/src/pages/Home/InfoPanel/Body/SingleItem.js b/packages/client/src/pages/Home/InfoPanel/Body/SingleItem.js index c008cfc6a4..58631cd9cf 100644 --- a/packages/client/src/pages/Home/InfoPanel/Body/SingleItem.js +++ b/packages/client/src/pages/Home/InfoPanel/Body/SingleItem.js @@ -164,7 +164,7 @@ const SingleItem = (props) => { ), }, { - id: "ByCreationDate", + id: "ByCreation", title: t("Files:ByCreation"), content: styledText(parseAndFormatDate(item.created)), }, diff --git a/packages/client/src/pages/Home/Section/Filter/index.js b/packages/client/src/pages/Home/Section/Filter/index.js index f432ab4c1e..ba4ab4037c 100644 --- a/packages/client/src/pages/Home/Section/Filter/index.js +++ b/packages/client/src/pages/Home/Section/Filter/index.js @@ -807,7 +807,7 @@ const SectionFilterContent = ({ const size = { key: "Size", label: t("Common:Size"), default: true }; const creationDate = { key: "DateAndTimeCreation", - label: t("ByCreationDate"), + label: t("ByCreation"), default: true, }; const authorOption = { From c91711dbebd1bc72754e9a5cbb6b2635b12f07ef Mon Sep 17 00:00:00 2001 From: Alexey Bannov Date: Thu, 15 Sep 2022 23:56:55 +0300 Subject: [PATCH 69/87] hosting: fixed running ActivePassive instance --- common/ASC.Core.Common/Hosting/RegisterInstanceDao.cs | 6 ++++++ common/ASC.Core.Common/Hosting/RegisterInstanceManager.cs | 2 +- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/common/ASC.Core.Common/Hosting/RegisterInstanceDao.cs b/common/ASC.Core.Common/Hosting/RegisterInstanceDao.cs index 27d6b704fc..3c55805105 100644 --- a/common/ASC.Core.Common/Hosting/RegisterInstanceDao.cs +++ b/common/ASC.Core.Common/Hosting/RegisterInstanceDao.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.Notify; + namespace ASC.Core.Common.Hosting; [Scope] @@ -48,6 +50,10 @@ public class RegisterInstanceDao : IRegisterInstanceDao where T : IHostedS if (inst == null) { await _instanceRegistrationContext.AddAsync(obj); + } + else + { + _instanceRegistrationContext.Entry(inst).CurrentValues.SetValues(obj); } bool saveFailed; diff --git a/common/ASC.Core.Common/Hosting/RegisterInstanceManager.cs b/common/ASC.Core.Common/Hosting/RegisterInstanceManager.cs index 0582776b24..7d45b48f7b 100644 --- a/common/ASC.Core.Common/Hosting/RegisterInstanceManager.cs +++ b/common/ASC.Core.Common/Hosting/RegisterInstanceManager.cs @@ -60,7 +60,7 @@ public class RegisterInstanceManager : IRegisterInstanceManager where T : { var firstAliceInstance = GetFirstAliveInstance(instances); - if (firstAliceInstance != null && firstAliceInstance.InstanceRegistrationId == instance.InstanceRegistrationId) + if (firstAliceInstance == null || firstAliceInstance.InstanceRegistrationId == instance.InstanceRegistrationId) { instance.IsActive = true; } From 315f2322947f68e262d5f3d12785b83d4182f32a Mon Sep 17 00:00:00 2001 From: TimofeyBoyko Date: Fri, 16 Sep 2022 11:24:39 +0300 Subject: [PATCH 70/87] Web:Cliet:Home: fix displaying 'Created' option to sort menu --- 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 ba4ab4037c..f0054c1892 100644 --- a/packages/client/src/pages/Home/Section/Filter/index.js +++ b/packages/client/src/pages/Home/Section/Filter/index.js @@ -878,8 +878,8 @@ const SectionFilterContent = ({ !hide && commonOptions.push(authorOption); } - if (availableSort?.includes("Create")) { - const idx = availableSort.findIndex((x) => x === "Create"); + if (availableSort?.includes("Created")) { + const idx = availableSort.findIndex((x) => x === "Created"); const hide = infoPanelVisible && infoPanelColumnsSize[idx] === "0px"; !hide && commonOptions.push(creationDate); From d91848cfff6de28ea349a10c0b83937d9bad851f Mon Sep 17 00:00:00 2001 From: MaksimChegulov Date: Fri, 16 Sep 2022 13:32:00 +0300 Subject: [PATCH 71/87] Files: added withoutMe for files filter --- .../Core/Core/Dao/Interfaces/IFileDao.cs | 2 +- .../Core/Core/Dao/Interfaces/IFolderDao.cs | 4 ++-- .../Core/Core/Dao/TeamlabDao/FileDao.cs | 7 +++++- .../Core/Core/Dao/TeamlabDao/FolderDao.cs | 14 +++++++++-- .../Core/Core/Thirdparty/Box/BoxFileDao.cs | 2 +- .../Core/Core/Thirdparty/Box/BoxFolderDao.cs | 4 ++-- .../Core/Thirdparty/Dropbox/DropboxFileDao.cs | 2 +- .../Thirdparty/Dropbox/DropboxFolderDao.cs | 4 ++-- .../GoogleDrive/GoogleDriveFileDao.cs | 2 +- .../GoogleDrive/GoogleDriveFolderDao.cs | 4 ++-- .../Thirdparty/OneDrive/OneDriveFileDao.cs | 2 +- .../Thirdparty/OneDrive/OneDriveFolderDao.cs | 4 ++-- .../Thirdparty/ProviderDao/ProviderFileDao.cs | 4 ++-- .../ProviderDao/ProviderFolderDao.cs | 8 +++---- .../SharePoint/SharePointFileDao.cs | 2 +- .../SharePoint/SharePointFolderDao.cs | 4 ++-- .../Thirdparty/Sharpbox/SharpBoxFileDao.cs | 2 +- .../Thirdparty/Sharpbox/SharpBoxFolderDao.cs | 4 ++-- products/ASC.Files/Core/Utils/EntryManager.cs | 4 ++-- .../ASC.Files/Server/Api/FoldersController.cs | 24 +++++++++---------- .../Server/Helpers/FoldersControllerHelper.cs | 8 +++---- 21 files changed, 63 insertions(+), 48 deletions(-) diff --git a/products/ASC.Files/Core/Core/Dao/Interfaces/IFileDao.cs b/products/ASC.Files/Core/Core/Dao/Interfaces/IFileDao.cs index 4267cb5aaa..eb3120983d 100644 --- a/products/ASC.Files/Core/Core/Dao/Interfaces/IFileDao.cs +++ b/products/ASC.Files/Core/Core/Dao/Interfaces/IFileDao.cs @@ -112,7 +112,7 @@ public interface IFileDao /// /// Return only the latest versions of files of a folder /// - IAsyncEnumerable> GetFilesAsync(T parentId, OrderBy orderBy, FilterType filterType, bool subjectGroup, Guid subjectID, string searchText, bool searchInContent, bool withSubfolders = false); + IAsyncEnumerable> GetFilesAsync(T parentId, OrderBy orderBy, FilterType filterType, bool subjectGroup, Guid subjectID, string searchText, bool searchInContent, bool withSubfolders = false, bool withoutMe = false); /// /// Get stream of file diff --git a/products/ASC.Files/Core/Core/Dao/Interfaces/IFolderDao.cs b/products/ASC.Files/Core/Core/Dao/Interfaces/IFolderDao.cs index a67583cf82..bde5918a4a 100644 --- a/products/ASC.Files/Core/Core/Dao/Interfaces/IFolderDao.cs +++ b/products/ASC.Files/Core/Core/Dao/Interfaces/IFolderDao.cs @@ -81,7 +81,7 @@ public interface IFolderDao /// /// /// - IAsyncEnumerable> GetFoldersAsync(T parentId, OrderBy orderBy, FilterType filterType, bool subjectGroup, Guid subjectID, string searchText, bool withSubfolders = false); + IAsyncEnumerable> GetFoldersAsync(T parentId, OrderBy orderBy, FilterType filterType, bool subjectGroup, Guid subjectID, string searchText, bool withSubfolders = false, bool withoutMe = false); /// /// Gets the folder (s) by ID (s) @@ -95,7 +95,7 @@ public interface IFolderDao /// /// /// - IAsyncEnumerable> GetFoldersAsync(IEnumerable folderIds, FilterType filterTypes = FilterType.None, bool subjectGroup = false, Guid? subjectID = null, string searchText = "", bool searchSubfolders = false, bool checkShare = true); + IAsyncEnumerable> GetFoldersAsync(IEnumerable folderIds, FilterType filterTypes = FilterType.None, bool subjectGroup = false, Guid? subjectID = null, string searchText = "", bool searchSubfolders = false, bool checkShare = true, bool withoutMe = false); /// /// Get folder, contains folder with id diff --git a/products/ASC.Files/Core/Core/Dao/TeamlabDao/FileDao.cs b/products/ASC.Files/Core/Core/Dao/TeamlabDao/FileDao.cs index fcea5311f8..90af0b26cc 100644 --- a/products/ASC.Files/Core/Core/Dao/TeamlabDao/FileDao.cs +++ b/products/ASC.Files/Core/Core/Dao/TeamlabDao/FileDao.cs @@ -273,7 +273,7 @@ internal class FileDao : AbstractDao, IFileDao } } - public async IAsyncEnumerable> GetFilesAsync(int parentId, OrderBy orderBy, FilterType filterType, bool subjectGroup, Guid subjectID, string searchText, bool searchInContent, bool withSubfolders = false) + public async IAsyncEnumerable> GetFilesAsync(int parentId, OrderBy orderBy, FilterType filterType, bool subjectGroup, Guid subjectID, string searchText, bool searchInContent, bool withSubfolders = false, bool withoutMe = false) { if (filterType == FilterType.FoldersOnly) { @@ -353,6 +353,11 @@ internal class FileDao : AbstractDao, IFileDao break; } + if (withoutMe) + { + q = q.Where(r => r.CreateBy != _authContext.CurrentAccount.ID); + } + await foreach (var e in FromQueryWithShared(filesDbContext, q).AsAsyncEnumerable()) { yield return _mapper.Map>(e); diff --git a/products/ASC.Files/Core/Core/Dao/TeamlabDao/FolderDao.cs b/products/ASC.Files/Core/Core/Dao/TeamlabDao/FolderDao.cs index c47326a939..b3aaa7cdbd 100644 --- a/products/ASC.Files/Core/Core/Dao/TeamlabDao/FolderDao.cs +++ b/products/ASC.Files/Core/Core/Dao/TeamlabDao/FolderDao.cs @@ -226,7 +226,7 @@ internal class FolderDao : AbstractDao, IFolderDao } } - public async IAsyncEnumerable> GetFoldersAsync(int parentId, OrderBy orderBy, FilterType filterType, bool subjectGroup, Guid subjectID, string searchText, bool withSubfolders = false) + public async IAsyncEnumerable> GetFoldersAsync(int parentId, OrderBy orderBy, FilterType filterType, bool subjectGroup, Guid subjectID, string searchText, bool withSubfolders = false, bool withoutMe = false) { if (CheckInvalidFilter(filterType)) { @@ -280,13 +280,18 @@ internal class FolderDao : AbstractDao, IFolderDao } } + if (withoutMe) + { + q = q.Where(r => r.CreateBy != _authContext.CurrentAccount.ID); + } + await foreach (var e in FromQueryWithShared(filesDbContext, q).AsAsyncEnumerable()) { yield return _mapper.Map>(e); } } - public async IAsyncEnumerable> GetFoldersAsync(IEnumerable folderIds, FilterType filterType = FilterType.None, bool subjectGroup = false, Guid? subjectID = null, string searchText = "", bool searchSubfolders = false, bool checkShare = true) + public async IAsyncEnumerable> GetFoldersAsync(IEnumerable folderIds, FilterType filterType = FilterType.None, bool subjectGroup = false, Guid? subjectID = null, string searchText = "", bool searchSubfolders = false, bool checkShare = true, bool withoutMe = false) { if (CheckInvalidFilter(filterType)) { @@ -334,6 +339,11 @@ internal class FolderDao : AbstractDao, IFolderDao } } + if (withoutMe) + { + q = q.Where(r => r.CreateBy != _authContext.CurrentAccount.ID); + } + await foreach (var e in (checkShare ? FromQueryWithShared(filesDbContext, q) : FromQuery(filesDbContext, q)).AsAsyncEnumerable().Distinct()) { yield return _mapper.Map>(e); diff --git a/products/ASC.Files/Core/Core/Thirdparty/Box/BoxFileDao.cs b/products/ASC.Files/Core/Core/Thirdparty/Box/BoxFileDao.cs index 3d85087159..88c4b193f1 100644 --- a/products/ASC.Files/Core/Core/Thirdparty/Box/BoxFileDao.cs +++ b/products/ASC.Files/Core/Core/Thirdparty/Box/BoxFileDao.cs @@ -181,7 +181,7 @@ internal class BoxFileDao : BoxDaoBase, IFileDao } } - public async IAsyncEnumerable> GetFilesAsync(string parentId, OrderBy orderBy, FilterType filterType, bool subjectGroup, Guid subjectID, string searchText, bool searchInContent, bool withSubfolders = false) + public async IAsyncEnumerable> GetFilesAsync(string parentId, OrderBy orderBy, FilterType filterType, bool subjectGroup, Guid subjectID, string searchText, bool searchInContent, bool withSubfolders = false, bool withoutMe = false) { if (filterType == FilterType.FoldersOnly) { diff --git a/products/ASC.Files/Core/Core/Thirdparty/Box/BoxFolderDao.cs b/products/ASC.Files/Core/Core/Thirdparty/Box/BoxFolderDao.cs index 267d478dbb..382f81fd3b 100644 --- a/products/ASC.Files/Core/Core/Thirdparty/Box/BoxFolderDao.cs +++ b/products/ASC.Files/Core/Core/Thirdparty/Box/BoxFolderDao.cs @@ -129,7 +129,7 @@ internal class BoxFolderDao : BoxDaoBase, IFolderDao } } - public IAsyncEnumerable> GetFoldersAsync(string parentId, OrderBy orderBy, FilterType filterType, bool subjectGroup, Guid subjectID, string searchText, bool withSubfolders = false) + public IAsyncEnumerable> GetFoldersAsync(string parentId, OrderBy orderBy, FilterType filterType, bool subjectGroup, Guid subjectID, string searchText, bool withSubfolders = false, bool withoutMe = false) { if (CheckInvalidFilter(filterType)) { @@ -164,7 +164,7 @@ internal class BoxFolderDao : BoxDaoBase, IFolderDao return folders; } - public IAsyncEnumerable> GetFoldersAsync(IEnumerable folderIds, FilterType filterType = FilterType.None, bool subjectGroup = false, Guid? subjectID = null, string searchText = "", bool searchSubfolders = false, bool checkShare = true) + public IAsyncEnumerable> GetFoldersAsync(IEnumerable folderIds, FilterType filterType = FilterType.None, bool subjectGroup = false, Guid? subjectID = null, string searchText = "", bool searchSubfolders = false, bool checkShare = true, bool withoutMe = false) { if (CheckInvalidFilter(filterType)) { diff --git a/products/ASC.Files/Core/Core/Thirdparty/Dropbox/DropboxFileDao.cs b/products/ASC.Files/Core/Core/Thirdparty/Dropbox/DropboxFileDao.cs index bae0b7fedd..2577839a6a 100644 --- a/products/ASC.Files/Core/Core/Thirdparty/Dropbox/DropboxFileDao.cs +++ b/products/ASC.Files/Core/Core/Thirdparty/Dropbox/DropboxFileDao.cs @@ -183,7 +183,7 @@ internal class DropboxFileDao : DropboxDaoBase, IFileDao } } - public async IAsyncEnumerable> GetFilesAsync(string parentId, OrderBy orderBy, FilterType filterType, bool subjectGroup, Guid subjectID, string searchText, bool searchInContent, bool withSubfolders = false) + public async IAsyncEnumerable> GetFilesAsync(string parentId, OrderBy orderBy, FilterType filterType, bool subjectGroup, Guid subjectID, string searchText, bool searchInContent, bool withSubfolders = false, bool withoutMe = false) { if (filterType == FilterType.FoldersOnly) { diff --git a/products/ASC.Files/Core/Core/Thirdparty/Dropbox/DropboxFolderDao.cs b/products/ASC.Files/Core/Core/Thirdparty/Dropbox/DropboxFolderDao.cs index 261cddb88e..3d00f5d73d 100644 --- a/products/ASC.Files/Core/Core/Thirdparty/Dropbox/DropboxFolderDao.cs +++ b/products/ASC.Files/Core/Core/Thirdparty/Dropbox/DropboxFolderDao.cs @@ -130,7 +130,7 @@ internal class DropboxFolderDao : DropboxDaoBase, IFolderDao } } - public IAsyncEnumerable> GetFoldersAsync(string parentId, OrderBy orderBy, FilterType filterType, bool subjectGroup, Guid subjectID, string searchText, bool withSubfolders = false) + public IAsyncEnumerable> GetFoldersAsync(string parentId, OrderBy orderBy, FilterType filterType, bool subjectGroup, Guid subjectID, string searchText, bool withSubfolders = false, bool withoutMe = false) { if (filterType is FilterType.FilesOnly or FilterType.ByExtension or FilterType.DocumentsOnly or FilterType.ImagesOnly or FilterType.PresentationsOnly or FilterType.SpreadsheetsOnly or FilterType.ArchiveOnly or FilterType.MediaOnly) @@ -166,7 +166,7 @@ internal class DropboxFolderDao : DropboxDaoBase, IFolderDao return folders; } - public IAsyncEnumerable> GetFoldersAsync(IEnumerable folderIds, FilterType filterType = FilterType.None, bool subjectGroup = false, Guid? subjectID = null, string searchText = "", bool searchSubfolders = false, bool checkShare = true) + public IAsyncEnumerable> GetFoldersAsync(IEnumerable folderIds, FilterType filterType = FilterType.None, bool subjectGroup = false, Guid? subjectID = null, string searchText = "", bool searchSubfolders = false, bool checkShare = true, bool withoutMe = false) { if (filterType is FilterType.FilesOnly or FilterType.ByExtension or FilterType.DocumentsOnly or FilterType.ImagesOnly or FilterType.PresentationsOnly or FilterType.SpreadsheetsOnly or FilterType.ArchiveOnly or FilterType.MediaOnly) diff --git a/products/ASC.Files/Core/Core/Thirdparty/GoogleDrive/GoogleDriveFileDao.cs b/products/ASC.Files/Core/Core/Thirdparty/GoogleDrive/GoogleDriveFileDao.cs index 5bdaba1176..1334ed123d 100644 --- a/products/ASC.Files/Core/Core/Thirdparty/GoogleDrive/GoogleDriveFileDao.cs +++ b/products/ASC.Files/Core/Core/Thirdparty/GoogleDrive/GoogleDriveFileDao.cs @@ -182,7 +182,7 @@ internal class GoogleDriveFileDao : GoogleDriveDaoBase, IFileDao } } - public async IAsyncEnumerable> GetFilesAsync(string parentId, OrderBy orderBy, FilterType filterType, bool subjectGroup, Guid subjectID, string searchText, bool searchInContent, bool withSubfolders = false) + public async IAsyncEnumerable> GetFilesAsync(string parentId, OrderBy orderBy, FilterType filterType, bool subjectGroup, Guid subjectID, string searchText, bool searchInContent, bool withSubfolders = false, bool withoutMe = false) { if (filterType == FilterType.FoldersOnly) { diff --git a/products/ASC.Files/Core/Core/Thirdparty/GoogleDrive/GoogleDriveFolderDao.cs b/products/ASC.Files/Core/Core/Thirdparty/GoogleDrive/GoogleDriveFolderDao.cs index 6fd6de69c8..060dc406d8 100644 --- a/products/ASC.Files/Core/Core/Thirdparty/GoogleDrive/GoogleDriveFolderDao.cs +++ b/products/ASC.Files/Core/Core/Thirdparty/GoogleDrive/GoogleDriveFolderDao.cs @@ -128,7 +128,7 @@ internal class GoogleDriveFolderDao : GoogleDriveDaoBase, IFolderDao } } - public IAsyncEnumerable> GetFoldersAsync(string parentId, OrderBy orderBy, FilterType filterType, bool subjectGroup, Guid subjectID, string searchText, bool withSubfolders = false) + public IAsyncEnumerable> GetFoldersAsync(string parentId, OrderBy orderBy, FilterType filterType, bool subjectGroup, Guid subjectID, string searchText, bool withSubfolders = false, bool withoutMe = false) { if (filterType is FilterType.FilesOnly or FilterType.ByExtension or FilterType.DocumentsOnly or FilterType.ImagesOnly or FilterType.PresentationsOnly or FilterType.SpreadsheetsOnly or FilterType.ArchiveOnly or FilterType.MediaOnly) @@ -164,7 +164,7 @@ internal class GoogleDriveFolderDao : GoogleDriveDaoBase, IFolderDao return folders; } - public IAsyncEnumerable> GetFoldersAsync(IEnumerable folderIds, FilterType filterType = FilterType.None, bool subjectGroup = false, Guid? subjectID = null, string searchText = "", bool searchSubfolders = false, bool checkShare = true) + public IAsyncEnumerable> GetFoldersAsync(IEnumerable folderIds, FilterType filterType = FilterType.None, bool subjectGroup = false, Guid? subjectID = null, string searchText = "", bool searchSubfolders = false, bool checkShare = true, bool withoutMe = false) { if (filterType is FilterType.FilesOnly or FilterType.ByExtension or FilterType.DocumentsOnly or FilterType.ImagesOnly or FilterType.PresentationsOnly or FilterType.SpreadsheetsOnly or FilterType.ArchiveOnly or FilterType.MediaOnly) diff --git a/products/ASC.Files/Core/Core/Thirdparty/OneDrive/OneDriveFileDao.cs b/products/ASC.Files/Core/Core/Thirdparty/OneDrive/OneDriveFileDao.cs index 08d84a1391..23eed12ecb 100644 --- a/products/ASC.Files/Core/Core/Thirdparty/OneDrive/OneDriveFileDao.cs +++ b/products/ASC.Files/Core/Core/Thirdparty/OneDrive/OneDriveFileDao.cs @@ -181,7 +181,7 @@ internal class OneDriveFileDao : OneDriveDaoBase, IFileDao } - public async IAsyncEnumerable> GetFilesAsync(string parentId, OrderBy orderBy, FilterType filterType, bool subjectGroup, Guid subjectID, string searchText, bool searchInContent, bool withSubfolders = false) + public async IAsyncEnumerable> GetFilesAsync(string parentId, OrderBy orderBy, FilterType filterType, bool subjectGroup, Guid subjectID, string searchText, bool searchInContent, bool withSubfolders = false, bool withoutMe = false) { if (filterType == FilterType.FoldersOnly) { diff --git a/products/ASC.Files/Core/Core/Thirdparty/OneDrive/OneDriveFolderDao.cs b/products/ASC.Files/Core/Core/Thirdparty/OneDrive/OneDriveFolderDao.cs index aa214b51e2..344c2cbebc 100644 --- a/products/ASC.Files/Core/Core/Thirdparty/OneDrive/OneDriveFolderDao.cs +++ b/products/ASC.Files/Core/Core/Thirdparty/OneDrive/OneDriveFolderDao.cs @@ -128,7 +128,7 @@ internal class OneDriveFolderDao : OneDriveDaoBase, IFolderDao } } - public IAsyncEnumerable> GetFoldersAsync(string parentId, OrderBy orderBy, FilterType filterType, bool subjectGroup, Guid subjectID, string searchText, bool withSubfolders = false) + public IAsyncEnumerable> GetFoldersAsync(string parentId, OrderBy orderBy, FilterType filterType, bool subjectGroup, Guid subjectID, string searchText, bool withSubfolders = false, bool withoutMe = false) { if (filterType is FilterType.FilesOnly or FilterType.ByExtension or FilterType.DocumentsOnly or FilterType.ImagesOnly or FilterType.PresentationsOnly or FilterType.SpreadsheetsOnly or FilterType.ArchiveOnly or FilterType.MediaOnly) @@ -165,7 +165,7 @@ internal class OneDriveFolderDao : OneDriveDaoBase, IFolderDao return folders; } - public IAsyncEnumerable> GetFoldersAsync(IEnumerable folderIds, FilterType filterType = FilterType.None, bool subjectGroup = false, Guid? subjectID = null, string searchText = "", bool searchSubfolders = false, bool checkShare = true) + public IAsyncEnumerable> GetFoldersAsync(IEnumerable folderIds, FilterType filterType = FilterType.None, bool subjectGroup = false, Guid? subjectID = null, string searchText = "", bool searchSubfolders = false, bool checkShare = true, bool withoutMe = false) { if (filterType is FilterType.FilesOnly or FilterType.ByExtension or FilterType.DocumentsOnly or FilterType.ImagesOnly or FilterType.PresentationsOnly or FilterType.SpreadsheetsOnly or FilterType.ArchiveOnly or FilterType.MediaOnly) diff --git a/products/ASC.Files/Core/Core/Thirdparty/ProviderDao/ProviderFileDao.cs b/products/ASC.Files/Core/Core/Thirdparty/ProviderDao/ProviderFileDao.cs index 01db3c9abb..3a9194a085 100644 --- a/products/ASC.Files/Core/Core/Thirdparty/ProviderDao/ProviderFileDao.cs +++ b/products/ASC.Files/Core/Core/Thirdparty/ProviderDao/ProviderFileDao.cs @@ -182,12 +182,12 @@ internal class ProviderFileDao : ProviderDaoBase, IFileDao } } - public async IAsyncEnumerable> GetFilesAsync(string parentId, OrderBy orderBy, FilterType filterType, bool subjectGroup, Guid subjectID, string searchText, bool searchInContent, bool withSubfolders = false) + public async IAsyncEnumerable> GetFilesAsync(string parentId, OrderBy orderBy, FilterType filterType, bool subjectGroup, Guid subjectID, string searchText, bool searchInContent, bool withSubfolders = false, bool withoutMe = false) { var selector = GetSelector(parentId); var fileDao = selector.GetFileDao(parentId); - var files = fileDao.GetFilesAsync(selector.ConvertId(parentId), orderBy, filterType, subjectGroup, subjectID, searchText, searchInContent, withSubfolders); + var files = fileDao.GetFilesAsync(selector.ConvertId(parentId), orderBy, filterType, subjectGroup, subjectID, searchText, searchInContent, withSubfolders, withoutMe); var result = await files.Where(r => r != null).ToListAsync(); await SetSharedPropertyAsync(result); diff --git a/products/ASC.Files/Core/Core/Thirdparty/ProviderDao/ProviderFolderDao.cs b/products/ASC.Files/Core/Core/Thirdparty/ProviderDao/ProviderFolderDao.cs index 5b0abb018d..3a1c657e60 100644 --- a/products/ASC.Files/Core/Core/Thirdparty/ProviderDao/ProviderFolderDao.cs +++ b/products/ASC.Files/Core/Core/Thirdparty/ProviderDao/ProviderFolderDao.cs @@ -142,11 +142,11 @@ internal class ProviderFolderDao : ProviderDaoBase, IFolderDao return folders.Where(r => r != null); } - public async IAsyncEnumerable> GetFoldersAsync(string parentId, OrderBy orderBy, FilterType filterType, bool subjectGroup, Guid subjectID, string searchText, bool withSubfolders = false) + public async IAsyncEnumerable> GetFoldersAsync(string parentId, OrderBy orderBy, FilterType filterType, bool subjectGroup, Guid subjectID, string searchText, bool withSubfolders = false, bool withoutMe = false) { var selector = GetSelector(parentId); var folderDao = selector.GetFolderDao(parentId); - var folders = folderDao.GetFoldersAsync(selector.ConvertId(parentId), orderBy, filterType, subjectGroup, subjectID, searchText, withSubfolders); + var folders = folderDao.GetFoldersAsync(selector.ConvertId(parentId), orderBy, filterType, subjectGroup, subjectID, searchText, withSubfolders, withoutMe); var result = await folders.Where(r => r != null).ToListAsync(); await SetSharedPropertyAsync(result); @@ -157,7 +157,7 @@ internal class ProviderFolderDao : ProviderDaoBase, IFolderDao } } - public IAsyncEnumerable> GetFoldersAsync(IEnumerable folderIds, FilterType filterType = FilterType.None, bool subjectGroup = false, Guid? subjectID = null, string searchText = "", bool searchSubfolders = false, bool checkShare = true) + public IAsyncEnumerable> GetFoldersAsync(IEnumerable folderIds, FilterType filterType = FilterType.None, bool subjectGroup = false, Guid? subjectID = null, string searchText = "", bool searchSubfolders = false, bool checkShare = true, bool withoutMe = false) { var result = AsyncEnumerable.Empty>(); @@ -178,7 +178,7 @@ internal class ProviderFolderDao : ProviderDaoBase, IFolderDao var folderDao = selectorLocal.GetFolderDao(matchedId.FirstOrDefault()); return folderDao.GetFoldersAsync(matchedId.Select(selectorLocal.ConvertId).ToList(), - filterType, subjectGroup, subjectID, searchText, searchSubfolders, checkShare); + filterType, subjectGroup, subjectID, searchText, searchSubfolders, checkShare, withoutMe); }) .Where(r => r != null)); } diff --git a/products/ASC.Files/Core/Core/Thirdparty/SharePoint/SharePointFileDao.cs b/products/ASC.Files/Core/Core/Thirdparty/SharePoint/SharePointFileDao.cs index f00ba634fc..81b293ab0b 100644 --- a/products/ASC.Files/Core/Core/Thirdparty/SharePoint/SharePointFileDao.cs +++ b/products/ASC.Files/Core/Core/Thirdparty/SharePoint/SharePointFileDao.cs @@ -171,7 +171,7 @@ internal class SharePointFileDao : SharePointDaoBase, IFileDao } } - public async IAsyncEnumerable> GetFilesAsync(string parentId, OrderBy orderBy, FilterType filterType, bool subjectGroup, Guid subjectID, string searchText, bool searchInContent, bool withSubfolders = false) + public async IAsyncEnumerable> GetFilesAsync(string parentId, OrderBy orderBy, FilterType filterType, bool subjectGroup, Guid subjectID, string searchText, bool searchInContent, bool withSubfolders = false, bool withoutMe = false) { if (filterType == FilterType.FoldersOnly) { diff --git a/products/ASC.Files/Core/Core/Thirdparty/SharePoint/SharePointFolderDao.cs b/products/ASC.Files/Core/Core/Thirdparty/SharePoint/SharePointFolderDao.cs index a5df7031ae..a102fe035c 100644 --- a/products/ASC.Files/Core/Core/Thirdparty/SharePoint/SharePointFolderDao.cs +++ b/products/ASC.Files/Core/Core/Thirdparty/SharePoint/SharePointFolderDao.cs @@ -134,7 +134,7 @@ internal class SharePointFolderDao : SharePointDaoBase, IFolderDao } } - public IAsyncEnumerable> GetFoldersAsync(string parentId, OrderBy orderBy, FilterType filterType, bool subjectGroup, Guid subjectID, string searchText, bool withSubfolders = false) + public IAsyncEnumerable> GetFoldersAsync(string parentId, OrderBy orderBy, FilterType filterType, bool subjectGroup, Guid subjectID, string searchText, bool withSubfolders = false, bool withoutMe = false) { if (filterType is FilterType.FilesOnly or FilterType.ByExtension or FilterType.DocumentsOnly or FilterType.ImagesOnly or FilterType.PresentationsOnly or FilterType.SpreadsheetsOnly or FilterType.ArchiveOnly or FilterType.MediaOnly) @@ -171,7 +171,7 @@ internal class SharePointFolderDao : SharePointDaoBase, IFolderDao return folders; } - public IAsyncEnumerable> GetFoldersAsync(IEnumerable folderIds, FilterType filterType = FilterType.None, bool subjectGroup = false, Guid? subjectID = null, string searchText = "", bool searchSubfolders = false, bool checkShare = true) + public IAsyncEnumerable> GetFoldersAsync(IEnumerable folderIds, FilterType filterType = FilterType.None, bool subjectGroup = false, Guid? subjectID = null, string searchText = "", bool searchSubfolders = false, bool checkShare = true, bool withoutMe = false) { if (filterType is FilterType.FilesOnly or FilterType.ByExtension or FilterType.DocumentsOnly or FilterType.ImagesOnly or FilterType.PresentationsOnly or FilterType.SpreadsheetsOnly or FilterType.ArchiveOnly or FilterType.MediaOnly) diff --git a/products/ASC.Files/Core/Core/Thirdparty/Sharpbox/SharpBoxFileDao.cs b/products/ASC.Files/Core/Core/Thirdparty/Sharpbox/SharpBoxFileDao.cs index 2f43cffc53..337b9a6542 100644 --- a/products/ASC.Files/Core/Core/Thirdparty/Sharpbox/SharpBoxFileDao.cs +++ b/products/ASC.Files/Core/Core/Thirdparty/Sharpbox/SharpBoxFileDao.cs @@ -166,7 +166,7 @@ internal class SharpBoxFileDao : SharpBoxDaoBase, IFileDao } } - public async IAsyncEnumerable> GetFilesAsync(string parentId, OrderBy orderBy, FilterType filterType, bool subjectGroup, Guid subjectID, string searchText, bool searchInContent, bool withSubfolders = false) + public async IAsyncEnumerable> GetFilesAsync(string parentId, OrderBy orderBy, FilterType filterType, bool subjectGroup, Guid subjectID, string searchText, bool searchInContent, bool withSubfolders = false, bool withoutMe = false) { if (filterType == FilterType.FoldersOnly) { diff --git a/products/ASC.Files/Core/Core/Thirdparty/Sharpbox/SharpBoxFolderDao.cs b/products/ASC.Files/Core/Core/Thirdparty/Sharpbox/SharpBoxFolderDao.cs index d87b4acaec..1d42388299 100644 --- a/products/ASC.Files/Core/Core/Thirdparty/Sharpbox/SharpBoxFolderDao.cs +++ b/products/ASC.Files/Core/Core/Thirdparty/Sharpbox/SharpBoxFolderDao.cs @@ -130,7 +130,7 @@ internal class SharpBoxFolderDao : SharpBoxDaoBase, IFolderDao return parentFolder.OfType().Select(ToFolder).ToAsyncEnumerable(); } - public IAsyncEnumerable> GetFoldersAsync(string parentId, OrderBy orderBy, FilterType filterType, bool subjectGroup, Guid subjectID, string searchText, bool withSubfolders = false) + public IAsyncEnumerable> GetFoldersAsync(string parentId, OrderBy orderBy, FilterType filterType, bool subjectGroup, Guid subjectID, string searchText, bool withSubfolders = false, bool withoutMe = false) { if (filterType is FilterType.FilesOnly or FilterType.ByExtension or FilterType.DocumentsOnly or FilterType.ImagesOnly or FilterType.PresentationsOnly or FilterType.SpreadsheetsOnly or FilterType.ArchiveOnly or FilterType.MediaOnly) @@ -167,7 +167,7 @@ internal class SharpBoxFolderDao : SharpBoxDaoBase, IFolderDao return folders; } - public IAsyncEnumerable> GetFoldersAsync(IEnumerable folderIds, FilterType filterType = FilterType.None, bool subjectGroup = false, Guid? subjectID = null, string searchText = "", bool searchSubfolders = false, bool checkShare = true) + public IAsyncEnumerable> GetFoldersAsync(IEnumerable folderIds, FilterType filterType = FilterType.None, bool subjectGroup = false, Guid? subjectID = null, string searchText = "", bool searchSubfolders = false, bool checkShare = true, bool withoutMe = false) { if (filterType is FilterType.FilesOnly or FilterType.ByExtension or FilterType.DocumentsOnly or FilterType.ImagesOnly or FilterType.PresentationsOnly or FilterType.SpreadsheetsOnly or FilterType.ArchiveOnly or FilterType.MediaOnly) diff --git a/products/ASC.Files/Core/Utils/EntryManager.cs b/products/ASC.Files/Core/Utils/EntryManager.cs index 08fbd0ea57..48e81f3d1e 100644 --- a/products/ASC.Files/Core/Utils/EntryManager.cs +++ b/products/ASC.Files/Core/Utils/EntryManager.cs @@ -468,8 +468,8 @@ public class EntryManager withSubfolders = false; } - var folders = _daoFactory.GetFolderDao().GetFoldersAsync(parent.Id, orderBy, filterType, subjectGroup, subjectId, searchText, withSubfolders); - var files = _daoFactory.GetFileDao().GetFilesAsync(parent.Id, orderBy, filterType, subjectGroup, subjectId, searchText, searchInContent, withSubfolders); + var folders = _daoFactory.GetFolderDao().GetFoldersAsync(parent.Id, orderBy, filterType, subjectGroup, subjectId, searchText, withSubfolders, withoutMe); + var files = _daoFactory.GetFileDao().GetFilesAsync(parent.Id, orderBy, filterType, subjectGroup, subjectId, searchText, searchInContent, withSubfolders, withoutMe); var task1 = _fileSecurity.FilterReadAsync(folders).ToListAsync(); var task2 = _fileSecurity.FilterReadAsync(files).ToListAsync(); diff --git a/products/ASC.Files/Server/Api/FoldersController.cs b/products/ASC.Files/Server/Api/FoldersController.cs index f6a724d676..e149ef764c 100644 --- a/products/ASC.Files/Server/Api/FoldersController.cs +++ b/products/ASC.Files/Server/Api/FoldersController.cs @@ -122,9 +122,9 @@ public abstract class FoldersController : ApiControllerBase /// Filter type /// Folder contents [HttpGet("{folderId}", Order = 1)] - public async Task> GetFolderAsync(T folderId, Guid? userIdOrGroupId, FilterType? filterType, bool? searchInContent, bool? withsubfolders) + public async Task> GetFolderAsync(T folderId, Guid? userIdOrGroupId, FilterType? filterType, bool? searchInContent, bool? withsubfolders, bool withoutMe) { - var folder = await _foldersControllerHelper.GetFolderAsync(folderId, userIdOrGroupId, filterType, searchInContent, withsubfolders); + var folder = await _foldersControllerHelper.GetFolderAsync(folderId, userIdOrGroupId, filterType, searchInContent, withsubfolders, withoutMe); return folder.NotFoundIfNull(); } @@ -225,7 +225,7 @@ public class FoldersControllerCommon : ApiControllerBase [HttpGet("@common")] public async Task> GetCommonFolderAsync(Guid? userIdOrGroupId, FilterType? filterType, bool? searchInContent, bool? withsubfolders) { - return await _foldersControllerHelperInt.GetFolderAsync(await _globalFolderHelper.FolderCommonAsync, userIdOrGroupId, filterType, searchInContent, withsubfolders); + return await _foldersControllerHelperInt.GetFolderAsync(await _globalFolderHelper.FolderCommonAsync, userIdOrGroupId, filterType, searchInContent, withsubfolders, false); } /// @@ -237,7 +237,7 @@ public class FoldersControllerCommon : ApiControllerBase [HttpGet("@favorites")] public async Task> GetFavoritesFolderAsync(Guid? userIdOrGroupId, FilterType? filterType, bool? searchInContent, bool? withsubfolders) { - return await _foldersControllerHelperInt.GetFolderAsync(await _globalFolderHelper.FolderFavoritesAsync, userIdOrGroupId, filterType, searchInContent, withsubfolders); + return await _foldersControllerHelperInt.GetFolderAsync(await _globalFolderHelper.FolderFavoritesAsync, userIdOrGroupId, filterType, searchInContent, withsubfolders, false); } /// @@ -251,7 +251,7 @@ public class FoldersControllerCommon : ApiControllerBase [HttpGet("@my")] public Task> GetMyFolderAsync(Guid? userIdOrGroupId, FilterType? filterType, bool? searchInContent, bool? withsubfolders) { - return _foldersControllerHelperInt.GetFolderAsync(_globalFolderHelper.FolderMy, userIdOrGroupId, filterType, searchInContent, withsubfolders); + return _foldersControllerHelperInt.GetFolderAsync(_globalFolderHelper.FolderMy, userIdOrGroupId, filterType, searchInContent, withsubfolders, false); } [HttpGet("@privacy")] @@ -262,7 +262,7 @@ public class FoldersControllerCommon : ApiControllerBase throw new System.Security.SecurityException(); } - return await _foldersControllerHelperInt.GetFolderAsync(await _globalFolderHelper.FolderPrivacyAsync, userIdOrGroupId, filterType, searchInContent, withsubfolders); + return await _foldersControllerHelperInt.GetFolderAsync(await _globalFolderHelper.FolderPrivacyAsync, userIdOrGroupId, filterType, searchInContent, withsubfolders, false); } /// @@ -276,7 +276,7 @@ public class FoldersControllerCommon : ApiControllerBase [HttpGet("@projects")] public async Task> GetProjectsFolderAsync(Guid? userIdOrGroupId, FilterType? filterType, bool? searchInContent, bool? withsubfolders) { - return await _foldersControllerHelperString.GetFolderAsync(await _globalFolderHelper.GetFolderProjectsAsync(), userIdOrGroupId, filterType, searchInContent, withsubfolders); + return await _foldersControllerHelperString.GetFolderAsync(await _globalFolderHelper.GetFolderProjectsAsync(), userIdOrGroupId, filterType, searchInContent, withsubfolders, false); } /// @@ -288,7 +288,7 @@ public class FoldersControllerCommon : ApiControllerBase [HttpGet("@recent")] public async Task> GetRecentFolderAsync(Guid? userIdOrGroupId, FilterType? filterType, bool? searchInContent, bool? withsubfolders) { - return await _foldersControllerHelperInt.GetFolderAsync(await _globalFolderHelper.FolderRecentAsync, userIdOrGroupId, filterType, searchInContent, withsubfolders); + return await _foldersControllerHelperInt.GetFolderAsync(await _globalFolderHelper.FolderRecentAsync, userIdOrGroupId, filterType, searchInContent, withsubfolders, false); } [HttpGet("@root")] @@ -298,7 +298,7 @@ public class FoldersControllerCommon : ApiControllerBase await foreach (var folder in foldersIds) { - yield return await _foldersControllerHelperInt.GetFolderAsync(folder, userIdOrGroupId, filterType, searchInContent, withsubfolders); + yield return await _foldersControllerHelperInt.GetFolderAsync(folder, userIdOrGroupId, filterType, searchInContent, withsubfolders, false); } } @@ -313,7 +313,7 @@ public class FoldersControllerCommon : ApiControllerBase [HttpGet("@share")] public async Task> GetShareFolderAsync(Guid? userIdOrGroupId, FilterType? filterType, bool? searchInContent, bool? withsubfolders) { - return await _foldersControllerHelperInt.GetFolderAsync(await _globalFolderHelper.FolderShareAsync, userIdOrGroupId, filterType, searchInContent, withsubfolders); + return await _foldersControllerHelperInt.GetFolderAsync(await _globalFolderHelper.FolderShareAsync, userIdOrGroupId, filterType, searchInContent, withsubfolders, false); } /// @@ -325,7 +325,7 @@ public class FoldersControllerCommon : ApiControllerBase [HttpGet("@templates")] public async Task> GetTemplatesFolderAsync(Guid? userIdOrGroupId, FilterType? filterType, bool? searchInContent, bool? withsubfolders) { - return await _foldersControllerHelperInt.GetFolderAsync(await _globalFolderHelper.FolderTemplatesAsync, userIdOrGroupId, filterType, searchInContent, withsubfolders); + return await _foldersControllerHelperInt.GetFolderAsync(await _globalFolderHelper.FolderTemplatesAsync, userIdOrGroupId, filterType, searchInContent, withsubfolders, false); } /// @@ -339,6 +339,6 @@ public class FoldersControllerCommon : ApiControllerBase [HttpGet("@trash")] public Task> GetTrashFolderAsync(Guid? userIdOrGroupId, FilterType? filterType, bool? searchInContent, bool? withsubfolders) { - return _foldersControllerHelperInt.GetFolderAsync(Convert.ToInt32(_globalFolderHelper.FolderTrash), userIdOrGroupId, filterType, searchInContent, withsubfolders); + return _foldersControllerHelperInt.GetFolderAsync(Convert.ToInt32(_globalFolderHelper.FolderTrash), userIdOrGroupId, filterType, searchInContent, withsubfolders, false); } } diff --git a/products/ASC.Files/Server/Helpers/FoldersControllerHelper.cs b/products/ASC.Files/Server/Helpers/FoldersControllerHelper.cs index 593cd72668..c29218e6a2 100644 --- a/products/ASC.Files/Server/Helpers/FoldersControllerHelper.cs +++ b/products/ASC.Files/Server/Helpers/FoldersControllerHelper.cs @@ -77,9 +77,9 @@ public class FoldersControllerHelper : FilesHelperBase return await _folderDtoHelper.GetAsync(folder); } - public async Task> GetFolderAsync(T folderId, Guid? userIdOrGroupId, FilterType? filterType, bool? searchInContent, bool? withSubFolders) + public async Task> GetFolderAsync(T folderId, Guid? userIdOrGroupId, FilterType? filterType, bool? searchInContent, bool? withSubFolders, bool? withoutMe) { - var folderContentWrapper = await ToFolderContentWrapperAsync(folderId, userIdOrGroupId ?? Guid.Empty, filterType ?? FilterType.None, searchInContent ?? false, withSubFolders ?? false); + var folderContentWrapper = await ToFolderContentWrapperAsync(folderId, userIdOrGroupId ?? Guid.Empty, filterType ?? FilterType.None, searchInContent ?? false, withSubFolders ?? false, withoutMe ?? false); return folderContentWrapper.NotFoundIfNull(); } @@ -166,7 +166,7 @@ public class FoldersControllerHelper : FilesHelperBase return await _folderDtoHelper.GetAsync(folder); } - private async Task> ToFolderContentWrapperAsync(T folderId, Guid userIdOrGroupId, FilterType filterType, bool searchInContent, bool withSubFolders) + private async Task> ToFolderContentWrapperAsync(T folderId, Guid userIdOrGroupId, FilterType filterType, bool searchInContent, bool withSubFolders, bool withoutMe) { OrderBy orderBy = null; if (SortedByTypeExtensions.TryParse(_apiContext.SortBy, true, out var sortBy)) @@ -175,7 +175,7 @@ public class FoldersControllerHelper : FilesHelperBase } var startIndex = Convert.ToInt32(_apiContext.StartIndex); - var items = await _fileStorageService.GetFolderItemsAsync(folderId, startIndex, Convert.ToInt32(_apiContext.Count), filterType, filterType == FilterType.ByUser, userIdOrGroupId.ToString(), _apiContext.FilterValue, searchInContent, withSubFolders, orderBy); + var items = await _fileStorageService.GetFolderItemsAsync(folderId, startIndex, Convert.ToInt32(_apiContext.Count), filterType, filterType == FilterType.ByUser, userIdOrGroupId.ToString(), _apiContext.FilterValue, searchInContent, withSubFolders, orderBy, withoutMe: withoutMe); return await _folderContentDtoHelper.GetAsync(items, startIndex); } From 22d5c0c427b089da50a4b58e65f31a118a53304b Mon Sep 17 00:00:00 2001 From: MaksimChegulov Date: Fri, 16 Sep 2022 13:52:54 +0300 Subject: [PATCH 72/87] Files: refactor --- .../ASC.Files/Server/Api/FoldersController.cs | 42 +++++++++---------- 1 file changed, 21 insertions(+), 21 deletions(-) diff --git a/products/ASC.Files/Server/Api/FoldersController.cs b/products/ASC.Files/Server/Api/FoldersController.cs index e149ef764c..9568d44b6b 100644 --- a/products/ASC.Files/Server/Api/FoldersController.cs +++ b/products/ASC.Files/Server/Api/FoldersController.cs @@ -122,7 +122,7 @@ public abstract class FoldersController : ApiControllerBase /// Filter type /// Folder contents [HttpGet("{folderId}", Order = 1)] - public async Task> GetFolderAsync(T folderId, Guid? userIdOrGroupId, FilterType? filterType, bool? searchInContent, bool? withsubfolders, bool withoutMe) + public async Task> GetFolderAsync(T folderId, Guid? userIdOrGroupId, FilterType? filterType, bool? searchInContent, bool? withsubfolders, bool? withoutMe) { var folder = await _foldersControllerHelper.GetFolderAsync(folderId, userIdOrGroupId, filterType, searchInContent, withsubfolders, withoutMe); @@ -223,9 +223,9 @@ public class FoldersControllerCommon : ApiControllerBase /// Folders /// Common folder contents [HttpGet("@common")] - public async Task> GetCommonFolderAsync(Guid? userIdOrGroupId, FilterType? filterType, bool? searchInContent, bool? withsubfolders) + public async Task> GetCommonFolderAsync(Guid? userIdOrGroupId, FilterType? filterType, bool? searchInContent, bool? withsubfolders, bool? withoutMe) { - return await _foldersControllerHelperInt.GetFolderAsync(await _globalFolderHelper.FolderCommonAsync, userIdOrGroupId, filterType, searchInContent, withsubfolders, false); + return await _foldersControllerHelperInt.GetFolderAsync(await _globalFolderHelper.FolderCommonAsync, userIdOrGroupId, filterType, searchInContent, withsubfolders, withoutMe); } /// @@ -235,9 +235,9 @@ public class FoldersControllerCommon : ApiControllerBase /// Folders /// Favorites contents [HttpGet("@favorites")] - public async Task> GetFavoritesFolderAsync(Guid? userIdOrGroupId, FilterType? filterType, bool? searchInContent, bool? withsubfolders) + public async Task> GetFavoritesFolderAsync(Guid? userIdOrGroupId, FilterType? filterType, bool? searchInContent, bool? withsubfolders, bool? withoutMe) { - return await _foldersControllerHelperInt.GetFolderAsync(await _globalFolderHelper.FolderFavoritesAsync, userIdOrGroupId, filterType, searchInContent, withsubfolders, false); + return await _foldersControllerHelperInt.GetFolderAsync(await _globalFolderHelper.FolderFavoritesAsync, userIdOrGroupId, filterType, searchInContent, withsubfolders, withoutMe); } /// @@ -249,20 +249,20 @@ public class FoldersControllerCommon : ApiControllerBase /// Folders /// My folder contents [HttpGet("@my")] - public Task> GetMyFolderAsync(Guid? userIdOrGroupId, FilterType? filterType, bool? searchInContent, bool? withsubfolders) + public Task> GetMyFolderAsync(Guid? userIdOrGroupId, FilterType? filterType, bool? searchInContent, bool? withsubfolders, bool? withoutMe) { - return _foldersControllerHelperInt.GetFolderAsync(_globalFolderHelper.FolderMy, userIdOrGroupId, filterType, searchInContent, withsubfolders, false); + return _foldersControllerHelperInt.GetFolderAsync(_globalFolderHelper.FolderMy, userIdOrGroupId, filterType, searchInContent, withsubfolders, withoutMe); } [HttpGet("@privacy")] - public async Task> GetPrivacyFolderAsync(Guid? userIdOrGroupId, FilterType? filterType, bool? searchInContent, bool? withsubfolders) + public async Task> GetPrivacyFolderAsync(Guid? userIdOrGroupId, FilterType? filterType, bool? searchInContent, bool? withsubfolders, bool? withoutMe) { if (PrivacyRoomSettings.IsAvailable()) { throw new System.Security.SecurityException(); } - return await _foldersControllerHelperInt.GetFolderAsync(await _globalFolderHelper.FolderPrivacyAsync, userIdOrGroupId, filterType, searchInContent, withsubfolders, false); + return await _foldersControllerHelperInt.GetFolderAsync(await _globalFolderHelper.FolderPrivacyAsync, userIdOrGroupId, filterType, searchInContent, withsubfolders, withoutMe); } /// @@ -274,9 +274,9 @@ public class FoldersControllerCommon : ApiControllerBase /// Folders /// Projects folder contents [HttpGet("@projects")] - public async Task> GetProjectsFolderAsync(Guid? userIdOrGroupId, FilterType? filterType, bool? searchInContent, bool? withsubfolders) + public async Task> GetProjectsFolderAsync(Guid? userIdOrGroupId, FilterType? filterType, bool? searchInContent, bool? withsubfolders, bool? withoutMe) { - return await _foldersControllerHelperString.GetFolderAsync(await _globalFolderHelper.GetFolderProjectsAsync(), userIdOrGroupId, filterType, searchInContent, withsubfolders, false); + return await _foldersControllerHelperString.GetFolderAsync(await _globalFolderHelper.GetFolderProjectsAsync(), userIdOrGroupId, filterType, searchInContent, withsubfolders, withoutMe); } /// @@ -286,19 +286,19 @@ public class FoldersControllerCommon : ApiControllerBase /// Folders /// Recent contents [HttpGet("@recent")] - public async Task> GetRecentFolderAsync(Guid? userIdOrGroupId, FilterType? filterType, bool? searchInContent, bool? withsubfolders) + public async Task> GetRecentFolderAsync(Guid? userIdOrGroupId, FilterType? filterType, bool? searchInContent, bool? withsubfolders, bool? withoutMe) { - return await _foldersControllerHelperInt.GetFolderAsync(await _globalFolderHelper.FolderRecentAsync, userIdOrGroupId, filterType, searchInContent, withsubfolders, false); + return await _foldersControllerHelperInt.GetFolderAsync(await _globalFolderHelper.FolderRecentAsync, userIdOrGroupId, filterType, searchInContent, withsubfolders, withoutMe); } [HttpGet("@root")] - public async IAsyncEnumerable> GetRootFoldersAsync(Guid? userIdOrGroupId, FilterType? filterType, bool? withsubfolders, bool? withoutTrash, bool? searchInContent, bool? withoutAdditionalFolder) + public async IAsyncEnumerable> GetRootFoldersAsync(Guid? userIdOrGroupId, FilterType? filterType, bool? withsubfolders, bool? withoutTrash, bool? searchInContent, bool? withoutAdditionalFolder, bool? withoutMe) { var foldersIds = _foldersControllerHelperInt.GetRootFoldersIdsAsync(withoutTrash ?? false, withoutAdditionalFolder ?? false); await foreach (var folder in foldersIds) { - yield return await _foldersControllerHelperInt.GetFolderAsync(folder, userIdOrGroupId, filterType, searchInContent, withsubfolders, false); + yield return await _foldersControllerHelperInt.GetFolderAsync(folder, userIdOrGroupId, filterType, searchInContent, withsubfolders, withoutMe); } } @@ -311,9 +311,9 @@ public class FoldersControllerCommon : ApiControllerBase /// Folders /// Shared folder contents [HttpGet("@share")] - public async Task> GetShareFolderAsync(Guid? userIdOrGroupId, FilterType? filterType, bool? searchInContent, bool? withsubfolders) + public async Task> GetShareFolderAsync(Guid? userIdOrGroupId, FilterType? filterType, bool? searchInContent, bool? withsubfolders, bool? withoutMe) { - return await _foldersControllerHelperInt.GetFolderAsync(await _globalFolderHelper.FolderShareAsync, userIdOrGroupId, filterType, searchInContent, withsubfolders, false); + return await _foldersControllerHelperInt.GetFolderAsync(await _globalFolderHelper.FolderShareAsync, userIdOrGroupId, filterType, searchInContent, withsubfolders, withoutMe); } /// @@ -323,9 +323,9 @@ public class FoldersControllerCommon : ApiControllerBase /// Folders /// Templates contents [HttpGet("@templates")] - public async Task> GetTemplatesFolderAsync(Guid? userIdOrGroupId, FilterType? filterType, bool? searchInContent, bool? withsubfolders) + public async Task> GetTemplatesFolderAsync(Guid? userIdOrGroupId, FilterType? filterType, bool? searchInContent, bool? withsubfolders, bool? withoutMe) { - return await _foldersControllerHelperInt.GetFolderAsync(await _globalFolderHelper.FolderTemplatesAsync, userIdOrGroupId, filterType, searchInContent, withsubfolders, false); + return await _foldersControllerHelperInt.GetFolderAsync(await _globalFolderHelper.FolderTemplatesAsync, userIdOrGroupId, filterType, searchInContent, withsubfolders, withoutMe); } /// @@ -337,8 +337,8 @@ public class FoldersControllerCommon : ApiControllerBase /// Folders /// Trash folder contents [HttpGet("@trash")] - public Task> GetTrashFolderAsync(Guid? userIdOrGroupId, FilterType? filterType, bool? searchInContent, bool? withsubfolders) + public Task> GetTrashFolderAsync(Guid? userIdOrGroupId, FilterType? filterType, bool? searchInContent, bool? withsubfolders, bool? withoutMe) { - return _foldersControllerHelperInt.GetFolderAsync(Convert.ToInt32(_globalFolderHelper.FolderTrash), userIdOrGroupId, filterType, searchInContent, withsubfolders, false); + return _foldersControllerHelperInt.GetFolderAsync(Convert.ToInt32(_globalFolderHelper.FolderTrash), userIdOrGroupId, filterType, searchInContent, withsubfolders, withoutMe); } } From abe0f8563f9abec795b09835b6b18e55923b6333 Mon Sep 17 00:00:00 2001 From: MaksimChegulov Date: Fri, 16 Sep 2022 14:01:50 +0300 Subject: [PATCH 73/87] Files: refactor --- .../ASC.Files/Server/Api/FoldersController.cs | 40 +++++++++---------- .../Server/Helpers/FoldersControllerHelper.cs | 2 +- 2 files changed, 21 insertions(+), 21 deletions(-) diff --git a/products/ASC.Files/Server/Api/FoldersController.cs b/products/ASC.Files/Server/Api/FoldersController.cs index 9568d44b6b..b9ac68a89b 100644 --- a/products/ASC.Files/Server/Api/FoldersController.cs +++ b/products/ASC.Files/Server/Api/FoldersController.cs @@ -223,9 +223,9 @@ public class FoldersControllerCommon : ApiControllerBase /// Folders /// Common folder contents [HttpGet("@common")] - public async Task> GetCommonFolderAsync(Guid? userIdOrGroupId, FilterType? filterType, bool? searchInContent, bool? withsubfolders, bool? withoutMe) + public async Task> GetCommonFolderAsync(Guid? userIdOrGroupId, FilterType? filterType, bool? searchInContent, bool? withsubfolders) { - return await _foldersControllerHelperInt.GetFolderAsync(await _globalFolderHelper.FolderCommonAsync, userIdOrGroupId, filterType, searchInContent, withsubfolders, withoutMe); + return await _foldersControllerHelperInt.GetFolderAsync(await _globalFolderHelper.FolderCommonAsync, userIdOrGroupId, filterType, searchInContent, withsubfolders); } /// @@ -235,9 +235,9 @@ public class FoldersControllerCommon : ApiControllerBase /// Folders /// Favorites contents [HttpGet("@favorites")] - public async Task> GetFavoritesFolderAsync(Guid? userIdOrGroupId, FilterType? filterType, bool? searchInContent, bool? withsubfolders, bool? withoutMe) + public async Task> GetFavoritesFolderAsync(Guid? userIdOrGroupId, FilterType? filterType, bool? searchInContent, bool? withsubfolders) { - return await _foldersControllerHelperInt.GetFolderAsync(await _globalFolderHelper.FolderFavoritesAsync, userIdOrGroupId, filterType, searchInContent, withsubfolders, withoutMe); + return await _foldersControllerHelperInt.GetFolderAsync(await _globalFolderHelper.FolderFavoritesAsync, userIdOrGroupId, filterType, searchInContent, withsubfolders); } /// @@ -249,20 +249,20 @@ public class FoldersControllerCommon : ApiControllerBase /// Folders /// My folder contents [HttpGet("@my")] - public Task> GetMyFolderAsync(Guid? userIdOrGroupId, FilterType? filterType, bool? searchInContent, bool? withsubfolders, bool? withoutMe) + public Task> GetMyFolderAsync(Guid? userIdOrGroupId, FilterType? filterType, bool? searchInContent, bool? withsubfolders) { - return _foldersControllerHelperInt.GetFolderAsync(_globalFolderHelper.FolderMy, userIdOrGroupId, filterType, searchInContent, withsubfolders, withoutMe); + return _foldersControllerHelperInt.GetFolderAsync(_globalFolderHelper.FolderMy, userIdOrGroupId, filterType, searchInContent, withsubfolders); } [HttpGet("@privacy")] - public async Task> GetPrivacyFolderAsync(Guid? userIdOrGroupId, FilterType? filterType, bool? searchInContent, bool? withsubfolders, bool? withoutMe) + public async Task> GetPrivacyFolderAsync(Guid? userIdOrGroupId, FilterType? filterType, bool? searchInContent, bool? withsubfolders) { if (PrivacyRoomSettings.IsAvailable()) { throw new System.Security.SecurityException(); } - return await _foldersControllerHelperInt.GetFolderAsync(await _globalFolderHelper.FolderPrivacyAsync, userIdOrGroupId, filterType, searchInContent, withsubfolders, withoutMe); + return await _foldersControllerHelperInt.GetFolderAsync(await _globalFolderHelper.FolderPrivacyAsync, userIdOrGroupId, filterType, searchInContent, withsubfolders); } /// @@ -274,9 +274,9 @@ public class FoldersControllerCommon : ApiControllerBase /// Folders /// Projects folder contents [HttpGet("@projects")] - public async Task> GetProjectsFolderAsync(Guid? userIdOrGroupId, FilterType? filterType, bool? searchInContent, bool? withsubfolders, bool? withoutMe) + public async Task> GetProjectsFolderAsync(Guid? userIdOrGroupId, FilterType? filterType, bool? searchInContent, bool? withsubfolders) { - return await _foldersControllerHelperString.GetFolderAsync(await _globalFolderHelper.GetFolderProjectsAsync(), userIdOrGroupId, filterType, searchInContent, withsubfolders, withoutMe); + return await _foldersControllerHelperString.GetFolderAsync(await _globalFolderHelper.GetFolderProjectsAsync(), userIdOrGroupId, filterType, searchInContent, withsubfolders); } /// @@ -286,19 +286,19 @@ public class FoldersControllerCommon : ApiControllerBase /// Folders /// Recent contents [HttpGet("@recent")] - public async Task> GetRecentFolderAsync(Guid? userIdOrGroupId, FilterType? filterType, bool? searchInContent, bool? withsubfolders, bool? withoutMe) + public async Task> GetRecentFolderAsync(Guid? userIdOrGroupId, FilterType? filterType, bool? searchInContent, bool? withsubfolders) { - return await _foldersControllerHelperInt.GetFolderAsync(await _globalFolderHelper.FolderRecentAsync, userIdOrGroupId, filterType, searchInContent, withsubfolders, withoutMe); + return await _foldersControllerHelperInt.GetFolderAsync(await _globalFolderHelper.FolderRecentAsync, userIdOrGroupId, filterType, searchInContent, withsubfolders); } [HttpGet("@root")] - public async IAsyncEnumerable> GetRootFoldersAsync(Guid? userIdOrGroupId, FilterType? filterType, bool? withsubfolders, bool? withoutTrash, bool? searchInContent, bool? withoutAdditionalFolder, bool? withoutMe) + public async IAsyncEnumerable> GetRootFoldersAsync(Guid? userIdOrGroupId, FilterType? filterType, bool? withsubfolders, bool? withoutTrash, bool? searchInContent, bool? withoutAdditionalFolder) { var foldersIds = _foldersControllerHelperInt.GetRootFoldersIdsAsync(withoutTrash ?? false, withoutAdditionalFolder ?? false); await foreach (var folder in foldersIds) { - yield return await _foldersControllerHelperInt.GetFolderAsync(folder, userIdOrGroupId, filterType, searchInContent, withsubfolders, withoutMe); + yield return await _foldersControllerHelperInt.GetFolderAsync(folder, userIdOrGroupId, filterType, searchInContent, withsubfolders); } } @@ -311,9 +311,9 @@ public class FoldersControllerCommon : ApiControllerBase /// Folders /// Shared folder contents [HttpGet("@share")] - public async Task> GetShareFolderAsync(Guid? userIdOrGroupId, FilterType? filterType, bool? searchInContent, bool? withsubfolders, bool? withoutMe) + public async Task> GetShareFolderAsync(Guid? userIdOrGroupId, FilterType? filterType, bool? searchInContent, bool? withsubfolders) { - return await _foldersControllerHelperInt.GetFolderAsync(await _globalFolderHelper.FolderShareAsync, userIdOrGroupId, filterType, searchInContent, withsubfolders, withoutMe); + return await _foldersControllerHelperInt.GetFolderAsync(await _globalFolderHelper.FolderShareAsync, userIdOrGroupId, filterType, searchInContent, withsubfolders); } /// @@ -323,9 +323,9 @@ public class FoldersControllerCommon : ApiControllerBase /// Folders /// Templates contents [HttpGet("@templates")] - public async Task> GetTemplatesFolderAsync(Guid? userIdOrGroupId, FilterType? filterType, bool? searchInContent, bool? withsubfolders, bool? withoutMe) + public async Task> GetTemplatesFolderAsync(Guid? userIdOrGroupId, FilterType? filterType, bool? searchInContent, bool? withsubfolders) { - return await _foldersControllerHelperInt.GetFolderAsync(await _globalFolderHelper.FolderTemplatesAsync, userIdOrGroupId, filterType, searchInContent, withsubfolders, withoutMe); + return await _foldersControllerHelperInt.GetFolderAsync(await _globalFolderHelper.FolderTemplatesAsync, userIdOrGroupId, filterType, searchInContent, withsubfolders); } /// @@ -337,8 +337,8 @@ public class FoldersControllerCommon : ApiControllerBase /// Folders /// Trash folder contents [HttpGet("@trash")] - public Task> GetTrashFolderAsync(Guid? userIdOrGroupId, FilterType? filterType, bool? searchInContent, bool? withsubfolders, bool? withoutMe) + public Task> GetTrashFolderAsync(Guid? userIdOrGroupId, FilterType? filterType, bool? searchInContent, bool? withsubfolders) { - return _foldersControllerHelperInt.GetFolderAsync(Convert.ToInt32(_globalFolderHelper.FolderTrash), userIdOrGroupId, filterType, searchInContent, withsubfolders, withoutMe); + return _foldersControllerHelperInt.GetFolderAsync(Convert.ToInt32(_globalFolderHelper.FolderTrash), userIdOrGroupId, filterType, searchInContent, withsubfolders); } } diff --git a/products/ASC.Files/Server/Helpers/FoldersControllerHelper.cs b/products/ASC.Files/Server/Helpers/FoldersControllerHelper.cs index 847de0c155..83c7457a9d 100644 --- a/products/ASC.Files/Server/Helpers/FoldersControllerHelper.cs +++ b/products/ASC.Files/Server/Helpers/FoldersControllerHelper.cs @@ -77,7 +77,7 @@ public class FoldersControllerHelper : FilesHelperBase return await _folderDtoHelper.GetAsync(folder); } - public async Task> GetFolderAsync(T folderId, Guid? userIdOrGroupId, FilterType? filterType, bool? searchInContent, bool? withSubFolders, bool? withoutMe) + public async Task> GetFolderAsync(T folderId, Guid? userIdOrGroupId, FilterType? filterType, bool? searchInContent, bool? withSubFolders, bool? withoutMe = false) { var folderContentWrapper = await ToFolderContentWrapperAsync(folderId, userIdOrGroupId ?? Guid.Empty, filterType ?? FilterType.None, searchInContent ?? false, withSubFolders ?? false, withoutMe ?? false); From 50e45e72896ba6ee35e9e4f55d3081358b80aab4 Mon Sep 17 00:00:00 2001 From: Alexey Safronov Date: Fri, 16 Sep 2022 14:38:44 +0300 Subject: [PATCH 74/87] Web: Editor: Fix SaveAs dialog --- .../panels/SelectionPanel/FilesListBody.js | 3 +- .../panels/SelectionPanel/FilesListWrapper.js | 2 + .../SelectionPanel/SelectionPanelBody.js | 1 + .../SelectionPanel/StyledSelectionPanel.js | 6 +- packages/client/src/helpers/filesUtils.js | 2 +- .../editor/src/client/components/Editor.js | 3 +- .../src/client/components/SelectFileDialog.js | 6 +- .../client/components/SelectFolderDialog.js | 67 +++++++++++-------- .../src/client/components/SharingDialog.js | 6 +- .../editor/src/client/helpers/constants.js | 4 +- .../editor/src/client/helpers/useMfScripts.js | 12 ++-- 11 files changed, 63 insertions(+), 49 deletions(-) diff --git a/packages/client/src/components/panels/SelectionPanel/FilesListBody.js b/packages/client/src/components/panels/SelectionPanel/FilesListBody.js index 6ddb631482..b5a0dc4227 100644 --- a/packages/client/src/components/panels/SelectionPanel/FilesListBody.js +++ b/packages/client/src/components/panels/SelectionPanel/FilesListBody.js @@ -26,6 +26,7 @@ const FilesListBody = ({ page, folderSelection, getIcon, + maxHeight = 384, }) => { const { t } = useTranslation(["SelectFile", "Common"]); const [isLoading, setIsLoading] = useState(false); @@ -177,7 +178,7 @@ const FilesListBody = ({ {({ onItemsRendered, ref }) => ( ); } diff --git a/packages/client/src/components/panels/SelectionPanel/SelectionPanelBody.js b/packages/client/src/components/panels/SelectionPanel/SelectionPanelBody.js index 579819b1c2..bcf4ae35c7 100644 --- a/packages/client/src/components/panels/SelectionPanel/SelectionPanelBody.js +++ b/packages/client/src/components/panels/SelectionPanel/SelectionPanelBody.js @@ -118,6 +118,7 @@ const SelectionPanelBody = ({ folderSelection={folderSelection} newFilter={newFilter} fileId={fileId} + maxHeight={!header ? 384 : 310} />
diff --git a/packages/client/src/components/panels/SelectionPanel/StyledSelectionPanel.js b/packages/client/src/components/panels/SelectionPanel/StyledSelectionPanel.js index 40030ef1e7..d9c0488885 100644 --- a/packages/client/src/components/panels/SelectionPanel/StyledSelectionPanel.js +++ b/packages/client/src/components/panels/SelectionPanel/StyledSelectionPanel.js @@ -21,6 +21,8 @@ const commonStyles = css` const StyledModalDialog = styled(ModalDialog)` #modal-dialog { max-height: 560px; + display: flex; + flex-direction: column; } .select-panel-modal-header { @@ -56,9 +58,9 @@ const StyledBody = styled.div` display: grid; grid-template-rows: max-content auto; } - .selection-panel_files-list-body { + /* .selection-panel_files-list-body { height: 384px; - } + } */ .selection-panel_tree-body { grid-area: tree; height: 100%; diff --git a/packages/client/src/helpers/filesUtils.js b/packages/client/src/helpers/filesUtils.js index d2914e022b..4a3e59bd4d 100644 --- a/packages/client/src/helpers/filesUtils.js +++ b/packages/client/src/helpers/filesUtils.js @@ -102,7 +102,7 @@ export const getDataSaveAs = async (params) => { const data = await request({ baseURL: combineUrl(AppServerConfig.proxyURL, config.homepage), method: "get", - url: `/httphandlers/filehandler.ashx?${params}`, + url: `/products/files/httphandlers/filehandler.ashx?${params}`, responseType: "text", }); diff --git a/packages/editor/src/client/components/Editor.js b/packages/editor/src/client/components/Editor.js index 635df3c96e..3e6a8ae7ad 100644 --- a/packages/editor/src/client/components/Editor.js +++ b/packages/editor/src/client/components/Editor.js @@ -493,8 +493,7 @@ function Editor({ config.editorConfig.createUrl = combineUrl( window.location.origin, AppServerConfig.proxyURL, - "products/files/", - `/httphandlers/filehandler.ashx?action=create&doctype=text&title=${encodeURIComponent( + `/products/files/httphandlers/filehandler.ashx?action=create&doctype=text&title=${encodeURIComponent( defaultFileName )}` ); diff --git a/packages/editor/src/client/components/SelectFileDialog.js b/packages/editor/src/client/components/SelectFileDialog.js index a6f3aae8c4..19043d2317 100644 --- a/packages/editor/src/client/components/SelectFileDialog.js +++ b/packages/editor/src/client/components/SelectFileDialog.js @@ -1,6 +1,6 @@ import React from "react"; import DynamicComponent from "./DynamicComponent"; -import { STUDIO_REMOTE_ENTRY_URL, STUDIO_SCOPE } from "../helpers/constants"; +import { CLIENT_REMOTE_ENTRY_URL, CLIENT_SCOPE } from "../helpers/constants"; const SelectFileDialog = ({ isVisible, @@ -17,8 +17,8 @@ const SelectFileDialog = ({ { const { t } = useTranslation(["Editor", "Common"]); - return ( - (mfReady && isVisible && successAuth && ( - - {t("FileName")} - - - } - {...(extension !== "fb2" && { + const headerProps = { + header: ( + + {t("FileName")} + + + ), + }; + + const footerProps = + extension !== "fb2" + ? { footer: ( ), - })} + } + : {}; + + return ( + (mfReady && isVisible && successAuth && ( + )) || null diff --git a/packages/editor/src/client/components/SharingDialog.js b/packages/editor/src/client/components/SharingDialog.js index d277cfe506..0f115b1261 100644 --- a/packages/editor/src/client/components/SharingDialog.js +++ b/packages/editor/src/client/components/SharingDialog.js @@ -1,6 +1,6 @@ import React from "react"; import DynamicComponent from "./DynamicComponent"; -import { STUDIO_REMOTE_ENTRY_URL, STUDIO_SCOPE } from "../helpers/constants"; +import { CLIENT_REMOTE_ENTRY_URL, CLIENT_SCOPE } from "../helpers/constants"; const SharingDialog = ({ isVisible, @@ -15,8 +15,8 @@ const SharingDialog = ({ { @@ -27,11 +27,11 @@ function useMfScripts() { const initMfScripts = async () => { const SharingDialog = await loadComponent( - STUDIO_SCOPE, + CLIENT_SCOPE, "./SharingDialog" )(); - const filesUtils = await loadComponent(STUDIO_SCOPE, "./utils")(); - const authStore = await loadComponent(STUDIO_SCOPE, "./store")(); + const filesUtils = await loadComponent(CLIENT_SCOPE, "./utils")(); + const authStore = await loadComponent(CLIENT_SCOPE, "./store")(); window.filesUtils = filesUtils; window.SharingDialog = SharingDialog.default; From 5d748a1788ffdcecb9fcb6b2ec7ad2784ca3dfc0 Mon Sep 17 00:00:00 2001 From: gopienkonikita Date: Fri, 16 Sep 2022 14:41:23 +0300 Subject: [PATCH 75/87] Web: Files: fixed navigationPath for Shared folder --- packages/client/src/store/FilesStore.js | 29 +++++++++++++++---------- 1 file changed, 18 insertions(+), 11 deletions(-) diff --git a/packages/client/src/store/FilesStore.js b/packages/client/src/store/FilesStore.js index 50659fe991..fd10064e05 100644 --- a/packages/client/src/store/FilesStore.js +++ b/packages/client/src/store/FilesStore.js @@ -679,9 +679,6 @@ class FilesStore { api.files .getFolder(folderId, filterData) .then(async (data) => { - const isRecycleBinFolder = - data.current.rootFolderType === FolderType.TRASH; - filterData.total = data.total; if (data.total > 0) { @@ -699,9 +696,6 @@ class FilesStore { } } - const isPrivacyFolder = - data.current.rootFolderType === FolderType.Privacy; - runInAction(() => { this.categoryType = getCategoryTypeByFolderType( data.current.rootFolderType, @@ -711,6 +705,9 @@ class FilesStore { this.setFilesFilter(filterData); //TODO: FILTER + const isPrivacyFolder = + data.current.rootFolderType === FolderType.Privacy; + runInAction(() => { this.setFolders(isPrivacyFolder && isMobile ? [] : data.folders); this.setFiles(isPrivacyFolder && isMobile ? [] : data.files); @@ -724,10 +721,22 @@ class FilesStore { const navigationPath = await Promise.all( data.pathParts.map(async (folder) => { + const { Rooms, Archive } = FolderType; + + let folderId = folder; + + if ( + data.current.providerKey && + data.current.rootFolderType === Rooms && + this.treeFoldersStore.sharedRoomId + ) { + folderId = this.treeFoldersStore.sharedRoomId; + } + const folderInfo = - data.current.id === folder + data.current.id === folderId ? data.current - : await api.files.getFolderInfo(folder); + : await api.files.getFolderInfo(folderId); const { id, @@ -737,14 +746,12 @@ class FilesStore { rootFolderType, } = folderInfo; - const { Rooms, Archive } = FolderType; - const isRootRoom = rootFolderId === id && (rootFolderType === Rooms || rootFolderType === Archive); return { - id: folder, + id: folderId, title, isRoom: !!roomType, isRootRoom, From f6f5c0a338fadfa3532763f0c4bbb30e959b4332 Mon Sep 17 00:00:00 2001 From: gopienkonikita Date: Fri, 16 Sep 2022 14:42:30 +0300 Subject: [PATCH 76/87] Web: Files: fixed back to parent folder from thirdparty folder --- .../EmptyContainer/EmptyFolderContainer.js | 24 ++++++++++++++----- 1 file changed, 18 insertions(+), 6 deletions(-) diff --git a/packages/client/src/components/EmptyContainer/EmptyFolderContainer.js b/packages/client/src/components/EmptyContainer/EmptyFolderContainer.js index 78fb29616d..cae300e581 100644 --- a/packages/client/src/components/EmptyContainer/EmptyFolderContainer.js +++ b/packages/client/src/components/EmptyContainer/EmptyFolderContainer.js @@ -8,16 +8,19 @@ import Box from "@docspace/components/box"; const EmptyFolderContainer = ({ t, onCreate, - filter, fetchFiles, + fetchRooms, setIsLoading, parentId, linkStyles, + isRooms, }) => { const onBackToParentFolder = () => { - const newFilter = filter.clone(); setIsLoading(true); - fetchFiles(parentId, newFilter).finally(() => setIsLoading(false)); + + isRooms + ? fetchRooms(parentId).finally(() => setIsLoading(false)) + : fetchFiles(parentId).finally(() => setIsLoading(false)); }; const buttons = ( @@ -85,12 +88,21 @@ const EmptyFolderContainer = ({ }; export default inject(({ filesStore, selectedFolderStore }) => { - const { filter, fetchFiles } = filesStore; + const { fetchFiles, fetchRooms } = filesStore; + const { navigationPath, parentId } = selectedFolderStore; + + let isRootRoom, isRoom, id; + if (navigationPath.length) { + isRootRoom = navigationPath.at(-1).isRootRoom; + isRoom = navigationPath.at(-1).isRoom; + id = navigationPath.at(-1).id; + } return { - filter, fetchFiles, + fetchRooms, setIsLoading: filesStore.setIsLoading, - parentId: selectedFolderStore.parentId, + parentId: id ?? parentId, + isRooms: isRoom || isRootRoom, }; })(withTranslation(["Files", "Translations"])(observer(EmptyFolderContainer))); From 6f1243b382390c09751434cef4b66a6f8cdccb04 Mon Sep 17 00:00:00 2001 From: MaksimChegulov Date: Fri, 16 Sep 2022 15:30:43 +0300 Subject: [PATCH 77/87] Files: changed filter logic, refactor --- .../Core/Core/Dao/Interfaces/IFileDao.cs | 2 +- .../Core/Core/Dao/Interfaces/IFolderDao.cs | 12 ++--- .../Core/Core/Dao/TeamlabDao/FileDao.cs | 9 +--- .../Core/Core/Dao/TeamlabDao/FolderDao.cs | 49 +++++++------------ .../ASC.Files/Core/Core/FileStorageService.cs | 4 +- .../Core/Core/Security/FileSecurity.cs | 22 ++++----- .../Core/Core/Thirdparty/Box/BoxFileDao.cs | 2 +- .../Core/Core/Thirdparty/Box/BoxFolderDao.cs | 16 +++--- .../Core/Thirdparty/Dropbox/DropboxFileDao.cs | 2 +- .../Thirdparty/Dropbox/DropboxFolderDao.cs | 12 ++--- .../GoogleDrive/GoogleDriveFileDao.cs | 2 +- .../GoogleDrive/GoogleDriveFolderDao.cs | 12 ++--- .../Core/Thirdparty/IThirdPartyProviderDao.cs | 11 ++--- .../Thirdparty/OneDrive/OneDriveFileDao.cs | 2 +- .../Thirdparty/OneDrive/OneDriveFolderDao.cs | 12 ++--- .../Thirdparty/ProviderDao/ProviderFileDao.cs | 4 +- .../ProviderDao/ProviderFolderDao.cs | 16 +++--- .../SharePoint/SharePointFileDao.cs | 2 +- .../SharePoint/SharePointFolderDao.cs | 12 ++--- .../Thirdparty/Sharpbox/SharpBoxFileDao.cs | 2 +- .../Thirdparty/Sharpbox/SharpBoxFolderDao.cs | 12 ++--- products/ASC.Files/Core/Utils/EntryManager.cs | 8 +-- .../ASC.Files/Server/Api/FoldersController.cs | 4 +- .../Server/Api/VirtualRoomsController.cs | 8 +-- .../Server/Helpers/FoldersControllerHelper.cs | 8 +-- 25 files changed, 110 insertions(+), 135 deletions(-) diff --git a/products/ASC.Files/Core/Core/Dao/Interfaces/IFileDao.cs b/products/ASC.Files/Core/Core/Dao/Interfaces/IFileDao.cs index eb3120983d..da74aeca13 100644 --- a/products/ASC.Files/Core/Core/Dao/Interfaces/IFileDao.cs +++ b/products/ASC.Files/Core/Core/Dao/Interfaces/IFileDao.cs @@ -112,7 +112,7 @@ public interface IFileDao /// /// Return only the latest versions of files of a folder /// - IAsyncEnumerable> GetFilesAsync(T parentId, OrderBy orderBy, FilterType filterType, bool subjectGroup, Guid subjectID, string searchText, bool searchInContent, bool withSubfolders = false, bool withoutMe = false); + IAsyncEnumerable> GetFilesAsync(T parentId, OrderBy orderBy, FilterType filterType, bool subjectGroup, Guid subjectID, string searchText, bool searchInContent, bool withSubfolders = false, bool exludeSubject = false); /// /// Get stream of file diff --git a/products/ASC.Files/Core/Core/Dao/Interfaces/IFolderDao.cs b/products/ASC.Files/Core/Core/Dao/Interfaces/IFolderDao.cs index bde5918a4a..ace8f95f57 100644 --- a/products/ASC.Files/Core/Core/Dao/Interfaces/IFolderDao.cs +++ b/products/ASC.Files/Core/Core/Dao/Interfaces/IFolderDao.cs @@ -57,11 +57,11 @@ public interface IFolderDao /// root folder Task> GetRootFolderByFileAsync(T fileId); - IAsyncEnumerable> GetRoomsAsync(T parentId, FilterType filterType, IEnumerable tags, Guid ownerId, string searchText, bool withSubfolders, - bool withoutTags, bool withoutMe); + IAsyncEnumerable> GetRoomsAsync(T parentId, FilterType filterType, IEnumerable tags, Guid subjectId, string searchText, bool withSubfolders, + bool withoutTags, bool excludeSubject); - IAsyncEnumerable> GetRoomsAsync(IEnumerable roomsIds, FilterType filterType, IEnumerable tags, Guid ownerId, string searchText, bool withSubfolders, - bool withoutTags, bool withoutMe); + IAsyncEnumerable> GetRoomsAsync(IEnumerable roomsIds, FilterType filterType, IEnumerable tags, Guid subjectId, string searchText, bool withSubfolders, + bool withoutTags, bool excludeSubject); /// /// Get a list of folders in current folder. @@ -81,7 +81,7 @@ public interface IFolderDao /// /// /// - IAsyncEnumerable> GetFoldersAsync(T parentId, OrderBy orderBy, FilterType filterType, bool subjectGroup, Guid subjectID, string searchText, bool withSubfolders = false, bool withoutMe = false); + IAsyncEnumerable> GetFoldersAsync(T parentId, OrderBy orderBy, FilterType filterType, bool subjectGroup, Guid subjectID, string searchText, bool withSubfolders = false, bool exludeSubject = false); /// /// Gets the folder (s) by ID (s) @@ -95,7 +95,7 @@ public interface IFolderDao /// /// /// - IAsyncEnumerable> GetFoldersAsync(IEnumerable folderIds, FilterType filterTypes = FilterType.None, bool subjectGroup = false, Guid? subjectID = null, string searchText = "", bool searchSubfolders = false, bool checkShare = true, bool withoutMe = false); + IAsyncEnumerable> GetFoldersAsync(IEnumerable folderIds, FilterType filterTypes = FilterType.None, bool subjectGroup = false, Guid? subjectID = null, string searchText = "", bool searchSubfolders = false, bool checkShare = true, bool exludeSubject = false); /// /// Get folder, contains folder with id diff --git a/products/ASC.Files/Core/Core/Dao/TeamlabDao/FileDao.cs b/products/ASC.Files/Core/Core/Dao/TeamlabDao/FileDao.cs index c3249fd79b..2bedcf5008 100644 --- a/products/ASC.Files/Core/Core/Dao/TeamlabDao/FileDao.cs +++ b/products/ASC.Files/Core/Core/Dao/TeamlabDao/FileDao.cs @@ -275,7 +275,7 @@ internal class FileDao : AbstractDao, IFileDao } } - public async IAsyncEnumerable> GetFilesAsync(int parentId, OrderBy orderBy, FilterType filterType, bool subjectGroup, Guid subjectID, string searchText, bool searchInContent, bool withSubfolders = false, bool withoutMe = false) + public async IAsyncEnumerable> GetFilesAsync(int parentId, OrderBy orderBy, FilterType filterType, bool subjectGroup, Guid subjectID, string searchText, bool searchInContent, bool withSubfolders = false, bool excludeSubject = false) { if (filterType == FilterType.FoldersOnly) { @@ -333,7 +333,7 @@ internal class FileDao : AbstractDao, IFileDao } else { - q = q.Where(r => r.CreateBy == subjectID); + q = excludeSubject ? q.Where(r => r.CreateBy != subjectID) : q.Where(r => r.CreateBy == subjectID); } } @@ -357,11 +357,6 @@ internal class FileDao : AbstractDao, IFileDao break; } - if (withoutMe) - { - q = q.Where(r => r.CreateBy != _authContext.CurrentAccount.ID); - } - await foreach (var e in FromQueryWithShared(filesDbContext, q).AsAsyncEnumerable()) { yield return _mapper.Map>(e); diff --git a/products/ASC.Files/Core/Core/Dao/TeamlabDao/FolderDao.cs b/products/ASC.Files/Core/Core/Dao/TeamlabDao/FolderDao.cs index 048fb302f4..1777df47f5 100644 --- a/products/ASC.Files/Core/Core/Dao/TeamlabDao/FolderDao.cs +++ b/products/ASC.Files/Core/Core/Dao/TeamlabDao/FolderDao.cs @@ -166,7 +166,7 @@ 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 ownerId, string searchText, bool withSubfolders, bool withoutTags, bool withoutMe) + public async IAsyncEnumerable> GetRoomsAsync(int parentId, FilterType filterType, IEnumerable tags, Guid subjectId, string searchText, bool withSubfolders, bool withoutTags, bool excludeSubject) { if (CheckInvalidFilter(filterType)) { @@ -181,8 +181,8 @@ internal class FolderDao : AbstractDao, IFolderDao var filesDbContext = _dbContextFactory.CreateDbContext(); var q = GetFolderQuery(filesDbContext, r => r.ParentId == parentId).AsNoTracking(); - q = !withSubfolders ? BuildRoomsQuery(filesDbContext, q, filter, tags, ownerId, searchByTags, withoutTags, searchByTypes, false, withoutMe) - : BuildRoomsWithSubfoldersQuery(filesDbContext, parentId, filter, tags, searchByTags, searchByTypes, withoutTags, withoutMe, ownerId); + q = !withSubfolders ? BuildRoomsQuery(filesDbContext, q, filter, tags, subjectId, searchByTags, withoutTags, searchByTypes, false, excludeSubject) + : BuildRoomsWithSubfoldersQuery(filesDbContext, parentId, filter, tags, searchByTags, searchByTypes, withoutTags, excludeSubject, subjectId); if (!string.IsNullOrEmpty(searchText)) { @@ -196,7 +196,7 @@ internal class FolderDao : AbstractDao, IFolderDao } } - public async IAsyncEnumerable> GetRoomsAsync(IEnumerable roomsIds, FilterType filterType, IEnumerable tags, Guid ownerId, string searchText, bool withSubfolders, bool withoutTags, bool withoutMe) + public async IAsyncEnumerable> GetRoomsAsync(IEnumerable roomsIds, FilterType filterType, IEnumerable tags, Guid subjectId, string searchText, bool withSubfolders, bool withoutTags, bool excludeSubject) { if (CheckInvalidFilter(filterType)) { @@ -211,8 +211,8 @@ internal class FolderDao : AbstractDao, IFolderDao var filesDbContext = _dbContextFactory.CreateDbContext(); var q = GetFolderQuery(filesDbContext, f => roomsIds.Contains(f.Id)).AsNoTracking(); - q = !withSubfolders ? BuildRoomsQuery(filesDbContext, q, filter, tags, ownerId, searchByTags, withoutTags, searchByTypes, false, withoutMe) - : BuildRoomsWithSubfoldersQuery(filesDbContext, roomsIds, filter, tags, searchByTags, searchByTypes, withoutTags, withoutMe, ownerId); + q = !withSubfolders ? BuildRoomsQuery(filesDbContext, q, filter, tags, subjectId, searchByTags, withoutTags, searchByTypes, false, excludeSubject) + : BuildRoomsWithSubfoldersQuery(filesDbContext, roomsIds, filter, tags, searchByTags, searchByTypes, withoutTags, excludeSubject, subjectId); if (!string.IsNullOrEmpty(searchText)) { @@ -226,7 +226,7 @@ internal class FolderDao : AbstractDao, IFolderDao } } - public async IAsyncEnumerable> GetFoldersAsync(int parentId, OrderBy orderBy, FilterType filterType, bool subjectGroup, Guid subjectID, string searchText, bool withSubfolders = false, bool withoutMe = false) + public async IAsyncEnumerable> GetFoldersAsync(int parentId, OrderBy orderBy, FilterType filterType, bool subjectGroup, Guid subjectID, string searchText, bool withSubfolders = false, bool excludeSubject = false) { if (CheckInvalidFilter(filterType)) { @@ -276,22 +276,17 @@ internal class FolderDao : AbstractDao, IFolderDao } else { - q = q.Where(r => r.CreateBy == subjectID); + q = excludeSubject ? q.Where(r => r.CreateBy != subjectID) : q.Where(r => r.CreateBy == subjectID); } } - if (withoutMe) - { - q = q.Where(r => r.CreateBy != _authContext.CurrentAccount.ID); - } - await foreach (var e in FromQueryWithShared(filesDbContext, q).AsAsyncEnumerable()) { yield return _mapper.Map>(e); } } - public async IAsyncEnumerable> GetFoldersAsync(IEnumerable folderIds, FilterType filterType = FilterType.None, bool subjectGroup = false, Guid? subjectID = null, string searchText = "", bool searchSubfolders = false, bool checkShare = true, bool withoutMe = false) + public async IAsyncEnumerable> GetFoldersAsync(IEnumerable folderIds, FilterType filterType = FilterType.None, bool subjectGroup = false, Guid? subjectID = null, string searchText = "", bool searchSubfolders = false, bool checkShare = true, bool excludeSubject = false) { if (CheckInvalidFilter(filterType)) { @@ -335,15 +330,10 @@ internal class FolderDao : AbstractDao, IFolderDao } else { - q = q.Where(r => r.CreateBy == subjectID); + q = excludeSubject ? q.Where(r => r.CreateBy != subjectID) : q.Where(r => r.CreateBy == subjectID); } } - if (withoutMe) - { - q = q.Where(r => r.CreateBy != _authContext.CurrentAccount.ID); - } - await foreach (var e in (checkShare ? FromQueryWithShared(filesDbContext, q) : FromQuery(filesDbContext, q)).AsAsyncEnumerable().Distinct()) { yield return _mapper.Map>(e); @@ -1469,8 +1459,8 @@ internal class FolderDao : AbstractDao, IFolderDao } } - private IQueryable BuildRoomsQuery(FilesDbContext filesDbContext, IQueryable query, FolderType filterByType, IEnumerable tags, Guid ownerId, bool searchByTags, bool withoutTags, - bool searchByFilter, bool withSubfolders, bool withoutMe) + private IQueryable BuildRoomsQuery(FilesDbContext filesDbContext, IQueryable query, FolderType filterByType, IEnumerable tags, Guid subjectId, bool searchByTags, bool withoutTags, + bool searchByFilter, bool withSubfolders, bool excludeSubject) { if (searchByFilter) { @@ -1483,14 +1473,9 @@ internal class FolderDao : AbstractDao, IFolderDao .Where(r => r.tag.Type == TagType.Custom).Any(t => t.EntryId == f.Id.ToString())); } - if (ownerId != Guid.Empty && !withoutMe) + if (subjectId != Guid.Empty) { - query = query.Where(f => f.CreateBy == ownerId); - } - - if (ownerId == Guid.Empty && withoutMe) - { - query = query.Where((f => f.CreateBy != _authContext.CurrentAccount.ID)); + query = excludeSubject ? query.Where(f => f.CreateBy != subjectId) : query.Where(f => f.CreateBy == subjectId); } if (searchByTags && !withSubfolders) @@ -1505,11 +1490,11 @@ internal class FolderDao : AbstractDao, IFolderDao } private IQueryable BuildRoomsWithSubfoldersQuery(FilesDbContext filesDbContext, int parentId, FolderType filterByType, IEnumerable tags, bool searchByTags, bool searchByFilter, bool withoutTags, - bool withoutMe, Guid ownerId) + bool excludeSubject, Guid subjectId) { var q1 = GetFolderQuery(filesDbContext, r => r.ParentId == parentId).AsNoTracking(); - q1 = BuildRoomsQuery(filesDbContext, q1, filterByType, tags, ownerId, searchByTags, withoutTags, searchByFilter, true, withoutMe); + q1 = BuildRoomsQuery(filesDbContext, q1, filterByType, tags, subjectId, searchByTags, withoutTags, searchByFilter, true, excludeSubject); if (searchByTags) { @@ -1523,7 +1508,7 @@ internal class FolderDao : AbstractDao, IFolderDao .Select(r => r.folder); } - if (!searchByFilter && !searchByTags && !withoutTags && !withoutMe) + if (!searchByFilter && !searchByTags && !withoutTags && !excludeSubject) { return GetFolderQuery(filesDbContext).AsNoTracking() .Join(filesDbContext.Tree, r => r.Id, a => a.FolderId, (folder, tree) => new { folder, tree }) diff --git a/products/ASC.Files/Core/Core/FileStorageService.cs b/products/ASC.Files/Core/Core/FileStorageService.cs index 755c9b8231..2f2247ad21 100644 --- a/products/ASC.Files/Core/Core/FileStorageService.cs +++ b/products/ASC.Files/Core/Core/FileStorageService.cs @@ -258,7 +258,7 @@ public class FileStorageService //: IFileStorageService SearchArea searchArea = SearchArea.Active, bool withoutTags = false, IEnumerable tagNames = null, - bool withoutMe = false) + bool excludeSubject = false) { var subjectId = string.IsNullOrEmpty(subject) ? Guid.Empty : new Guid(subject); @@ -308,7 +308,7 @@ public class FileStorageService //: IFileStorageService try { (entries, total) = await _entryManager.GetEntriesAsync(parent, from, count, filterType, subjectGroup, subjectId, searchText, searchInContent, withSubfolders, orderBy, searchArea, - withoutTags, tagNames, withoutMe); + withoutTags, tagNames, excludeSubject); } catch (Exception e) { diff --git a/products/ASC.Files/Core/Core/Security/FileSecurity.cs b/products/ASC.Files/Core/Core/Security/FileSecurity.cs index b30620aed2..d376612e08 100644 --- a/products/ASC.Files/Core/Core/Security/FileSecurity.cs +++ b/products/ASC.Files/Core/Core/Security/FileSecurity.cs @@ -921,11 +921,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 withoutMe) + SearchArea searchArea, bool withoutTags, IEnumerable tagNames, bool excludeSubject) { if (_fileSecurityCommon.IsAdministrator(_authContext.CurrentAccount.ID)) { - return await GetVirtualRoomsForAdminAsync(filterType, subjectId, searchText, searchInContent, withSubfolders, searchArea, withoutTags, tagNames, withoutMe); + return await GetVirtualRoomsForAdminAsync(filterType, subjectId, searchText, searchInContent, withSubfolders, searchArea, withoutTags, tagNames, excludeSubject); } var securityDao = _daoFactory.GetSecurityDao(); @@ -934,9 +934,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, withoutMe); + withSubfolders, searchArea, withoutTags, tagNames, excludeSubject); var thirdPartyRooms = await GetVirtualRoomsForUserAsync(records.Where(r => r.EntryId is string), subjects, filterType, subjectId, searchText, - searchInContent, withSubfolders, searchArea, withoutTags, tagNames, withoutMe); + searchInContent, withSubfolders, searchArea, withoutTags, tagNames, excludeSubject); entries.AddRange(rooms); entries.AddRange(thirdPartyRooms); @@ -945,7 +945,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 withoutMe) + SearchArea searchArea, bool withoutTags, IEnumerable tagNames, bool excludeSubject) { var folderDao = _daoFactory.GetFolderDao(); var folderThirdPartyDao = _daoFactory.GetFolderDao(); @@ -962,8 +962,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, withoutMe).ToListAsync(); - var thirdPartyRoomsEntries = await folderThirdPartyDao.GetRoomsAsync(thirdPartyRoomsIds, filterType, tagNames, subjectId, search, withSubfolders, withoutTags, withoutMe) + 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) .ToListAsync(); foldersInt.AddRange(roomsEntries); @@ -994,8 +994,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, withoutMe).ToListAsync(); - var thirdPartyRoomsEntries = await folderThirdPartyDao.GetRoomsAsync(thirdPartyRoomsIds, filterType, tagNames, subjectId, search, withSubfolders, withoutTags, withoutMe) + 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) .ToListAsync(); foldersInt.AddRange(roomsEntries); @@ -1034,7 +1034,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 withoutMe) + bool searchInContent, bool withSubfolders, SearchArea searchArea, bool withoutTags, IEnumerable tagNames, bool excludeSubject) { var folderDao = _daoFactory.GetFolderDao(); var fileDao = _daoFactory.GetFileDao(); @@ -1076,7 +1076,7 @@ public class FileSecurity : IFileSecurity return false; }; - var fileEntries = await folderDao.GetRoomsAsync(roomsIds.Keys, filterType, tagNames, subjectId, search, withSubfolders, withoutTags, withoutMe) + var fileEntries = await folderDao.GetRoomsAsync(roomsIds.Keys, filterType, tagNames, subjectId, search, withSubfolders, withoutTags, excludeSubject) .Where(filter).ToListAsync(); await SetTagsAsync(fileEntries); diff --git a/products/ASC.Files/Core/Core/Thirdparty/Box/BoxFileDao.cs b/products/ASC.Files/Core/Core/Thirdparty/Box/BoxFileDao.cs index bc9fed59b0..525f40b4a6 100644 --- a/products/ASC.Files/Core/Core/Thirdparty/Box/BoxFileDao.cs +++ b/products/ASC.Files/Core/Core/Thirdparty/Box/BoxFileDao.cs @@ -186,7 +186,7 @@ internal class BoxFileDao : BoxDaoBase, IFileDao } } - public async IAsyncEnumerable> GetFilesAsync(string parentId, OrderBy orderBy, FilterType filterType, bool subjectGroup, Guid subjectID, string searchText, bool searchInContent, bool withSubfolders = false, bool withoutMe = false) + public async IAsyncEnumerable> GetFilesAsync(string parentId, OrderBy orderBy, FilterType filterType, bool subjectGroup, Guid subjectID, string searchText, bool searchInContent, bool withSubfolders = false, bool excludeSubject = false) { if (filterType == FilterType.FoldersOnly) { diff --git a/products/ASC.Files/Core/Core/Thirdparty/Box/BoxFolderDao.cs b/products/ASC.Files/Core/Core/Thirdparty/Box/BoxFolderDao.cs index 382f81fd3b..4563300965 100644 --- a/products/ASC.Files/Core/Core/Thirdparty/Box/BoxFolderDao.cs +++ b/products/ASC.Files/Core/Core/Thirdparty/Box/BoxFolderDao.cs @@ -74,8 +74,8 @@ internal class BoxFolderDao : BoxDaoBase, IFolderDao return GetRootFolderAsync(fileId); } - public IAsyncEnumerable> GetRoomsAsync(string parentId, FilterType filterType, IEnumerable tags, Guid ownerId, string searchText, bool withSubfolders, - bool withoutTags, bool withoutMe) + public IAsyncEnumerable> GetRoomsAsync(string parentId, FilterType filterType, IEnumerable tags, Guid subjectId, string searchText, bool withSubfolders, + bool withoutTags, bool excludeSubject) { if (CheckInvalidFilter(filterType)) { @@ -85,7 +85,7 @@ internal class BoxFolderDao : BoxDaoBase, IFolderDao var rooms = GetFoldersAsync(parentId); rooms = FilterByRoomType(rooms, filterType); - rooms = FilterByOwner(rooms, ownerId, withoutMe); + rooms = FilterBySubject(rooms, subjectId, excludeSubject); if (!string.IsNullOrEmpty(searchText)) { @@ -97,8 +97,8 @@ internal class BoxFolderDao : BoxDaoBase, IFolderDao return rooms; } - public IAsyncEnumerable> GetRoomsAsync(IEnumerable roomsIds, FilterType filterType, IEnumerable tags, Guid ownerId, string searchText, - bool withSubfolders, bool withoutTags, bool withoutMe) + public IAsyncEnumerable> GetRoomsAsync(IEnumerable roomsIds, FilterType filterType, IEnumerable tags, Guid subjectId, string searchText, + bool withSubfolders, bool withoutTags, bool excludeSubject) { if (CheckInvalidFilter(filterType)) { @@ -108,7 +108,7 @@ internal class BoxFolderDao : BoxDaoBase, IFolderDao var folders = roomsIds.ToAsyncEnumerable().SelectAwait(async e => await GetFolderAsync(e).ConfigureAwait(false)); folders = FilterByRoomType(folders, filterType); - folders = FilterByOwner(folders, ownerId, withoutMe); + folders = FilterBySubject(folders, subjectId, excludeSubject); if (!string.IsNullOrEmpty(searchText)) { @@ -129,7 +129,7 @@ internal class BoxFolderDao : BoxDaoBase, IFolderDao } } - public IAsyncEnumerable> GetFoldersAsync(string parentId, OrderBy orderBy, FilterType filterType, bool subjectGroup, Guid subjectID, string searchText, bool withSubfolders = false, bool withoutMe = false) + public IAsyncEnumerable> GetFoldersAsync(string parentId, OrderBy orderBy, FilterType filterType, bool subjectGroup, Guid subjectID, string searchText, bool withSubfolders = false, bool excludeSubject = false) { if (CheckInvalidFilter(filterType)) { @@ -164,7 +164,7 @@ internal class BoxFolderDao : BoxDaoBase, IFolderDao return folders; } - public IAsyncEnumerable> GetFoldersAsync(IEnumerable folderIds, FilterType filterType = FilterType.None, bool subjectGroup = false, Guid? subjectID = null, string searchText = "", bool searchSubfolders = false, bool checkShare = true, bool withoutMe = false) + public IAsyncEnumerable> GetFoldersAsync(IEnumerable folderIds, FilterType filterType = FilterType.None, bool subjectGroup = false, Guid? subjectID = null, string searchText = "", bool searchSubfolders = false, bool checkShare = true, bool excludeSubject = false) { if (CheckInvalidFilter(filterType)) { diff --git a/products/ASC.Files/Core/Core/Thirdparty/Dropbox/DropboxFileDao.cs b/products/ASC.Files/Core/Core/Thirdparty/Dropbox/DropboxFileDao.cs index b8187f52c4..40c1bde441 100644 --- a/products/ASC.Files/Core/Core/Thirdparty/Dropbox/DropboxFileDao.cs +++ b/products/ASC.Files/Core/Core/Thirdparty/Dropbox/DropboxFileDao.cs @@ -189,7 +189,7 @@ internal class DropboxFileDao : DropboxDaoBase, IFileDao } } - public async IAsyncEnumerable> GetFilesAsync(string parentId, OrderBy orderBy, FilterType filterType, bool subjectGroup, Guid subjectID, string searchText, bool searchInContent, bool withSubfolders = false, bool withoutMe = false) + public async IAsyncEnumerable> GetFilesAsync(string parentId, OrderBy orderBy, FilterType filterType, bool subjectGroup, Guid subjectID, string searchText, bool searchInContent, bool withSubfolders = false, bool excludeSubject = false) { if (filterType == FilterType.FoldersOnly) { diff --git a/products/ASC.Files/Core/Core/Thirdparty/Dropbox/DropboxFolderDao.cs b/products/ASC.Files/Core/Core/Thirdparty/Dropbox/DropboxFolderDao.cs index 46afa34cca..7e07c5b4a7 100644 --- a/products/ASC.Files/Core/Core/Thirdparty/Dropbox/DropboxFolderDao.cs +++ b/products/ASC.Files/Core/Core/Thirdparty/Dropbox/DropboxFolderDao.cs @@ -77,7 +77,7 @@ internal class DropboxFolderDao : DropboxDaoBase, IFolderDao return GetRootFolderAsync(fileId); } - public IAsyncEnumerable> GetRoomsAsync(string parentId, FilterType filterType, IEnumerable tags, Guid ownerId, string searchText, bool withSubfolders, bool withoutTags, bool withoutMe) + public IAsyncEnumerable> GetRoomsAsync(string parentId, FilterType filterType, IEnumerable tags, Guid subjectId, string searchText, bool withSubfolders, bool withoutTags, bool excludeSubject) { if (CheckInvalidFilter(filterType)) { @@ -87,7 +87,7 @@ internal class DropboxFolderDao : DropboxDaoBase, IFolderDao var rooms = GetFoldersAsync(parentId); rooms = FilterByRoomType(rooms, filterType); - rooms = FilterByOwner(rooms, ownerId, withoutMe); + rooms = FilterBySubject(rooms, subjectId, excludeSubject); if (!string.IsNullOrEmpty(searchText)) { @@ -99,7 +99,7 @@ internal class DropboxFolderDao : DropboxDaoBase, IFolderDao return rooms; } - public IAsyncEnumerable> GetRoomsAsync(IEnumerable roomsIds, FilterType filterType, IEnumerable tags, Guid ownerId, string searchText, bool withSubfolders, bool withoutTags, bool withoutMe) + public IAsyncEnumerable> GetRoomsAsync(IEnumerable roomsIds, FilterType filterType, IEnumerable tags, Guid subjectId, string searchText, bool withSubfolders, bool withoutTags, bool excludeSubject) { if (CheckInvalidFilter(filterType)) { @@ -109,7 +109,7 @@ internal class DropboxFolderDao : DropboxDaoBase, IFolderDao var folders = roomsIds.ToAsyncEnumerable().SelectAwait(async e => await GetFolderAsync(e).ConfigureAwait(false)); folders = FilterByRoomType(folders, filterType); - folders = FilterByOwner(folders, ownerId, withoutMe); + folders = FilterBySubject(folders, subjectId, excludeSubject); if (!string.IsNullOrEmpty(searchText)) { @@ -130,7 +130,7 @@ internal class DropboxFolderDao : DropboxDaoBase, IFolderDao } } - public IAsyncEnumerable> GetFoldersAsync(string parentId, OrderBy orderBy, FilterType filterType, bool subjectGroup, Guid subjectID, string searchText, bool withSubfolders = false, bool withoutMe = false) + public IAsyncEnumerable> GetFoldersAsync(string parentId, OrderBy orderBy, FilterType filterType, bool subjectGroup, Guid subjectID, string searchText, bool withSubfolders = false, bool excludeSubject = false) { if (CheckInvalidFilter(filterType)) { @@ -165,7 +165,7 @@ internal class DropboxFolderDao : DropboxDaoBase, IFolderDao return folders; } - public IAsyncEnumerable> GetFoldersAsync(IEnumerable folderIds, FilterType filterType = FilterType.None, bool subjectGroup = false, Guid? subjectID = null, string searchText = "", bool searchSubfolders = false, bool checkShare = true, bool withoutMe = false) + public IAsyncEnumerable> GetFoldersAsync(IEnumerable folderIds, FilterType filterType = FilterType.None, bool subjectGroup = false, Guid? subjectID = null, string searchText = "", bool searchSubfolders = false, bool checkShare = true, bool excludeSubject = false) { if (CheckInvalidFilter(filterType)) { diff --git a/products/ASC.Files/Core/Core/Thirdparty/GoogleDrive/GoogleDriveFileDao.cs b/products/ASC.Files/Core/Core/Thirdparty/GoogleDrive/GoogleDriveFileDao.cs index 10324bc0e3..286775b22f 100644 --- a/products/ASC.Files/Core/Core/Thirdparty/GoogleDrive/GoogleDriveFileDao.cs +++ b/products/ASC.Files/Core/Core/Thirdparty/GoogleDrive/GoogleDriveFileDao.cs @@ -188,7 +188,7 @@ internal class GoogleDriveFileDao : GoogleDriveDaoBase, IFileDao } } - public async IAsyncEnumerable> GetFilesAsync(string parentId, OrderBy orderBy, FilterType filterType, bool subjectGroup, Guid subjectID, string searchText, bool searchInContent, bool withSubfolders = false, bool withoutMe = false) + public async IAsyncEnumerable> GetFilesAsync(string parentId, OrderBy orderBy, FilterType filterType, bool subjectGroup, Guid subjectID, string searchText, bool searchInContent, bool withSubfolders = false, bool excludeSubject = false) { if (filterType == FilterType.FoldersOnly) { diff --git a/products/ASC.Files/Core/Core/Thirdparty/GoogleDrive/GoogleDriveFolderDao.cs b/products/ASC.Files/Core/Core/Thirdparty/GoogleDrive/GoogleDriveFolderDao.cs index 2372a6b4b2..2e7b8b9c06 100644 --- a/products/ASC.Files/Core/Core/Thirdparty/GoogleDrive/GoogleDriveFolderDao.cs +++ b/products/ASC.Files/Core/Core/Thirdparty/GoogleDrive/GoogleDriveFolderDao.cs @@ -74,7 +74,7 @@ internal class GoogleDriveFolderDao : GoogleDriveDaoBase, IFolderDao return GetRootFolderAsync(""); } - public IAsyncEnumerable> GetRoomsAsync(string parentId, FilterType filterType, IEnumerable tags, Guid ownerId, string searchText, bool withSubfolders, bool withoutTags, bool withoutMe) + public IAsyncEnumerable> GetRoomsAsync(string parentId, FilterType filterType, IEnumerable tags, Guid subjectId, string searchText, bool withSubfolders, bool withoutTags, bool excludeSubject) { if (CheckInvalidFilter(filterType)) { @@ -84,7 +84,7 @@ internal class GoogleDriveFolderDao : GoogleDriveDaoBase, IFolderDao var rooms = GetFoldersAsync(parentId); rooms = FilterByRoomType(rooms, filterType); - rooms = FilterByOwner(rooms, ownerId, withoutMe); + rooms = FilterBySubject(rooms, subjectId, excludeSubject); if (!string.IsNullOrEmpty(searchText)) { @@ -96,7 +96,7 @@ internal class GoogleDriveFolderDao : GoogleDriveDaoBase, IFolderDao return rooms; } - public IAsyncEnumerable> GetRoomsAsync(IEnumerable roomsIds, FilterType filterType, IEnumerable tags, Guid ownerId, string searchText, bool withSubfolders, bool withoutTags, bool withoutMe) + public IAsyncEnumerable> GetRoomsAsync(IEnumerable roomsIds, FilterType filterType, IEnumerable tags, Guid subjectId, string searchText, bool withSubfolders, bool withoutTags, bool excludeSubject) { if (CheckInvalidFilter(filterType)) { @@ -106,7 +106,7 @@ internal class GoogleDriveFolderDao : GoogleDriveDaoBase, IFolderDao var folders = roomsIds.ToAsyncEnumerable().SelectAwait(async e => await GetFolderAsync(e).ConfigureAwait(false)); folders = FilterByRoomType(folders, filterType); - folders = FilterByOwner(folders, ownerId, withoutMe); + folders = FilterBySubject(folders, subjectId, excludeSubject); if (!string.IsNullOrEmpty(searchText)) { @@ -128,7 +128,7 @@ internal class GoogleDriveFolderDao : GoogleDriveDaoBase, IFolderDao } } - public IAsyncEnumerable> GetFoldersAsync(string parentId, OrderBy orderBy, FilterType filterType, bool subjectGroup, Guid subjectID, string searchText, bool withSubfolders = false, bool withoutMe = false) + public IAsyncEnumerable> GetFoldersAsync(string parentId, OrderBy orderBy, FilterType filterType, bool subjectGroup, Guid subjectID, string searchText, bool withSubfolders = false, bool excludeSubject = false) { if (CheckInvalidFilter(filterType)) { @@ -163,7 +163,7 @@ internal class GoogleDriveFolderDao : GoogleDriveDaoBase, IFolderDao return folders; } - public IAsyncEnumerable> GetFoldersAsync(IEnumerable folderIds, FilterType filterType = FilterType.None, bool subjectGroup = false, Guid? subjectID = null, string searchText = "", bool searchSubfolders = false, bool checkShare = true, bool withoutMe = false) + public IAsyncEnumerable> GetFoldersAsync(IEnumerable folderIds, FilterType filterType = FilterType.None, bool subjectGroup = false, Guid? subjectID = null, string searchText = "", bool searchSubfolders = false, bool checkShare = true, bool excludeSubject = false) { if (CheckInvalidFilter(filterType)) { diff --git a/products/ASC.Files/Core/Core/Thirdparty/IThirdPartyProviderDao.cs b/products/ASC.Files/Core/Core/Thirdparty/IThirdPartyProviderDao.cs index df1fe53bca..6490176de6 100644 --- a/products/ASC.Files/Core/Core/Thirdparty/IThirdPartyProviderDao.cs +++ b/products/ASC.Files/Core/Core/Thirdparty/IThirdPartyProviderDao.cs @@ -456,16 +456,11 @@ internal abstract class ThirdPartyProviderDao : ThirdPartyProviderDao, IDispo return rooms.Where(f => f.FolderType == filter || filter == FolderType.DEFAULT); } - protected IAsyncEnumerable> FilterByOwner(IAsyncEnumerable> rooms, Guid ownerId, bool withoutMe) + protected IAsyncEnumerable> FilterBySubject(IAsyncEnumerable> rooms, Guid subjectId, bool excludeSubject) { - if (ownerId != Guid.Empty && !withoutMe) + if (subjectId != Guid.Empty) { - rooms = rooms.Where(f => f.CreateBy == ownerId); - } - - if (ownerId == Guid.Empty && withoutMe) - { - rooms = rooms.Where((f => f.CreateBy != _authContext.CurrentAccount.ID)); + rooms = excludeSubject ? rooms.Where(f => f.CreateBy != subjectId) : rooms.Where(f => f.CreateBy == subjectId); } return rooms; diff --git a/products/ASC.Files/Core/Core/Thirdparty/OneDrive/OneDriveFileDao.cs b/products/ASC.Files/Core/Core/Thirdparty/OneDrive/OneDriveFileDao.cs index 22dd7ad493..d298fde622 100644 --- a/products/ASC.Files/Core/Core/Thirdparty/OneDrive/OneDriveFileDao.cs +++ b/products/ASC.Files/Core/Core/Thirdparty/OneDrive/OneDriveFileDao.cs @@ -187,7 +187,7 @@ internal class OneDriveFileDao : OneDriveDaoBase, IFileDao } - public async IAsyncEnumerable> GetFilesAsync(string parentId, OrderBy orderBy, FilterType filterType, bool subjectGroup, Guid subjectID, string searchText, bool searchInContent, bool withSubfolders = false, bool withoutMe = false) + public async IAsyncEnumerable> GetFilesAsync(string parentId, OrderBy orderBy, FilterType filterType, bool subjectGroup, Guid subjectID, string searchText, bool searchInContent, bool excludeSubject = false, bool withoutMe = false) { if (filterType == FilterType.FoldersOnly) { diff --git a/products/ASC.Files/Core/Core/Thirdparty/OneDrive/OneDriveFolderDao.cs b/products/ASC.Files/Core/Core/Thirdparty/OneDrive/OneDriveFolderDao.cs index 9f09729206..4c2ee44d79 100644 --- a/products/ASC.Files/Core/Core/Thirdparty/OneDrive/OneDriveFolderDao.cs +++ b/products/ASC.Files/Core/Core/Thirdparty/OneDrive/OneDriveFolderDao.cs @@ -74,7 +74,7 @@ internal class OneDriveFolderDao : OneDriveDaoBase, IFolderDao return GetRootFolderAsync(fileId); } - public IAsyncEnumerable> GetRoomsAsync(string parentId, FilterType filterType, IEnumerable tags, Guid ownerId, string searchText, bool withSubfolders, bool withoutTags, bool withoutMe) + public IAsyncEnumerable> GetRoomsAsync(string parentId, FilterType filterType, IEnumerable tags, Guid subjectId, string searchText, bool withSubfolders, bool withoutTags, bool excludeSubject) { if (CheckInvalidFilter(filterType)) { @@ -84,7 +84,7 @@ internal class OneDriveFolderDao : OneDriveDaoBase, IFolderDao var rooms = GetFoldersAsync(parentId); rooms = FilterByRoomType(rooms, filterType); - rooms = FilterByOwner(rooms, ownerId, withoutMe); + rooms = FilterBySubject(rooms, subjectId, excludeSubject); if (!string.IsNullOrEmpty(searchText)) { @@ -96,7 +96,7 @@ internal class OneDriveFolderDao : OneDriveDaoBase, IFolderDao return rooms; } - public IAsyncEnumerable> GetRoomsAsync(IEnumerable roomsIds, FilterType filterType, IEnumerable tags, Guid ownerId, string searchText, bool withSubfolders, bool withoutTags, bool withoutMe) + public IAsyncEnumerable> GetRoomsAsync(IEnumerable roomsIds, FilterType filterType, IEnumerable tags, Guid subjectId, string searchText, bool withSubfolders, bool withoutTags, bool excludeSubject) { if (CheckInvalidFilter(filterType)) { @@ -106,7 +106,7 @@ internal class OneDriveFolderDao : OneDriveDaoBase, IFolderDao var folders = roomsIds.ToAsyncEnumerable().SelectAwait(async e => await GetFolderAsync(e).ConfigureAwait(false)); folders = FilterByRoomType(folders, filterType); - folders = FilterByOwner(folders, ownerId, withoutMe); + folders = FilterBySubject(folders, subjectId, excludeSubject); if (!string.IsNullOrEmpty(searchText)) { @@ -128,7 +128,7 @@ internal class OneDriveFolderDao : OneDriveDaoBase, IFolderDao } } - public IAsyncEnumerable> GetFoldersAsync(string parentId, OrderBy orderBy, FilterType filterType, bool subjectGroup, Guid subjectID, string searchText, bool withSubfolders = false, bool withoutMe = false) + public IAsyncEnumerable> GetFoldersAsync(string parentId, OrderBy orderBy, FilterType filterType, bool subjectGroup, Guid subjectID, string searchText, bool withSubfolders = false, bool excludeSubject = false) { if (CheckInvalidFilter(filterType)) { @@ -164,7 +164,7 @@ internal class OneDriveFolderDao : OneDriveDaoBase, IFolderDao return folders; } - public IAsyncEnumerable> GetFoldersAsync(IEnumerable folderIds, FilterType filterType = FilterType.None, bool subjectGroup = false, Guid? subjectID = null, string searchText = "", bool searchSubfolders = false, bool checkShare = true, bool withoutMe = false) + public IAsyncEnumerable> GetFoldersAsync(IEnumerable folderIds, FilterType filterType = FilterType.None, bool subjectGroup = false, Guid? subjectID = null, string searchText = "", bool searchSubfolders = false, bool checkShare = true, bool excludeSubject = false) { if (CheckInvalidFilter(filterType)) { diff --git a/products/ASC.Files/Core/Core/Thirdparty/ProviderDao/ProviderFileDao.cs b/products/ASC.Files/Core/Core/Thirdparty/ProviderDao/ProviderFileDao.cs index 3a9194a085..24b2603bef 100644 --- a/products/ASC.Files/Core/Core/Thirdparty/ProviderDao/ProviderFileDao.cs +++ b/products/ASC.Files/Core/Core/Thirdparty/ProviderDao/ProviderFileDao.cs @@ -182,12 +182,12 @@ internal class ProviderFileDao : ProviderDaoBase, IFileDao } } - public async IAsyncEnumerable> GetFilesAsync(string parentId, OrderBy orderBy, FilterType filterType, bool subjectGroup, Guid subjectID, string searchText, bool searchInContent, bool withSubfolders = false, bool withoutMe = false) + public async IAsyncEnumerable> GetFilesAsync(string parentId, OrderBy orderBy, FilterType filterType, bool subjectGroup, Guid subjectID, string searchText, bool searchInContent, bool withSubfolders = false, bool excludeSubject = false) { var selector = GetSelector(parentId); var fileDao = selector.GetFileDao(parentId); - var files = fileDao.GetFilesAsync(selector.ConvertId(parentId), orderBy, filterType, subjectGroup, subjectID, searchText, searchInContent, withSubfolders, withoutMe); + var files = fileDao.GetFilesAsync(selector.ConvertId(parentId), orderBy, filterType, subjectGroup, subjectID, searchText, searchInContent, withSubfolders, excludeSubject); var result = await files.Where(r => r != null).ToListAsync(); await SetSharedPropertyAsync(result); diff --git a/products/ASC.Files/Core/Core/Thirdparty/ProviderDao/ProviderFolderDao.cs b/products/ASC.Files/Core/Core/Thirdparty/ProviderDao/ProviderFolderDao.cs index 3a1c657e60..d594c18641 100644 --- a/products/ASC.Files/Core/Core/Thirdparty/ProviderDao/ProviderFolderDao.cs +++ b/products/ASC.Files/Core/Core/Thirdparty/ProviderDao/ProviderFolderDao.cs @@ -90,11 +90,11 @@ internal class ProviderFolderDao : ProviderDaoBase, IFolderDao return folderDao.GetRootFolderByFileAsync(selector.ConvertId(fileId)); } - public async IAsyncEnumerable> GetRoomsAsync(string parentId, FilterType filterType, IEnumerable tags, Guid ownerId, string searchText, bool withSubfolders, bool withoutTags, bool withoutMe) + public async IAsyncEnumerable> GetRoomsAsync(string parentId, FilterType filterType, IEnumerable tags, Guid subjectId, string searchText, bool withSubfolders, bool withoutTags, bool excludeSubject) { var selector = GetSelector(parentId); var folderDao = selector.GetFolderDao(parentId); - var rooms = folderDao.GetRoomsAsync(selector.ConvertId(parentId), filterType, tags, ownerId, searchText, withSubfolders, withoutTags, withoutMe); + var rooms = folderDao.GetRoomsAsync(selector.ConvertId(parentId), filterType, tags, subjectId, searchText, withSubfolders, withoutTags, excludeSubject); var result = await rooms.Where(r => r != null).ToListAsync(); await SetSharedPropertyAsync(result); @@ -105,7 +105,7 @@ internal class ProviderFolderDao : ProviderDaoBase, IFolderDao } } - public IAsyncEnumerable> GetRoomsAsync(IEnumerable roomsIds, FilterType filterType, IEnumerable tags, Guid ownerId, string searchText, bool withSubfolders, bool withoutTags, bool withoutMe) + public IAsyncEnumerable> GetRoomsAsync(IEnumerable roomsIds, FilterType filterType, IEnumerable tags, Guid subjectId, string searchText, bool withSubfolders, bool withoutTags, bool excludeSubject) { var result = AsyncEnumerable.Empty>(); @@ -125,7 +125,7 @@ internal class ProviderFolderDao : ProviderDaoBase, IFolderDao { var folderDao = selectorLocal.GetFolderDao(matchedId.FirstOrDefault()); - return folderDao.GetRoomsAsync(matchedId.Select(selectorLocal.ConvertId).ToList(), filterType, tags, ownerId, searchText, withSubfolders, withoutTags, withoutMe); + return folderDao.GetRoomsAsync(matchedId.Select(selectorLocal.ConvertId).ToList(), filterType, tags, subjectId, searchText, withSubfolders, withoutTags, excludeSubject); }) .Where(r => r != null)); } @@ -142,11 +142,11 @@ internal class ProviderFolderDao : ProviderDaoBase, IFolderDao return folders.Where(r => r != null); } - public async IAsyncEnumerable> GetFoldersAsync(string parentId, OrderBy orderBy, FilterType filterType, bool subjectGroup, Guid subjectID, string searchText, bool withSubfolders = false, bool withoutMe = false) + public async IAsyncEnumerable> GetFoldersAsync(string parentId, OrderBy orderBy, FilterType filterType, bool subjectGroup, Guid subjectID, string searchText, bool withSubfolders = false, bool excludeSubject = false) { var selector = GetSelector(parentId); var folderDao = selector.GetFolderDao(parentId); - var folders = folderDao.GetFoldersAsync(selector.ConvertId(parentId), orderBy, filterType, subjectGroup, subjectID, searchText, withSubfolders, withoutMe); + var folders = folderDao.GetFoldersAsync(selector.ConvertId(parentId), orderBy, filterType, subjectGroup, subjectID, searchText, withSubfolders, excludeSubject); var result = await folders.Where(r => r != null).ToListAsync(); await SetSharedPropertyAsync(result); @@ -157,7 +157,7 @@ internal class ProviderFolderDao : ProviderDaoBase, IFolderDao } } - public IAsyncEnumerable> GetFoldersAsync(IEnumerable folderIds, FilterType filterType = FilterType.None, bool subjectGroup = false, Guid? subjectID = null, string searchText = "", bool searchSubfolders = false, bool checkShare = true, bool withoutMe = false) + public IAsyncEnumerable> GetFoldersAsync(IEnumerable folderIds, FilterType filterType = FilterType.None, bool subjectGroup = false, Guid? subjectID = null, string searchText = "", bool searchSubfolders = false, bool checkShare = true, bool excludeSubject = false) { var result = AsyncEnumerable.Empty>(); @@ -178,7 +178,7 @@ internal class ProviderFolderDao : ProviderDaoBase, IFolderDao var folderDao = selectorLocal.GetFolderDao(matchedId.FirstOrDefault()); return folderDao.GetFoldersAsync(matchedId.Select(selectorLocal.ConvertId).ToList(), - filterType, subjectGroup, subjectID, searchText, searchSubfolders, checkShare, withoutMe); + filterType, subjectGroup, subjectID, searchText, searchSubfolders, checkShare, excludeSubject); }) .Where(r => r != null)); } diff --git a/products/ASC.Files/Core/Core/Thirdparty/SharePoint/SharePointFileDao.cs b/products/ASC.Files/Core/Core/Thirdparty/SharePoint/SharePointFileDao.cs index 6aeb4cac52..0434c888d0 100644 --- a/products/ASC.Files/Core/Core/Thirdparty/SharePoint/SharePointFileDao.cs +++ b/products/ASC.Files/Core/Core/Thirdparty/SharePoint/SharePointFileDao.cs @@ -177,7 +177,7 @@ internal class SharePointFileDao : SharePointDaoBase, IFileDao } } - public async IAsyncEnumerable> GetFilesAsync(string parentId, OrderBy orderBy, FilterType filterType, bool subjectGroup, Guid subjectID, string searchText, bool searchInContent, bool withSubfolders = false, bool withoutMe = false) + public async IAsyncEnumerable> GetFilesAsync(string parentId, OrderBy orderBy, FilterType filterType, bool subjectGroup, Guid subjectID, string searchText, bool searchInContent, bool withSubfolders = false, bool excludeSubject = false) { if (filterType == FilterType.FoldersOnly) { diff --git a/products/ASC.Files/Core/Core/Thirdparty/SharePoint/SharePointFolderDao.cs b/products/ASC.Files/Core/Core/Thirdparty/SharePoint/SharePointFolderDao.cs index a7022a0c6d..482af24032 100644 --- a/products/ASC.Files/Core/Core/Thirdparty/SharePoint/SharePointFolderDao.cs +++ b/products/ASC.Files/Core/Core/Thirdparty/SharePoint/SharePointFolderDao.cs @@ -80,7 +80,7 @@ internal class SharePointFolderDao : SharePointDaoBase, IFolderDao return Task.FromResult(ProviderInfo.ToFolder(ProviderInfo.RootFolder)); } - public IAsyncEnumerable> GetRoomsAsync(string parentId, FilterType filterType, IEnumerable tags, Guid ownerId, string searchText, bool withSubfolders, bool withoutTags, bool withoutMe) + public IAsyncEnumerable> GetRoomsAsync(string parentId, FilterType filterType, IEnumerable tags, Guid subjectId, string searchText, bool withSubfolders, bool withoutTags, bool excludeSubject) { if (CheckInvalidFilter(filterType)) { @@ -90,7 +90,7 @@ internal class SharePointFolderDao : SharePointDaoBase, IFolderDao var rooms = GetFoldersAsync(parentId); rooms = FilterByRoomType(rooms, filterType); - rooms = FilterByOwner(rooms, ownerId, withoutMe); + rooms = FilterBySubject(rooms, subjectId, excludeSubject); if (!string.IsNullOrEmpty(searchText)) { @@ -102,7 +102,7 @@ internal class SharePointFolderDao : SharePointDaoBase, IFolderDao return rooms; } - public IAsyncEnumerable> GetRoomsAsync(IEnumerable roomsIds, FilterType filterType, IEnumerable tags, Guid ownerId, string searchText, bool withSubfolders, bool withoutTags, bool withoutMe) + public IAsyncEnumerable> GetRoomsAsync(IEnumerable roomsIds, FilterType filterType, IEnumerable tags, Guid subjectId, string searchText, bool withSubfolders, bool withoutTags, bool excludeSubject) { if (CheckInvalidFilter(filterType)) { @@ -112,7 +112,7 @@ internal class SharePointFolderDao : SharePointDaoBase, IFolderDao var folders = roomsIds.ToAsyncEnumerable().SelectAwait(async e => await GetFolderAsync(e).ConfigureAwait(false)); folders = FilterByRoomType(folders, filterType); - folders = FilterByOwner(folders, ownerId, withoutMe); + folders = FilterBySubject(folders, subjectId, excludeSubject); if (!string.IsNullOrEmpty(searchText)) { @@ -134,7 +134,7 @@ internal class SharePointFolderDao : SharePointDaoBase, IFolderDao } } - public IAsyncEnumerable> GetFoldersAsync(string parentId, OrderBy orderBy, FilterType filterType, bool subjectGroup, Guid subjectID, string searchText, bool withSubfolders = false, bool withoutMe = false) + public IAsyncEnumerable> GetFoldersAsync(string parentId, OrderBy orderBy, FilterType filterType, bool subjectGroup, Guid subjectID, string searchText, bool withSubfolders = false, bool excludeSubject = false) { if (CheckInvalidFilter(filterType)) { @@ -170,7 +170,7 @@ internal class SharePointFolderDao : SharePointDaoBase, IFolderDao return folders; } - public IAsyncEnumerable> GetFoldersAsync(IEnumerable folderIds, FilterType filterType = FilterType.None, bool subjectGroup = false, Guid? subjectID = null, string searchText = "", bool searchSubfolders = false, bool checkShare = true, bool withoutMe = false) + public IAsyncEnumerable> GetFoldersAsync(IEnumerable folderIds, FilterType filterType = FilterType.None, bool subjectGroup = false, Guid? subjectID = null, string searchText = "", bool searchSubfolders = false, bool checkShare = true, bool excludeSubject = false) { if (CheckInvalidFilter(filterType)) { diff --git a/products/ASC.Files/Core/Core/Thirdparty/Sharpbox/SharpBoxFileDao.cs b/products/ASC.Files/Core/Core/Thirdparty/Sharpbox/SharpBoxFileDao.cs index eb5dfb3dcc..91630dd8df 100644 --- a/products/ASC.Files/Core/Core/Thirdparty/Sharpbox/SharpBoxFileDao.cs +++ b/products/ASC.Files/Core/Core/Thirdparty/Sharpbox/SharpBoxFileDao.cs @@ -172,7 +172,7 @@ internal class SharpBoxFileDao : SharpBoxDaoBase, IFileDao } } - public async IAsyncEnumerable> GetFilesAsync(string parentId, OrderBy orderBy, FilterType filterType, bool subjectGroup, Guid subjectID, string searchText, bool searchInContent, bool withSubfolders = false, bool withoutMe = false) + public async IAsyncEnumerable> GetFilesAsync(string parentId, OrderBy orderBy, FilterType filterType, bool subjectGroup, Guid subjectID, string searchText, bool searchInContent, bool withSubfolders = false, bool excludeSubject = false) { if (filterType == FilterType.FoldersOnly) { diff --git a/products/ASC.Files/Core/Core/Thirdparty/Sharpbox/SharpBoxFolderDao.cs b/products/ASC.Files/Core/Core/Thirdparty/Sharpbox/SharpBoxFolderDao.cs index 0de8703989..8714e9e6ee 100644 --- a/products/ASC.Files/Core/Core/Thirdparty/Sharpbox/SharpBoxFolderDao.cs +++ b/products/ASC.Files/Core/Core/Thirdparty/Sharpbox/SharpBoxFolderDao.cs @@ -79,7 +79,7 @@ internal class SharpBoxFolderDao : SharpBoxDaoBase, IFolderDao return Task.FromResult(ToFolder(RootFolder())); } - public IAsyncEnumerable> GetRoomsAsync(string parentId, FilterType filterType, IEnumerable tags, Guid ownerId, string searchText, bool withSubfolders, bool withoutTags, bool withoutMe) + public IAsyncEnumerable> GetRoomsAsync(string parentId, FilterType filterType, IEnumerable tags, Guid subjectId, string searchText, bool withSubfolders, bool withoutTags, bool excludeSubject) { if (CheckInvalidFilter(filterType)) { @@ -89,7 +89,7 @@ internal class SharpBoxFolderDao : SharpBoxDaoBase, IFolderDao var rooms = GetFoldersAsync(parentId); rooms = FilterByRoomType(rooms, filterType); - rooms = FilterByOwner(rooms, ownerId, withoutMe); + rooms = FilterBySubject(rooms, subjectId, excludeSubject); if (!string.IsNullOrEmpty(searchText)) { @@ -101,7 +101,7 @@ internal class SharpBoxFolderDao : SharpBoxDaoBase, IFolderDao return rooms; } - public IAsyncEnumerable> GetRoomsAsync(IEnumerable roomsIds, FilterType filterType, IEnumerable tags, Guid ownerId, string searchText, bool withSubfolders, bool withoutTags, bool withoutMe) + public IAsyncEnumerable> GetRoomsAsync(IEnumerable roomsIds, FilterType filterType, IEnumerable tags, Guid subjectId, string searchText, bool withSubfolders, bool withoutTags, bool excludeSubject) { if (CheckInvalidFilter(filterType)) { @@ -111,7 +111,7 @@ internal class SharpBoxFolderDao : SharpBoxDaoBase, IFolderDao var folders = roomsIds.ToAsyncEnumerable().SelectAwait(async e => await GetFolderAsync(e).ConfigureAwait(false)); folders = FilterByRoomType(folders, filterType); - folders = FilterByOwner(folders, ownerId, withoutMe); + folders = FilterBySubject(folders, subjectId, excludeSubject); if (!string.IsNullOrEmpty(searchText)) { @@ -130,7 +130,7 @@ internal class SharpBoxFolderDao : SharpBoxDaoBase, IFolderDao return parentFolder.OfType().Select(ToFolder).ToAsyncEnumerable(); } - public IAsyncEnumerable> GetFoldersAsync(string parentId, OrderBy orderBy, FilterType filterType, bool subjectGroup, Guid subjectID, string searchText, bool withSubfolders = false, bool withoutMe = false) + public IAsyncEnumerable> GetFoldersAsync(string parentId, OrderBy orderBy, FilterType filterType, bool subjectGroup, Guid subjectID, string searchText, bool withSubfolders = false, bool excludeSubject = false) { if (CheckInvalidFilter(filterType)) { @@ -166,7 +166,7 @@ internal class SharpBoxFolderDao : SharpBoxDaoBase, IFolderDao return folders; } - public IAsyncEnumerable> GetFoldersAsync(IEnumerable folderIds, FilterType filterType = FilterType.None, bool subjectGroup = false, Guid? subjectID = null, string searchText = "", bool searchSubfolders = false, bool checkShare = true, bool withoutMe = false) + public IAsyncEnumerable> GetFoldersAsync(IEnumerable folderIds, FilterType filterType = FilterType.None, bool subjectGroup = false, Guid? subjectID = null, string searchText = "", bool searchSubfolders = false, bool checkShare = true, bool excludeSubject = false) { if (CheckInvalidFilter(filterType)) { diff --git a/products/ASC.Files/Core/Utils/EntryManager.cs b/products/ASC.Files/Core/Utils/EntryManager.cs index 8fa83fd6b6..257c1ebf42 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 withoutMe = false) + bool excludeSubject = false) { 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, withoutMe); + entries = await _fileSecurity.GetVirtualRoomsAsync(filterType, subjectId, searchText, searchInContent, withSubfolders, searchArea, withoutTags, tagNames, excludeSubject); CalculateTotal(); } @@ -468,8 +468,8 @@ public class EntryManager withSubfolders = false; } - var folders = _daoFactory.GetFolderDao().GetFoldersAsync(parent.Id, orderBy, filterType, subjectGroup, subjectId, searchText, withSubfolders, withoutMe); - var files = _daoFactory.GetFileDao().GetFilesAsync(parent.Id, orderBy, filterType, subjectGroup, subjectId, searchText, searchInContent, withSubfolders, withoutMe); + var folders = _daoFactory.GetFolderDao().GetFoldersAsync(parent.Id, orderBy, filterType, subjectGroup, subjectId, searchText, withSubfolders, excludeSubject); + var files = _daoFactory.GetFileDao().GetFilesAsync(parent.Id, orderBy, filterType, subjectGroup, subjectId, searchText, searchInContent, withSubfolders, excludeSubject); var task1 = _fileSecurity.FilterReadAsync(folders).ToListAsync(); var task2 = _fileSecurity.FilterReadAsync(files).ToListAsync(); diff --git a/products/ASC.Files/Server/Api/FoldersController.cs b/products/ASC.Files/Server/Api/FoldersController.cs index b9ac68a89b..a5e708f231 100644 --- a/products/ASC.Files/Server/Api/FoldersController.cs +++ b/products/ASC.Files/Server/Api/FoldersController.cs @@ -122,9 +122,9 @@ public abstract class FoldersController : ApiControllerBase /// Filter type /// Folder contents [HttpGet("{folderId}", Order = 1)] - public async Task> GetFolderAsync(T folderId, Guid? userIdOrGroupId, FilterType? filterType, bool? searchInContent, bool? withsubfolders, bool? withoutMe) + public async Task> GetFolderAsync(T folderId, Guid? userIdOrGroupId, FilterType? filterType, bool? searchInContent, bool? withsubfolders, bool? excludeSubject) { - var folder = await _foldersControllerHelper.GetFolderAsync(folderId, userIdOrGroupId, filterType, searchInContent, withsubfolders, withoutMe); + var folder = await _foldersControllerHelper.GetFolderAsync(folderId, userIdOrGroupId, filterType, searchInContent, withsubfolders, excludeSubject); return folder.NotFoundIfNull(); } diff --git a/products/ASC.Files/Server/Api/VirtualRoomsController.cs b/products/ASC.Files/Server/Api/VirtualRoomsController.cs index ee53292a66..85b2e8c289 100644 --- a/products/ASC.Files/Server/Api/VirtualRoomsController.cs +++ b/products/ASC.Files/Server/Api/VirtualRoomsController.cs @@ -740,14 +740,14 @@ public class VirtualRoomsCommonController : ApiControllerBase /// /// Filter by tags /// - /// - /// Exclude your rooms from search + /// + /// Exclude subject from search /// /// /// Virtual Rooms content /// [HttpGet("rooms")] - public async Task> GetRoomsFolderAsync(RoomFilterType? type, string subjectId, bool? searchInContent, bool? withSubfolders, SearchArea? searchArea, bool? withoutTags, string tags, bool? withoutMe) + public async Task> GetRoomsFolderAsync(RoomFilterType? type, string subjectId, bool? searchInContent, bool? withSubfolders, SearchArea? searchArea, bool? withoutTags, string tags, bool? excludeSubject) { ErrorIfNotDocSpace(); @@ -778,7 +778,7 @@ public class VirtualRoomsCommonController : ApiControllerBase var filterValue = _apiContext.FilterValue; var content = await _fileStorageService.GetFolderItemsAsync(parentId, startIndex, count, filter, false, subjectId, filterValue, - searchInContent ?? false, withSubfolders ?? false, orderBy, searchArea ?? SearchArea.Active, withoutTags ?? false, tagNames, withoutMe ?? false); + searchInContent ?? false, withSubfolders ?? false, orderBy, searchArea ?? SearchArea.Active, withoutTags ?? false, tagNames, excludeSubject ?? false); var dto = await _folderContentDtoHelper.GetAsync(content, startIndex); diff --git a/products/ASC.Files/Server/Helpers/FoldersControllerHelper.cs b/products/ASC.Files/Server/Helpers/FoldersControllerHelper.cs index 83c7457a9d..355133bfaf 100644 --- a/products/ASC.Files/Server/Helpers/FoldersControllerHelper.cs +++ b/products/ASC.Files/Server/Helpers/FoldersControllerHelper.cs @@ -77,9 +77,9 @@ public class FoldersControllerHelper : FilesHelperBase return await _folderDtoHelper.GetAsync(folder); } - public async Task> GetFolderAsync(T folderId, Guid? userIdOrGroupId, FilterType? filterType, bool? searchInContent, bool? withSubFolders, bool? withoutMe = false) + public async Task> GetFolderAsync(T folderId, Guid? userIdOrGroupId, FilterType? filterType, bool? searchInContent, bool? withSubFolders, bool? excludeSubject = false) { - var folderContentWrapper = await ToFolderContentWrapperAsync(folderId, userIdOrGroupId ?? Guid.Empty, filterType ?? FilterType.None, searchInContent ?? false, withSubFolders ?? false, withoutMe ?? false); + var folderContentWrapper = await ToFolderContentWrapperAsync(folderId, userIdOrGroupId ?? Guid.Empty, filterType ?? FilterType.None, searchInContent ?? false, withSubFolders ?? false, excludeSubject ?? false); return folderContentWrapper.NotFoundIfNull(); } @@ -166,7 +166,7 @@ public class FoldersControllerHelper : FilesHelperBase return await _folderDtoHelper.GetAsync(folder); } - private async Task> ToFolderContentWrapperAsync(T folderId, Guid userIdOrGroupId, FilterType filterType, bool searchInContent, bool withSubFolders, bool withoutMe) + private async Task> ToFolderContentWrapperAsync(T folderId, Guid userIdOrGroupId, FilterType filterType, bool searchInContent, bool withSubFolders, bool excludeSubject) { OrderBy orderBy = null; if (SortedByTypeExtensions.TryParse(_apiContext.SortBy, true, out var sortBy)) @@ -175,7 +175,7 @@ public class FoldersControllerHelper : FilesHelperBase } var startIndex = Convert.ToInt32(_apiContext.StartIndex); - var items = await _fileStorageService.GetFolderItemsAsync(folderId, startIndex, Convert.ToInt32(_apiContext.Count), filterType, filterType == FilterType.ByUser, userIdOrGroupId.ToString(), _apiContext.FilterValue, searchInContent, withSubFolders, orderBy, withoutMe: withoutMe); + var items = await _fileStorageService.GetFolderItemsAsync(folderId, startIndex, Convert.ToInt32(_apiContext.Count), filterType, filterType == FilterType.ByUser, userIdOrGroupId.ToString(), _apiContext.FilterValue, searchInContent, withSubFolders, orderBy, excludeSubject: excludeSubject); return await _folderContentDtoHelper.GetAsync(items, startIndex); } From 150072b885e267328acd3ffe9e3a8c63aa2345a3 Mon Sep 17 00:00:00 2001 From: gopienkonikita Date: Fri, 16 Sep 2022 15:53:19 +0300 Subject: [PATCH 78/87] Web: Common: fixed logo click, fixed burger styles --- packages/common/components/Article/styled-article.js | 3 +++ .../Article/sub-components/article-header.js | 11 ++++------- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/packages/common/components/Article/styled-article.js b/packages/common/components/Article/styled-article.js index 8e52490656..33bcfba041 100644 --- a/packages/common/components/Article/styled-article.js +++ b/packages/common/components/Article/styled-article.js @@ -165,6 +165,8 @@ const StyledArticleHeader = styled.div` StyledArticleHeader.defaultProps = { theme: Base }; const StyledHeading = styled.div` + height: 24px; + margin: 0; padding: 0; cursor: pointer; @@ -191,6 +193,7 @@ const StyledHeading = styled.div` `; const StyledIconBox = styled.div` + cursor: pointer; display: none; align-items: center; height: 20px; diff --git a/packages/common/components/Article/sub-components/article-header.js b/packages/common/components/Article/sub-components/article-header.js index ca0ca183a9..045b024837 100644 --- a/packages/common/components/Article/sub-components/article-header.js +++ b/packages/common/components/Article/sub-components/article-header.js @@ -3,15 +3,13 @@ import PropTypes from "prop-types"; import { useHistory, useLocation } from "react-router"; import Loaders from "@docspace/common/components/Loaders"; import { isTablet as isTabletUtils } from "@docspace/components/utils/device"; +import Link from "@docspace/components/link"; import { isTablet, isMobileOnly } from "react-device-detect"; import { inject, observer } from "mobx-react"; -import { ReactSVG } from "react-svg"; -import styled, { css } from "styled-components"; import { StyledArticleHeader, StyledHeading, StyledIconBox, - StyledMenuIcon, } from "../styled-article"; const ArticleHeader = ({ @@ -62,10 +60,9 @@ const ArticleHeader = ({ ) : ( - + + + )} From d246dc4dfd6f03825ec350454cd99b3be0e34c7a Mon Sep 17 00:00:00 2001 From: gopienkonikita Date: Fri, 16 Sep 2022 16:00:07 +0300 Subject: [PATCH 79/87] Web: Files: fixed EmptyFolderContainer crash --- .../src/components/EmptyContainer/EmptyFolderContainer.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/client/src/components/EmptyContainer/EmptyFolderContainer.js b/packages/client/src/components/EmptyContainer/EmptyFolderContainer.js index cae300e581..a06ff01b05 100644 --- a/packages/client/src/components/EmptyContainer/EmptyFolderContainer.js +++ b/packages/client/src/components/EmptyContainer/EmptyFolderContainer.js @@ -92,7 +92,7 @@ export default inject(({ filesStore, selectedFolderStore }) => { const { navigationPath, parentId } = selectedFolderStore; let isRootRoom, isRoom, id; - if (navigationPath.length) { + if (navigationPath && navigationPath.length) { isRootRoom = navigationPath.at(-1).isRootRoom; isRoom = navigationPath.at(-1).isRoom; id = navigationPath.at(-1).id; From fbc24b21874eb60647f23a2285853f3fbcd4938b Mon Sep 17 00:00:00 2001 From: gopienkonikita Date: Fri, 16 Sep 2022 16:20:04 +0300 Subject: [PATCH 80/87] Web: People: fixed user role --- .../AccountsHome/Section/Body/TableView/TableRow.js | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/packages/client/src/pages/AccountsHome/Section/Body/TableView/TableRow.js b/packages/client/src/pages/AccountsHome/Section/Body/TableView/TableRow.js index 576b142b84..fca0e96b6a 100644 --- a/packages/client/src/pages/AccountsHome/Section/Body/TableView/TableRow.js +++ b/packages/client/src/pages/AccountsHome/Section/Body/TableView/TableRow.js @@ -146,10 +146,12 @@ const PeopleTableRow = (props) => { statusType, userName, position, - role, rooms, + // role } = item; + const role = item.role === "guest" ? "user" : item.role; // TODO: remove after getting valid 'role' field + const isPending = statusType === "pending" || statusType === "disabled"; const nameColor = isPending @@ -242,6 +244,8 @@ const PeopleTableRow = (props) => { setBufferSelection(item); }, [isSeveralSelection, isChecked, item, setBufferSelection]); + const typesOptions = getTypesOptions(); + return ( { userId !== item.id ? ( option.key === role )} - options={getTypesOptions()} + options={typesOptions} onSelect={onTypeChange} scaled={false} size="content" From 6563d4b63318eb1a724acff15932e3ea97ab140a Mon Sep 17 00:00:00 2001 From: Alexey Bannov Date: Fri, 16 Sep 2022 16:41:51 +0300 Subject: [PATCH 81/87] nlog: refactoring service name --- build/run/WebApi.bat | 2 +- build/run/WebStudio.bat | 2 +- .../Extensions/ISetupBuilderExtension.cs | 20 ++++++++++--------- .../Program.cs | 2 +- .../Properties/launchSettings.json | 4 ++-- common/services/ASC.Data.Backup/Program.cs | 2 +- common/services/ASC.Studio.Notify/Program.cs | 2 +- .../services/ASC.Webhooks.Service/Program.cs | 2 +- products/ASC.Files/Service/Program.cs | 2 +- web/ASC.Web.Api/Program.cs | 2 +- .../Properties/launchSettings.json | 4 ++-- web/ASC.Web.Studio/Program.cs | 2 +- .../Properties/launchSettings.json | 4 ++-- 13 files changed, 26 insertions(+), 24 deletions(-) diff --git a/build/run/WebApi.bat b/build/run/WebApi.bat index 6564a54aa9..dbfe6e528a 100644 --- a/build/run/WebApi.bat +++ b/build/run/WebApi.bat @@ -1,4 +1,4 @@ @echo off PUSHD %~dp0..\.. -set servicepath=%cd%\web\ASC.Web.Api\bin\Debug\ASC.Web.Api.exe urls=http://0.0.0.0:5000 $STORAGE_ROOT=%cd%\Data log:dir=%cd%\Logs log:name=api pathToConf=%cd%\config core:products:folder=%cd%\products \ No newline at end of file +set servicepath=%cd%\web\ASC.Web.Api\bin\Debug\ASC.Web.Api.exe urls=http://0.0.0.0:5000 $STORAGE_ROOT=%cd%\Data log:dir=%cd%\Logs log:name=web.api pathToConf=%cd%\config core:products:folder=%cd%\products \ No newline at end of file diff --git a/build/run/WebStudio.bat b/build/run/WebStudio.bat index ec4aa04cf1..52ea4a2c81 100644 --- a/build/run/WebStudio.bat +++ b/build/run/WebStudio.bat @@ -1,4 +1,4 @@ @echo off PUSHD %~dp0..\.. -set servicepath=%cd%\web\ASC.Web.Studio\bin\Debug\ASC.Web.Studio.exe urls=http://0.0.0.0:5003 $STORAGE_ROOT=%cd%\Data log:dir=%cd%\Logs log:name=studio pathToConf=%cd%\config core:products:folder=%cd%\products \ No newline at end of file +set servicepath=%cd%\web\ASC.Web.Studio\bin\Debug\ASC.Web.Studio.exe urls=http://0.0.0.0:5003 $STORAGE_ROOT=%cd%\Data log:dir=%cd%\Logs log:name=web.studio pathToConf=%cd%\config core:products:folder=%cd%\products \ No newline at end of file diff --git a/common/ASC.Api.Core/Extensions/ISetupBuilderExtension.cs b/common/ASC.Api.Core/Extensions/ISetupBuilderExtension.cs index 71812f914e..318f1e7fac 100644 --- a/common/ASC.Api.Core/Extensions/ISetupBuilderExtension.cs +++ b/common/ASC.Api.Core/Extensions/ISetupBuilderExtension.cs @@ -46,18 +46,20 @@ public static class ISetupBuilderExtension conf.Variables["dir"] = dir.TrimEnd('/').TrimEnd('\\') + Path.DirectorySeparatorChar; } - if (!string.IsNullOrEmpty(settings.AWSSecretAccessKey)) + foreach (var targetName in new[] { "aws", "aws_sql" }) { - foreach (var targetName in new[] { "aws", "aws_sql" }) + var awsTarget = conf.FindTargetByName(targetName); + + if (awsTarget == null) continue; + + //hack + if (!string.IsNullOrEmpty(settings.Name)) { - var awsTarget = conf.FindTargetByName(targetName); - - //hack - if (!string.IsNullOrEmpty(settings.Name)) - { - awsTarget.LogGroup = awsTarget.LogGroup.Replace("${var:name}", settings.Name); - } + awsTarget.LogGroup = awsTarget.LogGroup.Replace("${var:name}", settings.Name); + } + if (!string.IsNullOrEmpty(settings.AWSSecretAccessKey)) + { awsTarget.Credentials = new Amazon.Runtime.BasicAWSCredentials(settings.AWSAccessKeyId, settings.AWSSecretAccessKey); } } diff --git a/common/services/ASC.Data.Backup.BackgroundTasks/Program.cs b/common/services/ASC.Data.Backup.BackgroundTasks/Program.cs index b0953ab3b1..52f8aadf14 100644 --- a/common/services/ASC.Data.Backup.BackgroundTasks/Program.cs +++ b/common/services/ASC.Data.Backup.BackgroundTasks/Program.cs @@ -94,5 +94,5 @@ finally public partial class Program { public static string Namespace = typeof(Startup).Namespace; - public static string AppName = Namespace.Substring(Namespace.LastIndexOf('.', Namespace.LastIndexOf('.') - 1) + 1); + public static string AppName = Namespace.Substring(Namespace.LastIndexOf('.', Namespace.LastIndexOf('.') - 1) + 1).Replace(".",""); } \ No newline at end of file diff --git a/common/services/ASC.Data.Backup.BackgroundTasks/Properties/launchSettings.json b/common/services/ASC.Data.Backup.BackgroundTasks/Properties/launchSettings.json index 61bd428c2a..4cad284152 100644 --- a/common/services/ASC.Data.Backup.BackgroundTasks/Properties/launchSettings.json +++ b/common/services/ASC.Data.Backup.BackgroundTasks/Properties/launchSettings.json @@ -5,7 +5,7 @@ "launchBrowser": false, "environmentVariables": { "$STORAGE_ROOT": "../../../Data", - "log__name": "backup", + "log__name": "backup.backgoundtasks", "log__dir": "../../../Logs", "core__products__folder": "../../../products", "ASPNETCORE_ENVIRONMENT": "Development", @@ -17,7 +17,7 @@ "launchBrowser": false, "environmentVariables": { "$STORAGE_ROOT": "../../../Data", - "log__name": "backup", + "log__name": "backup.backgoundtasks", "log__dir": "../../../Logs", "core__products__folder": "../../../products", "ASPNETCORE_ENVIRONMENT": "Development", diff --git a/common/services/ASC.Data.Backup/Program.cs b/common/services/ASC.Data.Backup/Program.cs index f30891d80f..0807d9efe8 100644 --- a/common/services/ASC.Data.Backup/Program.cs +++ b/common/services/ASC.Data.Backup/Program.cs @@ -88,5 +88,5 @@ finally public partial class Program { public static string Namespace = typeof(Startup).Namespace; - public static string AppName = Namespace.Substring(Namespace.LastIndexOf('.') + 1).ToLower(); + public static string AppName = Namespace.Substring(Namespace.LastIndexOf('.') + 1); } \ No newline at end of file diff --git a/common/services/ASC.Studio.Notify/Program.cs b/common/services/ASC.Studio.Notify/Program.cs index cb85e1baf9..801d023b78 100644 --- a/common/services/ASC.Studio.Notify/Program.cs +++ b/common/services/ASC.Studio.Notify/Program.cs @@ -90,5 +90,5 @@ finally public partial class Program { public static string Namespace = typeof(Startup).Namespace; - public static string AppName = Namespace.Substring(Namespace.LastIndexOf('.', Namespace.LastIndexOf('.') - 1) + 1); + public static string AppName = Namespace.Substring(Namespace.LastIndexOf('.', Namespace.LastIndexOf('.') - 1) + 1).Replace(".", ""); } \ No newline at end of file diff --git a/common/services/ASC.Webhooks.Service/Program.cs b/common/services/ASC.Webhooks.Service/Program.cs index c23f56a082..a9989f96d9 100644 --- a/common/services/ASC.Webhooks.Service/Program.cs +++ b/common/services/ASC.Webhooks.Service/Program.cs @@ -82,6 +82,6 @@ finally public partial class Program { public static string Namespace = typeof(Startup).Namespace; - public static string AppName = Namespace.Substring(Namespace.LastIndexOf('.') + 1); + public static string AppName = Namespace.Substring(Namespace.LastIndexOf('.') + 1).Replace(".", ""); } diff --git a/products/ASC.Files/Service/Program.cs b/products/ASC.Files/Service/Program.cs index 2ec938f2b3..99107394cf 100644 --- a/products/ASC.Files/Service/Program.cs +++ b/products/ASC.Files/Service/Program.cs @@ -90,5 +90,5 @@ finally public partial class Program { public static string Namespace = typeof(Startup).Namespace; - public static string AppName = Namespace.Substring(Namespace.LastIndexOf('.', Namespace.LastIndexOf('.') - 1) + 1); + public static string AppName = Namespace.Substring(Namespace.LastIndexOf('.', Namespace.LastIndexOf('.') - 1) + 1).Replace(".", ""); } \ No newline at end of file diff --git a/web/ASC.Web.Api/Program.cs b/web/ASC.Web.Api/Program.cs index 93fd4592fe..4ef52d543a 100644 --- a/web/ASC.Web.Api/Program.cs +++ b/web/ASC.Web.Api/Program.cs @@ -86,5 +86,5 @@ finally public partial class Program { public static string Namespace = typeof(Startup).Namespace; - public static string AppName = Namespace.Substring(Namespace.LastIndexOf('.') + 1); + public static string AppName = Namespace.Substring(Namespace.LastIndexOf('.') + 1).Replace(".",""); } \ No newline at end of file diff --git a/web/ASC.Web.Api/Properties/launchSettings.json b/web/ASC.Web.Api/Properties/launchSettings.json index 51706ad589..25876fc298 100644 --- a/web/ASC.Web.Api/Properties/launchSettings.json +++ b/web/ASC.Web.Api/Properties/launchSettings.json @@ -7,7 +7,7 @@ "environmentVariables": { "$STORAGE_ROOT": "../../Data", "log__dir": "../../Logs", - "log__name": "api", + "log__name": "web.api", "ASPNETCORE_URLS": "http://localhost:5000", "ASPNETCORE_ENVIRONMENT": "Development" } @@ -19,7 +19,7 @@ "environmentVariables": { "$STORAGE_ROOT": "../../Data", "log__dir": "../../Logs", - "log__name": "api", + "log__name": "web.api", "ASPNETCORE_URLS": "http://localhost:5000", "ASPNETCORE_ENVIRONMENT": "Development" }, diff --git a/web/ASC.Web.Studio/Program.cs b/web/ASC.Web.Studio/Program.cs index 59ea75d6fd..2f56e4172d 100644 --- a/web/ASC.Web.Studio/Program.cs +++ b/web/ASC.Web.Studio/Program.cs @@ -86,5 +86,5 @@ finally public partial class Program { public static string Namespace = typeof(Startup).Namespace; - public static string AppName = Namespace.Substring(Namespace.LastIndexOf('.') + 1); + public static string AppName = Namespace.Substring(Namespace.LastIndexOf('.', Namespace.LastIndexOf('.') - 1) + 1).Replace(".",""); } \ No newline at end of file diff --git a/web/ASC.Web.Studio/Properties/launchSettings.json b/web/ASC.Web.Studio/Properties/launchSettings.json index 81981ef0e0..874345c1b5 100644 --- a/web/ASC.Web.Studio/Properties/launchSettings.json +++ b/web/ASC.Web.Studio/Properties/launchSettings.json @@ -6,7 +6,7 @@ "environmentVariables": { "$STORAGE_ROOT": "../../Data", "log__dir": "../../Logs", - "log__name": "api", + "log__name": "web.studio", "ASPNETCORE_URLS": "http://localhost:5003", "ASPNETCORE_ENVIRONMENT": "Development" } @@ -16,7 +16,7 @@ "launchBrowser": false, "environmentVariables": { "$STORAGE_ROOT": "../../Data", - "log__name": "studio", + "log__name": "web.studio", "log__dir": "../../Logs", "ASPNETCORE_URLS": "http://localhost:5003", "ASPNETCORE_ENVIRONMENT": "Development" From 65e04b76c8a4c0eb6d5826d608d8d0390cfbdf78 Mon Sep 17 00:00:00 2001 From: TimofeyBoyko Date: Fri, 16 Sep 2022 17:34:17 +0300 Subject: [PATCH 82/87] Web:Common:Api: change withoutMe to excludeSubject at rooms filter --- packages/common/api/rooms/filter.js | 27 ++++++++++++++------------- 1 file changed, 14 insertions(+), 13 deletions(-) diff --git a/packages/common/api/rooms/filter.js b/packages/common/api/rooms/filter.js index 2dffd8ed7f..e996056197 100644 --- a/packages/common/api/rooms/filter.js +++ b/packages/common/api/rooms/filter.js @@ -34,8 +34,8 @@ const DEFAULT_SORT_BY = "DateAndTime"; const SORT_ORDER = "sortorder"; const DEFAULT_SORT_ORDER = "descending"; -const WITHOUT_ME = "withoutMe"; -const DEFAULT_WITHOUT_ME = false; +const EXCLUDE_SUBJECT = "excludeSubject"; +const DEFAULT_EXCLUDE_SUBJECT = false; const WITHOUT_TAGS = "withoutTags"; const DEFAULT_WITHOUT_TAGS = false; @@ -94,7 +94,8 @@ class RoomsFilter { const sortOrder = urlFilter[SORT_ORDER] || defaultFilter.sortOrder; - const withoutMe = urlFilter[WITHOUT_ME] || defaultFilter.withoutMe; + const excludeSubject = + urlFilter[EXCLUDE_SUBJECT] || defaultFilter.excludeSubject; const withoutTags = urlFilter[WITHOUT_TAGS] || defaultFilter.withoutTags; @@ -111,7 +112,7 @@ class RoomsFilter { tags, sortBy, sortOrder, - withoutMe, + excludeSubject, withoutTags ); @@ -131,7 +132,7 @@ class RoomsFilter { tags = DEFAULT_TAGS, sortBy = DEFAULT_SORT_BY, sortOrder = DEFAULT_SORT_ORDER, - withoutMe = DEFAULT_WITHOUT_ME, + excludeSubject = DEFAULT_EXCLUDE_SUBJECT, withoutTags = DEFAULT_WITHOUT_TAGS ) { this.page = page; @@ -146,7 +147,7 @@ class RoomsFilter { this.tags = tags; this.sortBy = sortBy; this.sortOrder = sortOrder; - this.withoutMe = withoutMe; + this.excludeSubject = excludeSubject; this.withoutTags = withoutTags; } @@ -175,7 +176,7 @@ class RoomsFilter { tags, sortBy, sortOrder, - withoutMe, + excludeSubject, withoutTags, } = this; @@ -192,7 +193,7 @@ class RoomsFilter { tags: tags, sortBy: sortBy, sortOrder: sortOrder, - withoutMe: withoutMe, + excludeSubject: excludeSubject, withoutTags: withoutTags, }; @@ -213,7 +214,7 @@ class RoomsFilter { tags, sortBy, sortOrder, - withoutMe, + excludeSubject, withoutTags, } = this; @@ -247,8 +248,8 @@ class RoomsFilter { dtoFilter[PAGE_COUNT] = pageCount; } - if (withoutMe) { - dtoFilter[WITHOUT_ME] = withoutMe; + if (excludeSubject) { + dtoFilter[EXCLUDE_SUBJECT] = excludeSubject; } if (withoutTags) { @@ -282,7 +283,7 @@ class RoomsFilter { this.tags, this.sortBy, this.sortOrder, - this.withoutMe, + this.excludeSubject, this.withoutTags ); } @@ -308,7 +309,7 @@ class RoomsFilter { tagsEqual && this.sortBy === filter.sortBy && this.sortOrder === filter.sortOrder && - this.withoutMe === filter.withoutMe && + this.excludeSubject === filter.excludeSubject && this.withoutTags === filter.withoutTags; return equals; From 0e5b27e8ad3e0c6b1c6368ec4de513d3a108d622 Mon Sep 17 00:00:00 2001 From: TimofeyBoyko Date: Fri, 16 Sep 2022 17:34:46 +0300 Subject: [PATCH 83/87] Web:Client:Home: update rooms filter with excludeSubject --- .../src/pages/Home/Section/Filter/index.js | 24 +++++++------------ 1 file changed, 9 insertions(+), 15 deletions(-) diff --git a/packages/client/src/pages/Home/Section/Filter/index.js b/packages/client/src/pages/Home/Section/Filter/index.js index f0054c1892..1cf23be4ae 100644 --- a/packages/client/src/pages/Home/Section/Filter/index.js +++ b/packages/client/src/pages/Home/Section/Filter/index.js @@ -147,9 +147,7 @@ const SectionFilterContent = ({ const owner = getOwner(data) || null; const subjectId = - owner === FilterKeys.other - ? null - : owner === FilterKeys.me + owner === FilterKeys.other || owner === FilterKeys.me ? userId : owner; @@ -182,7 +180,7 @@ const SectionFilterContent = ({ newFilter.withoutTags = false; } - newFilter.withoutMe = withoutMe; + newFilter.excludeSubject = withoutMe; // newFilter.withSubfolders = withSubfolders; // newFilter.searchInContent = withContent; @@ -369,7 +367,11 @@ const SectionFilterContent = ({ if (roomsFilter.subjectId) { const isMe = userId === roomsFilter.subjectId; - let label = isMe ? t("Common:MeLabel") : null; + let label = isMe + ? roomsFilter.excludeSubject + ? t("Common:OtherLabel") + : t("Common:MeLabel") + : null; if (!isMe) { const user = await getUser(roomsFilter.subjectId); @@ -384,14 +386,6 @@ const SectionFilterContent = ({ }); } - if (roomsFilter.withoutMe) { - filterValues.push({ - key: FilterKeys.other, - group: FilterGroups.roomFilterOwner, - label: t("Common:OtherLabel"), - }); - } - // if (roomsFilter.withoutTags) { // filterValues.push({ // key: [t("NoTag")], @@ -487,7 +481,7 @@ const SectionFilterContent = ({ roomsFilter.subjectId, roomsFilter.tags, roomsFilter.tags?.length, - roomsFilter.withoutMe, + roomsFilter.excludeSubject, roomsFilter.withoutTags, // roomsFilter.withSubfolders, // roomsFilter.searchInContent, @@ -934,7 +928,7 @@ const SectionFilterContent = ({ if (group === FilterGroups.roomFilterOwner) { newFilter.subjectId = null; - newFilter.withoutMe = false; + newFilter.excludeSubject = false; } if (group === FilterGroups.roomFilterTags) { From 9b60a73c2184c397d580e1adde302001cef6f468 Mon Sep 17 00:00:00 2001 From: gopienkonikita Date: Fri, 16 Sep 2022 18:17:28 +0300 Subject: [PATCH 84/87] Web: Common: fixed logo click --- .../Article/sub-components/article-header.js | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/packages/common/components/Article/sub-components/article-header.js b/packages/common/components/Article/sub-components/article-header.js index 045b024837..ae2a8671ad 100644 --- a/packages/common/components/Article/sub-components/article-header.js +++ b/packages/common/components/Article/sub-components/article-header.js @@ -3,7 +3,7 @@ import PropTypes from "prop-types"; import { useHistory, useLocation } from "react-router"; import Loaders from "@docspace/common/components/Loaders"; import { isTablet as isTabletUtils } from "@docspace/components/utils/device"; -import Link from "@docspace/components/link"; +import { Link } from "react-router-dom"; import { isTablet, isMobileOnly } from "react-device-detect"; import { inject, observer } from "mobx-react"; import { @@ -60,9 +60,16 @@ const ArticleHeader = ({ ) : ( - - - + {isTabletView ? ( + + ) : ( + + + + )} )} From 45675c5dc1b7ec4458e56bed238b05e56cd0f873 Mon Sep 17 00:00:00 2001 From: TimofeyBoyko Date: Fri, 16 Sep 2022 18:27:28 +0300 Subject: [PATCH 85/87] Web:Common:Api: add excludeSubject at files filter --- packages/common/api/files/filter.js | 24 ++++++++++++++++++++---- 1 file changed, 20 insertions(+), 4 deletions(-) diff --git a/packages/common/api/files/filter.js b/packages/common/api/files/filter.js index e3f9d082a3..bf5cc315e0 100644 --- a/packages/common/api/files/filter.js +++ b/packages/common/api/files/filter.js @@ -14,6 +14,7 @@ const DEFAULT_AUTHOR_TYPE = null; const DEFAULT_SELECTED_ITEM = {}; const DEFAULT_FOLDER = "@my"; const DEFAULT_SEARCH_IN_CONTENT = null; +const DEFAULT_EXCLUDE_SUBJECT = null; const SEARCH_TYPE = "withSubfolders"; const AUTHOR_TYPE = "authorType"; @@ -27,6 +28,7 @@ const PAGE_COUNT = "count"; const FOLDER = "folder"; const PREVIEW = "preview"; const SEARCH_IN_CONTENT = "searchInContent"; +const EXCLUDE_SUBJECT = "excludeSubject"; // TODO: add next params // subjectGroup bool @@ -69,6 +71,8 @@ class FilesFilter { const folder = urlFilter[FOLDER] || defaultFilter.folder; const searchInContent = urlFilter[SEARCH_IN_CONTENT] || defaultFilter.searchInContent; + const excludeSubject = + urlFilter[EXCLUDE_SUBJECT] || defaultFilter.excludeSubject; const newFilter = new FilesFilter( page, @@ -83,7 +87,8 @@ class FilesFilter { authorType, defaultFilter.selectedItem, folder, - searchInContent + searchInContent, + excludeSubject ); return newFilter; @@ -102,7 +107,8 @@ class FilesFilter { authorType = DEFAULT_AUTHOR_TYPE, selectedItem = DEFAULT_SELECTED_ITEM, folder = DEFAULT_FOLDER, - searchInContent = DEFAULT_SEARCH_IN_CONTENT + searchInContent = DEFAULT_SEARCH_IN_CONTENT, + excludeSubject = DEFAULT_EXCLUDE_SUBJECT ) { this.page = page; this.pageCount = pageCount; @@ -117,6 +123,7 @@ class FilesFilter { this.selectedItem = selectedItem; this.folder = folder; this.searchInContent = searchInContent; + this.excludeSubject = excludeSubject; } getStartIndex = () => { @@ -143,6 +150,7 @@ class FilesFilter { withSubfolders, startIndex, searchInContent, + excludeSubject, } = this; const isFilterSet = @@ -165,6 +173,7 @@ class FilesFilter { withSubfolders: isFilterSet, userIdOrGroupId, searchInContent, + excludeSubject, }; const str = toUrlParams(dtoFilter, true); @@ -183,6 +192,7 @@ class FilesFilter { sortOrder, withSubfolders, searchInContent, + excludeSubject, } = this; const dtoFilter = {}; @@ -219,6 +229,10 @@ class FilesFilter { dtoFilter[SEARCH_IN_CONTENT] = searchInContent; } + if (excludeSubject) { + dtoFilter[EXCLUDE_SUBJECT] = excludeSubject; + } + dtoFilter[PAGE] = page + 1; dtoFilter[SORT_BY] = sortBy; dtoFilter[SORT_ORDER] = sortOrder; @@ -245,7 +259,8 @@ class FilesFilter { this.authorType, this.selectedItem, this.folder, - this.searchInContent + this.searchInContent, + this.excludeSubject ); } @@ -262,7 +277,8 @@ class FilesFilter { this.selectedItem.key === filter.selectedItem.key && this.folder === filter.folder && this.pageCount === filter.pageCount && - this.searchInContent === filter.searchInContent; + this.searchInContent === filter.searchInContent && + this.excludeSubject === filter.excludeSubject; return equals; } From 2d01924ea6106b5f02595e61c0493509202059ae Mon Sep 17 00:00:00 2001 From: TimofeyBoyko Date: Fri, 16 Sep 2022 18:27:54 +0300 Subject: [PATCH 86/87] Web:Common:FilterInput: fix select option --- .../components/FilterInput/sub-components/FilterBlock.js | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/packages/common/components/FilterInput/sub-components/FilterBlock.js b/packages/common/components/FilterInput/sub-components/FilterBlock.js index 70789425a1..81dc92c540 100644 --- a/packages/common/components/FilterInput/sub-components/FilterBlock.js +++ b/packages/common/components/FilterInput/sub-components/FilterBlock.js @@ -278,12 +278,7 @@ const FilterBlock = ({ show: false, })); - changeFilterValue( - showSelector.group, - items[0].key, - false, - items[0].label - ); + changeFilterValue(showSelector.group, items[0].id, false, items[0].label); }, [showSelector.group, changeFilterValue] ); From 007d25ce8eb07ac5c985e4af44a18784d967ef06 Mon Sep 17 00:00:00 2001 From: TimofeyBoyko Date: Fri, 16 Sep 2022 18:28:49 +0300 Subject: [PATCH 87/87] Web:Client:Home: update files filter with 'Other' and 'Me' filter author --- .../src/pages/Home/Section/Filter/index.js | 63 +++++++++++++++---- 1 file changed, 50 insertions(+), 13 deletions(-) diff --git a/packages/client/src/pages/Home/Section/Filter/index.js b/packages/client/src/pages/Home/Section/Filter/index.js index 1cf23be4ae..9d336a4a55 100644 --- a/packages/client/src/pages/Home/Section/Filter/index.js +++ b/packages/client/src/pages/Home/Section/Filter/index.js @@ -190,11 +190,8 @@ const SectionFilterContent = ({ } else { const filterType = getFilterType(data) || null; - const authorType = !!getAuthorType(data) - ? getAuthorType(data).includes("user_") - ? getAuthorType(data) - : `user_${getAuthorType(data)}` - : null; + const authorType = getAuthorType(data); + const withSubfolders = getSearchParams(data); const withContent = getFilterContent(data); @@ -203,7 +200,14 @@ const SectionFilterContent = ({ newFilter.filterType = filterType; - newFilter.authorType = authorType; + if (authorType === FilterKeys.me || authorType === FilterKeys.other) { + newFilter.authorType = `user_${userId}`; + newFilter.excludeSubject = authorType === FilterKeys.other; + } else { + newFilter.authorType = authorType ? `user_${authorType}` : null; + newFilter.excludeSubject = null; + } + newFilter.withSubfolders = withSubfolders === FilterKeys.excludeSubfolders ? "false" : "true"; newFilter.searchInContent = withContent === "true" ? "true" : null; @@ -462,11 +466,28 @@ const SectionFilterContent = ({ } if (filter.authorType) { - const user = await getUser(filter.authorType.replace("user_", "")); + const isMe = userId === filter.authorType.replace("user_", ""); + + let label = isMe + ? filter.excludeSubject + ? t("Common:OtherLabel") + : t("Common:MeLabel") + : null; + + if (!isMe) { + const user = await getUser(filter.authorType.replace("user_", "")); + + label = user.displayName; + } + filterValues.push({ - key: `${filter.authorType}`, + key: isMe + ? filter.excludeSubject + ? FilterKeys.other + : FilterKeys.me + : filter.authorType.replace("user_", ""), group: FilterGroups.filterAuthor, - label: user.displayName, + label: label, }); } } @@ -477,6 +498,7 @@ const SectionFilterContent = ({ filter.authorType, filter.filterType, filter.searchInContent, + filter.excludeSubject, roomsFilter.type, roomsFilter.subjectId, roomsFilter.tags, @@ -747,20 +769,33 @@ const SectionFilterContent = ({ } if (!isPersonalRoom) { - filterOptions.push( + const authorOption = [ { key: FilterGroups.filterAuthor, group: FilterGroups.filterAuthor, label: t("ByAuthor"), isHeader: true, + withMultiItems: true, }, { - key: "user", + key: FilterKeys.me, + group: FilterGroups.filterAuthor, + label: t("Common:MeLabel"), + }, + { + key: FilterKeys.other, + group: FilterGroups.filterAuthor, + label: t("Common:OtherLabel"), + }, + { + key: FilterKeys.user, group: FilterGroups.filterAuthor, label: t("Translations:AddAuthor"), isSelector: true, - } - ); + }, + ]; + + filterOptions.push(...authorOption); } filterOptions.push(...typeOptions); @@ -965,11 +1000,13 @@ const SectionFilterContent = ({ ); } else { const newFilter = filter.clone(); + if (group === FilterGroups.filterType) { newFilter.filterType = null; } if (group === FilterGroups.filterAuthor) { newFilter.authorType = null; + newFilter.excludeSubject = null; } if (group === FilterGroups.filterFolders) { newFilter.withSubfolders = "true";