diff --git a/data/kres_srl b/data/kres_srl index 465d987..f1acfc4 120000 --- a/data/kres_srl +++ b/data/kres_srl @@ -1 +1 @@ -/home/voje/work_data/final_json \ No newline at end of file +/home/kristjan/kres_srl/final_json/ \ No newline at end of file diff --git a/dockerfiles/database/mongodb-stack.yml b/dockerfiles/database/mongodb-stack.yml index 0e74083..f16ddef 100644 --- a/dockerfiles/database/mongodb-stack.yml +++ b/dockerfiles/database/mongodb-stack.yml @@ -10,6 +10,8 @@ services: environment: MONGO_INITDB_ROOT_USERNAME: ${DB_ADM_USER} MONGO_INITDB_ROOT_PASSWORD: ${DB_ADM_PASS} + volumes: + - ${HOME}/mongo_container/data/:/data/ mongo-express: image: mongo-express diff --git a/src/backend_flask/app.py b/src/backend_flask/app.py index c4cf664..2f6a0c1 100644 --- a/src/backend_flask/app.py +++ b/src/backend_flask/app.py @@ -35,9 +35,10 @@ app_index = {c: {} for c in CORPORA} # when running vuejs via webpack # CORS(app) -CORS(app, resources={r"/api/*": { - "origins": "*", -}}) +# CORS(app, resources={r"/api/*": { +# "origins": "*", +# }}) +CORS(app) # for testing functions @@ -58,18 +59,15 @@ def home(pathname): return redirect(url_for("index"), code=302) -# @app.route("/api/words/") -# def api_words(corpus): -@app.route("/api/words") -def api_words(): +@app.route("/api/words/") +def api_words(corpus): return json.dumps({ - "sorted_words": app_index["ssj"]["words"], # todo - make corpus as arg + "sorted_words": app_index[corpus]["words"], # todo - make corpus as arg }) -@app.route("/api/functors") -def api_functors(): - # return array ([functor, len]) - return json.dumps(app_index["ssj"]["functors"]) +@app.route("/api/functors/") +def api_functors(corpus): + return json.dumps(app_index[corpus]["functors"]) @app.route("/api/register", methods=["POST"]) diff --git a/src/frontend_vue/src/components/LFunctors.vue b/src/frontend_vue/src/components/LFunctors.vue index 331e1fe..9ddeda6 100644 --- a/src/frontend_vue/src/components/LFunctors.vue +++ b/src/frontend_vue/src/components/LFunctors.vue @@ -19,7 +19,11 @@ export default { methods: { apiGetFunctors: function () { var component = this - this.$http.get(this.$root.store.api_addr + "/api/functors") + this.$http.get( + this.$root.store.api_addr + + "/api/functors/" + + this.$root.store.selCorpus + ) .then(function(response) { component.$root.store.api_error = null component.functors = response.data diff --git a/src/frontend_vue/src/components/LWords.vue b/src/frontend_vue/src/components/LWords.vue index 683782b..bd1c5a1 100644 --- a/src/frontend_vue/src/components/LWords.vue +++ b/src/frontend_vue/src/components/LWords.vue @@ -27,7 +27,11 @@ export default { methods: { apiGetWords: function() { var component = this - this.$http.get(this.$root.storeGet("api_addr") + "/api/words") + this.$http.get( + this.$root.store.api_addr + + "/api/words/" + + this.$root.store.selCorpus + ) .then(function(response) { component.$root.store.api_error = null // component.$root.store.has_se = response.data["has_se"] diff --git a/src/frontend_vue/src/components/Login.vue b/src/frontend_vue/src/components/Login.vue index 02d69df..46063cd 100644 --- a/src/frontend_vue/src/components/Login.vue +++ b/src/frontend_vue/src/components/Login.vue @@ -86,7 +86,7 @@ export default { } var component = this - this.$http.post(this.$root.storeGet("api_addr") + "/api/login", + this.$http.post(this.$root.store.api_addr + "/api/login", data, // the data to post { headers: { 'Content-type': 'application/x-www-form-urlencoded', diff --git a/src/frontend_vue/src/components/MainDispl.vue b/src/frontend_vue/src/components/MainDispl.vue index e53461a..d03e5d1 100644 --- a/src/frontend_vue/src/components/MainDispl.vue +++ b/src/frontend_vue/src/components/MainDispl.vue @@ -119,8 +119,10 @@ export default { } var component = this this.$http.get( - this.$root.storeGet("api_addr") + "/api/functor-frames" + - "?functor=" + functor + "&rf=" + reduce_fun) + this.$root.store.api_addr + + "/api/functor-frames" + + "?functor=" + functor + "&rf=" + reduce_fun + ) .then(function (response) { component.$root.store.api_error = null component.frames = response.data.frames @@ -147,8 +149,9 @@ export default { } var component = this this.$http.get( - this.$root.storeGet("api_addr") + "/api/frames" + - "?hw=" + hw + "&rf=" + reduce_fun) + this.$root.store.api_addr + "/api/frames" + + "?hw=" + hw + "&rf=" + reduce_fun + ) .then(function (response) { component.$root.store.api_error = null component.frames = response.data.frames diff --git a/src/frontend_vue/src/components/NewPass.vue b/src/frontend_vue/src/components/NewPass.vue index aa12c46..e2a2058 100644 --- a/src/frontend_vue/src/components/NewPass.vue +++ b/src/frontend_vue/src/components/NewPass.vue @@ -78,7 +78,7 @@ export default { } var component = this - this.$http.post(this.$root.storeGet("api_addr") + "/api/new_pass", + this.$http.post(this.$root.store.api_addr + "/api/new_pass", data, // the data to post { headers: { 'Content-type': 'application/x-www-form-urlencoded', diff --git a/src/frontend_vue/src/components/Register.vue b/src/frontend_vue/src/components/Register.vue index 304437f..26944dc 100644 --- a/src/frontend_vue/src/components/Register.vue +++ b/src/frontend_vue/src/components/Register.vue @@ -111,7 +111,7 @@ export default { password: this.credentials.password, email: this.credentials.email, } - this.$http.post(this.$root.storeGet("api_addr") + "/api/register", + this.$http.post(this.$root.store.api_addr + "/api/register", post_data, // the data to post { headers: { 'Content-type': 'application/json', diff --git a/src/frontend_vue/src/main.js b/src/frontend_vue/src/main.js index 6fda067..ddc9ecc 100644 --- a/src/frontend_vue/src/main.js +++ b/src/frontend_vue/src/main.js @@ -44,17 +44,6 @@ const store = { has_se: [], // used for appending (se) to certain verbs } -const store_methods = { - storeSet: function(key, val) { - store[key] = val - }, - storeGet: function(key) { - // returns undefined if not in dict. - // check if (variable) - return store[key] - } -} - const login_methods = { checkToken: function () { var tthis = this @@ -110,7 +99,7 @@ new Vue({ data() { return { store: store, }}, - methods: Object.assign(store_methods, login_methods, other_methods), + methods: Object.assign(login_methods, other_methods), beforeCreate: function() { document.title = "Vezljivostni vzorci" if (this.$cookies.isKey("valency_token")) { diff --git a/src/pkg/cjvt-corpusparser b/src/pkg/cjvt-corpusparser index e599740..77c599d 160000 --- a/src/pkg/cjvt-corpusparser +++ b/src/pkg/cjvt-corpusparser @@ -1 +1 @@ -Subproject commit e599740ac940be1b150d653dfbf66d0551ece3a3 +Subproject commit 77c599dded132a690ba2555eed439fed76e69868