Commit 9e38500d authored by Bartłomiej Żmudziński's avatar Bartłomiej Żmudziński

Merge branch 'develop' into 'staging'

Develop

See merge request geoplan/geoankieta!2311
parents ee9760da 10b1e6e5
......@@ -27,8 +27,9 @@ variables:
LOGIN_URL: "https://api.${CI_COMMIT_REF_SLUG}.thebitbybit.com/accounts/"
GEOFORMS_URL: "https://geoforms.${CI_COMMIT_REF_SLUG}.thebitbybit.com/"
DISCUSS_URL: "https://api.${CI_COMMIT_REF_SLUG}.thebitbybit.com/"
PANEL_FORMS_URL: "https://panel.forms.${CI_COMMIT_REF_SLUG}.thebitbybit.com/"
GEOPINE_IMAGE_BACKEND: "registry.recoded.co/geoplan/geoankieta/geopine:backend"
GEOPINE_IMAGE_BACKEND: "registry.recoded.co/geoplan/geoankieta/geopine-py3"
GEOPINE_IMAGE_FRONTEND: "registry.recoded.co/geoplan/geoankieta/geopine:frontend"
GEO_VOLUME: 'geoankieta_${CI_COMMIT_REF_SLUG}'
......@@ -81,10 +82,10 @@ Test django server:
EMAIL_URL: "dummymail://"
before_script:
- ./web/image/waitfordb.sh
- pip install -r web/src/requirements.txt
- pip3 install -r web/src/requirements.txt
script:
- cd web/src/
- ./manage.py test
- python3 manage.py test
Lint geoforms:
stage: test
......@@ -266,11 +267,13 @@ Deploy web:
-e DATABASE_URL=$DB_URL
-e GOOGLE_API_KEY=$GOOGLE_API_KEY
-e EMAIL_URL=$EMAIL_URL
-e PANEL_FORMS_URL=$PANEL_FORMS_URL
--link postgis:db $WEB_IMAGE_NAME:${CI_COMMIT_REF_SLUG}
- docker exec $WEB_CONTAINER_NAME python manage.py migrate
- docker exec $WEB_CONTAINER_NAME python manage.py add_local_host_site
- docker exec $WEB_CONTAINER_NAME python manage.py createcachetable
- docker exec $WEB_CONTAINER_NAME python manage.py rebuild_index --noinput
- docker exec $WEB_CONTAINER_NAME python3 manage.py migrate
- docker exec $WEB_CONTAINER_NAME python3 manage.py add_local_host_site
- docker exec $WEB_CONTAINER_NAME python3 manage.py createcachetable
- docker exec $WEB_CONTAINER_NAME python3 manage.py update_questionnaires_organization
- docker exec $WEB_CONTAINER_NAME python3 manage.py rebuild_index --noinput
Deploy geoforms:
stage: deploy
......@@ -455,12 +458,12 @@ Release deploy web:
-e GOOGLE_API_KEY=$GOOGLE_API_KEY
-e EMAIL_URL=$EMAIL_URL
--link postgis:db $WEB_IMAGE_NAME:${CI_COMMIT_TAG}
- docker exec $WEB_CONTAINER_NAME python manage.py migrate
- docker exec $WEB_CONTAINER_NAME python manage.py add_local_host_site
- docker exec $WEB_CONTAINER_NAME python manage.py createcachetable
- docker exec $WEB_CONTAINER_NAME python manage.py rebuild_index --noinput
- docker exec $WEB_CONTAINER_NAME python manage.py check_sites
- docker exec $WEB_CONTAINER_NAME python manage.py trycreateextendedsuperuser
- docker exec $WEB_CONTAINER_NAME python3 manage.py migrate
- docker exec $WEB_CONTAINER_NAME python3 manage.py add_local_host_site
- docker exec $WEB_CONTAINER_NAME python3 manage.py createcachetable
- docker exec $WEB_CONTAINER_NAME python3 manage.py rebuild_index --noinput
- docker exec $WEB_CONTAINER_NAME python3 manage.py check_sites
- docker exec $WEB_CONTAINER_NAME python3 manage.py trycreateextendedsuperuser
Release deploy geoforms:
stage: release-deploy
......
......@@ -17,7 +17,6 @@ services:
web:
build: ./web
image: registry.recoded.co/geoplan/geoankieta:web-latest
env_file: ./web/.env
command: runserver
ports:
......@@ -57,7 +56,7 @@ services:
image: registry.recoded.co/geoplan/geoankieta:panel_discuss-latest
env_file: ./panel_discuss/.env
ports:
- 3002:3000
- 3002:3002
volumes:
- ./panel_discuss/src:/srv/app
depends_on:
......
......@@ -5,7 +5,8 @@
"settings": {
"react": {
"version": "16.7"
}},
}
},
"rules": {
"prettier/prettier": ["error"],
"import/no-extraneous-dependencies": "off",
......@@ -20,6 +21,7 @@
"import/order": "off",
"react/no-deprecated": "warn",
"no-restricted-globals": "off",
"react/jsx-curly-brace-presence": ["warn", { "props": "never", "children": "always" }],
"react/jsx-filename-extension": "off",
"react/forbid-prop-types": "off",
"react/destructuring-assignment": "warn",
......
This diff is collapsed.
{
"name": "geoforms",
"version": "0.1.0",
"private": true,
"devDependencies": {
"@babel/core": "7.5.5",
"@babel/preset-env": "7.5.5",
"@babel/preset-flow": "7.0.0",
"@babel/preset-react": "7.0.0",
"autoprefixer": "9.6.1",
"babel-eslint": "10.0.2",
"babel-loader": "8.0.6",
"babel-plugin-transform-class-properties": "6.24.1",
"case-sensitive-paths-webpack-plugin": "^2.2.0",
"chalk": "1.1.3",
"compression-webpack-plugin": "3.0.0",
"connect-history-api-fallback": "1.5.0",
"cross-spawn": "5.0.1",
"css-loader": "^3.2.0",
"cssnano": "4.1.10",
"detect-port": "1.2.3",
"dotenv": "8.0.0",
"eslint": "6.1.0",
"eslint-config-airbnb": "^18.0.0",
"eslint-config-prettier": "6.0.0",
"eslint-config-react-app": "^5.0.0",
"eslint-loader": "2.2.1",
"eslint-plugin-flowtype": "^4.2.0",
"eslint-plugin-import": "2.18.2",
"eslint-plugin-jsx-a11y": "6.2.3",
"eslint-plugin-prettier": "^3.1.0",
"eslint-plugin-react": "7.14.3",
"extract-text-webpack-plugin": "^3.0.2",
"file-loader": "^4.2.0",
"filesize": "3.6.1",
"fs-extra": "2.0.0",
"gzip-size": "3.0.0",
"html-webpack-plugin": "3.2.0",
"http-proxy-middleware": "0.19.0",
"jest": "^24.8.0",
"json-loader": "0.5.7",
"mini-css-extract-plugin": "0.8.0",
"object-assign": "4.1.1",
"optimize-css-assets-webpack-plugin": "5.0.3",
"path-exists": "3.0.0",
"postcss-import": "12.0.1",
"postcss-loader": "3.0.0",
"postcss-preset-env": "6.7.0",
"prettier": "1.18.2",
"promise": "7.1.1",
"react-dev-utils": "0.4.2",
"recursive-readdir": "2.2.2",
"strip-ansi": "3.0.1",
"style-loader": "^1.0.0",
"stylelint": "10.1.0",
"stylelint-config-standard": "18.3.0",
"url-loader": "0.5.7",
"webpack": "4.39.1",
"webpack-cli": "3.3.6",
"webpack-dev-server": "^3.8.0",
"webpack-manifest-plugin": "^2.0.4",
"whatwg-fetch": "2.0.4"
},
"dependencies": {
"@babel/polyfill": "7.4.4",
"airbnb-js-shims": "2.1.1",
"animate.css": "3.7.0",
"babel-plugin-dynamic-import-webpack": "1.1.0",
"camelcasetodjango": "0.1.14",
"classnames": "2.2.6",
"fetch-retry": "1.2.1",
"lodash": "4.17.11",
"material-ui": "0.17.0",
"normalize.css": "5.0.0",
"npm-check": "5.9.0",
"openlayers": "4.2.0",
"point-in-polygon": "1.0.1",
"prop-types": "^15.7.2",
"react": "15.6.1",
"react-dom": "15.4.2",
"react-facebook-pixel": "0.1.1",
"react-ga": "2.5.3",
"react-intl": "2.4.0",
"react-material-icons": "1.0.3",
"react-mixin": "4.0.0",
"react-notification-system": "0.2.17",
"react-notification-system-redux": "1.2.0",
"react-redux": "5.1.1",
"react-router": "4.0.0-beta.6",
"react-router-dom": "4.0.0-beta.6",
"react-scripts": "0.8.5",
"react-tap-event-plugin": "2.0.1",
"react-timer-mixin": "0.13.4",
"redux": "4.0.1",
"redux-freeze": "0.1.7",
"redux-i18n": "1.5.14",
"redux-logger": "3.0.6",
"redux-persist": "5.10.0",
"redux-promise-middleware": "5.1.1",
"redux-thunk": "2.3.0",
"uuid": "3.3.2",
"yarn": "1.12.3"
},
"scripts": {
"start": "NODE_ENV=development webpack-dev-server --config=config/webpack.js --progress",
"start:server": "echo \"$(eval \"echo \\\"$(cat config/publicSettingsForBuild.js)\\\"\")\" > dist/settings.js; superstatic ./dist --port 3000 --compression --host 0.0.0.0",
"test": "jest test --coverage --watch",
"build": "NODE_ENV=production webpack --config=config/webpack.js",
"lint": "eslint ./src --ext js,jsx || true",
"lint:fix": "eslint --fix ./src --ext js,jsx || true",
"lint:css": "stylelint --fix \"./src/**/*.css\" || true"
},
"jest": {
"collectCoverageFrom": ["src/**/*.{js,jsx}"],
"setupFiles": ["<rootDir>/config/polyfills.js"],
"testPathIgnorePatterns": ["<rootDir>[/\\\\](build|docs|node_modules)[/\\\\]"],
"testEnvironment": "node",
"testURL": "http://localhost",
"transform": {
".+\\.(js|jsx)$": "<rootDir>/node_modules/babel-jest",
".+\\.css$": "<rootDir>/config/jest/cssTransform.js",
"(?!.*\\.(js|jsx|css|json)$)": "<rootDir>/config/jest/fileTransform.js"
},
"transformIgnorePatterns": ["[/\\\\]node_modules[/\\\\].+\\.(js|jsx)$"],
"moduleNameMapper": {
"react-native$": "react-native-web"
}
}
"name": "geoforms",
"version": "0.1.0",
"private": true,
"devDependencies": {
"@babel/core": "^7.9.6",
"@babel/polyfill": "^7.8.7",
"@babel/preset-env": "^7.9.6",
"@babel/preset-flow": "^7.9.0",
"@babel/preset-react": "^7.9.4",
"autoprefixer": "^9.8.0",
"babel-eslint": "^10.1.0",
"babel-loader": "^8.1.0",
"babel-plugin-dynamic-import-webpack": "1.1.0",
"babel-plugin-transform-class-properties": "6.24.1",
"case-sensitive-paths-webpack-plugin": "2.3.0",
"chalk": "3.0.0",
"compression-webpack-plugin": "3.1.0",
"connect-history-api-fallback": "1.6.0",
"cross-spawn": "^7.0.2",
"css-loader": "^3.5.3",
"cssnano": "4.1.10",
"detect-port": "1.3.0",
"dotenv": "8.2.0",
"eslint": "6.8.0",
"eslint-config-airbnb": "^18.1.0",
"eslint-config-prettier": "^6.11.0",
"eslint-config-react-app": "^5.2.1",
"eslint-loader": "3.0.3",
"eslint-plugin-flowtype": "4.6.0",
"eslint-plugin-import": "^2.20.2",
"eslint-plugin-jsx-a11y": "6.2.3",
"eslint-plugin-prettier": "^3.1.3",
"eslint-plugin-react": "^7.20.0",
"extract-text-webpack-plugin": "3.0.2",
"file-loader": "5.0.2",
"filesize": "^6.1.0",
"fs-extra": "8.1.0",
"gzip-size": "5.1.1",
"html-webpack-plugin": "3.2.0",
"http-proxy-middleware": "0.20.0",
"jest": "24.9.0",
"json-loader": "0.5.7",
"mini-css-extract-plugin": "0.9.0",
"object-assign": "4.1.1",
"optimize-css-assets-webpack-plugin": "5.0.3",
"path-exists": "4.0.0",
"postcss-import": "12.0.1",
"postcss-loader": "3.0.0",
"postcss-preset-env": "6.7.0",
"prettier": "1.19.1",
"promise": "^8.1.0",
"react-dev-utils": "^10.2.1",
"recursive-readdir": "2.2.2",
"strip-ansi": "6.0.0",
"style-loader": "^1.2.1",
"stylelint": "^13.4.1",
"stylelint-config-standard": "19.0.0",
"url-loader": "3.0.0",
"webpack": "^4.43.0",
"webpack-cli": "^3.3.11",
"webpack-dev-server": "^3.11.0",
"webpack-manifest-plugin": "2.2.0",
"whatwg-fetch": "3.0.0"
},
"dependencies": {
"airbnb-js-shims": "2.2.1",
"animate.css": "3.7.2",
"camelcasetodjango": "0.1.14",
"classnames": "2.2.6",
"fetch-retry": "1.2.1",
"lodash": "4.17.15",
"material-ui": "0.17.0",
"normalize.css": "5.0.0",
"openlayers": "4.2.0",
"point-in-polygon": "1.0.1",
"prop-types": "15.7.2",
"react": "15.6.1",
"react-dom": "15.4.2",
"react-facebook-pixel": "0.1.3",
"react-ga": "2.5.3",
"react-intl": "2.4.0",
"react-material-icons": "1.0.3",
"react-mixin": "4.0.0",
"react-notification-system": "0.3.0",
"react-notification-system-redux": "1.2.0",
"react-redux": "5.1.1",
"react-router": "4.0.0-beta.6",
"react-router-dom": "4.0.0-beta.6",
"react-scripts": "0.8.5",
"react-tap-event-plugin": "2.0.1",
"react-timer-mixin": "0.13.4",
"redux": "4.0.5",
"redux-freeze": "0.1.7",
"redux-i18n": "1.5.19",
"redux-logger": "3.0.6",
"redux-persist": "5.10.0",
"redux-promise-middleware": "5.1.1",
"redux-thunk": "2.3.0",
"uuid": "3.3.3"
},
"scripts": {
"start": "NODE_ENV=development webpack-dev-server --config=config/webpack.js --progress",
"start:server": "echo \"$(eval \"echo \\\"$(cat config/publicSettingsForBuild.js)\\\"\")\" > dist/settings.js; superstatic ./dist --port 3000 --compression --host 0.0.0.0",
"test": "jest test --coverage --watch",
"build": "NODE_ENV=production webpack --config=config/webpack.js",
"lint": "eslint ./src --ext js,jsx || true",
"lint:fix": "eslint --fix ./src --ext js,jsx || true",
"lint:css": "stylelint --fix \"./src/**/*.css\" || true"
},
"jest": {
"collectCoverageFrom": [
"src/**/*.{js,jsx}"
],
"setupFiles": [
"<rootDir>/config/polyfills.js"
],
"testPathIgnorePatterns": [
"<rootDir>[/\\\\](build|docs|node_modules)[/\\\\]"
],
"testEnvironment": "node",
"testURL": "http://localhost",
"transform": {
".+\\.(js|jsx)$": "<rootDir>/node_modules/babel-jest",
".+\\.css$": "<rootDir>/config/jest/cssTransform.js",
"(?!.*\\.(js|jsx|css|json)$)": "<rootDir>/config/jest/fileTransform.js"
},
"transformIgnorePatterns": [
"[/\\\\]node_modules[/\\\\].+\\.(js|jsx)$"
],
"moduleNameMapper": {
"react-native$": "react-native-web"
}
}
}
......@@ -3,12 +3,13 @@ import 'normalize.css';
import { Route, BrowserRouter as Router, Switch } from 'react-router-dom';
import { persistor, store } from './store';
import FlatPage from './screens/FlatPage';
import Header from './components/Header';
import Home from './screens/Home';
import OrganizationPage from './screens/OrganizationPage';
import I18n from 'redux-i18n';
import NotFound from './screens/NotFound';
import Notifications from './components/Notifications';
import OrganizationPage from './screens/OrganizationPage';
import { PersistGate } from 'redux-persist/integration/react';
import { Provider } from 'react-redux';
import Questionnaire from './screens/Questionnaire';
......@@ -40,10 +41,11 @@ const App = () => (
<section className="app-body">
<Switch>
<Route component={withTracker(Home)} path="/" exact />
<Route component={withTracker(OrganizationPage)} path="/org/:slug" exact />
<Route component={withTracker(NotFound)} path="/NotFound" exact />
<Route component={withTracker(OrganizationPage)} path="/:slug" exact />
<Route component={withTracker(ServerError)} path="/ServerError" exact />
<Route component={withTracker(Questionnaire)} path="/questionnaire/:slug/:lang([a-zA-Z]{1,3})?" />
<Route component={withTracker(FlatPage)} path="/a/:slug/page/:pageSlug" />
<Route component={withTracker(Questionnaire)} path="/a/:slug/:lang([a-zA-Z]{1,3})?" />
<Route component={withTracker(Questionnaire)} path="/p/:previewToken/:lang([a-zA-Z]{1,3})?" />
<Route component={withTracker(NotFound)} />
......
......@@ -99,12 +99,13 @@ export function fetchQuestionnairePreview(previewToken, router, token = null, la
};
}
export function fetchQuestionnaireIfNeeded(params, router, token = null) {
export function fetchQuestionnaireIfNeeded(params, router, token = null, isLangChanged = false) {
return (dispatch, getState) => {
const state = getState();
const { slug, previewToken, lang } = params;
if (
state.i18nState.lang === lang &&
!isLangChanged &&
state.questionnaire.loaded &&
(state.questionnaire.data.id === slug || state.questionnaire.previewToken === previewToken)
) {
......
main > .header {
width: 100vw;
height: auto !important;
padding: 0 30px !important;
box-shadow: 0 4px 4px 0 rgba(0, 0, 0, 0.24), 0 0 4px 0 rgba(0, 0, 0, 0.12) !important;
position: relative;
......@@ -24,6 +23,11 @@ main > .header > .left-col .header-logo-col {
width: 62.5vw;
}
main > .header > .menu-wrapper {
display: flex;
flex-direction: row;
}
main > .header .header-search-bar {
width: 37.5vw;
max-width: 550px;
......@@ -36,16 +40,12 @@ main > .header > .left-col .header-logo-link {
align-items: center;
justify-content: center;
box-sizing: border-box;
width: 5vw;
height: 4vw;
padding: 3px 0;
min-width: 60px;
min-height: 50px;
}
main > .header > .left-col > div .header-logo {
max-width: 100% !important;
max-height: 100% !important;
max-width: 125px !important;
max-height: 50px !important;
object-fit: contain;
}
......@@ -94,7 +94,6 @@ main > .header .version strong.header-title {
main > .header > .left-col {
width: 100%;
margin-left: 0 !important;
min-height: 75px;
}
main > .header > .left-col .header-logo-col {
......@@ -106,7 +105,7 @@ main > .header .version strong.header-title {
}
main > .header > .left-col .header-logo-link {
height: 75px;
height: 100%;
width: 100%;
}
......@@ -154,18 +153,3 @@ main > .header .version strong.header-title {
margin-left: 0 !important;
}
}
.lang-label {
padding: 10px;
}
.lang-label:hover {
background-color: #fffaf0;
border-radius: 10px;
}
@media (max-width: 500px) {
main > .header > .left-col .header-logo-col {
grid-template-columns: 30vw calc(100% - 30vw);
}
}
import { FlatButton, FontIcon, Menu, Popover, PopoverAnimationVertical, ToolbarGroup } from 'material-ui';
import { Link, matchPath, withRouter } from 'react-router-dom';
import React, { Component } from 'react';
import MenuItem from 'material-ui/MenuItem';
import PropTypes from 'prop-types';
import SETTINGS from '../../../config';
import { connect } from 'react-redux';
import { muiThemeable } from 'material-ui/styles';
import { saveSheet } from '../../../actionCreators/sheets';
class LayerSwitcher extends Component {
constructor(props, context) {
super(props, context);
this.state = {
open: false,
};
this.handleClose = this.handleClose.bind(this);
this.handleClick = this.handleClick.bind(this);
this.handleChangeLang = this.handleChangeLang.bind(this);
}
getMenuLink(urlSign, identifier, languageShortcut) {
const baseLink = `${urlSign}${identifier}/`;
if (languageShortcut) {
return baseLink + languageShortcut;
}
return baseLink;
}
handleClick(event) {
event.preventDefault();
this.setState({
open: true,
anchorEl: event.currentTarget,
});
}
handleClose() {
this.setState({ open: false });
}
handleChangeLang(lang) {
this.setState({ open: false });
this.props.dispatch(saveSheet(this.props.questionnaireId, lang.shortcut));
}
languageList() {
const { t } = this.context; // eslint-disable-line id-length
const { previewMode, questionnaireSlug, previewToken } = this.props;
const identifier = previewMode ? previewToken : questionnaireSlug;
const urlSign = previewMode ? SETTINGS.PREVIEW_MODE_URL_PART : SETTINGS.ANSWER_MODE_URL_PART;
let languages = [
<MenuItem
containerElement={<Link to={this.getMenuLink(urlSign, identifier)} />}
id="menuItem-header-langDefault"
key="menuItem-header-langDefault"
primaryText={t('Default')}
onClick={() => this.setState({ open: false })}
/>,
];
const newLanguages = this.props.languages.map(lang => (
<MenuItem
containerElement={<Link to={this.getMenuLink(urlSign, identifier, lang.shortcut)} />}
id={`menuItem-header-lang-${lang.shortcut}`}
key={`menuItem-header-lang-${lang.shortcut}`}
label={lang.shortcut}
primaryText={`${lang.language} - ${lang.shortcut}`}
value={lang.language}
onClick={() => this.handleChangeLang(lang)}
/>
));