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

dev
voje 5 years ago
parent bc4e8e2cf1
commit e363cc3fd6

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

@ -10,6 +10,8 @@ services:
environment: environment:
MONGO_INITDB_ROOT_USERNAME: ${DB_ADM_USER} MONGO_INITDB_ROOT_USERNAME: ${DB_ADM_USER}
MONGO_INITDB_ROOT_PASSWORD: ${DB_ADM_PASS} MONGO_INITDB_ROOT_PASSWORD: ${DB_ADM_PASS}
volumes:
- ${HOME}/mongo_container/data/:/data/
mongo-express: mongo-express:
image: mongo-express image: mongo-express

@ -35,9 +35,10 @@ app_index = {c: {} for c in CORPORA}
# when running vuejs via webpack # when running vuejs via webpack
# CORS(app) # CORS(app)
CORS(app, resources={r"/api/*": { # CORS(app, resources={r"/api/*": {
"origins": "*", # "origins": "*",
}}) # }})
CORS(app)
# for testing functions # for testing functions
@ -58,18 +59,15 @@ def home(pathname):
return redirect(url_for("index"), code=302) return redirect(url_for("index"), code=302)
# @app.route("/api/words/<corpus>") @app.route("/api/words/<corpus>")
# def api_words(corpus): def api_words(corpus):
@app.route("/api/words")
def api_words():
return json.dumps({ 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") @app.route("/api/functors/<corpus>")
def api_functors(): def api_functors(corpus):
# return array ([functor, len]) return json.dumps(app_index[corpus]["functors"])
return json.dumps(app_index["ssj"]["functors"])
@app.route("/api/register", methods=["POST"]) @app.route("/api/register", methods=["POST"])

@ -19,7 +19,11 @@ export default {
methods: { methods: {
apiGetFunctors: function () { apiGetFunctors: function () {
var component = this 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) { .then(function(response) {
component.$root.store.api_error = null component.$root.store.api_error = null
component.functors = response.data component.functors = response.data

@ -27,7 +27,11 @@ export default {
methods: { methods: {
apiGetWords: function() { apiGetWords: function() {
var component = this 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) { .then(function(response) {
component.$root.store.api_error = null component.$root.store.api_error = null
// component.$root.store.has_se = response.data["has_se"] // component.$root.store.has_se = response.data["has_se"]

@ -86,7 +86,7 @@ export default {
} }
var component = this 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 data, // the data to post
{ headers: { { headers: {
'Content-type': 'application/x-www-form-urlencoded', 'Content-type': 'application/x-www-form-urlencoded',

@ -119,8 +119,10 @@ export default {
} }
var component = this var component = this
this.$http.get( this.$http.get(
this.$root.storeGet("api_addr") + "/api/functor-frames" + this.$root.store.api_addr +
"?functor=" + functor + "&rf=" + reduce_fun) "/api/functor-frames" +
"?functor=" + functor + "&rf=" + reduce_fun
)
.then(function (response) { .then(function (response) {
component.$root.store.api_error = null component.$root.store.api_error = null
component.frames = response.data.frames component.frames = response.data.frames
@ -147,8 +149,9 @@ export default {
} }
var component = this var component = this
this.$http.get( this.$http.get(
this.$root.storeGet("api_addr") + "/api/frames" + this.$root.store.api_addr + "/api/frames" +
"?hw=" + hw + "&rf=" + reduce_fun) "?hw=" + hw + "&rf=" + reduce_fun
)
.then(function (response) { .then(function (response) {
component.$root.store.api_error = null component.$root.store.api_error = null
component.frames = response.data.frames component.frames = response.data.frames

@ -78,7 +78,7 @@ export default {
} }
var component = this 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 data, // the data to post
{ headers: { { headers: {
'Content-type': 'application/x-www-form-urlencoded', 'Content-type': 'application/x-www-form-urlencoded',

@ -111,7 +111,7 @@ export default {
password: this.credentials.password, password: this.credentials.password,
email: this.credentials.email, 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 post_data, // the data to post
{ headers: { { headers: {
'Content-type': 'application/json', 'Content-type': 'application/json',

@ -44,17 +44,6 @@ const store = {
has_se: [], // used for appending (se) to certain verbs 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 = { const login_methods = {
checkToken: function () { checkToken: function () {
var tthis = this var tthis = this
@ -110,7 +99,7 @@ new Vue({
data() { return { data() { return {
store: store, store: store,
}}, }},
methods: Object.assign(store_methods, login_methods, other_methods), methods: Object.assign(login_methods, other_methods),
beforeCreate: function() { beforeCreate: function() {
document.title = "Vezljivostni vzorci" document.title = "Vezljivostni vzorci"
if (this.$cookies.isKey("valency_token")) { if (this.$cookies.isKey("valency_token")) {

@ -1 +1 @@
Subproject commit e599740ac940be1b150d653dfbf66d0551ece3a3 Subproject commit 77c599dded132a690ba2555eed439fed76e69868
Loading…
Cancel
Save