Merge branch 'master' of github.com:Human-Connection/Human-Connection into 691_handle-large-file-sizes-bug

This commit is contained in:
aonomike 2019-05-29 15:35:12 +03:00
commit 7def0b4c20
17 changed files with 91 additions and 35 deletions

View File

@ -22,7 +22,7 @@ install:
script: script:
# Backend # Backend
- docker-compose exec backend yarn run lint - docker-compose exec backend yarn run lint
- docker-compose exec backend yarn run test:jest --ci --verbose=false - docker-compose exec backend yarn run test:jest --ci --verbose=false --coverage
- docker-compose exec backend yarn run db:reset - docker-compose exec backend yarn run db:reset
- docker-compose exec backend yarn run db:seed - docker-compose exec backend yarn run db:seed
- docker-compose exec backend yarn run test:cucumber - docker-compose exec backend yarn run test:cucumber
@ -30,7 +30,7 @@ script:
- docker-compose exec backend yarn run db:seed - docker-compose exec backend yarn run db:seed
# Frontend # Frontend
- docker-compose exec webapp yarn run lint - docker-compose exec webapp yarn run lint
- docker-compose exec webapp yarn run test --ci --verbose=false - docker-compose exec webapp yarn run test --ci --verbose=false --coverage
- docker-compose exec -d backend yarn run test:before:seeder - docker-compose exec -d backend yarn run test:before:seeder
# Fullstack # Fullstack
- CYPRESS_RETRIES=1 yarn run cypress:run - CYPRESS_RETRIES=1 yarn run cypress:run

View File

@ -26,7 +26,6 @@
"license": "MIT", "license": "MIT",
"jest": { "jest": {
"verbose": true, "verbose": true,
"collectCoverage": true,
"collectCoverageFrom": [ "collectCoverageFrom": [
"**/*.js", "**/*.js",
"!**/node_modules/**", "!**/node_modules/**",
@ -106,7 +105,7 @@
"graphql-request": "~1.8.2", "graphql-request": "~1.8.2",
"jest": "~24.8.0", "jest": "~24.8.0",
"nodemon": "~1.19.1", "nodemon": "~1.19.1",
"prettier": "~1.14.3", "prettier": "~1.17.1",
"supertest": "~4.0.2" "supertest": "~4.0.2"
} }
} }

View File

@ -1,9 +1,9 @@
import { rule, shield, allow, or } from 'graphql-shield' import { rule, shield, allow, or } from 'graphql-shield'
/* /*
* TODO: implement * TODO: implement
* See: https://github.com/Human-Connection/Nitro-Backend/pull/40#pullrequestreview-180898363 * See: https://github.com/Human-Connection/Nitro-Backend/pull/40#pullrequestreview-180898363
*/ */
const isAuthenticated = rule()(async (parent, args, ctx, info) => { const isAuthenticated = rule()(async (parent, args, ctx, info) => {
return ctx.user !== null return ctx.user !== null
}) })

View File

@ -6233,10 +6233,10 @@ prettier-linter-helpers@^1.0.0:
dependencies: dependencies:
fast-diff "^1.1.2" fast-diff "^1.1.2"
prettier@~1.14.3: prettier@~1.17.1:
version "1.14.3" version "1.17.1"
resolved "https://registry.yarnpkg.com/prettier/-/prettier-1.14.3.tgz#90238dd4c0684b7edce5f83b0fb7328e48bd0895" resolved "https://registry.yarnpkg.com/prettier/-/prettier-1.17.1.tgz#ed64b4e93e370cb8a25b9ef7fef3e4fd1c0995db"
integrity sha512-qZDVnCrnpsRJJq5nSsiHCE3BYMED2OtsI+cmzIzF1QIfqm5ALf8tEJcO27zV1gKNKRPdhjO0dNWnrzssDQ1tFg== integrity sha512-TzGRNvuUSmPgwivDqkZ9tM/qTGW9hqDKWOE9YHiyQdixlKbv7kvEqsmDPrcHJTKwthU774TQwZXVtaQ/mMsvjg==
pretty-format@^24.8.0: pretty-format@^24.8.0:
version "24.8.0" version "24.8.0"

View File

@ -0,0 +1,16 @@
# Neo4J Settings
# NEO4J_USERNAME='neo4j'
# NEO4J_PASSWORD='letmein'
# Import Settings
# On Windows this resolves to C:\Users\dornhoeschen\AppData\Local\Temp\mongo-export (MinGW)
IMPORT_PATH='/tmp/mongo-export/'
IMPORT_CHUNK_PATH='/tmp/mongo-export/splits/current-chunk.json'
IMPORT_CHUNK_PATH_CQL='/tmp/mongo-export/splits/current-chunk.json'
# On Windows this path needs to be windows style since the cypher-shell runs native - note the forward slash
# IMPORT_CHUNK_PATH_CQL='C:/Users/dornhoeschen/AppData/Local/Temp/mongo-export/splits/current-chunk.json'
IMPORT_CYPHERSHELL_BIN='cypher-shell'
# On Windows use something like this
# IMPORT_CYPHERSHELL_BIN='C:\Program Files\neo4j-community\bin\cypher-shell.bat'

View File

@ -1,4 +1,4 @@
CALL apoc.load.json('file:/tmp/mongo-export/splits/current-chunk.json') YIELD value as badge CALL apoc.load.json("file:${IMPORT_CHUNK_PATH_CQL}") YIELD value as badge
MERGE(b:Badge {id: badge._id["$oid"]}) MERGE(b:Badge {id: badge._id["$oid"]})
ON CREATE SET ON CREATE SET
b.key = badge.key, b.key = badge.key,

View File

@ -1,4 +1,4 @@
CALL apoc.load.json('file:/tmp/mongo-export/splits/current-chunk.json') YIELD value as category CALL apoc.load.json("file:${IMPORT_CHUNK_PATH_CQL}") YIELD value as category
MERGE(c:Category {id: category._id["$oid"]}) MERGE(c:Category {id: category._id["$oid"]})
ON CREATE SET ON CREATE SET
c.name = category.title, c.name = category.title,

View File

@ -1,4 +1,4 @@
CALL apoc.load.json('file:/tmp/mongo-export/splits/current-chunk.json') YIELD value as json CALL apoc.load.json("file:${IMPORT_CHUNK_PATH_CQL}") YIELD value as json
MERGE (comment:Comment {id: json._id["$oid"]}) MERGE (comment:Comment {id: json._id["$oid"]})
ON CREATE SET ON CREATE SET

View File

@ -1,4 +1,4 @@
CALL apoc.load.json('file:/tmp/mongo-export/splits/current-chunk.json') YIELD value as post CALL apoc.load.json("file:${IMPORT_CHUNK_PATH_CQL}") YIELD value as post
MERGE (p:Post {id: post._id["$oid"]}) MERGE (p:Post {id: post._id["$oid"]})
ON CREATE SET ON CREATE SET
p.title = post.title, p.title = post.title,
@ -20,6 +20,6 @@ MATCH (c:Category {id: categoryId})
MERGE (p)-[:CATEGORIZED]->(c) MERGE (p)-[:CATEGORIZED]->(c)
WITH p, post.tags AS tags WITH p, post.tags AS tags
UNWIND tags AS tag UNWIND tags AS tag
MERGE (t:Tag {id: apoc.create.uuid(), name: tag}) MERGE (t:Tag {id: tag, name: tag})
MERGE (p)-[:TAGGED]->(t) MERGE (p)-[:TAGGED]->(t)
; ;

View File

@ -1,4 +1,4 @@
CALL apoc.load.json('file:/tmp/mongo-export/splits/current-chunk.json') YIELD value as follow CALL apoc.load.json("file:${IMPORT_CHUNK_PATH_CQL}") YIELD value as follow
MATCH (u1:User {id: follow.userId}), (u2:User {id: follow.foreignId}) MATCH (u1:User {id: follow.userId}), (u2:User {id: follow.foreignId})
MERGE (u1)-[:FOLLOWS]->(u2) MERGE (u1)-[:FOLLOWS]->(u2)
; ;

View File

@ -1,17 +1,48 @@
#!/usr/bin/env bash #!/usr/bin/env bash
set -e set -e
SECONDS=0 # import .env config
SCRIPT_DIRECTORY="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )" set -o allexport
source $(dirname "$0")/.env
set +o allexport
echo "MATCH (n) DETACH DELETE n;" | cypher-shell # Import collection function defintion
function import_collection () {
for collection in "badges" "categories" "users" "follows" "contributions" "shouts" "comments" for chunk in ${IMPORT_PATH}splits/$1/*
do
for chunk in /tmp/mongo-export/splits/$collection/*
do do
mv $chunk /tmp/mongo-export/splits/current-chunk.json mv $chunk ${IMPORT_CHUNK_PATH}
echo "Import ${chunk}" && cypher-shell < $SCRIPT_DIRECTORY/$collection.cql NEO4J_COMMAND="$(envsubst '${IMPORT_CHUNK_PATH_CQL}' < $(dirname "$0")/$1.cql)"
echo "Import ${chunk}"
echo "${NEO4J_COMMAND}" | "${IMPORT_CYPHERSHELL_BIN}" -u ${NEO4J_USERNAME} -p ${NEO4J_PASSWORD}
done done
done }
# Time variable
SECONDS=0
# Delete all Neo4J Database content
echo "Deleting Database Contents"
echo "MATCH (n) DETACH DELETE n;" | "${IMPORT_CYPHERSHELL_BIN}" -u ${NEO4J_USERNAME} -p ${NEO4J_PASSWORD}
# Import Data
echo "Start Importing Data"
import_collection "badges"
import_collection "categories"
import_collection "users"
import_collection "follows"
import_collection "contributions"
import_collection "shouts"
import_collection "comments"
#import_collection "emotions"
#import_collection "invites"
#import_collection "notifications"
#import_collection "organizations"
#import_collection "pages"
#import_collection "projects"
#import_collection "settings"
#import_collection "status"
#import_collection "systemnotifications"
#import_collection "userscandos"
#import_collection "usersettings"
echo "Time elapsed: $SECONDS seconds" echo "Time elapsed: $SECONDS seconds"

View File

@ -1,4 +1,4 @@
CALL apoc.load.json('file:/tmp/mongo-export/splits/current-chunk.json') YIELD value as shout CALL apoc.load.json("file:${IMPORT_CHUNK_PATH_CQL}") YIELD value as shout
MATCH (u:User {id: shout.userId}), (p:Post {id: shout.foreignId}) MATCH (u:User {id: shout.userId}), (p:Post {id: shout.foreignId})
MERGE (u)-[:SHOUTED]->(p) MERGE (u)-[:SHOUTED]->(p)
; ;

View File

@ -1,4 +1,4 @@
CALL apoc.load.json('file:/tmp/mongo-export/splits/current-chunk.json') YIELD value as user CALL apoc.load.json("file:${IMPORT_CHUNK_PATH_CQL}") YIELD value as user
MERGE(u:User {id: user._id["$oid"]}) MERGE(u:User {id: user._id["$oid"]})
ON CREATE SET ON CREATE SET
u.name = user.name, u.name = user.name,

View File

@ -327,10 +327,18 @@ export default {
}, },
}, },
}, },
mounted() {
this.$root.$on('changeLanguage', () => {
this.changePlaceHolderText()
})
},
beforeDestroy() { beforeDestroy() {
this.editor.destroy() this.editor.destroy()
}, },
methods: { methods: {
changePlaceHolderText() {
this.editor.extensions.options.placeholder.emptyNodeText = this.$t('editor.placeholder')
},
// navigate to the previous item // navigate to the previous item
// if it's the first item, navigate to the last one // if it's the first item, navigate to the last one
upHandler() { upHandler() {

View File

@ -14,7 +14,8 @@
<ds-icon <ds-icon
style="margin-right: 2px;" style="margin-right: 2px;"
name="globe" name="globe"
/> {{ current.code.toUpperCase() }} />
{{ current.code.toUpperCase() }}
<ds-icon <ds-icon
style="margin-left: 2px" style="margin-left: 2px"
size="xx-small" size="xx-small"
@ -78,6 +79,7 @@ export default {
changeLanguage(locale, toggleMenu) { changeLanguage(locale, toggleMenu) {
this.$i18n.set(locale) this.$i18n.set(locale)
toggleMenu() toggleMenu()
this.$root.$emit('changeLanguage')
}, },
matcher(locale) { matcher(locale) {
return locale === this.$i18n.locale() return locale === this.$i18n.locale()

View File

@ -126,15 +126,16 @@ export default {
} }
#customdropzone .dz-preview { #customdropzone .dz-preview {
transition: all 0.2s ease-out;
width: 160px; width: 160px;
display: flex; display: flex;
} }
#customdropzone .dz-preview .dz-image { #customdropzone .dz-preview .dz-image {
position: relative; width: 100%;
width: 122px; height: 100%;
height: 122px; object-fit: contain;
margin: -35px; overflow: hidden;
} }
#customdropzone .dz-preview .dz-image > div { #customdropzone .dz-preview .dz-image > div {

View File

@ -22,7 +22,6 @@
}, },
"jest": { "jest": {
"verbose": true, "verbose": true,
"collectCoverage": true,
"collectCoverageFrom": [ "collectCoverageFrom": [
"**/*.{js,vue}", "**/*.{js,vue}",
"!**/node_modules/**", "!**/node_modules/**",