some frontend cleanup, backend bug fix (database volumd mount)

This commit is contained in:
voje 2019-03-24 13:45:19 +01:00
parent bc4e8e2cf1
commit e363cc3fd6
11 changed files with 35 additions and 35 deletions

View File

@ -1 +1 @@
/home/voje/work_data/final_json
/home/kristjan/kres_srl/final_json/

View File

@ -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

View File

@ -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/<corpus>")
# def api_words(corpus):
@app.route("/api/words")
def api_words():
@app.route("/api/words/<corpus>")
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/<corpus>")
def api_functors(corpus):
return json.dumps(app_index[corpus]["functors"])
@app.route("/api/register", methods=["POST"])

View File

@ -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

View File

@ -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"]

View File

@ -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',

View File

@ -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

View File

@ -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',

View File

@ -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',

View File

@ -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")) {

@ -1 +1 @@
Subproject commit e599740ac940be1b150d653dfbf66d0551ece3a3
Subproject commit 77c599dded132a690ba2555eed439fed76e69868