diff --git a/.dockerignore b/.dockerignore index b99378e..cbf0615 100644 --- a/.dockerignore +++ b/.dockerignore @@ -1,3 +1,2 @@ node_modules/ .cache/ -public/ diff --git a/Dockerfile b/Dockerfile index b26d1e4..972681e 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,12 +1,8 @@ -FROM node:14.4.0 +FROM nginx:1.19.0-alpine -WORKDIR /usr/src/app +COPY ./public /app/public -COPY package*.json ./ -RUN npm install +RUN mkdir -p /var/www/work_front/html && \ + cp -r /app/public/* /var/www/work_front/html/ -COPY . . - -RUN npm install -g gatsby-cli - -CMD ['gatsby', 'develop', '-H', '0.0.0.0:8000'] \ No newline at end of file +COPY ./default.conf /etc/nginx/conf.d/default.conf \ No newline at end of file diff --git a/default.conf b/default.conf new file mode 100644 index 0000000..b8647d1 --- /dev/null +++ b/default.conf @@ -0,0 +1,13 @@ +server { + listen 80; + listen [::]:80; + + root /var/www/work_front/html; + index index.html index.htm index.nginx-debian.html; + + server_name work_front www.work_front; + + location / { + try_files $uri $uri/ =404; + } +} \ No newline at end of file diff --git a/src/components/forms/model_crud/modelUpload.js b/src/components/forms/model_crud/modelUpload.js index 322cdf5..4978d91 100644 --- a/src/components/forms/model_crud/modelUpload.js +++ b/src/components/forms/model_crud/modelUpload.js @@ -56,6 +56,12 @@ const ModelUploadForm = () => { refList={ [] } action={ handleModelUpload } /> +

+ { 'info' in upload_blend_file_status + ? upload_blend_file_status.info + : '' + } +

) } diff --git a/src/images/background.jpg b/src/images/background.jpg new file mode 100644 index 0000000..fa8724a Binary files /dev/null and b/src/images/background.jpg differ diff --git a/src/pages/func_group/canvasBackgroundAnimation.js b/src/pages/func_group/canvasBackgroundAnimation.js index 86cc673..e0c3a56 100644 --- a/src/pages/func_group/canvasBackgroundAnimation.js +++ b/src/pages/func_group/canvasBackgroundAnimation.js @@ -30,7 +30,7 @@ const CanvasBackgroundAnimation = () => { line_linked: { enable: true, distance: 150, - color: menuColor, + color: darkGreen, opacity: 0.4, width: 1 }, diff --git a/src/pages/index.js b/src/pages/index.js index c210635..f7bd164 100644 --- a/src/pages/index.js +++ b/src/pages/index.js @@ -1,5 +1,4 @@ import React from 'react'; -// import ReactDOM from 'react-dom'; import '../styles/general.scss' import { Provider } from 'react-redux'; @@ -11,11 +10,17 @@ import Root from './func_group/root'; // echo fs.inotify.max_user_watches=524288 | sudo tee -a /etc/sysctl.conf && sudo sysctl -p const IndexPage = () => { - return ( - - - - ) + if (typeof window !== `undefined` && store !== 0) + return ( + + + + ) + else + return ( + <> + + ) } export default IndexPage \ No newline at end of file diff --git a/src/redux/asyncThunks/abstracts/abstractAddress.js b/src/redux/asyncThunks/abstracts/abstractAddress.js index 0bd6cb8..d4a2f28 100644 --- a/src/redux/asyncThunks/abstracts/abstractAddress.js +++ b/src/redux/asyncThunks/abstracts/abstractAddress.js @@ -1,3 +1,4 @@ -let API = 'localhost:9090' +// let API = 'localhost:9090' +let API = 'render_app_backend:9090' export const GeneralAddress = 'http://' + API export const GeneralAddressWS = 'ws://' + API + '/render' \ No newline at end of file diff --git a/src/redux/stateLoader.js b/src/redux/stateLoader.js index 1e7069c..3211fbe 100644 --- a/src/redux/stateLoader.js +++ b/src/redux/stateLoader.js @@ -1,32 +1,36 @@ export const loadState = () => { - try { - const serializedState = localStorage.getItem('state') + if ( typeof window !== 'undefined' ) { + try { + const serializedState = localStorage.getItem('state') - if (serializedState === undefined || serializedState === null) { - return {} - } else { - return JSON.parse(serializedState) + if (serializedState === undefined || serializedState === null) { + return {} + } else { + return JSON.parse(serializedState) + } + + + } catch (err) { + console.log(err) + return undefined } - - - } catch (err) { - console.log(err) - return undefined } }; export const saveState = (state) => { - try { + if ( typeof window !== 'undefined' ) { + try { - const serializedState = JSON.stringify(state) + const serializedState = JSON.stringify(state) - if (serializedState === null) { - return undefined - } else { - localStorage.setItem('state', serializedState) + if (serializedState === null) { + return undefined + } else { + localStorage.setItem('state', serializedState) + } + } catch (err) { + console.log('save in local storage error') } - } catch (err) { - console.log('save in local storage error') } }; \ No newline at end of file diff --git a/src/redux/store.js b/src/redux/store.js index d47e423..e369584 100644 --- a/src/redux/store.js +++ b/src/redux/store.js @@ -10,23 +10,33 @@ import { userAuthReducer } from './slices/userAuthSlice' import { userCrudReducer } from './slices/userCrudSlice' -let persistedState = loadState() +let persistedState = null -export const store = configureStore({ - reducer: { - modelCrudReducer, - renderCrudReducer, - renderWebsocketReducer, - userAuthReducer, - userCrudReducer - }, - preloadedState: persistedState -}) +if (typeof window !== `undefined`) { + persistedState = loadState() +} -store.subscribe(() => { - saveState(store.getState()); -}); +export const store = typeof window !== `undefined` + ? configureStore({ + reducer: { + modelCrudReducer, + renderCrudReducer, + renderWebsocketReducer, + userAuthReducer, + userCrudReducer + }, + preloadedState: persistedState + }) + : 0 -store.subscribe(lodash.throttle(() => { - saveState(store.getState()) -}, 100)) +if (typeof window !== `undefined`) { + + store.subscribe(() => { + saveState(store.getState()); + }); + + store.subscribe(lodash.throttle(() => { + saveState(store.getState()) + }, 100)) + +} diff --git a/src/styles/general.scss b/src/styles/general.scss index aecf7df..9664047 100644 --- a/src/styles/general.scss +++ b/src/styles/general.scss @@ -2,7 +2,11 @@ body { margin: 0 auto; overflow: hidden; - background-color: rgba(0,128,0,1); + // background-color: rgba(0,128,0,1); + background: + url("../images/background.jpg") + rgba(0,128,0,1) 100%; + background-size: 100% auto; width: 100%; height: 100%;