Skip to content

Commit

Permalink
Some tidy up.
Browse files Browse the repository at this point in the history
  • Loading branch information
alan-wu committed May 25, 2022
1 parent 682de09 commit d7886e4
Show file tree
Hide file tree
Showing 4 changed files with 35 additions and 25 deletions.
27 changes: 20 additions & 7 deletions src/components/ContentVuer.vue
Original file line number Diff line number Diff line change
Expand Up @@ -138,6 +138,9 @@ export default {
SimulationVuer,
},
methods: {
/**
* Toggle sync mode on/off depending on species and current state
*/
toggleSyncMode: function () {
if (this.syncMode == false) {
let action = undefined;
Expand Down Expand Up @@ -205,6 +208,9 @@ export default {
};
this.$emit("resource-selected", result);
},
/**
* Perform a local search on this contentvuer
*/
search: function (term) {
if (this.entry.type === "Flatmap") {
return this.$refs.flatmap.searchAndShowResult(term);
Expand Down Expand Up @@ -252,7 +258,6 @@ export default {
returnedAction = {};
returnedAction.type = "Facet";
returnedAction.label = this.idNamePair[resource.feature.models];
result.internalName = this.idNamePair[resource.feature.models];
fireResourceSelected = true;
if (type == "MultiFlatmap") {
const flatmap =
Expand Down Expand Up @@ -289,6 +294,9 @@ export default {
resource.type === "Neuron Search"
);
},
/**
* Handle sync pan zoom event
*/
handleSyncPanZoomEvent: function (data) {
//Prevent recursive callback
if (!this.mouseHovered) {
Expand Down Expand Up @@ -366,6 +374,11 @@ export default {
}
}
},
/**
* Get the term to zoom/highlight in a synchronisation event,
* if it cannot be found in the map, it will perform several
* calls to try to ge a valid name/id.
*/
getNameAndIdFromSyncData: async function(data) {
let name = data.internalName;
if (name === undefined && data.resource) {
Expand Down Expand Up @@ -487,6 +500,12 @@ export default {
let map = component.mapImp;
map.clearMarkers();
let params = [];
//Use the default list of uberons before we get the response
let terms = getAvailableTermsForSpecies();
for (let i = 0; i < terms.length; i++) {
map.addMarker(terms[i].id, terms[i].type);
this.idNamePair[terms[i].id] = terms[i].name;
}
if (this.apiLocation) {
store.state.settings.facets.species.forEach((e) => {
params.push(
Expand All @@ -511,12 +530,6 @@ export default {
}
);
}
//Previous attempt fails, use the hardcoded list
let terms = getAvailableTermsForSpecies();
for (let i = 0; i < terms.length; i++) {
map.addMarker(terms[i].id, terms[i].type);
this.idNamePair[terms[i].id] = terms[i].name;
}
},
startHelp: function (id) {
if (this.entry.id === id && this.isInHelp === undefined) {
Expand Down
9 changes: 0 additions & 9 deletions src/components/SplitFlow.vue
Original file line number Diff line number Diff line change
@@ -1,8 +1,5 @@
<template>
<el-container style="height:100%;background:white;">
<!--
<information-dialog ref="information"></information-dialog>
-->
<el-header ref="header" style="text-align: left; font-size: 14px;padding:0" height="32px" class="dialog-header">
<DialogToolbarContent :activeId="activeDockedId" :numberOfEntries="entries.length"
:topLevelControls=true
Expand Down Expand Up @@ -249,12 +246,6 @@ export default {
}
},
resourceSelected: function(result) {
/**
if (result.resource.eventType === "click" &&
result.internalName === "Vagus nerve") {
this.$refs.information.display();
}
*/
this.$emit("resource-selected", result);
if (store.state.splitFlow.globalCallback) {
this.$refs.splitdialog.sendSynchronisedEvent(result);
Expand Down
2 changes: 1 addition & 1 deletion src/components/SplitpanesBar.vue
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@
<el-popover class="tooltip" content="Close and remove" placement="bottom-end" :open-delay="helpDelay"
:appendToBody=false trigger="hover" popper-class="header-popper" >
<map-svg-icon icon="close" slot="reference" class="header-icon"
v-if="(activeView !== 'singlepanel') && (slot.name !== 'first') && (isFlatmap[slot.name] == false)"
v-if="(activeView !== 'singlepanel') && (isFlatmap[slot.name] == false)"
@click.native="closeAndRemove(slot)"/>
</el-popover>
</el-row>
Expand Down
22 changes: 14 additions & 8 deletions src/store/modules/splitFlow.js
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,8 @@ const mutations = {
state.globalCallback = flag;
},
updateActiveView(state, activeView) {
//Deactivate sync mode if current or future view
//is not in 2 split panels/
if (state.syncMode) {
const view1 = state.viewIcons.find(
view => state.activeView === view.icon);
Expand Down Expand Up @@ -160,6 +162,8 @@ const mutations = {
},
setSyncMode(state, payload) {
if (payload) {
//Force the second slot to be the new viewer in payload and change the
//view to the payload's layout
let secondSlot = state.slotInfo.find(slot => slot.name === "second");
if (payload.flag === true) {
let firstSlot = state.slotInfo.find(slot => slot.name === "first");
Expand All @@ -183,15 +187,14 @@ const mutations = {
if (payload) {
state.syncMode = false;
state.globalCallback = false;
//Find the next available id to fill empty slot
//Set to 1 if the slot being closed is the primary
//view
let availableId = 0;
//Primary id cannot be changed
if (payload.id === 1) {
availableId = 1;
} else if (payload.entries) {
for (let i = 0; i < payload.entries.length &&
availableId == 0; i++) {
//Find the entry not currently in use
if (state.slotInfo.find(slot => slot.id ===
payload.entries[i].id) === undefined) {
availableId = payload.entries[i].id;
Expand All @@ -206,22 +209,24 @@ const mutations = {
slotInfo => slotInfo.name === "third");
let fourthSlot = state.slotInfo.find(
slotInfo => slotInfo.name === "fourth");
// The following move the entry id to the appropriate slot
// and remove the target id
switch (slot.name) {
case "first": {
switch (state.activeView) {
case "2horpanel":
case "2vertpanel": {
slot.id = secondSlot.Id;
slot.id = secondSlot.id;
secondSlot.id = availableId;
} break;
case "3panel": {
slot.id = secondSlot.Id;
secondSlot.Id = thirdSlot.id;
slot.id = secondSlot.dd;
secondSlot.id = thirdSlot.id;
thirdSlot.id = availableId;
} break;
case "4panel": {
slot.id = secondSlot.Id;
secondSlot.Id = thirdSlot.id;
slot.id = secondSlot.id;
secondSlot.id = thirdSlot.id;
thirdSlot.id = fourthSlot.id;
fourthSlot.id = availableId;
} break;
Expand Down Expand Up @@ -272,6 +277,7 @@ const mutations = {
default:
break;
}
//Then switch the view
switch (state.activeView) {
case "2horpanel":
case "2vertpanel":
Expand Down

0 comments on commit d7886e4

Please sign in to comment.