Skip to content

Commit

Permalink
Merge branch 'release/1.0.0' of github.com:ONLYOFFICE/AppServer into …
Browse files Browse the repository at this point in the history
…bugfix/Bug52895
  • Loading branch information
vafomin committed Oct 4, 2021
2 parents 9c0e0db + 95b330f commit 63dfa0b
Show file tree
Hide file tree
Showing 12 changed files with 90 additions and 54 deletions.
91 changes: 60 additions & 31 deletions packages/asc-web-components/table-container/TableHeader.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ import { size } from "../utils/device";
import TableGroupMenu from "./TableGroupMenu";

const minColumnSize = 150;
const defaultMinColumnSize = 90;
const settingsSize = 24;
const containerMargin = 25;

Expand Down Expand Up @@ -80,7 +81,7 @@ class TableHeader extends React.Component {

const minSize = leftColumn.dataset.minWidth
? leftColumn.dataset.minWidth
: minColumnSize;
: defaultMinColumnSize;

if (leftColumn.clientWidth <= minSize) {
if (colIndex === 1) return false;
Expand Down Expand Up @@ -117,7 +118,10 @@ class TableHeader extends React.Component {
const offset = this.getSubstring(widths[+columnIndex]) - newWidth;
const column2Width = this.getSubstring(widths[colIndex]);

if (column2Width + offset >= minColumnSize) {
const defaultColumn = document.getElementById("column_" + colIndex);
if (defaultColumn.dataset.defaultSize) return;

if (column2Width + offset >= defaultMinColumnSize) {
widths[+columnIndex] = newWidth + "px";
widths[colIndex] = column2Width + offset + "px";
} else {
Expand Down Expand Up @@ -167,7 +171,7 @@ class TableHeader extends React.Component {

const minSize = column.dataset.minWidth
? column.dataset.minWidth
: minColumnSize;
: defaultMinColumnSize;

if (newWidth <= minSize) {
const columnChanged = this.moveToLeft(widths, newWidth);
Expand Down Expand Up @@ -248,19 +252,11 @@ class TableHeader extends React.Component {
: container.style.gridTemplateColumns.split(" ");

const containerWidth = +container.clientWidth;
const newContainerWidth = containerWidth - this.getSubstring(checkboxSize);

const oldWidth = tableContainer
.map((column) => this.getSubstring(column))
.reduce((x, y) => x + y);

const enableColumns = this.props.columns
.filter((x) => !x.default)
.filter((x) => x.enable)
.filter((x) => !x.defaultSize);

const isSingleTable = enableColumns.length > 0;

let str = "";

if (tableContainer.length > 1) {
Expand Down Expand Up @@ -306,39 +302,72 @@ class TableHeader extends React.Component {
}

if (activeColumnIndex) {
this.addNewColumns(gridTemplateColumns, activeColumnIndex);
localStorage.removeItem(columnStorageName);
return this.resetColumns();
//this.addNewColumns(gridTemplateColumns, activeColumnIndex);
}

str = gridTemplateColumns.join(" ");
} else {
const column =
(newContainerWidth * (isSingleTable ? 60 : 100)) / 100 -
(defaultSize || 0) -
containerMargin +
"px";
const percent = 40 / enableColumns.length;
const otherColumns = (newContainerWidth * percent) / 100 + "px";

str = `${checkboxSize} ${column} `;
for (let col of this.props.columns) {
if (!col.default) {
str += col.enable
? col.defaultSize
? `${col.defaultSize}px `
: `${otherColumns} `
: "0px ";
}
this.resetColumns();
}
if (str) {
container.style.gridTemplateColumns = str;
if (this.headerRef.current) {
this.headerRef.current.style.gridTemplateColumns = str;
this.headerRef.current.style.width = containerWidth + "px";
}

str += `${settingsSize}px`;
localStorage.setItem(columnStorageName, str);
}
};

resetColumns = () => {
const { containerRef, checkboxSize, columnStorageName } = this.props;
const defaultSize = this.props.columns.find((col) => col.defaultSize)
?.defaultSize;

let str = "";

const enableColumns = this.props.columns
.filter((x) => x.enable)
.filter((x) => !x.defaultSize);

const container = containerRef.current
? containerRef.current
: document.getElementById("table-container");
const containerWidth = +container.clientWidth;

const percent = 100 / enableColumns.length;
const newContainerWidth =
containerWidth -
this.getSubstring(checkboxSize) -
containerMargin -
defaultSize;
const otherColumns = (newContainerWidth * percent) / 100 + "px";

str = `${checkboxSize} `;
for (let col of this.props.columns) {
str += col.enable
? /* col.minWidth
? `${col.minWidth}px `
: */ col.defaultSize
? `${col.defaultSize}px `
: `${otherColumns} `
: "0px ";
}

str += `${settingsSize}px`;

container.style.gridTemplateColumns = str;
if (this.headerRef.current) {
this.headerRef.current.style.gridTemplateColumns = str;
this.headerRef.current.style.width = containerWidth + "px";
}

localStorage.setItem(columnStorageName, str);
str && localStorage.setItem(columnStorageName, str);

this.onResize();
};

onChange = (checked) => {
Expand Down
2 changes: 1 addition & 1 deletion products/ASC.Files/Core/Core/Dao/Interfaces/IFileDao.cs
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ public interface IFileDao<T>
/// <param name="searchText"></param>
/// <param name="searchInContent"></param>
/// <returns></returns>
List<File<T>> GetFilesFiltered(IEnumerable<T> fileIds, FilterType filterType, bool subjectGroup, Guid subjectID, string searchText, bool searchInContent);
List<File<T>> GetFilesFiltered(IEnumerable<T> fileIds, FilterType filterType, bool subjectGroup, Guid subjectID, string searchText, bool searchInContent, bool checkShared = false);

/// <summary>
///
Expand Down
4 changes: 2 additions & 2 deletions products/ASC.Files/Core/Core/Dao/TeamlabDao/FileDao.cs
Original file line number Diff line number Diff line change
Expand Up @@ -187,7 +187,7 @@ public List<File<int>> GetFiles(IEnumerable<int> fileIds)
return FromQueryWithShared(query).Select(ToFile).ToList();
}

public List<File<int>> GetFilesFiltered(IEnumerable<int> fileIds, FilterType filterType, bool subjectGroup, Guid subjectID, string searchText, bool searchInContent)
public List<File<int>> GetFilesFiltered(IEnumerable<int> fileIds, FilterType filterType, bool subjectGroup, Guid subjectID, string searchText, bool searchInContent, bool checkShared = false)
{
if (fileIds == null || !fileIds.Any() || filterType == FilterType.FoldersOnly) return new List<File<int>>();

Expand Down Expand Up @@ -238,7 +238,7 @@ public List<File<int>> GetFilesFiltered(IEnumerable<int> fileIds, FilterType fil
break;
}

return FromQuery(query).Select(ToFile).ToList();
return (checkShared ? FromQueryWithShared(query) : FromQuery(query)).Select(ToFile).ToList();
}


Expand Down
2 changes: 1 addition & 1 deletion products/ASC.Files/Core/Core/Thirdparty/Box/BoxFileDao.cs
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ public List<File<string>> GetFiles(IEnumerable<string> fileIds)
return fileIds.Select(GetBoxFile).Select(ToFile).ToList();
}

public List<File<string>> GetFilesFiltered(IEnumerable<string> fileIds, FilterType filterType, bool subjectGroup, Guid subjectID, string searchText, bool searchInContent)
public List<File<string>> GetFilesFiltered(IEnumerable<string> fileIds, FilterType filterType, bool subjectGroup, Guid subjectID, string searchText, bool searchInContent, bool checkShared = false)
{
if (fileIds == null || !fileIds.Any() || filterType == FilterType.FoldersOnly) return new List<File<string>>();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ public List<File<string>> GetFiles(IEnumerable<string> fileIds)
return fileIds.Select(GetDropboxFile).Select(ToFile).ToList();
}

public List<File<string>> GetFilesFiltered(IEnumerable<string> fileIds, FilterType filterType, bool subjectGroup, Guid subjectID, string searchText, bool searchInContent)
public List<File<string>> GetFilesFiltered(IEnumerable<string> fileIds, FilterType filterType, bool subjectGroup, Guid subjectID, string searchText, bool searchInContent, bool checkShared = false)
{
if (fileIds == null || !fileIds.Any() || filterType == FilterType.FoldersOnly) return new List<File<string>>();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ public List<File<string>> GetFiles(IEnumerable<string> fileIds)
return fileIds.Select(GetDriveEntry).Select(ToFile).ToList();
}

public List<File<string>> GetFilesFiltered(IEnumerable<string> fileIds, FilterType filterType, bool subjectGroup, Guid subjectID, string searchText, bool searchInContent)
public List<File<string>> GetFilesFiltered(IEnumerable<string> fileIds, FilterType filterType, bool subjectGroup, Guid subjectID, string searchText, bool searchInContent, bool checkShared = false)
{
if (fileIds == null || !fileIds.Any() || filterType == FilterType.FoldersOnly) return new List<File<string>>();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ public List<File<string>> GetFiles(IEnumerable<string> fileIds)
return fileIds.Select(GetOneDriveItem).Select(ToFile).ToList();
}

public List<File<string>> GetFilesFiltered(IEnumerable<string> fileIds, FilterType filterType, bool subjectGroup, Guid subjectID, string searchText, bool searchInContent)
public List<File<string>> GetFilesFiltered(IEnumerable<string> fileIds, FilterType filterType, bool subjectGroup, Guid subjectID, string searchText, bool searchInContent, bool checkShared = false)
{
if (fileIds == null || !fileIds.Any() || filterType == FilterType.FoldersOnly) return new List<File<string>>();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,7 @@ public List<File<string>> GetFiles(IEnumerable<string> fileIds)
return result.ToList();
}

public List<File<string>> GetFilesFiltered(IEnumerable<string> fileIds, FilterType filterType, bool subjectGroup, Guid subjectID, string searchText, bool searchInContent)
public List<File<string>> GetFilesFiltered(IEnumerable<string> fileIds, FilterType filterType, bool subjectGroup, Guid subjectID, string searchText, bool searchInContent, bool checkShared = false)
{
var result = Enumerable.Empty<File<string>>();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ public List<File<string>> GetFiles(IEnumerable<string> fileIds)
return fileIds.Select(fileId => ProviderInfo.ToFile(ProviderInfo.GetFileById(fileId))).ToList();
}

public List<File<string>> GetFilesFiltered(IEnumerable<string> fileIds, FilterType filterType, bool subjectGroup, Guid subjectID, string searchText, bool searchInContent)
public List<File<string>> GetFilesFiltered(IEnumerable<string> fileIds, FilterType filterType, bool subjectGroup, Guid subjectID, string searchText, bool searchInContent, bool checkShared = false)
{
if (fileIds == null || !fileIds.Any() || filterType == FilterType.FoldersOnly) return new List<File<string>>();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ public List<File<string>> GetFiles(IEnumerable<string> fileIds)
return fileIds.Select(fileId => ToFile(GetFileById(fileId))).ToList();
}

public List<File<string>> GetFilesFiltered(IEnumerable<string> fileIds, FilterType filterType, bool subjectGroup, Guid subjectID, string searchText, bool searchInContent)
public List<File<string>> GetFilesFiltered(IEnumerable<string> fileIds, FilterType filterType, bool subjectGroup, Guid subjectID, string searchText, bool searchInContent, bool checkShared = false)
{
if (fileIds == null || !fileIds.Any() || filterType == FilterType.FoldersOnly) return new List<File<string>>();

Expand Down
12 changes: 6 additions & 6 deletions products/ASC.Files/Core/Utils/EntryManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -239,8 +239,8 @@ public void SetFileStatus<T>(IEnumerable<File<T>> files)
[Scope]
public class EntryManager
{
private const string UPDATE_LIST = "filesUpdateList";
private const string UPDATE_LIST = "filesUpdateList";

private ICache Cache { get; set; }
private FileTrackerHelper FileTracker { get; }
private EntryStatusManager EntryStatusManager { get; }
Expand Down Expand Up @@ -291,7 +291,7 @@ public EntryManager(
BreadCrumbsManager breadCrumbsManager,
TenantManager tenantManager,
SettingsManager settingsManager,
IServiceProvider serviceProvider,
IServiceProvider serviceProvider,
ICache cache,
FileTrackerHelper fileTracker,
EntryStatusManager entryStatusManager)
Expand Down Expand Up @@ -464,7 +464,7 @@ public IEnumerable<FileEntry> GetEntries<T>(Folder<T> parent, int from, int coun

entries = entries.Concat(folders);
entries = entries.Concat(files);

CalculateTotal();
}
else if (parent.FolderType == FolderType.Templates)
Expand Down Expand Up @@ -616,7 +616,7 @@ public IEnumerable<FileEntry> GetRecent(FilterType filter, bool subjectGroup, Gu

var fileIds = tags.Where(tag => tag.EntryType == FileEntryType.File).ToList();

List<FileEntry> files = GetRecentByIds(fileIds.Where(r => r.EntryId is int).Select(r=> (int)r.EntryId), filter, subjectGroup, subjectId, searchText, searchInContent).ToList();
List<FileEntry> files = GetRecentByIds(fileIds.Where(r => r.EntryId is int).Select(r => (int)r.EntryId), filter, subjectGroup, subjectId, searchText, searchInContent).ToList();
files.AddRange(GetRecentByIds(fileIds.Where(r => r.EntryId is string).Select(r => (string)r.EntryId), filter, subjectGroup, subjectId, searchText, searchInContent));

var listFileIds = fileIds.Select(tag => tag.EntryId).ToList();
Expand All @@ -642,7 +642,7 @@ IEnumerable<FileEntry> GetRecentByIds<T>(IEnumerable<T> fileIds, FilterType filt
{
var folderDao = DaoFactory.GetFolderDao<T>();
var fileDao = DaoFactory.GetFileDao<T>();
var files = fileDao.GetFilesFiltered(fileIds, filter, subjectGroup, subjectId, searchText, searchInContent);
var files = fileDao.GetFilesFiltered(fileIds, filter, subjectGroup, subjectId, searchText, searchInContent, true);
files = files.Where(file => file.RootFolderType != FolderType.TRASH).ToList();

files = FileSecurity.FilterRead(files).ToList();
Expand Down
21 changes: 14 additions & 7 deletions web/ASC.Web.Api/Models/BuildVersion.cs
Original file line number Diff line number Diff line change
Expand Up @@ -28,12 +28,14 @@


using ASC.Common;
using ASC.Web.Core.Files;
using ASC.Web.Files.Services.DocumentService;

using Microsoft.Extensions.Configuration;

namespace ASC.Api.Settings
{
[Singletone]
[Scope]
public class BuildVersion
{
public string CommunityServer { get; set; }
Expand All @@ -47,9 +49,17 @@ public class BuildVersion
[JsonIgnore]
private IConfiguration Configuration { get; }

public BuildVersion(IConfiguration configuration)
[JsonIgnore]
private FilesLinkUtility FilesLinkUtility { get; }

[JsonIgnore]
private DocumentServiceConnector DocumentServiceConnector { get; }

public BuildVersion(IConfiguration configuration, FilesLinkUtility filesLinkUtility, DocumentServiceConnector documentServiceConnector)
{
Configuration = configuration;
FilesLinkUtility = filesLinkUtility;
DocumentServiceConnector = documentServiceConnector;
}

public BuildVersion GetCurrentBuildVersion()
Expand All @@ -67,15 +77,12 @@ private string GetCommunityVersion()
return Configuration["version:number"] ?? "8.5.0";
}

private static string GetDocumentVersion()
private string GetDocumentVersion()
{
return "";
//TODO
/*
if (string.IsNullOrEmpty(FilesLinkUtility.DocServiceApiUrl))
return null;

return DocumentServiceConnector.GetVersion();*/
return DocumentServiceConnector.GetVersion();
}

private static string GetMailServerVersion()
Expand Down

0 comments on commit 63dfa0b

Please sign in to comment.