Skip to content

Commit

Permalink
remove isChildNode and _onChangeRoot
Browse files Browse the repository at this point in the history
  • Loading branch information
Raruto committed Feb 26, 2024
1 parent 3881d53 commit 89d6652
Showing 1 changed file with 4 additions and 24 deletions.
28 changes: 4 additions & 24 deletions src/components/ChangeMapMenu.vue
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@

<template>
<div id="g3w-change-map-menu">
<template v-if="isChildNode">
<!-- current node is a child -->
<template v-if="'root' !== this.current">
<div
style="
display: flex;
Expand Down Expand Up @@ -155,17 +156,6 @@ export default {
}
},

computed: {

/**
* @returns {boolean} whether current node isn't a "root" element
*/
isChildNode() {
return 'root' !== this.current;
},

},

methods: {

/**
Expand Down Expand Up @@ -279,16 +269,6 @@ export default {
this.steps = [];
},

_onChangeRoot(item) {
// item is a macrogroup
if (undefined === item.srid) {
this.showGroups(item)
} else {
// item is a group
this.showProjects(item);
}
},

/**
* @param {string} item.url
* @param {string} item.map_url
Expand All @@ -301,15 +281,15 @@ export default {
try {
new URL(base_url);
url = `${base_url}${item.url || item.map_url.replace(/^\//, "")}`;
} catch(err) {
} catch(e) {
url = `${location.origin}${base_url}${item.url || item.map_url.replace(/^\//, "")}`;
}
return ApplicationService.changeMapProject({ url, epsg });
},

async trigger(item) {
switch(this.current) {
case 'root': return this._onChangeRoot(item);
case 'root': return undefined === item.srid ? this.showGroups(item) : this.showProjects(item); // `srid` is undefined when item is a macrogroup
case 'macrogroups': return this.showGroups(item);
case 'groups': return await this.showProjects(item);
case 'projects': return await this.changeMapProject(item);
Expand Down

0 comments on commit 89d6652

Please sign in to comment.