Merge branch 'feature/files' into feature/selectors-refactoring

# Conflicts:
#	products/ASC.Files/Client/src/components/pages/DocEditor/index.js
This commit is contained in:
Nikita Gopienko 2020-10-12 15:36:26 +03:00
commit 577fc5ac70
12 changed files with 76 additions and 39 deletions

View File

@ -31,10 +31,10 @@
"header": "AuthorizationJwt"
},
"url": {
"public" : "https://dotnet.onlyoffice.com:8093",
"internal" : "",
"portal" : "https://dotnet.onlyoffice.com:8093",
"converter" : "https://dotnet.onlyoffice.com/ds-vpath/ConvertService.ashx",
"public": "/ds-vpath/",
"internal": "http://172.18.0.4/",
"portal": "https://dotnet.onlyoffice.com:8093/",
"converter" : "/ds-vpath/ConvertService.ashx",
}
},
"ffmpeg" :

View File

@ -53,6 +53,26 @@ server {
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_param PATH_INFO "";
location ~* ^/ds-vpath/ {
rewrite /ds-vpath/(.*) /$1 break;
proxy_pass http://172.18.0.4:80;
proxy_redirect off;
client_max_body_size 100m;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
proxy_set_header Host $http_host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Host $the_host/ds-vpath;
proxy_set_header X-Forwarded-Proto $the_scheme;
}
location / {
proxy_pass http://localhost:5001;

View File

@ -26,10 +26,6 @@
rel="stylesheet"
type="text/css"
/>
<script
type="text/javascript"
src="/ds-vpath/web-apps/apps/api/documents/api.js"
></script>
<!--
Notice the use of %PUBLIC_URL% in the tags above.
It will be replaced with the URL of the `public` folder during the build.

View File

@ -3,13 +3,11 @@ import { connect } from "react-redux";
import PropTypes from "prop-types";
import { withRouter } from "react-router";
import { /*RequestLoader,*/ Box } from "asc-web-components";
import { utils, api, store } from "asc-web-common";
import { utils, api, toastr } from "asc-web-common";
import { withTranslation, I18nextProvider } from "react-i18next";
import { createI18N } from "../../../helpers/i18n";
import { getFiles, getFolders } from "../../../store/files/selectors";
const { getIsLoaded } = store.auth.selectors;
const i18n = createI18N({
page: "DocEditor",
localesPath: "pages/DocEditor",
@ -19,28 +17,49 @@ const { changeLanguage, getObjectByLocation, hideLoader, showLoader } = utils;
const { files } = api;
class PureEditor extends React.Component {
componentDidMount() {
async componentDidMount() {
const urlParams = getObjectByLocation(window.location);
const fileId = urlParams.fileId || null;
console.log("PureEditor componentDidMount", fileId);
const vh = window.innerHeight * 0.01;
document.documentElement.style.setProperty("--vh", `${vh}px`);
showLoader();
files
.openEdit(fileId)
.then((config) => {
if (window.innerWidth < 720) {
config.type = "mobile";
}
let docApiUrl = await files.getDocServiceUrl();
window.DocsAPI.DocEditor("editor", config);
})
.catch((e) => {
console.log(e);
hideLoader();
});
const script = document.createElement("script");
script.setAttribute("type", "text/javascript");
script.setAttribute("id", "scripDocServiceAddress");
script.onload = function () {
console.log("PureEditor script.onload", fileId, window.DocsAPI);
files
.openEdit(fileId)
.then((config) => {
// if (window.innerWidth < 720) {
// config.type = "mobile";
// }
if (!window.DocsAPI) throw new Error("DocsAPI is not defined");
console.log("Trying to open file with DocsAPI", fileId);
window.DocsAPI.DocEditor("editor", config);
})
.catch((e) => {
console.log(e);
toastr.error(e);
hideLoader();
});
};
script.src = docApiUrl;
script.async = true;
console.log("PureEditor componentDidMount: added script");
document.body.appendChild(script);
}
render() {
@ -67,15 +86,13 @@ const DocEditor = (props) => {
DocEditor.propTypes = {
files: PropTypes.array,
history: PropTypes.object,
isLoaded: PropTypes.bool,
history: PropTypes.object
};
function mapStateToProps(state) {
return {
files: getFiles(state),
folders: getFolders(state),
isLoaded: getIsLoaded(state),
folders: getFolders(state)
};
}

View File

@ -2178,7 +2178,7 @@ asap@~2.0.6:
integrity sha1-5QNHYR1+aQlDIIu9r+vLwvuGbUY=
"asc-web-common@file:../../../packages/asc-web-common":
version "1.0.250"
version "1.0.252"
dependencies:
axios "^0.19.1"
history "4.10.1"
@ -2193,7 +2193,7 @@ asap@~2.0.6:
sjcl "^1.0.8"
"asc-web-components@file:../../../packages/asc-web-components":
version "1.0.459"
version "1.0.460"
dependencies:
email-addresses "^3.1.0"
html-to-react "^1.4.2"

View File

@ -243,7 +243,7 @@ namespace ASC.Files.Core.Data
q = GetFolderQuery()
.AsNoTracking()
.Join(FilesDbContext.Tree, r => r.Id, a => a.FolderId, (folder, tree) => new { folder, tree })
.Where(r => folderIds.Any(q => q == r.folder.ParentId))
.Where(r => folderIds.Any(q => q == r.tree.ParentId))
.Select(r => r.folder);
}

View File

@ -2171,7 +2171,7 @@ asap@~2.0.6:
integrity sha1-5QNHYR1+aQlDIIu9r+vLwvuGbUY=
"asc-web-common@file:../../../packages/asc-web-common":
version "1.0.250"
version "1.0.252"
dependencies:
axios "^0.19.1"
history "4.10.1"
@ -2186,7 +2186,7 @@ asap@~2.0.6:
sjcl "^1.0.8"
"asc-web-components@file:../../../packages/asc-web-components":
version "1.0.459"
version "1.0.460"
dependencies:
email-addresses "^3.1.0"
html-to-react "^1.4.2"

View File

@ -49,7 +49,7 @@ emailSettings.allowDomainPunycode = true;
const WizardContainer = styled.div`
width: 960px;
margin: 0 auto;
margin-top: 120px;
margin-top: 60px;
.wizard-form {
margin-top: 32px;
@ -65,7 +65,7 @@ const WizardContainer = styled.div`
@media (max-width: 520px) {
width: calc(100% - 32px);
margin-top: 72px;
margin-top: 12px;
}
`;

View File

@ -2171,7 +2171,7 @@ asap@~2.0.6:
integrity sha1-5QNHYR1+aQlDIIu9r+vLwvuGbUY=
"asc-web-common@file:../../packages/asc-web-common":
version "1.0.250"
version "1.0.252"
dependencies:
axios "^0.19.1"
history "4.10.1"
@ -2186,7 +2186,7 @@ asap@~2.0.6:
sjcl "^1.0.8"
"asc-web-components@file:../../packages/asc-web-components":
version "1.0.459"
version "1.0.460"
dependencies:
email-addresses "^3.1.0"
html-to-react "^1.4.2"

View File

@ -1,6 +1,6 @@
{
"name": "asc-web-common",
"version": "1.0.251",
"version": "1.0.252",
"description": "Ascensio System SIA common components and solutions library",
"license": "AGPL-3.0",
"files": [

View File

@ -465,3 +465,7 @@ export function thirdParty(val) {
export function getSettingsFiles() {
return request({ method: "get", url: `/files/settings` });
}
export function getDocServiceUrl() {
return request({ method: "get", url: `/files/docservice` });
}

View File

@ -3122,7 +3122,7 @@ arrify@^1.0.1:
integrity sha1-iYUI2iIm84DfkEcoRWhJwVAaSw0=
"asc-web-components@file:../../packages/asc-web-components":
version "1.0.459"
version "1.0.460"
dependencies:
email-addresses "^3.1.0"
html-to-react "^1.4.2"