Skip to content
Snippets Groups Projects
Commit c2c610a1 authored by Paul Pestov's avatar Paul Pestov
Browse files

Merge branch 'feature/#66-enable-search-using-real-data' into 'develop'

Enable search using real data

Closes #66

See merge request !26
parents 1e38a819 263d5880
No related branches found
No related tags found
1 merge request!26Enable search using real data
Pipeline #214328 passed
......@@ -15,33 +15,15 @@ class ApiService {
}
async search(value) {
// TODO: Uncomment this when the real search endpoint is ready
// return this.request('/search', 'POST', {
// query: {
// simple_query_string: {
// query: value
// }
// },
// from: 0,
// size: 10
// })
return Promise.resolve({
"hits" : {
"total" : {
"value" : 2
},
"hits" : [{
"item": "/api/textapi/ahikar/syriac/3r678-186v/latest/item.json",
"label": "Cod. Arab. 236 Copenhagen",
"n": "123v"
}, {
"item": "/api/textapi/ahikar/syriac/3r678-126r/latest/item.json",
"label": "Cod. Arab. 236 Copenhagen",
"n": "126r"
}]
return this.request('/search', 'POST', {
query: {
simple_query_string: {
query: value
}
},
"took" : 1
});
from: 0,
size: 10
})
}
async request (url, method, data, params) {
......@@ -54,4 +36,4 @@ class ApiService {
}
}
export default new ApiService('/');
export default new ApiService('https://ahikar-dev.sub.uni-goettingen.de/api');
......@@ -6,10 +6,10 @@
>
<v-list-item v-for="item in items" :key="item.item">
<v-list-item-content>
<a :href="viewerBaseUrl + '/#/?itemurl=' + item.item" target="_blank">
<v-list-item-title>{{item.n}}</v-list-item-title>
<v-list-item-subtitle>{{item.label}}</v-list-item-subtitle>
<v-list-item-subtitle>Manifest: manifest title</v-list-item-subtitle>
<a :href="getItemUrl(item)" target="_blank">
<v-list-item-title>{{item.label}}</v-list-item-title>
<v-list-item-subtitle>Sheet {{item.n}}</v-list-item-subtitle>
<v-list-item-subtitle>{{getLanguage(item.lang)}}</v-list-item-subtitle>
</a>
</v-list-item-content>
</v-list-item>
......@@ -27,19 +27,38 @@
export default {
data() {
return {
page: 1
page: 1,
languagesMap: {
ara: 'Arabic',
syc: 'Syriac',
}
}
},
computed: {
viewerBaseUrl() {
return 'https://ahikar-dev.sub.uni-goettingen.de';
}
},
},
props: {
items: {
type: Array,
default: []
}
},
methods: {
getLanguage(code) {
return this.languagesMap[code] || 'Unknown';
},
getItemUrl(item) {
let language = '';
if (item.lang === 'ara') {
language = 'arabic-karshuni';
} else if (item.lang === 'syc') {
language = 'syriac'
}
return this.viewerBaseUrl + '/' + language + '/#/?itemurl=' + item.item
}
}
}
</script>
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment