Skip to content

Commit

Permalink
fetch biblio link
Browse files Browse the repository at this point in the history
  • Loading branch information
jpvoigt committed Jul 22, 2024
1 parent 2d2538e commit 1b3c3c9
Show file tree
Hide file tree
Showing 5 changed files with 29 additions and 7 deletions.
17 changes: 15 additions & 2 deletions src/components/DocumentHeaderComponent.vue
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ import OpenSeadragon from 'openseadragon'
import { mutations } from '@/store/names'
import FlipPageButtonComponent from './FlipPageButtonComponent.vue'
import SourceMenu from './SourceMenu.vue'
import { editdist } from '@/toolbox'
/**
* @module components/DocumentHeaderComponent
Expand All @@ -73,7 +74,7 @@ export default {
},
srcmenu: {
type: Boolean,
default: false
default: true
}
},
data: function () {
Expand Down Expand Up @@ -283,7 +284,18 @@ export default {
this.$emit('move-source', this.sourcePosition.x, this.sourcePosition.y)
},
dblclick (e) {
alert(this.source.label)
// alert(this.source.label)
const bibliolinks = this.$store.getters.bibliolinks
const sigs = Object.keys(bibliolinks)
const ed = sigs.map(sig => editdist(sig, this.source.label))
const argmin = array => [].map.call(array, (x, i) => [x, i]).reduce((r, a) => (a[0] < r[0] ? a : r))[1]
const mni = argmin(ed)
if (ed[mni] <= 3) {
console.log(bibliolinks[sigs[mni]])
window.open(bibliolinks[sigs[mni]], '_blank')
} else {
console.warn('no link for "' + this.source.label + '"')
}
}
}
}
Expand Down Expand Up @@ -350,6 +362,7 @@ export default {
}
.title {
cursor: pointer;
position: absolute;
left: 10%;
width: 80%;
Expand Down
5 changes: 3 additions & 2 deletions src/config/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,11 +34,12 @@ const config = {
}

const API_URL = {
'jpv/dev': 'http://localhost:8080/exist/apps/api/'
// 'jpv/dev': 'http://localhost:8080/exist/apps/api/'
}
const API_HOST = {
main: 'api.beethovens-werkstatt.de',
dev: 'dev-api.beethovens-werkstatt.de'
dev: 'dev-api.beethovens-werkstatt.de',
'jpv/dev': 'dev-api.beethovens-werkstatt.de'
}

export const getAPIURL = async function (path) {
Expand Down
2 changes: 1 addition & 1 deletion src/store/complaints/data.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ export const tagLabel = {
[sortTag.classification]: 'terms.complaint.classification',
[sortTag.context]: 'terms.complaint.context',
[sortTag.implementation]: 'terms.complaint.implementation',
[sortTag.document]: 'terms.document'
[sortTag.document]: 'terms.complaint.state.revisionDoc'
}

export const complaintFilterTags = {
Expand Down
6 changes: 5 additions & 1 deletion src/store/complaints/getters.js
Original file line number Diff line number Diff line change
Expand Up @@ -241,7 +241,11 @@ const getters = {
[n.getters.complaintMovements]: (state, getters) => (workId) => {
// console.log('complaintMovements', workId)
const complaints = workId ? getters[n.getters.workComplaints](workId, false) : getters[n.getters.allComplaints]
const movements = [...new Set(complaints.map(c => c.affects[0]?.mdiv).filter(cmd => !!cmd))]
const errata = [...complaints.filter(c => !c.affects[0])]
for (const ec of errata) {
console.warn('affects is empty!', ec)
}
const movements = [...new Set(complaints.map(c => c.affects[0]?.mdiv))]
// console.log(workId, complaints, movements)
return movements.sort((mdiv1, mdiv2) => {
const m1 = getters[n.getters.getMovementById](mdiv1)
Expand Down
6 changes: 5 additions & 1 deletion src/store/directory/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,11 @@ const getters = {
[n.getters.directory_is_dev_work]: (state) => (work) => {
return !!(state[n.state.directory_dev_works].find(w => w.id === work))
},
get_bibliolink: (state) => (signa) => state.bibliolinks[signa]
get_bibliolink: (state) => (signa) => state.bibliolinks[signa],
bibliolinks: (state) => {
const ret = { ...state.bibliolinks }
return ret
}
}

const directoryModule = {
Expand Down

0 comments on commit 1b3c3c9

Please sign in to comment.