working on api + frontend; todo: switch corpus

This commit is contained in:
2019-03-24 02:08:22 +01:00
parent 8c6d6ab8ab
commit bc4e8e2cf1
12 changed files with 149 additions and 55 deletions

View File

@@ -1,3 +1,3 @@
{
"api_addr": "http://193.2.76.103:5004"
"api_addr": "http://0.0.0.0:5004"
}

View File

@@ -1,3 +1,3 @@
{
"api_addr": "http://localhost:5004"
"api_addr": "http://0.0.0.0:5004"
}

View File

@@ -1,3 +1,3 @@
{
"api_addr": "http://193.2.76.103:5004"
"api_addr": "0.0.0.0:5004"
}

View File

@@ -116,7 +116,7 @@
"argparse": {
"version": "1.0.10",
"resolved": "https://registry.npmjs.org/argparse/-/argparse-1.0.10.tgz",
"integrity": "sha1-vNZ5HqWuCXJeF+WtmIE0zUCz2RE=",
"integrity": "sha512-o5Roy6tNG4SL/FOkCAN6RzjiakZS25RLYFrcMttJqbdd8BWrnA+fGz57iN5Pb06pvBGvl5gQ0B48dJlslXvoTg==",
"dev": true,
"requires": {
"sprintf-js": "~1.0.2"
@@ -2979,9 +2979,9 @@
}
},
"esprima": {
"version": "2.7.3",
"resolved": "https://registry.npmjs.org/esprima/-/esprima-2.7.3.tgz",
"integrity": "sha1-luO3DVd59q1JzQMmc9HDEnZ7pYE=",
"version": "4.0.1",
"resolved": "https://registry.npmjs.org/esprima/-/esprima-4.0.1.tgz",
"integrity": "sha512-eGuFFw7Upda+g4p+QHvnW0RyTX/SVeJBDM/gCtMARO0cLuT2HcEKnTPvhjV6aGeqrCB/sbNop0Kszm0jsaWU4A==",
"dev": true
},
"esrecurse": {
@@ -5128,13 +5128,13 @@
"dev": true
},
"js-yaml": {
"version": "3.7.0",
"resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-3.7.0.tgz",
"integrity": "sha1-XJZ93YN6m/3KXy3oQlOr6KHAO4A=",
"version": "3.13.0",
"resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-3.13.0.tgz",
"integrity": "sha512-pZZoSxcCYco+DIKBTimr67J6Hy+EYGZDY/HCWC+iAEA9h1ByhMXAIVUXMcMFpOCxQ/xjXmPI2MkDL5HRm5eFrQ==",
"dev": true,
"requires": {
"argparse": "^1.0.7",
"esprima": "^2.6.0"
"esprima": "^4.0.0"
}
},
"jsesc": {
@@ -5255,9 +5255,9 @@
}
},
"lodash": {
"version": "4.17.10",
"resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.10.tgz",
"integrity": "sha512-UejweD1pDoXu+AD825lWwp4ZGtSwgnpZxb3JDViD7StjQz+Nb/6l093lx4OQ0foGWNRoc19mWy7BzL+UAK2iVg=="
"version": "4.17.11",
"resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.11.tgz",
"integrity": "sha512-cQKh8igo5QUhZ7lg38DYWAxMvjSAKG0A8wGSVimP07SIUEK2UO+arSRKbRZWtelMtN5V0Hkwh5ryOto/SshYIg=="
},
"lodash.camelcase": {
"version": "4.3.0",
@@ -9679,6 +9679,24 @@
"mkdirp": "~0.5.1",
"sax": "~1.2.1",
"whet.extend": "~0.9.9"
},
"dependencies": {
"esprima": {
"version": "2.7.3",
"resolved": "https://registry.npmjs.org/esprima/-/esprima-2.7.3.tgz",
"integrity": "sha1-luO3DVd59q1JzQMmc9HDEnZ7pYE=",
"dev": true
},
"js-yaml": {
"version": "3.7.0",
"resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-3.7.0.tgz",
"integrity": "sha1-XJZ93YN6m/3KXy3oQlOr6KHAO4A=",
"dev": true,
"requires": {
"argparse": "^1.0.7",
"esprima": "^2.6.0"
}
}
}
},
"tapable": {

View File

@@ -10,7 +10,7 @@
<div class="my-home container-fluid">
<div class="row">
<div id="serach" class="col-sm-2 border-right fill">
<LWords v-if="navSS()"></LWords>
<LWords v-if="this.$root.store.selIndex === 'words'"></LWords>
<LFunctors v-else></LFunctors>
</div>
<div class="col-sm-10">
@@ -35,11 +35,6 @@ export default {
LFunctors: LFunctors,
MainDispl: MainDispl,
},
methods: {
navSS: function () {
return this.$root.storeGet("navSS") === "words"
}
}
}
</script>

View File

@@ -30,7 +30,7 @@ export default {
this.$http.get(this.$root.storeGet("api_addr") + "/api/words")
.then(function(response) {
component.$root.store.api_error = null
component.$root.store.has_se = response.data["has_se"]
// component.$root.store.has_se = response.data["has_se"]
component.letters = response.data["sorted_words"]
})
.catch(function(error) {

View File

@@ -32,7 +32,7 @@
<tr>
<label class="radio-inline"><input value="one" v-model="$root.store.radio" v-on:change="reload()" checked="" type="radio" name="optradio">posamezne povedi</label>&nbsp;&nbsp;
<label class="radio-inline"><input value="two" v-model="$root.store.radio" v-on:change="reload()" type="radio" name="optradio">skupne udeleženske vloge</label>&nbsp;&nbsp;
<label v-if="this.$root.store.navSS === 'words'" class="radio-inline"><input value="three" v-model="$root.store.radio" v-on:change="reload()" type="radio" name="optradio">po meri</label>
<label v-if="this.$root.store.selIndex === 'words'" class="radio-inline"><input value="three" v-model="$root.store.radio" v-on:change="reload()" type="radio" name="optradio">po meri</label>
</tr>
</table>
</div>
@@ -206,7 +206,7 @@ export default {
reload: function () {
this.state = "loading"
this.sentences = {}
if (this.$root.store.navSS === "functors") this.getFFrames(this.hw)
if (this.$root.store.selIndex === "functors") this.getFFrames(this.hw)
else {
this.getFrames(this.hw)
if (this.$root.store.radio === "three") {

View File

@@ -6,17 +6,30 @@
<b-collapse is-nav id="nav_collapse">
<b-navbar-nav>
<b-nav-item-dropdown text="Prikaz" right>
<b-dropdown-item v-for="option in search_options"
<b-nav-item-dropdown text="korpus" right>
<b-dropdown-item v-for="option in optCorpora"
:value="option"
:key="option"
v-on:click="updateCorpus(option)"
>
{{ option }}
</b-dropdown-item>
</b-nav-item-dropdown>
</b-navbar-nav>
<b-navbar-nav>
<b-nav-item-dropdown text="prikaz" right>
<b-dropdown-item v-for="option in optIndexes"
:value="option.val"
:key="option.val"
v-on:click="setNavSS(option.val)">
v-on:click="updateIndex(option.val)"
>
{{ option.key }}
</b-dropdown-item>
</b-nav-item-dropdown>
</b-navbar-nav>
<!-- Right aligned nav items -->
<!-- Right aligned nav items -->
<b-navbar-nav class="ml-auto" right v-if="this.loggedIn()">
<b-nav-item>
Uporabnik: {{ this.$root.store.username }}
@@ -46,19 +59,27 @@ export default {
name: "Nav",
props: ["appState"],
data() {return {
search_options: [
optIndexes: [
{key: "besede", val: "words"},
{key: "udeleženske vloge", val: "functors"},
],
optCorpora: ["kres", "ssj"],
}},
methods: {
setNavSS(val) {
updateAll() {
this.$root.store.radio = "one"
this.$root.store.navSS = val
this.$router.push({
name: "Home"
})
},
updateCorpus(val) {
this.$root.store.selCorpus = val
this.updateAll()
},
updateIndex(val) {
this.$root.store.selIndex = val
this.updateAll()
},
loggedIn() {
return (this.$root.store.token !== null)
},

View File

@@ -38,7 +38,8 @@ const store = {
// api_addr: "http://193.2.76.103:5004", // production
token: null,
username: null,
navSS: "words",
selIndex: "words",
selCorpus: "kres",
radio: "one",
has_se: [], // used for appending (se) to certain verbs
}