From fcd1ea5575ad22720772841e749a8a27590ada8c Mon Sep 17 00:00:00 2001 From: Franz Osorio Date: Tue, 13 Aug 2024 12:34:06 -0400 Subject: [PATCH 01/16] Change which profiles are loaded --- src/components/panels/edit/fields/LookupComplex.vue | 1 + src/stores/config.js | 6 +++--- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/src/components/panels/edit/fields/LookupComplex.vue b/src/components/panels/edit/fields/LookupComplex.vue index 5a563486..adf57cca 100644 --- a/src/components/panels/edit/fields/LookupComplex.vue +++ b/src/components/panels/edit/fields/LookupComplex.vue @@ -977,6 +977,7 @@ export default { // Open the authority `panel` for an given authority openAuthority: function() { + console.info("Authority lookup") let label = this.$refs.el[0].innerHTML let sibling = this.$refs.el[0].parentNode.childNodes[2] diff --git a/src/stores/config.js b/src/stores/config.js index fda5e1cf..d9eb4aeb 100644 --- a/src/stores/config.js +++ b/src/stores/config.js @@ -23,8 +23,8 @@ export const useConfigStore = defineStore('config', { profiles : 'http://localhost:9401/util/profiles/profile/prod', starting: 'http://localhost:9401/util/profiles/starting/prod', - profiles: 'https://raw.githubusercontent.com/lcnetdev/bfe-profiles/main/profile-stage/data.json', - starting: 'https://raw.githubusercontent.com/lcnetdev/bfe-profiles/main/starting-stage/data.json', + profiles: 'https://raw.githubusercontent.com/lcnetdev/bfe-profiles/main/profile-prod/data.json', + starting: 'https://raw.githubusercontent.com/lcnetdev/bfe-profiles/main/starting-prod/data.json', @@ -212,7 +212,7 @@ export const useConfigStore = defineStore('config', { testData:[ {lccn:'2001059208',label:"The knitter's handy book of patterns: basic designs in multiple sizes & gauges", idUrl:'https://id.loc.gov/resources/instances/12618072.html', profile:'Monograph',profileId:'lc:RT:bf2:Monograph:Instance'}, {lccn:'2021375840',label:"Schooling under control", idUrl:'https://id.loc.gov/resources/instances/21910923.html', profile:'Monograph',profileId:'lc:RT:bf2:Monograph:Instance'}, - + {lccn:'2024591512',label:"The Berkshires, Massachusetts discovery map 2022-2023", idUrl:'https://id.loc.gov/resources/instances/23486403.html', profile:'Cartographic',profileId:'lc:RT:bf2:Cartographic:Instance'}, {lccn:'2016627557',label:"Wallflower", idUrl:'https://id.loc.gov/resources/instances/2016627557.html', profile:'Audio CD',profileId:'lc:RT:bf2:SoundRecording:Instance'}, From 646c33ff0636e37bfa4c2bd777ecbddfeab96a7a Mon Sep 17 00:00:00 2001 From: Franz Osorio Date: Tue, 13 Aug 2024 13:54:16 -0400 Subject: [PATCH 02/16] Mostly working. Selecting the complex heading only replaces the last piece of the complex heading. Needs to look into "selectContext" and see how it works. --- .../panels/edit/modals/SubjectEditor.vue | 6 +- src/lib/utils_network.js | 55 +++++++++++++++++-- 2 files changed, 53 insertions(+), 8 deletions(-) diff --git a/src/components/panels/edit/modals/SubjectEditor.vue b/src/components/panels/edit/modals/SubjectEditor.vue index bef1afc4..cb6dbc20 100644 --- a/src/components/panels/edit/modals/SubjectEditor.vue +++ b/src/components/panels/edit/modals/SubjectEditor.vue @@ -108,7 +108,7 @@
-
{{subjectC.suggestLabel}}
+
{{subjectC.suggestLabel}}

@@ -861,6 +861,8 @@ export default { that.searchResults = await utilsNetwork.subjectSearch(searchString,searchStringFull,that.searchMode) + console.info("that.searchResults", that.searchResults) + // if they clicked around while it was doing this lookup bail out // if (that.activeSearchInterrupted){ @@ -886,7 +888,6 @@ export default { s.label = s.label.replaceAll('-','‑') } - for (let s of that.searchResults.subjectsComplex){ s.labelOrginal = s.label s.complex=true @@ -1123,6 +1124,7 @@ export default { /** Clear the current selection so that hovering will update the preview again */ clearSelected: function(){ + console.info("pickLookup: ", this.pickLookup) this.pickLookup[this.pickCurrent].picked = false this.pickCurrent = null }, diff --git a/src/lib/utils_network.js b/src/lib/utils_network.js index b173c245..1ef13909 100644 --- a/src/lib/utils_network.js +++ b/src/lib/utils_network.js @@ -290,10 +290,10 @@ const utilsNetwork = { // console.log("searchPayload",searchPayload) - let returnUrls = useConfigStore().returnUrls let urlTemplate = searchPayload.url + let searchValue = searchPayload.searchValue console.log("######################################") console.log("url ", urlTemplate) @@ -337,8 +337,34 @@ const utilsNetwork = { url = url.replace('q=?','q=') } + //break up complex (contains "--") heads to search against the whole term, and the last -- section of it + let r = null + let partial = null + let all = null + try{ + if (searchValue.includes("--")) { + let pieces = searchValue.split("--") + if (pieces.length > 2){ + let last = pieces[pieces.length-1] + let pen = pieces[pieces.length-2] + let value = pen + "--" + last + partial = await this.fetchSimpleLookup(url.replace(searchValue, value)) + } + all = await this.fetchSimpleLookup(url) + + if (partial != null){ + all.count += partial.count + all.hits = all.hits.concat(partial.hits) + } + r = all - let r = await this.fetchSimpleLookup(url) + } else { + r = await this.fetchSimpleLookup(url) + } + } catch(error) { + console.info("error: ", error) + } + //r = await this.fetchSimpleLookup(url) //Config only allows 25 results, this will add something to the results // to let the user know there are more names. @@ -1444,7 +1470,7 @@ const utilsNetwork = { let resultsGenre=[] - + console.info("searching: ", heading) // if it is a primary heading then we need to search LCNAF, HUBS, WORKS, and simple subjects, and do the whole thing with complex subjects if (heading.primary){ // resultsNames = await this.searchComplex(searchPayloadNames) @@ -1475,6 +1501,8 @@ const utilsNetwork = { resultsHubsAnchored = resultsHubsAnchored.filter((r)=>{ return (!r.literal) }) resultsPayloadSubjectsSimpleSubdivision = resultsPayloadSubjectsSimpleSubdivision.filter((r)=>{ return (!r.literal) }) + console.info("resultsNamesSubdivision: ", resultsNamesSubdivision) + // console.log("Yeeth") // console.log("resultsNames",resultsNames) // console.log("resultsSubjectsSimple",resultsSubjectsSimple) @@ -1913,6 +1941,7 @@ const utilsNetwork = { console.log(useConfigStore().lookupConfig) let namesUrl = useConfigStore().lookupConfig['http://preprod.id.loc.gov/authorities/names'].modes[0]['NAF All'].url.replace('',searchVal).replace('&count=25','&count=4').replace("", "1") + let namesUrlComplex = useConfigStore().lookupConfig['http://preprod.id.loc.gov/authorities/names'].modes[0]['NAF All'].url.replace('',complexVal).replace('&count=25','&count=4').replace("", "1") let subjectUrlComplex = useConfigStore().lookupConfig['http://id.loc.gov/authorities/subjects'].modes[0]['LCSH All'].url.replace('',complexVal).replace('&count=25','&count=5').replace("", "1")+'&rdftype=ComplexType' let subjectUrlSimple = useConfigStore().lookupConfig['http://id.loc.gov/authorities/subjects'].modes[0]['LCSH All'].url.replace('',searchVal).replace('&count=25','&count=4').replace("", "1")+'&rdftype=SimpleType' @@ -1944,6 +1973,12 @@ const utilsNetwork = { searchValue: searchVal } + let searchPayloadNamesComplex = { + processor: 'lcAuthorities', + url: [namesUrlComplex], + searchValue: complexVal + } + let searchPayloadSubjectsSimple = { processor: 'lcAuthorities', url: [subjectUrlSimple], @@ -1990,6 +2025,7 @@ const utilsNetwork = { let resultsNames =[] + let resultsNamesComplex =[] let resultsSubjectsSimple=[] let resultsSubjectsComplex=[] let resultsHierarchicalGeographic=[] @@ -1999,13 +2035,16 @@ const utilsNetwork = { let resultsHubsKeyword=[] if (mode == "LCSHNAF"){ - [resultsNames, resultsSubjectsSimple, resultsSubjectsComplex, resultsHierarchicalGeographic] = await Promise.all([ + [resultsNames, resultsNamesComplex, resultsSubjectsSimple, resultsSubjectsComplex, resultsHierarchicalGeographic] = await Promise.all([ this.searchComplex(searchPayloadNames), + this.searchComplex(searchPayloadNamesComplex), this.searchComplex(searchPayloadSubjectsSimple), this.searchComplex(searchPayloadSubjectsComplex), this.searchComplex(searchPayloadHierarchicalGeographic) ]); + console.info("resultsNamesComplex: ", resultsNamesComplex) + }else if (mode == "GEO"){ [resultsHierarchicalGeographic] = await Promise.all([ @@ -2035,6 +2074,9 @@ const utilsNetwork = { if (resultsNames.length>0){ resultsNames.pop() } + if (resultsNamesComplex.length > 0){ + resultsNamesComplex.pop() + } if (resultsSubjectsComplex.length>0){ resultsSubjectsComplex.pop() } @@ -2079,14 +2121,15 @@ const utilsNetwork = { resultsSubjectsSimple = resultsHubsAnchored resultsSubjectsComplex = resultsHubsKeyword } + let results = { 'subjectsSimple': resultsSubjectsSimple, 'subjectsComplex': resultsSubjectsComplex, - 'names':resultsNames, + 'names':resultsNames.concat(resultsNamesComplex), 'hierarchicalGeographic': resultsHierarchicalGeographic } - + console.info("results: ", results) return results }, From 599f26b4a1577924fac660496b7e76210572b2f4 Mon Sep 17 00:00:00 2001 From: Franz Osorio Date: Tue, 13 Aug 2024 13:57:21 -0400 Subject: [PATCH 03/16] Fix issue with selectContext's index --- src/components/panels/edit/modals/SubjectEditor.vue | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/components/panels/edit/modals/SubjectEditor.vue b/src/components/panels/edit/modals/SubjectEditor.vue index cb6dbc20..8a4f1bbd 100644 --- a/src/components/panels/edit/modals/SubjectEditor.vue +++ b/src/components/panels/edit/modals/SubjectEditor.vue @@ -108,7 +108,7 @@
-
{{subjectC.suggestLabel}}
+
{{subjectC.suggestLabel}}

From e7804d6a88e62c96e39fc75d9a458754420978d1 Mon Sep 17 00:00:00 2001 From: Franz Osorio Date: Wed, 14 Aug 2024 11:17:19 -0400 Subject: [PATCH 04/16] Working, but needs more testing --- .../panels/edit/fields/LookupComplex.vue | 1 - .../panels/edit/modals/ComplexLookupModal.vue | 1 - .../panels/edit/modals/SubjectEditor.vue | 28 +++++++++++-------- src/lib/utils_network.js | 8 +----- src/stores/profile.js | 26 ++++++++--------- 5 files changed, 30 insertions(+), 34 deletions(-) diff --git a/src/components/panels/edit/fields/LookupComplex.vue b/src/components/panels/edit/fields/LookupComplex.vue index adf57cca..5a563486 100644 --- a/src/components/panels/edit/fields/LookupComplex.vue +++ b/src/components/panels/edit/fields/LookupComplex.vue @@ -977,7 +977,6 @@ export default { // Open the authority `panel` for an given authority openAuthority: function() { - console.info("Authority lookup") let label = this.$refs.el[0].innerHTML let sibling = this.$refs.el[0].parentNode.childNodes[2] diff --git a/src/components/panels/edit/modals/ComplexLookupModal.vue b/src/components/panels/edit/modals/ComplexLookupModal.vue index a0b0aaab..ae796aca 100644 --- a/src/components/panels/edit/modals/ComplexLookupModal.vue +++ b/src/components/panels/edit/modals/ComplexLookupModal.vue @@ -334,7 +334,6 @@ updated: function(){ - console.info("incoming: ", this.searchValueLocal) if (this.authorityLookup == null){ //Reset this so the input field isn't loaded with the old data this.activeComplexSearch = [] diff --git a/src/components/panels/edit/modals/SubjectEditor.vue b/src/components/panels/edit/modals/SubjectEditor.vue index 8a4f1bbd..f3b9c29f 100644 --- a/src/components/panels/edit/modals/SubjectEditor.vue +++ b/src/components/panels/edit/modals/SubjectEditor.vue @@ -861,9 +861,6 @@ export default { that.searchResults = await utilsNetwork.subjectSearch(searchString,searchStringFull,that.searchMode) - console.info("that.searchResults", that.searchResults) - - // if they clicked around while it was doing this lookup bail out // if (that.activeSearchInterrupted){ @@ -886,6 +883,9 @@ export default { for (let s of that.searchResults.names){ s.labelOrginal = s.label s.label = s.label.replaceAll('-','‑') + // if (s.label.includes("‑")){ + // s.complex=true + // } } for (let s of that.searchResults.subjectsComplex){ @@ -1124,7 +1124,6 @@ export default { /** Clear the current selection so that hovering will update the preview again */ clearSelected: function(){ - console.info("pickLookup: ", this.pickLookup) this.pickLookup[this.pickCurrent].picked = false this.pickCurrent = null }, @@ -1198,8 +1197,21 @@ export default { let splitString = this.subjectString.split('--') // replace the string with what we selected - splitString[this.activeComponentIndex] = this.pickLookup[this.pickPostion].label.replaceAll('-','‑') + // if the incoming term is complex, pop the elements from split string that are part of it + /* + Without this searching `New York (State)--new yor` and selecting `New York (State)--New York` + will result in the string being `New York (State)--New York (State)--New York` + */ + if (this.pickLookup[this.pickPostion].label.includes("‑‑")){ + // without this it's possible to keep selecting a term and delete parts of the heading that should remain + if (this.pickLookup[this.pickPostion].label.split("‑‑").length < splitString.length){ + let numPieces = this.pickLookup[this.pickPostion].label.split("‑‑").length-1 // how many things need to be removed minus the 1 to keep + let removalStart = splitString.length-1-numPieces + let updated = splitString.splice(removalStart, numPieces) + this.activeComponentIndex = this.activeComponentIndex - numPieces // update the activeComponentIndex + } + } this.subjectString = splitString.join('--') @@ -1208,7 +1220,6 @@ export default { this.componetLookup[this.activeComponentIndex]= {} } - this.componetLookup[this.activeComponentIndex][this.pickLookup[this.pickPostion].label.replaceAll('-','‑')] = this.pickLookup[this.pickPostion] for (let k in this.pickLookup){ @@ -1295,7 +1306,6 @@ export default { } - let start = event.target.selectionStart let end = event.target.selectionEnd console.log(this.subjectString.substring(0,start),'|',this.subjectString.substring(end,this.subjectString.length)) @@ -1393,7 +1403,6 @@ export default { }, - //TODO: if it's a literal, there shouldn't be a thesaurus subjectStringChanged: async function(event){ this.validateOkayToAdd() @@ -1461,7 +1470,6 @@ export default { for (let ss of subjectStringSplit){ // check the lookup to see if we have the data for this label - let uri = null let type = null let literal = null @@ -1776,8 +1784,6 @@ export default { if (typeof userValue == "string"){ - - // they sometimes come in with '.' at the end of the authorized form if (userValue.slice(-1)=='.'){ userValue=userValue.slice(0,-1) diff --git a/src/lib/utils_network.js b/src/lib/utils_network.js index 1ef13909..8afa6089 100644 --- a/src/lib/utils_network.js +++ b/src/lib/utils_network.js @@ -362,7 +362,7 @@ const utilsNetwork = { r = await this.fetchSimpleLookup(url) } } catch(error) { - console.info("error: ", error) + console.log("error: ", error) } //r = await this.fetchSimpleLookup(url) @@ -1470,7 +1470,6 @@ const utilsNetwork = { let resultsGenre=[] - console.info("searching: ", heading) // if it is a primary heading then we need to search LCNAF, HUBS, WORKS, and simple subjects, and do the whole thing with complex subjects if (heading.primary){ // resultsNames = await this.searchComplex(searchPayloadNames) @@ -1501,8 +1500,6 @@ const utilsNetwork = { resultsHubsAnchored = resultsHubsAnchored.filter((r)=>{ return (!r.literal) }) resultsPayloadSubjectsSimpleSubdivision = resultsPayloadSubjectsSimpleSubdivision.filter((r)=>{ return (!r.literal) }) - console.info("resultsNamesSubdivision: ", resultsNamesSubdivision) - // console.log("Yeeth") // console.log("resultsNames",resultsNames) // console.log("resultsSubjectsSimple",resultsSubjectsSimple) @@ -2043,8 +2040,6 @@ const utilsNetwork = { this.searchComplex(searchPayloadHierarchicalGeographic) ]); - console.info("resultsNamesComplex: ", resultsNamesComplex) - }else if (mode == "GEO"){ [resultsHierarchicalGeographic] = await Promise.all([ @@ -2129,7 +2124,6 @@ const utilsNetwork = { 'hierarchicalGeographic': resultsHierarchicalGeographic } - console.info("results: ", results) return results }, diff --git a/src/stores/profile.js b/src/stores/profile.js index 31bb7023..3244648e 100644 --- a/src/stores/profile.js +++ b/src/stores/profile.js @@ -63,7 +63,7 @@ export const useProfileStore = defineStore('profile', { componentGuid: null, componentPropertyPath:null }, - + // bf:title component/predicate for example, value will be the structure object for this component @@ -1033,8 +1033,6 @@ export const useProfileStore = defineStore('profile', { * @return {void} */ setValueSimple: async function(componentGuid, fieldGuid, propertyPath, URI, label){ - console.info("Setting vale") - propertyPath = propertyPath.filter((v)=> { return (v.propertyURI!=='http://www.w3.org/2002/07/owl#sameAs') }) @@ -2560,7 +2558,7 @@ export const useProfileStore = defineStore('profile', { /** * If it is a LCC component info about the LCC numbers * used in the interface rendering - * @return {boolean} + * @return {boolean} */ returnLccInfo: function(componentGuid, structure){ @@ -2615,8 +2613,8 @@ export const useProfileStore = defineStore('profile', { } } } - - + + if (pt.propertyURI=='http://id.loc.gov/ontologies/bibframe/contribution'){ let contributorUserValue = pt.userValue let type="normal" @@ -2625,7 +2623,7 @@ export const useProfileStore = defineStore('profile', { if (contributorUserValue['http://id.loc.gov/ontologies/bibframe/contribution'][0]['@type'] === 'http://id.loc.gov/ontologies/bibframe/PrimaryContribution'){ type="PrimaryContribution" } - + if (contributorUserValue['http://id.loc.gov/ontologies/bibframe/contribution'][0]['http://id.loc.gov/ontologies/bibframe/agent'] && contributorUserValue['http://id.loc.gov/ontologies/bibframe/contribution'][0]['http://id.loc.gov/ontologies/bibframe/agent'][0]){ let agent = contributorUserValue['http://id.loc.gov/ontologies/bibframe/contribution'][0]['http://id.loc.gov/ontologies/bibframe/agent'][0] if (agent && agent['http://www.w3.org/2000/01/rdf-schema#label'] && agent['http://www.w3.org/2000/01/rdf-schema#label'].length > 0 && agent['http://www.w3.org/2000/01/rdf-schema#label'][0] && agent['http://www.w3.org/2000/01/rdf-schema#label'][0]['http://www.w3.org/2000/01/rdf-schema#label']){ @@ -2644,12 +2642,12 @@ export const useProfileStore = defineStore('profile', { if (subjectUserValue && subjectUserValue['http://id.loc.gov/ontologies/bibframe/subject'] && subjectUserValue['http://id.loc.gov/ontologies/bibframe/subject'].length > 0 && subjectUserValue['http://id.loc.gov/ontologies/bibframe/subject'][0] && subjectUserValue['http://id.loc.gov/ontologies/bibframe/subject'][0]['http://www.w3.org/2000/01/rdf-schema#label']){ if (subjectUserValue['http://id.loc.gov/ontologies/bibframe/subject'][0]['http://www.w3.org/2000/01/rdf-schema#label'] && subjectUserValue['http://id.loc.gov/ontologies/bibframe/subject'][0]['http://www.w3.org/2000/01/rdf-schema#label'].length>0 && subjectUserValue['http://id.loc.gov/ontologies/bibframe/subject'][0]['http://www.w3.org/2000/01/rdf-schema#label'][0] && subjectUserValue['http://id.loc.gov/ontologies/bibframe/subject'][0]['http://www.w3.org/2000/01/rdf-schema#label'][0]['http://www.w3.org/2000/01/rdf-schema#label']){ - + firstSubject = subjectUserValue['http://id.loc.gov/ontologies/bibframe/subject'][0]['http://www.w3.org/2000/01/rdf-schema#label'][0]['http://www.w3.org/2000/01/rdf-schema#label'] } - + } } @@ -2661,11 +2659,11 @@ export const useProfileStore = defineStore('profile', { - + if (pt && pt.userValue && pt.userValue['http://id.loc.gov/ontologies/bibframe/classification'] && pt.userValue['http://id.loc.gov/ontologies/bibframe/classification'].length>0){ let uv = pt.userValue['http://id.loc.gov/ontologies/bibframe/classification'][0] - + if (uv && uv['@type'] && uv['@type'] == 'http://id.loc.gov/ontologies/bibframe/ClassificationLcc'){ // this is a LCC field then @@ -2673,7 +2671,7 @@ export const useProfileStore = defineStore('profile', { // we need to gather info from the component and the rest of the work to build links/suggestions - + if (uv['http://id.loc.gov/ontologies/bibframe/classificationPortion'] && uv['http://id.loc.gov/ontologies/bibframe/classificationPortion'].length>0 && uv['http://id.loc.gov/ontologies/bibframe/classificationPortion'][0] && uv['http://id.loc.gov/ontologies/bibframe/classificationPortion'][0]['http://id.loc.gov/ontologies/bibframe/classificationPortion']){ classNumber = uv['http://id.loc.gov/ontologies/bibframe/classificationPortion'][0]['http://id.loc.gov/ontologies/bibframe/classificationPortion'] @@ -2705,7 +2703,7 @@ export const useProfileStore = defineStore('profile', { // console.log("contributors",contributors) - + return { title: title, @@ -2747,7 +2745,7 @@ export const useProfileStore = defineStore('profile', { } - + //ClassificationLcc return false From eceb84c823b08492aa32e1dc4d1da4a9373e2a05 Mon Sep 17 00:00:00 2001 From: Franz Osorio Date: Wed, 14 Aug 2024 13:35:44 -0400 Subject: [PATCH 05/16] Make more general Works with Geographic subdivisions under names and subjects. TODO: fix the indexing of the elements in the HTML list --- .../panels/edit/modals/SubjectEditor.vue | 22 +++++++--- src/lib/utils_network.js | 44 ++++++++++++++++--- src/stores/config.js | 12 +++++ 3 files changed, 65 insertions(+), 13 deletions(-) diff --git a/src/components/panels/edit/modals/SubjectEditor.vue b/src/components/panels/edit/modals/SubjectEditor.vue index f3b9c29f..10dd6989 100644 --- a/src/components/panels/edit/modals/SubjectEditor.vue +++ b/src/components/panels/edit/modals/SubjectEditor.vue @@ -116,6 +116,11 @@
{{subject.suggestLabel}}{{subject.label}} [Literal]
+ +
+
{{subject.suggestLabel}}{{subject.label}} [Literal]
+
+ @@ -883,9 +888,6 @@ export default { for (let s of that.searchResults.names){ s.labelOrginal = s.label s.label = s.label.replaceAll('-','‑') - // if (s.label.includes("‑")){ - // s.complex=true - // } } for (let s of that.searchResults.subjectsComplex){ @@ -935,6 +937,12 @@ export default { s.label = s.label.replaceAll('-','‑') } + for (let s of that.searchResults.hierarchicalGeographicAll){ + s.labelOrginal = s.label + s.hierarchicalGeographic=true + s.label = s.label.replaceAll('-','‑') + } + if (that.searchResults.hierarchicalGeographic.length>0 && that.searchResults.subjectsComplex.length==0){ that.searchResults.subjectsComplex = that.searchResults.hierarchicalGeographic @@ -1163,11 +1171,13 @@ export default { } if (this.pickLookup[this.pickPostion].complex){ - // if it is a complex authorized heading then just replace the whole things with it - this.subjectString = this.pickLookup[this.pickPostion].label + console.info("HERE ", this.pickLookup[this.pickPostion]) this.activeComponentIndex = 0 - this.componetLookup = {} + + // if it is a complex authorized heading and there's nothing else then just replace the whole things with it + this.subjectString = this.pickLookup[this.pickPostion].label + this.componetLookup[this.activeComponentIndex] = {} this.componetLookup[this.activeComponentIndex][this.pickLookup[this.pickPostion].label] = this.pickLookup[this.pickPostion] for (let k in this.pickLookup){ diff --git a/src/lib/utils_network.js b/src/lib/utils_network.js index 8afa6089..fbd80d56 100644 --- a/src/lib/utils_network.js +++ b/src/lib/utils_network.js @@ -337,21 +337,29 @@ const utilsNetwork = { url = url.replace('q=?','q=') } - //break up complex (contains "--") heads to search against the whole term, and the last -- section of it + //break up complex (contains "--") headings to search against the whole term, and the last -- section of it + // this is for headings like "New York (State)--New York" where the second "New York" doesn't exist + // as a heading by itself let r = null let partial = null let all = null try{ if (searchValue.includes("--")) { let pieces = searchValue.split("--") + console.info("pieces: ", pieces) if (pieces.length > 2){ let last = pieces[pieces.length-1] let pen = pieces[pieces.length-2] let value = pen + "--" + last partial = await this.fetchSimpleLookup(url.replace(searchValue, value)) } + console.info("searchValue: ", searchValue) all = await this.fetchSimpleLookup(url) + console.info("Url: ", url) + console.info("partial: ", partial) + console.info("all: ", all) + if (partial != null){ all.count += partial.count all.hits = all.hits.concat(partial.hits) @@ -369,6 +377,7 @@ const utilsNetwork = { //Config only allows 25 results, this will add something to the results // to let the user know there are more names. let overflow = 0 + console.info("r: ", r) if (r.hits.length < r.count){ // It looks like the count is 1 more than the number of hits, why? overflow = (r.count - r.hits.length) @@ -1938,7 +1947,8 @@ const utilsNetwork = { console.log(useConfigStore().lookupConfig) let namesUrl = useConfigStore().lookupConfig['http://preprod.id.loc.gov/authorities/names'].modes[0]['NAF All'].url.replace('',searchVal).replace('&count=25','&count=4').replace("", "1") - let namesUrlComplex = useConfigStore().lookupConfig['http://preprod.id.loc.gov/authorities/names'].modes[0]['NAF All'].url.replace('',complexVal).replace('&count=25','&count=4').replace("", "1") + let namesUrlComplex = "" // useConfigStore().lookupConfig['http://preprod.id.loc.gov/authorities/names'].modes[0]['NAF All'].url.replace('',complexVal).replace('&count=25','&count=4').replace("", "1") + let subjectUrlComplex = useConfigStore().lookupConfig['http://id.loc.gov/authorities/subjects'].modes[0]['LCSH All'].url.replace('',complexVal).replace('&count=25','&count=5').replace("", "1")+'&rdftype=ComplexType' let subjectUrlSimple = useConfigStore().lookupConfig['http://id.loc.gov/authorities/subjects'].modes[0]['LCSH All'].url.replace('',searchVal).replace('&count=25','&count=4').replace("", "1")+'&rdftype=SimpleType' @@ -1955,6 +1965,10 @@ const utilsNetwork = { let subjectUrlHierarchicalGeographic = useConfigStore().lookupConfig['HierarchicalGeographic'].modes[0]['All'].url.replace('',searchValHierarchicalGeographic).replace('&count=25','&count=4').replace("", "1") + let HierarchicalGeographicAll = useConfigStore().lookupConfig['HierarchicalGeographicAll'].modes[0]['All'].url.replace('',complexVal).replace('&count=25','&count=4').replace("", "1") + + console.info("config: ", useConfigStore().lookupConfig['HierarchicalGeographicAll']) + console.info("URL:: ", HierarchicalGeographicAll) if (mode == 'GEO'){ @@ -1994,6 +2008,14 @@ const utilsNetwork = { searchValue: searchValHierarchicalGeographic } + let searchPayloadHierarchicalGeographicAll = { + processor: 'lcAuthorities', + url: [HierarchicalGeographicAll], + searchValue: complexVal + } + + console.info("payload: ", searchPayloadHierarchicalGeographicAll) + let searchPayloadWorksAnchored = { processor: 'lcAuthorities', @@ -2026,18 +2048,20 @@ const utilsNetwork = { let resultsSubjectsSimple=[] let resultsSubjectsComplex=[] let resultsHierarchicalGeographic=[] + let resultsHierarchicalGeographicAll=[] let resultsWorksAnchored=[] let resultsWorksKeyword=[] let resultsHubsAnchored=[] let resultsHubsKeyword=[] if (mode == "LCSHNAF"){ - [resultsNames, resultsNamesComplex, resultsSubjectsSimple, resultsSubjectsComplex, resultsHierarchicalGeographic] = await Promise.all([ + [resultsNames, resultsNamesComplex, resultsSubjectsSimple, resultsSubjectsComplex, resultsHierarchicalGeographic, resultsHierarchicalGeographicAll] = await Promise.all([ this.searchComplex(searchPayloadNames), - this.searchComplex(searchPayloadNamesComplex), + [], //this.searchComplex(searchPayloadNamesComplex), this.searchComplex(searchPayloadSubjectsSimple), this.searchComplex(searchPayloadSubjectsComplex), - this.searchComplex(searchPayloadHierarchicalGeographic) + this.searchComplex(searchPayloadHierarchicalGeographic), + this.searchComplex(searchPayloadHierarchicalGeographicAll) ]); }else if (mode == "GEO"){ @@ -2072,6 +2096,9 @@ const utilsNetwork = { if (resultsNamesComplex.length > 0){ resultsNamesComplex.pop() } + if (resultsHierarchicalGeographicAll.length > 0){ + resultsHierarchicalGeographicAll.pop() + } if (resultsSubjectsComplex.length>0){ resultsSubjectsComplex.pop() } @@ -2120,10 +2147,13 @@ const utilsNetwork = { let results = { 'subjectsSimple': resultsSubjectsSimple, 'subjectsComplex': resultsSubjectsComplex, - 'names':resultsNames.concat(resultsNamesComplex), - 'hierarchicalGeographic': resultsHierarchicalGeographic + 'names':resultsNames, //.concat(resultsNamesComplex), + 'hierarchicalGeographic': resultsHierarchicalGeographic, + 'hierarchicalGeographicAll': resultsHierarchicalGeographicAll } + console.info("results: ", results) + return results }, diff --git a/src/stores/config.js b/src/stores/config.js index d9eb4aeb..f9613548 100644 --- a/src/stores/config.js +++ b/src/stores/config.js @@ -327,6 +327,18 @@ export const useConfigStore = defineStore('config', { ] }, + // this will search across names and subjects, the above only searches names + "HierarchicalGeographicAll": { + "name":"names", + "type":"simple", + "processor" : 'lcAuthorities', + "modes":[ + { + 'All':{"url":"https://preprod-8288.id.loc.gov/suggest2/?q=&count=25&rdftype=HierarchicalGeographic", "all":true}, + } + ] + }, + "http://id.loc.gov/entities/providers" : {"name":"providers", "type":"complex", "modes":[]}, "http://id.loc.gov/entities/relationships" : {"name":"relationships", "processor" : 'lcAuthorities', "type":"complex", "modes":[ From d0a8e62173e514633cbf748bdd3657ef8b2d4804 Mon Sep 17 00:00:00 2001 From: Franz Osorio Date: Wed, 14 Aug 2024 13:49:22 -0400 Subject: [PATCH 06/16] Fix issue with indexes TODO: clean up the code --- .../panels/edit/modals/SubjectEditor.vue | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/src/components/panels/edit/modals/SubjectEditor.vue b/src/components/panels/edit/modals/SubjectEditor.vue index 10dd6989..e16ef98b 100644 --- a/src/components/panels/edit/modals/SubjectEditor.vue +++ b/src/components/panels/edit/modals/SubjectEditor.vue @@ -117,8 +117,16 @@ +
-
{{subject.suggestLabel}}{{subject.label}} [Literal]
+
{{subject.suggestLabel}} + {{subject.label}} [Literal]
@@ -966,7 +974,9 @@ export default { } - + for (let x in that.searchResults.hierarchicalGeographicAll){ + that.pickLookup[parseInt(x)+parseInt(that.searchResults.subjectsComplex.length)+parseInt(that.searchResults.subjectsSimple.length)] = that.searchResults.hierarchicalGeographicAll[x] + } @@ -1165,11 +1175,13 @@ export default { selectContext: async function(pickPostion, update=true){ if (pickPostion != null){ + console.info("incoming position: ", pickPostion) this.pickPostion=pickPostion this.pickCurrent=pickPostion this.getContext() } + console.info("lookup: ", this.pickLookup) if (this.pickLookup[this.pickPostion].complex){ console.info("HERE ", this.pickLookup[this.pickPostion]) this.activeComponentIndex = 0 From 567a839685920e5d471bc38fe166218d6f5f8f96 Mon Sep 17 00:00:00 2001 From: Franz Osorio Date: Wed, 14 Aug 2024 15:47:03 -0400 Subject: [PATCH 07/16] Fix duplicates in subject results This happened when a GeoSub division included a term in the complexSubjects --- src/components/panels/edit/modals/SubjectEditor.vue | 3 +++ src/lib/utils_network.js | 9 +++++++-- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/src/components/panels/edit/modals/SubjectEditor.vue b/src/components/panels/edit/modals/SubjectEditor.vue index e16ef98b..f735bf84 100644 --- a/src/components/panels/edit/modals/SubjectEditor.vue +++ b/src/components/panels/edit/modals/SubjectEditor.vue @@ -1232,6 +1232,9 @@ export default { let removalStart = splitString.length-1-numPieces let updated = splitString.splice(removalStart, numPieces) this.activeComponentIndex = this.activeComponentIndex - numPieces // update the activeComponentIndex + } else if (true){ + console.info(splitString) + console.info(this.pickLookup[this.pickPostion].label) } } diff --git a/src/lib/utils_network.js b/src/lib/utils_network.js index fbd80d56..ce83014d 100644 --- a/src/lib/utils_network.js +++ b/src/lib/utils_network.js @@ -2144,12 +2144,17 @@ const utilsNetwork = { resultsSubjectsComplex = resultsHubsKeyword } + // hierarchicalGeographicAll can sometimes have results found in subjectsComplex + // Remove the dupes + const subjectURIs = resultsSubjectsComplex.map((item) => item.uri) + const resultsHierarchicalGeographicAllFiltered = resultsHierarchicalGeographicAll.filter((subj) => !subjectURIs.includes(subj.uri)) + let results = { 'subjectsSimple': resultsSubjectsSimple, 'subjectsComplex': resultsSubjectsComplex, - 'names':resultsNames, //.concat(resultsNamesComplex), + 'names':resultsNames, 'hierarchicalGeographic': resultsHierarchicalGeographic, - 'hierarchicalGeographicAll': resultsHierarchicalGeographicAll + 'hierarchicalGeographicAll': resultsHierarchicalGeographicAllFiltered } console.info("results: ", results) From 988f592efa6d4379f62d374991b85f9deb0ed2c4 Mon Sep 17 00:00:00 2001 From: Franz Osorio Date: Wed, 14 Aug 2024 16:20:48 -0400 Subject: [PATCH 08/16] Clean up some code --- src/lib/utils_network.js | 14 +------------- 1 file changed, 1 insertion(+), 13 deletions(-) diff --git a/src/lib/utils_network.js b/src/lib/utils_network.js index ce83014d..546c2fc4 100644 --- a/src/lib/utils_network.js +++ b/src/lib/utils_network.js @@ -1947,7 +1947,6 @@ const utilsNetwork = { console.log(useConfigStore().lookupConfig) let namesUrl = useConfigStore().lookupConfig['http://preprod.id.loc.gov/authorities/names'].modes[0]['NAF All'].url.replace('',searchVal).replace('&count=25','&count=4').replace("", "1") - let namesUrlComplex = "" // useConfigStore().lookupConfig['http://preprod.id.loc.gov/authorities/names'].modes[0]['NAF All'].url.replace('',complexVal).replace('&count=25','&count=4').replace("", "1") let subjectUrlComplex = useConfigStore().lookupConfig['http://id.loc.gov/authorities/subjects'].modes[0]['LCSH All'].url.replace('',complexVal).replace('&count=25','&count=5').replace("", "1")+'&rdftype=ComplexType' let subjectUrlSimple = useConfigStore().lookupConfig['http://id.loc.gov/authorities/subjects'].modes[0]['LCSH All'].url.replace('',searchVal).replace('&count=25','&count=4').replace("", "1")+'&rdftype=SimpleType' @@ -1984,12 +1983,6 @@ const utilsNetwork = { searchValue: searchVal } - let searchPayloadNamesComplex = { - processor: 'lcAuthorities', - url: [namesUrlComplex], - searchValue: complexVal - } - let searchPayloadSubjectsSimple = { processor: 'lcAuthorities', url: [subjectUrlSimple], @@ -2044,7 +2037,6 @@ const utilsNetwork = { let resultsNames =[] - let resultsNamesComplex =[] let resultsSubjectsSimple=[] let resultsSubjectsComplex=[] let resultsHierarchicalGeographic=[] @@ -2055,9 +2047,8 @@ const utilsNetwork = { let resultsHubsKeyword=[] if (mode == "LCSHNAF"){ - [resultsNames, resultsNamesComplex, resultsSubjectsSimple, resultsSubjectsComplex, resultsHierarchicalGeographic, resultsHierarchicalGeographicAll] = await Promise.all([ + [resultsNames, resultsSubjectsSimple, resultsSubjectsComplex, resultsHierarchicalGeographic, resultsHierarchicalGeographicAll] = await Promise.all([ this.searchComplex(searchPayloadNames), - [], //this.searchComplex(searchPayloadNamesComplex), this.searchComplex(searchPayloadSubjectsSimple), this.searchComplex(searchPayloadSubjectsComplex), this.searchComplex(searchPayloadHierarchicalGeographic), @@ -2093,9 +2084,6 @@ const utilsNetwork = { if (resultsNames.length>0){ resultsNames.pop() } - if (resultsNamesComplex.length > 0){ - resultsNamesComplex.pop() - } if (resultsHierarchicalGeographicAll.length > 0){ resultsHierarchicalGeographicAll.pop() } From cda6737cd1354a111490020968d3d53471ee4793 Mon Sep 17 00:00:00 2001 From: Franz Osorio Date: Thu, 15 Aug 2024 07:53:16 -0400 Subject: [PATCH 09/16] More dup removal --- src/lib/utils_network.js | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/lib/utils_network.js b/src/lib/utils_network.js index 546c2fc4..2fe02fc4 100644 --- a/src/lib/utils_network.js +++ b/src/lib/utils_network.js @@ -2134,9 +2134,16 @@ const utilsNetwork = { // hierarchicalGeographicAll can sometimes have results found in subjectsComplex // Remove the dupes - const subjectURIs = resultsSubjectsComplex.map((item) => item.uri) + const hierarchicalGeographicURIs = resultsHierarchicalGeographic.map((item) => item.uri) + const subjectSimpleURIs = resultsSubjectsSimple.map((item) => item.uri) + const subjectComplexURIs = resultsSubjectsComplex.map((item) => item.uri) + + const subjectURIs = subjectComplexURIs.concat(subjectSimpleURIs).concat(hierarchicalGeographicURIs) const resultsHierarchicalGeographicAllFiltered = resultsHierarchicalGeographicAll.filter((subj) => !subjectURIs.includes(subj.uri)) + console.info("resultsHierarchicalGeographicAll: ",resultsHierarchicalGeographicAll) + console.info("resultsHierarchicalGeographicAllFiltered: ",resultsHierarchicalGeographicAllFiltered) + let results = { 'subjectsSimple': resultsSubjectsSimple, 'subjectsComplex': resultsSubjectsComplex, From 81e9950e1151896c25ac0c3f29bf55ff39be190f Mon Sep 17 00:00:00 2001 From: Franz Osorio Date: Thu, 15 Aug 2024 08:58:34 -0400 Subject: [PATCH 10/16] Fix duplication in string after selection --- .../panels/edit/modals/SubjectEditor.vue | 18 +++++++++++------- src/lib/utils_network.js | 5 +++-- 2 files changed, 14 insertions(+), 9 deletions(-) diff --git a/src/components/panels/edit/modals/SubjectEditor.vue b/src/components/panels/edit/modals/SubjectEditor.vue index f735bf84..3c389530 100644 --- a/src/components/panels/edit/modals/SubjectEditor.vue +++ b/src/components/panels/edit/modals/SubjectEditor.vue @@ -1220,10 +1220,10 @@ export default { // replace the string with what we selected splitString[this.activeComponentIndex] = this.pickLookup[this.pickPostion].label.replaceAll('-','‑') - // if the incoming term is complex, pop the elements from split string that are part of it + // if the incoming term is complex, pop the elements from splitstring that are part of it /* Without this searching `New York (State)--new yor` and selecting `New York (State)--New York` - will result in the string being `New York (State)--New York (State)--New York` + will result in `New York (State)--New York (State)--New York` */ if (this.pickLookup[this.pickPostion].label.includes("‑‑")){ // without this it's possible to keep selecting a term and delete parts of the heading that should remain @@ -1232,14 +1232,18 @@ export default { let removalStart = splitString.length-1-numPieces let updated = splitString.splice(removalStart, numPieces) this.activeComponentIndex = this.activeComponentIndex - numPieces // update the activeComponentIndex - } else if (true){ - console.info(splitString) - console.info(this.pickLookup[this.pickPostion].label) + } else if (this.pickLookup[this.pickPostion].label.split("‑‑").length == splitString.length){ + //if the selection has as many pieces as the input, replace the whole thing + splitString = this.pickLookup[this.pickPostion].label + this.activeComponentIndex = 0 } } - this.subjectString = splitString.join('--') - + try{ + this.subjectString = splitString.join('--') + } catch(err){ + this.subjectString = splitString + } if (!this.componetLookup[this.activeComponentIndex]){ this.componetLookup[this.activeComponentIndex]= {} diff --git a/src/lib/utils_network.js b/src/lib/utils_network.js index 2fe02fc4..4fa79397 100644 --- a/src/lib/utils_network.js +++ b/src/lib/utils_network.js @@ -2141,8 +2141,9 @@ const utilsNetwork = { const subjectURIs = subjectComplexURIs.concat(subjectSimpleURIs).concat(hierarchicalGeographicURIs) const resultsHierarchicalGeographicAllFiltered = resultsHierarchicalGeographicAll.filter((subj) => !subjectURIs.includes(subj.uri)) - console.info("resultsHierarchicalGeographicAll: ",resultsHierarchicalGeographicAll) - console.info("resultsHierarchicalGeographicAllFiltered: ",resultsHierarchicalGeographicAllFiltered) + console.info("resultsHierarchicalGeographic: ", resultsHierarchicalGeographic) + console.info("resultsHierarchicalGeographicAll: ", resultsHierarchicalGeographicAll) + console.info("resultsHierarchicalGeographicAllFiltered: ", resultsHierarchicalGeographicAllFiltered) let results = { 'subjectsSimple': resultsSubjectsSimple, From 16e4ed195b88db862795b615c3c90623f225e86a Mon Sep 17 00:00:00 2001 From: Franz Osorio Date: Thu, 15 Aug 2024 09:48:48 -0400 Subject: [PATCH 11/16] Add labels to search results --- src/components/panels/edit/modals/SubjectEditor.vue | 6 +++++- src/lib/utils_network.js | 6 ------ 2 files changed, 5 insertions(+), 7 deletions(-) diff --git a/src/components/panels/edit/modals/SubjectEditor.vue b/src/components/panels/edit/modals/SubjectEditor.vue index 3c389530..1c9d5bed 100644 --- a/src/components/panels/edit/modals/SubjectEditor.vue +++ b/src/components/panels/edit/modals/SubjectEditor.vue @@ -98,7 +98,7 @@
{{activeSearch}}
- + Names
{{name.suggestLabel.substring(0,41)}}... {{name.suggestLabel}} @@ -107,18 +107,22 @@
+
+ Subjects (Complex)
{{subjectC.suggestLabel}}

+ Subjects (Simple)
{{subject.suggestLabel}}{{subject.label}} [Literal]

+ Geo SubDivisions
!subjectURIs.includes(subj.uri)) - console.info("resultsHierarchicalGeographic: ", resultsHierarchicalGeographic) - console.info("resultsHierarchicalGeographicAll: ", resultsHierarchicalGeographicAll) - console.info("resultsHierarchicalGeographicAllFiltered: ", resultsHierarchicalGeographicAllFiltered) - let results = { 'subjectsSimple': resultsSubjectsSimple, 'subjectsComplex': resultsSubjectsComplex, @@ -2153,8 +2149,6 @@ const utilsNetwork = { 'hierarchicalGeographicAll': resultsHierarchicalGeographicAllFiltered } - console.info("results: ", results) - return results }, From 483877742bb7b003f0534c55fe2220d05c96094a Mon Sep 17 00:00:00 2001 From: Franz Osorio Date: Thu, 15 Aug 2024 10:01:50 -0400 Subject: [PATCH 12/16] Remove console statements --- .../panels/edit/modals/SubjectEditor.vue | 3 --- src/lib/utils_network.js | 14 -------------- 2 files changed, 17 deletions(-) diff --git a/src/components/panels/edit/modals/SubjectEditor.vue b/src/components/panels/edit/modals/SubjectEditor.vue index 1c9d5bed..4f3c078d 100644 --- a/src/components/panels/edit/modals/SubjectEditor.vue +++ b/src/components/panels/edit/modals/SubjectEditor.vue @@ -1179,15 +1179,12 @@ export default { selectContext: async function(pickPostion, update=true){ if (pickPostion != null){ - console.info("incoming position: ", pickPostion) this.pickPostion=pickPostion this.pickCurrent=pickPostion this.getContext() } - console.info("lookup: ", this.pickLookup) if (this.pickLookup[this.pickPostion].complex){ - console.info("HERE ", this.pickLookup[this.pickPostion]) this.activeComponentIndex = 0 this.componetLookup = {} diff --git a/src/lib/utils_network.js b/src/lib/utils_network.js index 4e381662..d7352bc0 100644 --- a/src/lib/utils_network.js +++ b/src/lib/utils_network.js @@ -346,20 +346,14 @@ const utilsNetwork = { try{ if (searchValue.includes("--")) { let pieces = searchValue.split("--") - console.info("pieces: ", pieces) if (pieces.length > 2){ let last = pieces[pieces.length-1] let pen = pieces[pieces.length-2] let value = pen + "--" + last partial = await this.fetchSimpleLookup(url.replace(searchValue, value)) } - console.info("searchValue: ", searchValue) all = await this.fetchSimpleLookup(url) - console.info("Url: ", url) - console.info("partial: ", partial) - console.info("all: ", all) - if (partial != null){ all.count += partial.count all.hits = all.hits.concat(partial.hits) @@ -377,7 +371,6 @@ const utilsNetwork = { //Config only allows 25 results, this will add something to the results // to let the user know there are more names. let overflow = 0 - console.info("r: ", r) if (r.hits.length < r.count){ // It looks like the count is 1 more than the number of hits, why? overflow = (r.count - r.hits.length) @@ -1966,10 +1959,6 @@ const utilsNetwork = { let subjectUrlHierarchicalGeographic = useConfigStore().lookupConfig['HierarchicalGeographic'].modes[0]['All'].url.replace('',searchValHierarchicalGeographic).replace('&count=25','&count=4').replace("", "1") let HierarchicalGeographicAll = useConfigStore().lookupConfig['HierarchicalGeographicAll'].modes[0]['All'].url.replace('',complexVal).replace('&count=25','&count=4').replace("", "1") - console.info("config: ", useConfigStore().lookupConfig['HierarchicalGeographicAll']) - console.info("URL:: ", HierarchicalGeographicAll) - - if (mode == 'GEO'){ subjectUrlHierarchicalGeographic = subjectUrlHierarchicalGeographic.replace('&count=4','&count=12').replace("", "1") } @@ -2007,9 +1996,6 @@ const utilsNetwork = { searchValue: complexVal } - console.info("payload: ", searchPayloadHierarchicalGeographicAll) - - let searchPayloadWorksAnchored = { processor: 'lcAuthorities', url: [worksUrlAnchored], From f68538cc5eef8a38a29b3e6c7a5c557f50d1c567 Mon Sep 17 00:00:00 2001 From: Franz Osorio Date: Thu, 15 Aug 2024 15:24:54 -0400 Subject: [PATCH 13/16] Arrows mostly working TODO, figure out how to keep the right sticky when using arrows --- .../panels/edit/modals/SubjectEditor.vue | 48 ++++++++++++++----- src/stores/profile.js | 8 +++- 2 files changed, 42 insertions(+), 14 deletions(-) diff --git a/src/components/panels/edit/modals/SubjectEditor.vue b/src/components/panels/edit/modals/SubjectEditor.vue index 4f3c078d..2d94d93f 100644 --- a/src/components/panels/edit/modals/SubjectEditor.vue +++ b/src/components/panels/edit/modals/SubjectEditor.vue @@ -86,9 +86,9 @@ - - - + + +
@@ -1146,12 +1146,23 @@ export default { /** Clear the current selection so that hovering will update the preview again */ clearSelected: function(){ + console.info("@@@ clear selected") this.pickLookup[this.pickCurrent].picked = false this.pickCurrent = null + + this.$refs.subjectInput.focus() }, loadContext: async function(pickPostion){ - if (this.pickCurrent == null) { + console.info("pickPostion: ", pickPostion) + console.info("this.pickCurrent: ", this.pickCurrent) + console.info("pickLookup: ", this.pickLookup) + try { + console.info("picked? ", this.pickLookup[this.pickCurrent].picked) + } catch(error){ + console.info("nope: ", error) + } + if (this.pickCurrent == null || this.pickLookup[this.pickCurrent].picked == true) { this.pickPostion = pickPostion } else { return null @@ -1166,6 +1177,7 @@ export default { this.localContextCache[this.contextData.uri] = JSON.parse(JSON.stringify(this.contextData)) } + // this.$store.dispatch("fetchContext", { self: this, searchPayload: this.pickLookup[this.pickPostion].uri }).then(() => { // // keep a local copy of it for looking up subject type @@ -1178,12 +1190,20 @@ export default { }, selectContext: async function(pickPostion, update=true){ + console.info(">>>selectContext") if (pickPostion != null){ this.pickPostion=pickPostion this.pickCurrent=pickPostion this.getContext() } + // if (this.pickLookup[this.pickCurrent].picked = true){ + // return true + // } + + // lock in the selected position + this.pickCurrent = this.pickPostion + if (this.pickLookup[this.pickPostion].complex){ this.activeComponentIndex = 0 this.componetLookup = {} @@ -1264,20 +1284,29 @@ export default { if (update == true){ this.subjectStringChanged() } - - } + this.$refs.subjectInput.focus() + }, navInput: function(event){ + console.info("navInput") + try { + console.info("picked? ", this.pickLookup[this.pickCurrent].picked) + } catch(error){ + console.info("") + } + if (event.key == 'ArrowUp'){ if (parseInt(this.pickPostion) <= this.searchResults.names.length*-1){ return false } + + this.pickCurrent = null //allows keyboard selection this.loadContext(parseInt(this.pickPostion) - 1 ) event.preventDefault() return false @@ -1287,21 +1316,16 @@ export default { return false } - + this.pickCurrent = null //allows keyboard selection this.loadContext(parseInt(this.pickPostion) + 1 ) event.preventDefault() return false }else if (event.key == 'Enter'){ - - - if (event.shiftKey){ this.add() return } - - this.selectContext() }else if (event.ctrlKey && event.key == "1"){ diff --git a/src/stores/profile.js b/src/stores/profile.js index 908e8bfa..30984b5c 100644 --- a/src/stores/profile.js +++ b/src/stores/profile.js @@ -1399,7 +1399,7 @@ export const useProfileStore = defineStore('profile', { // console.log(JSON.stringify(pt,null,2)) // let blankNode = utilsProfile.returnGuidLocation(pt.userValue,fieldGuid) - + if (blankNode === false){ // create the path to the blank node let buildBlankNodeResult @@ -2981,7 +2981,11 @@ export const useProfileStore = defineStore('profile', { this.activeProfile.rt[pt.parentId].pt[pt.id].deleted = true }else{ - + console.info("this.activeProfile: ", this.activeProfile) + console.info("this.activeProfile.rt: ", this.activeProfile.rt) + console.info("this.activeProfile.rt[pt.parentId]: ", this.activeProfile.rt[pt.parentId]) + console.info("pt.id: ", pt.id) + console.info("Trying to delete: ", this.activeProfile.rt[pt.parentId].pt[pt.id].userValue) for (let key in this.activeProfile.rt[pt.parentId].pt[pt.id].userValue){ if (!key.startsWith('@')){ delete this.activeProfile.rt[pt.parentId].pt[pt.id].userValue[key] From f23e154c2b767114ebb7ead128dbe0138bb553b8 Mon Sep 17 00:00:00 2001 From: Franz Osorio Date: Fri, 16 Aug 2024 08:26:55 -0400 Subject: [PATCH 14/16] Better arrow control --- .../panels/edit/modals/SubjectEditor.vue | 21 +++---------------- 1 file changed, 3 insertions(+), 18 deletions(-) diff --git a/src/components/panels/edit/modals/SubjectEditor.vue b/src/components/panels/edit/modals/SubjectEditor.vue index 2d94d93f..ea1816a5 100644 --- a/src/components/panels/edit/modals/SubjectEditor.vue +++ b/src/components/panels/edit/modals/SubjectEditor.vue @@ -1146,7 +1146,6 @@ export default { /** Clear the current selection so that hovering will update the preview again */ clearSelected: function(){ - console.info("@@@ clear selected") this.pickLookup[this.pickCurrent].picked = false this.pickCurrent = null @@ -1154,15 +1153,7 @@ export default { }, loadContext: async function(pickPostion){ - console.info("pickPostion: ", pickPostion) - console.info("this.pickCurrent: ", this.pickCurrent) - console.info("pickLookup: ", this.pickLookup) - try { - console.info("picked? ", this.pickLookup[this.pickCurrent].picked) - } catch(error){ - console.info("nope: ", error) - } - if (this.pickCurrent == null || this.pickLookup[this.pickCurrent].picked == true) { + if (this.pickCurrent == null) { this.pickPostion = pickPostion } else { return null @@ -1190,7 +1181,6 @@ export default { }, selectContext: async function(pickPostion, update=true){ - console.info(">>>selectContext") if (pickPostion != null){ this.pickPostion=pickPostion this.pickCurrent=pickPostion @@ -1294,13 +1284,6 @@ export default { navInput: function(event){ - console.info("navInput") - try { - console.info("picked? ", this.pickLookup[this.pickCurrent].picked) - } catch(error){ - console.info("") - } - if (event.key == 'ArrowUp'){ if (parseInt(this.pickPostion) <= this.searchResults.names.length*-1){ return false @@ -1308,6 +1291,7 @@ export default { this.pickCurrent = null //allows keyboard selection this.loadContext(parseInt(this.pickPostion) - 1 ) + this.pickCurrent = parseInt(this.pickPostion) - 1 event.preventDefault() return false }else if (event.key == 'ArrowDown'){ @@ -1318,6 +1302,7 @@ export default { this.pickCurrent = null //allows keyboard selection this.loadContext(parseInt(this.pickPostion) + 1 ) + this.pickCurrent = parseInt(this.pickPostion) + 1 event.preventDefault() return false }else if (event.key == 'Enter'){ From c92abf3b8ff07f521432b1d50d5c52fe7a5de59c Mon Sep 17 00:00:00 2001 From: Franz Osorio Date: Fri, 16 Aug 2024 08:57:54 -0400 Subject: [PATCH 15/16] Fix arrow key selection issue It was selecting the next one, not the option it should have selected. --- src/components/panels/edit/modals/SubjectEditor.vue | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/components/panels/edit/modals/SubjectEditor.vue b/src/components/panels/edit/modals/SubjectEditor.vue index ea1816a5..9ba5a4c1 100644 --- a/src/components/panels/edit/modals/SubjectEditor.vue +++ b/src/components/panels/edit/modals/SubjectEditor.vue @@ -1291,7 +1291,7 @@ export default { this.pickCurrent = null //allows keyboard selection this.loadContext(parseInt(this.pickPostion) - 1 ) - this.pickCurrent = parseInt(this.pickPostion) - 1 + this.pickCurrent = parseInt(this.pickPostion) event.preventDefault() return false }else if (event.key == 'ArrowDown'){ @@ -1302,7 +1302,7 @@ export default { this.pickCurrent = null //allows keyboard selection this.loadContext(parseInt(this.pickPostion) + 1 ) - this.pickCurrent = parseInt(this.pickPostion) + 1 + this.pickCurrent = parseInt(this.pickPostion) event.preventDefault() return false }else if (event.key == 'Enter'){ From e8e2d684d739d22b146d41d1a79cf4a9bb9a45f8 Mon Sep 17 00:00:00 2001 From: Franz Osorio Date: Fri, 16 Aug 2024 09:02:04 -0400 Subject: [PATCH 16/16] Remove short cut to `geo` search --- src/components/panels/edit/modals/SubjectEditor.vue | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/components/panels/edit/modals/SubjectEditor.vue b/src/components/panels/edit/modals/SubjectEditor.vue index 9ba5a4c1..f62e6a53 100644 --- a/src/components/panels/edit/modals/SubjectEditor.vue +++ b/src/components/panels/edit/modals/SubjectEditor.vue @@ -1317,11 +1317,11 @@ export default { this.searchModeSwitch("LCSHNAF") - }else if (event.ctrlKey && event.key == "2"){ - - this.searchModeSwitch("GEO") - - }else if (event.ctrlKey && event.key == "3"){ + } + // else if (event.ctrlKey && event.key == "2"){ + // this.searchModeSwitch("GEO") + // } + else if (event.ctrlKey && event.key == "2"){ this.searchModeSwitch("WORKS")