Open item from URL
This commit is contained in:
parent
53ba0d7845
commit
b18c846af9
|
@ -231,6 +231,7 @@ export default {
|
||||||
check_for_missing_done: false,
|
check_for_missing_done: false,
|
||||||
selected_circles: [],
|
selected_circles: [],
|
||||||
hover_isa: undefined,
|
hover_isa: undefined,
|
||||||
|
detail_qid: undefined,
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
computed: {
|
computed: {
|
||||||
|
@ -338,6 +339,11 @@ export default {
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
|
qid_from_url() {
|
||||||
|
const queryString = window.location.search;
|
||||||
|
const urlParams = new URLSearchParams(queryString);
|
||||||
|
return urlParams.get("item") || undefined;
|
||||||
|
},
|
||||||
isa_tick_all() {
|
isa_tick_all() {
|
||||||
this.isa_ticked = Object.keys(this.isa_labels);
|
this.isa_ticked = Object.keys(this.isa_labels);
|
||||||
},
|
},
|
||||||
|
@ -511,7 +517,6 @@ export default {
|
||||||
this.check_for_missing_done = false;
|
this.check_for_missing_done = false;
|
||||||
|
|
||||||
this.clear_items();
|
this.clear_items();
|
||||||
|
|
||||||
this.close_item();
|
this.close_item();
|
||||||
|
|
||||||
this.wikidata_loading = true;
|
this.wikidata_loading = true;
|
||||||
|
@ -578,7 +583,6 @@ export default {
|
||||||
if (this.check_for_missing_done) return;
|
if (this.check_for_missing_done) return;
|
||||||
if (!this.osm_loaded || !this.wikidata_loaded) return;
|
if (!this.osm_loaded || !this.wikidata_loaded) return;
|
||||||
|
|
||||||
|
|
||||||
var missing_qids = [];
|
var missing_qids = [];
|
||||||
for (const [qid, item] of Object.entries(this.items)) {
|
for (const [qid, item] of Object.entries(this.items)) {
|
||||||
if (!item.wikidata) missing_qids.push(qid);
|
if (!item.wikidata) missing_qids.push(qid);
|
||||||
|
@ -587,6 +591,8 @@ export default {
|
||||||
console.log('missing:', missing_qids);
|
console.log('missing:', missing_qids);
|
||||||
if (missing_qids.length == 0) {
|
if (missing_qids.length == 0) {
|
||||||
this.update_wikidata();
|
this.update_wikidata();
|
||||||
|
this.check_for_missing_done = true;
|
||||||
|
this.start_item();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -611,8 +617,15 @@ export default {
|
||||||
|
|
||||||
this.process_wikidata_items(response.data.items);
|
this.process_wikidata_items(response.data.items);
|
||||||
this.update_wikidata();
|
this.update_wikidata();
|
||||||
|
this.check_for_missing_done = true;
|
||||||
|
this.start_item();
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
start_item() {
|
||||||
|
if (!this.detail_qid) return;
|
||||||
|
this.open_item(this.detail_qid);
|
||||||
|
this.detail_qid = undefined;
|
||||||
|
},
|
||||||
update_wikidata() {
|
update_wikidata() {
|
||||||
for (const qid in this.items) {
|
for (const qid in this.items) {
|
||||||
var item = this.items[qid];
|
var item = this.items[qid];
|
||||||
|
@ -670,6 +683,11 @@ export default {
|
||||||
|
|
||||||
map.on("moveend", this.update_map_path);
|
map.on("moveend", this.update_map_path);
|
||||||
this.map = map;
|
this.map = map;
|
||||||
|
|
||||||
|
this.detail_qid = this.qid_from_url();
|
||||||
|
if (this.detail_qid) {
|
||||||
|
this.load_wikidata_items();
|
||||||
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
},
|
},
|
||||||
|
|
Loading…
Reference in a new issue