Web: Files: added href to filesList and tableView

This commit is contained in:
Dmitry Sychugov 2021-09-01 14:09:10 +05:00
parent 9be5858ae7
commit 4942fb26a8
4 changed files with 21 additions and 43 deletions

View File

@ -10,9 +10,6 @@ import RowContent from "@appserver/components/row-content";
import withContent from "../../../../../HOCs/withContent";
import withBadges from "../../../../../HOCs/withBadges";
import { AppServerConfig } from "@appserver/common/constants";
import { combineUrl } from "@appserver/common/utils";
import config from "../../../../../../package.json";
const sideColor = "#A3A9AE";
@ -59,7 +56,6 @@ const FilesRowContent = ({
updatedDate,
fileOwner,
linkStyles,
isTrashFolder,
//onFilesClick,
badgesComponent,
isAdmin,
@ -71,27 +67,10 @@ const FilesRowContent = ({
foldersCount,
providerKey,
access,
previewUrl,
folderUrl,
id,
} = item;
const withAccess = isAdmin || access === 0;
const docUrl = combineUrl(
AppServerConfig.proxyURL,
config.homepage,
`/doceditor?fileId=${id}`
);
const href = isTrashFolder
? null
: previewUrl
? previewUrl
: !item.isFolder
? docUrl
: folderUrl;
return (
<>
<SimpleFilesRowContent
@ -108,7 +87,7 @@ const FilesRowContent = ({
fontWeight="600"
fontSize="15px"
target="_blank"
href={href}
href={item.href}
{...linkStyles}
color="#333"
isTextOverflow={true}

View File

@ -10,6 +10,7 @@ const FileNameCell = ({ item, titleWithoutExt, linkStyles }) => {
title={titleWithoutExt}
fontWeight="600"
fontSize="15px"
href={item.href}
{...linkStyles}
color="#333"
isTextOverflow

View File

@ -10,10 +10,6 @@ import TileContent from "./sub-components/TileContent";
import withContent from "../../../../../HOCs/withContent";
import withBadges from "../../../../../HOCs/withBadges";
import { AppServerConfig } from "@appserver/common/constants";
import { combineUrl } from "@appserver/common/utils";
import config from "../../../../../../package.json";
const SimpleFilesTileContent = styled(TileContent)`
.row-main-container {
height: auto;
@ -81,25 +77,10 @@ const FilesTileContent = ({
item,
titleWithoutExt,
linkStyles,
isTrashFolder,
onFilesClick,
badgesComponent,
}) => {
const { fileExst, previewUrl, folderUrl, id } = item;
const docUrl = combineUrl(
AppServerConfig.proxyURL,
config.homepage,
`/doceditor?fileId=${id}`
);
const href = isTrashFolder
? null
: previewUrl
? previewUrl
: !item.isFolder
? docUrl
: folderUrl;
const { fileExst } = item;
return (
<>
@ -116,7 +97,7 @@ const FilesTileContent = ({
fontWeight="600"
fontSize="14px"
target="_blank"
href={href}
href={item.href}
{...linkStyles}
color="#333"
isTextOverflow

View File

@ -1116,6 +1116,8 @@ class FilesStore {
if (x.id === item.id) isFolder = true;
});
const { isRecycleBinFolder } = this.treeFoldersStore;
const folderUrl = isFolder
? combineUrl(
AppServerConfig.proxyURL,
@ -1124,6 +1126,20 @@ class FilesStore {
)
: null;
const docUrl = combineUrl(
AppServerConfig.proxyURL,
config.homepage,
`/doceditor?fileId=${id}`
);
const href = isRecycleBinFolder
? null
: previewUrl
? previewUrl
: !isFolder
? docUrl
: folderUrl;
return {
access,
//checked,
@ -1167,6 +1183,7 @@ class FilesStore {
thumbnailStatus,
previewUrl,
folderUrl,
href,
};
});