Merge branch 'release/1.0.0' of github.com:ONLYOFFICE/AppServer into bugfix/tile-view

This commit is contained in:
Viktor Fomin 2021-10-20 12:15:00 +03:00
commit 80d9471f7a
4 changed files with 57 additions and 8 deletions

View File

@ -515,6 +515,7 @@ namespace ASC.Files.Core.Data
var toInsert = FilesDbContext.Tree var toInsert = FilesDbContext.Tree
.Where(r => r.FolderId == toFolderId) .Where(r => r.FolderId == toFolderId)
.OrderBy(r => r.Level)
.ToList(); .ToList();
foreach (var subfolder in subfolders) foreach (var subfolder in subfolders)
@ -525,7 +526,7 @@ namespace ASC.Files.Core.Data
{ {
FolderId = subfolder.Key, FolderId = subfolder.Key,
ParentId = f.ParentId, ParentId = f.ParentId,
Level = f.Level + 1 Level = subfolder.Value + 1 + f.Level
}; };
FilesDbContext.AddOrUpdate(r => r.Tree, newTree); FilesDbContext.AddOrUpdate(r => r.Tree, newTree);
} }

View File

@ -36,6 +36,7 @@ using ASC.Common.Threading;
using ASC.Common.Web; using ASC.Common.Web;
using ASC.Core.Tenants; using ASC.Core.Tenants;
using ASC.Files.Core; using ASC.Files.Core;
using ASC.Files.Core.EF;
using ASC.Files.Core.Resources; using ASC.Files.Core.Resources;
using ASC.MessagingSystem; using ASC.MessagingSystem;
using ASC.Web.Core.Files; using ASC.Web.Core.Files;
@ -117,9 +118,42 @@ namespace ASC.Web.Files.Services.WCFService.FileOperations
MimeMapping.GetMimeMapping(path), MimeMapping.GetMimeMapping(path),
"attachment; filename=\"" + fileName + "\""); "attachment; filename=\"" + fileName + "\"");
Result = string.Format("{0}?{1}=bulk&ext={2}", filesLinkUtility.FileHandlerPath, FilesLinkUtility.Action, archiveExtension); Result = string.Format("{0}?{1}=bulk&ext={2}", filesLinkUtility.FileHandlerPath, FilesLinkUtility.Action, archiveExtension);
TaskInfo.SetProperty(PROGRESS, 100);
TaskInfo.SetProperty(RESULT, Result);
TaskInfo.SetProperty(FINISHED, true);
} }
FillDistributedTask(); TaskInfo.PublishChanges();
}
public override void PublishChanges(DistributedTask task)
{
var thirdpartyTask = ThirdPartyOperation.GetDistributedTask();
var daoTask = DaoOperation.GetDistributedTask();
var error1 = thirdpartyTask.GetProperty<string>(ERROR);
var error2 = daoTask.GetProperty<string>(ERROR);
if (!string.IsNullOrEmpty(error1))
{
Error = error1;
}
else if (!string.IsNullOrEmpty(error2))
{
Error = error2;
}
successProcessed = thirdpartyTask.GetProperty<int>(PROCESSED) + daoTask.GetProperty<int>(PROCESSED);
var progressSteps = ThirdPartyOperation.Total + DaoOperation.Total + 1;
var progress = (int)(successProcessed / (double)progressSteps * 100);
base.FillDistributedTask();
TaskInfo.SetProperty(PROGRESS, progress < 100 ? progress : progress);
TaskInfo.PublishChanges(); TaskInfo.PublishChanges();
} }
} }
@ -146,6 +180,7 @@ namespace ASC.Web.Files.Services.WCFService.FileOperations
if (!Files.Any() && !Folders.Any()) return; if (!Files.Any() && !Folders.Any()) return;
entriesPathId = GetEntriesPathId(scope); entriesPathId = GetEntriesPathId(scope);
if (entriesPathId == null || entriesPathId.Count == 0) if (entriesPathId == null || entriesPathId.Count == 0)
{ {
if (Files.Count > 0) if (Files.Count > 0)
@ -157,6 +192,10 @@ namespace ASC.Web.Files.Services.WCFService.FileOperations
} }
ReplaceLongPath(entriesPathId); ReplaceLongPath(entriesPathId);
Total = entriesPathId.Count;
TaskInfo.PublishChanges();
} }
private ItemNameValueCollection<T> ExecPathFromFile(IServiceScope scope, File<T> file, string path) private ItemNameValueCollection<T> ExecPathFromFile(IServiceScope scope, File<T> file, string path)
@ -345,6 +384,15 @@ namespace ASC.Web.Files.Services.WCFService.FileOperations
} }
compressTo.CloseEntry(); compressTo.CloseEntry();
counter++; counter++;
if (!Equals(entryId, default(T)) && file != null)
{
ProcessedFile(entryId);
}
else
{
ProcessedFolder(default(T));
}
} }
ProgressStep(); ProgressStep();

View File

@ -149,7 +149,7 @@ namespace ASC.Web.Files.Services.WCFService.FileOperations
base.FillDistributedTask(); base.FillDistributedTask();
} }
public void PublishChanges(DistributedTask task) public virtual void PublishChanges(DistributedTask task)
{ {
var thirdpartyTask = ThirdPartyOperation.GetDistributedTask(); var thirdpartyTask = ThirdPartyOperation.GetDistributedTask();
var daoTask = DaoOperation.GetDistributedTask(); var daoTask = DaoOperation.GetDistributedTask();

View File

@ -11,7 +11,7 @@
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<PackageReference Include="AppLimit.CloudComputing.SharpBox" Version="1.1.0.456" /> <PackageReference Include="AppLimit.CloudComputing.SharpBox" Version="1.1.0.457" />
<PackageReference Include="Autofac" Version="6.0.0" /> <PackageReference Include="Autofac" Version="6.0.0" />
<PackageReference Include="Autofac.Configuration" Version="6.0.0" /> <PackageReference Include="Autofac.Configuration" Version="6.0.0" />
<PackageReference Include="Autofac.Extensions.DependencyInjection" Version="7.1.0" /> <PackageReference Include="Autofac.Extensions.DependencyInjection" Version="7.1.0" />