Skip to content

Commit

Permalink
Merge pull request #373 from ONLYOFFICE/feature/debug-info
Browse files Browse the repository at this point in the history
Feature/debug info
  • Loading branch information
AlexeySafronov authored Oct 5, 2021
2 parents 0f59548 + 0a8f6c9 commit 4f9fddf
Show file tree
Hide file tree
Showing 42 changed files with 2,239 additions and 371 deletions.
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,5 @@ Data/
Logs/
**/.DS_Store
.eslintcache
build/deploy/
build/deploy/
/public/debuginfo.md
11 changes: 11 additions & 0 deletions build/install/common/build-frontend.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
SRC_PATH="/AppServer"
BUILD_ARGS="build"
DEPLOY_ARGS="deploy"
DEBUG_INFO="true"

while [ "$1" != "" ]; do
case $1 in
Expand All @@ -25,12 +26,19 @@ while [ "$1" != "" ]; do
shift
fi
;;
-di | --depbug-info )
if [ "$2" != "" ]; then
DEBUG_INFO=$2
shift
fi
;;
-? | -h | --help )
echo " Usage: bash build-backend.sh [PARAMETER] [[PARAMETER], ...]"
echo " Parameters:"
echo " -sp, --srcpath path to AppServer root directory"
echo " -ba, --build-args arguments for yarn building"
echo " -da, --deploy-args arguments for yarn deploying"
echo " -di, --depbug-info arguments for yarn debug info configure"
echo " -?, -h, --help this help"
echo " Examples"
echo " bash build-backend.sh -sp /app/AppServer"
Expand All @@ -48,6 +56,9 @@ done
echo "== FRONT-END-BUILD =="

cd ${SRC_PATH}
if [ "$DEBUG_INFO" = true ]; then
yarn debug-info
fi
yarn install
yarn ${BUILD_ARGS}
yarn ${DEPLOY_ARGS}
7 changes: 4 additions & 3 deletions build/install/docker/Dockerfile-app
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ ARG SRC_PATH
ARG BUILD_PATH
ARG BUILD_ARGS=build
ARG DEPLOY_ARGS=deploy
ARG DEBUG_INFO=true

LABEL onlyoffice.appserver.release-date="${RELEASE_DATE}" \
maintainer="Ascensio System SIA <[email protected]>"
Expand Down Expand Up @@ -48,9 +49,9 @@ RUN echo "nameserver 8.8.8.8" | tee /etc/resolv.conf > /dev/null && \
sed -i "s/\"number\".*,/\"number\": \"${PRODUCT_VERSION}.${BUILD_NUMBER}\",/g" /app/onlyoffice/config/appsettings.json && \
sed -e 's/#//' -i /etc/nginx/conf.d/onlyoffice.conf && \
cd ${SRC_PATH}/build/install/common/ && \
bash build-frontend.sh -sp ${SRC_PATH} -ba ${BUILD_ARGS} -da ${DEPLOY_ARGS} && \
bash build-backend.sh -sp ${SRC_PATH} && \
bash publish-backend.sh -sp ${SRC_PATH} -bp ${BUILD_PATH} && \
bash build-frontend.sh -sp "${SRC_PATH}" -ba "${BUILD_ARGS}" -da "${DEPLOY_ARGS}" && -di "${DEBUG_INFO}" && \
bash build-backend.sh -sp "${SRC_PATH}" && \
bash publish-backend.sh -sp "${SRC_PATH}" -bp "${BUILD_PATH}" && \
cp -rf ${SRC_PATH}/products/ASC.Files/Server/DocStore ${BUILD_PATH}/products/ASC.Files/server/ && \
rm -rf ${SRC_PATH}/common/* && \
rm -rf ${SRC_PATH}/web/ASC.Web.Core/* && \
Expand Down
3 changes: 3 additions & 0 deletions config/appsettings.json
Original file line number Diff line number Diff line change
Expand Up @@ -154,5 +154,8 @@
"messagingSenderId": "",
"appId": "",
"measurementId": ""
},
"debug-info": {
"enabled": "true"
}
}
2 changes: 1 addition & 1 deletion config/nginx/onlyoffice.conf
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ server {
location / {

proxy_pass http://localhost:5001;
location ~* /(manifest.json|sw.js|appIcon.png|bg-error.png|favicon.ico) {
location ~* /(manifest.json|sw.js|appIcon.png|bg-error.png|favicon.ico|debuginfo.md) {
root $public_root;
try_files /$basename /index.html =404;
}
Expand Down
1 change: 1 addition & 0 deletions lerna.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
"packages/asc-web-components",
"packages/asc-web-common",
"packages/browserslist-config-asc",
"packages/debug-info",
"web/ASC.Web.Login",
"web/ASC.Web.Client",
"web/ASC.Web.Editor",
Expand Down
27 changes: 8 additions & 19 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
"packages/asc-web-components",
"packages/asc-web-common",
"packages/browserslist-config-asc",
"packages/debug-info",
"web/ASC.Web.Login",
"web/ASC.Web.Client",
"web/ASC.Web.Editor",
Expand All @@ -17,15 +18,15 @@
"products/ASC.Calendar/Client"
],
"scripts": {
"build": "lerna run build --parallel --ignore @appserver/common --ignore @appserver/components --ignore @appserver/browserslist-config-asc",
"build": "lerna run build --parallel --ignore @appserver/common --ignore @appserver/components --ignore @appserver/browserslist-config-asc --ignore @appserver/debug-info",
"build:personal": "lerna run build --parallel --scope {@appserver/studio,@appserver/people,@appserver/files,@appserver/editor}",
"bump": "lerna version --no-push --no-git-tag-version",
"clean": "lerna run clean --parallel",
"deploy": "shx rm -rf build/deploy/products && shx rm -rf build/deploy/public && shx rm -rf build/deploy/studio && lerna run deploy --parallel --ignore @appserver/common --ignore @appserver/components --ignore @appserver/browserslist-config-asc && shx cp -r public build/deploy && yarn sw-build",
"deploy": "shx rm -rf build/deploy/products && shx rm -rf build/deploy/public && shx rm -rf build/deploy/studio && lerna run deploy --parallel --ignore @appserver/common --ignore @appserver/components --ignore @appserver/browserslist-config-asc --ignore @appserver/debug-info && shx cp -r public build/deploy && yarn sw-build",
"deploy:personal": "shx rm -rf build/deploy/products && shx rm -rf build/deploy/public && shx rm -rf build/deploy/studio && lerna run deploy --parallel --scope {@appserver/studio,@appserver/people,@appserver/files,@appserver/editor} && shx cp -r public build/deploy && yarn sw-build:personal",
"serve": "lerna run serve --parallel --ignore @appserver/common --ignore @appserver/components --ignore @appserver/browserslist-config-asc",
"start": "lerna run start --parallel --ignore @appserver/common --ignore @appserver/components --ignore @appserver/browserslist-config-asc",
"start-prod": "lerna run start-prod --parallel --ignore @appserver/common --ignore @appserver/components --ignore @appserver/browserslist-config-asc",
"serve": "lerna run serve --parallel --ignore @appserver/common --ignore @appserver/components --ignore @appserver/browserslist-config-asc --ignore @appserver/debug-info",
"start": "lerna run start --parallel --ignore @appserver/common --ignore @appserver/components --ignore @appserver/browserslist-config-asc --ignore @appserver/debug-info",
"start-prod": "lerna run start-prod --parallel --ignore @appserver/common --ignore @appserver/components --ignore @appserver/browserslist-config-asc --ignore @appserver/debug-info",
"storybook": "yarn workspace @appserver/components storybook",
"storybook-build": "yarn workspace @appserver/components run storybook-build",
"sw-build": "workbox injectManifest config/workbox-config.js && yarn sw-modify && yarn sw-minimize",
Expand All @@ -44,27 +45,15 @@
"sw-studio-login-replace": "replace-in-files --string='studio/login/' --replacement='login/' build/deploy/public/sw.js",
"sw-studio-replace": "replace-in-files --string='studio/client/' --replacement='/' build/deploy/public/sw.js",
"test": "yarn workspace @appserver/components test",
"wipe": "shx rm -rf node_modules yarn.lock web/**/node_modules products/**/node_modules"
"wipe": "shx rm -rf node_modules yarn.lock web/**/node_modules products/**/node_modules",
"debug-info": "node packages/debug-info --unreleased-only --template debuginfo --output public/debuginfo.md"
},
"devDependencies": {
"browserslist": "^4.17.1",
"lerna": "^4.0.0",
"replace-in-files-cli": "^1.0.0",
"shx": "^0.3.3",
"terser": "^5.8.0",
"workbox-cli": "^6.3.0"
},
"browserslist": {
"production": [
">0.2%",
"not dead",
"not op_mini all"
],
"development": [
"last 1 chrome version",
"last 1 firefox version",
"last 1 safari version"
]
},
"dependencies": {}
}
8 changes: 8 additions & 0 deletions packages/asc-web-common/api/settings/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -323,3 +323,11 @@ export function getCommonThirdPartyList() {
};
return request(options);
}

export function getBuildVersion() {
const options = {
method: "get",
url: "/settings/version/build.json",
};
return request(options);
}
24 changes: 23 additions & 1 deletion packages/asc-web-common/store/SettingsStore.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import { ARTICLE_PINNED_KEY, LANGUAGE } from "../constants";
import { combineUrl } from "../utils";
import FirebaseHelper from "../utils/firebase";
import { AppServerConfig } from "../constants";
import { version } from "../package.json";
const { proxyURL } = AppServerConfig;

class SettingsStore {
Expand Down Expand Up @@ -85,6 +86,11 @@ class SettingsStore {
measurementId: "",
};
version = "";
buildVersionInfo = {
appServer: version,
documentServer: "6.4.1",
};
debugInfo = false;

constructor() {
makeAutoObservable(this);
Expand Down Expand Up @@ -183,7 +189,7 @@ class SettingsStore {
init = async () => {
this.setIsLoading(true);

await this.getPortalSettings();
await Promise.all([this.getPortalSettings(), this.getBuildVersionInfo()]);

this.setIsLoading(false);
this.setIsLoaded(true);
Expand Down Expand Up @@ -329,6 +335,22 @@ class SettingsStore {
window.firebaseHelper = new FirebaseHelper(this.firebase);
return window.firebaseHelper;
}

getBuildVersionInfo = async () => {
const versionInfo = await api.settings.getBuildVersion();
this.setBuildVersionInfo(versionInfo);
};

setBuildVersionInfo = (versionInfo) => {
this.buildVersionInfo = {
...this.buildVersionInfo,
appServer: version,
...versionInfo,
};

if (!this.buildVersionInfo.documentServer)
this.buildVersionInfo.documentServer = "6.4.1";
};
}

export default SettingsStore;
7 changes: 5 additions & 2 deletions packages/asc-web-components/modal-dialog/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import PropTypes from "prop-types";
import Backdrop from "../backdrop";
import Aside from "../aside";
import Heading from "../heading";
import { desktop } from "../utils/device";
import { getModalType } from "../utils/device";
import throttle from "lodash/throttle";
import Box from "../box";
import {
Expand Down Expand Up @@ -49,7 +49,7 @@ class ModalDialog extends React.Component {
getTypeByWidth() {
if (this.props.displayType !== "auto") return this.props.displayType;

return window.innerWidth < desktop.match(/\d+/)[0] ? "aside" : "modal";
return getModalType();
}

resize() {
Expand All @@ -59,6 +59,8 @@ class ModalDialog extends React.Component {
if (type === this.state.displayType) return;

this.setState({ displayType: type });

this.props.onResize && this.props.onResize(type);
}

popstate() {
Expand Down Expand Up @@ -230,6 +232,7 @@ ModalDialog.propTypes = {
scale: PropTypes.bool,
/** Will be triggered when a close button is clicked */
onClose: PropTypes.func,
onResize: PropTypes.func,
/** CSS z-index */
zIndex: PropTypes.number,
/** CSS padding props for body section */
Expand Down
4 changes: 4 additions & 0 deletions packages/asc-web-components/utils/device.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,3 +34,7 @@ export const isTouchDevice = !!(
typeof navigator !== "undefined" &&
("ontouchstart" in window || navigator.msMaxTouchPoints > 0)
);

export const getModalType = () => {
return window.innerWidth < size.desktop ? "aside" : "modal";
};
14 changes: 14 additions & 0 deletions packages/debug-info/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
{
"name": "@appserver/debug-info",
"version": "1.0.0",
"private": true,
"description": "Command line tool for generating debug info by commit history",
"main": "src/index.js",
"dependencies": {
"commander": "^7.2.0",
"handlebars": "^4.7.7",
"node-fetch": "^2.6.5",
"parse-github-url": "^1.0.2",
"semver": "^7.3.5"
}
}
Loading

0 comments on commit 4f9fddf

Please sign in to comment.