rename menu => treemenu

This commit is contained in:
chfhtw
2026-06-25 16:46:18 +02:00
parent e27e64414a
commit 4a283ebf5d
5 changed files with 15 additions and 15 deletions
@@ -24,7 +24,7 @@ if (! defined('BASEPATH')) exit('No direct script access allowed');
* Provides data to the ajax get calls about menues * Provides data to the ajax get calls about menues
* This controller works with JSON calls on the HTTP GET or POST and the output is always JSON * This controller works with JSON calls on the HTTP GET or POST and the output is always JSON
*/ */
class Menu extends FHCAPI_Controller class Treemenu extends FHCAPI_Controller
{ {
public function __construct() public function __construct()
{ {
@@ -19,7 +19,7 @@ export default {
get(config, path = '') { get(config, path = '') {
return { return {
method: 'get', method: 'get',
url: '/api/frontend/v1/menu/' + config + '/' + path url: '/api/frontend/v1/treemenu/' + config + '/' + path
}; };
}, },
// TODO(chris): handle favorites per config // TODO(chris): handle favorites per config
@@ -1,14 +1,14 @@
import MenuEntry from './Menu/Entry.js'; import TreemenuEntry from './Treemenu/Entry.js';
import dragClick from '../../directives/dragClick.js'; import dragClick from '../../directives/dragClick.js';
import ApiMenu from '../../api/factory/menu.js'; import ApiTreemenu from '../../api/factory/treemenu.js';
export default { export default {
components: { components: {
PvTreetable: primevue.treetable, PvTreetable: primevue.treetable,
PvColumn: primevue.column, PvColumn: primevue.column,
MenuEntry TreemenuEntry
}, },
directives: { directives: {
dragClick dragClick
@@ -96,7 +96,7 @@ export default {
this.loading = true; this.loading = true;
return this.$api return this.$api
.call(ApiMenu.get(this.config, node.data.path)) .call(ApiTreemenu.get(this.config, node.data.path))
.then(result => { .then(result => {
const subNodes = result.data.map(this.mapResultToTreeData); const subNodes = result.data.map(this.mapResultToTreeData);
const realNode = this.findNodeByKey(node.key); const realNode = this.findNodeByKey(node.key);
@@ -224,7 +224,7 @@ export default {
filterFav() { filterFav() {
this.favorites.on = !this.favorites.on; this.favorites.on = !this.favorites.on;
this.$api this.$api
.call(ApiMenu.favorites.set( .call(ApiTreemenu.favorites.set(
JSON.stringify(this.favorites) JSON.stringify(this.favorites)
)); ));
}, },
@@ -238,7 +238,7 @@ export default {
} }
this.$api this.$api
.call(ApiMenu.favorites.set( .call(ApiTreemenu.favorites.set(
JSON.stringify(this.favorites) JSON.stringify(this.favorites)
)); ));
}, },
@@ -261,7 +261,7 @@ export default {
}, },
mounted() { mounted() {
this.$api this.$api
.call(ApiMenu.get(this.config)) .call(ApiTreemenu.get(this.config))
.then(result => { .then(result => {
this.nodes = result.data.map(el => { this.nodes = result.data.map(el => {
el.root = true; el.root = true;
@@ -273,7 +273,7 @@ export default {
.catch(this.$fhcAlert.handleSystemError); .catch(this.$fhcAlert.handleSystemError);
this.$api this.$api
.call(ApiMenu.favorites.get()) .call(ApiTreemenu.favorites.get())
.then(result => { .then(result => {
if (result.data) { if (result.data) {
this.favorites = JSON.parse(result.data); this.favorites = JSON.parse(result.data);
@@ -316,7 +316,7 @@ export default {
</div> </div>
</template> </template>
<template #body="{ node }"> <template #body="{ node }">
<menu-entry <treemenu-entry
:node="node" :node="node"
:data-tree-item-key="node.key" :data-tree-item-key="node.key"
v-drag-click="() => toggleTreeNode(node)" v-drag-click="() => toggleTreeNode(node)"
@@ -41,7 +41,7 @@ export default {
}, },
template: /* html */` template: /* html */`
<span <span
class="menu-entry d-flex align-items-center w-100 h-100" class="treemenu-entry d-flex align-items-center w-100 h-100"
:title="title" :title="title"
v-drop:[dropConfig]="(evt, data) => $emit('drop', { drop: node.data, drag: data })" v-drop:[dropConfig]="(evt, data) => $emit('drop', { drop: node.data, drag: data })"
> >
@@ -1,11 +1,11 @@
import BaseMenu from '../../Base/Menu.js'; import BaseTreemenu from '../../Base/Treemenu.js';
import ApiStvGroups from '../../../api/factory/stv/group.js'; import ApiStvGroups from '../../../api/factory/stv/group.js';
import ApiStvDetails from '../../../api/factory/stv/details.js'; import ApiStvDetails from '../../../api/factory/stv/details.js';
export default { export default {
components: { components: {
BaseMenu BaseTreemenu
}, },
inject: { inject: {
$reloadList: { $reloadList: {
@@ -83,7 +83,7 @@ export default {
}, },
template: /* html */` template: /* html */`
<div class="overflow-auto" tabindex="-1"> <div class="overflow-auto" tabindex="-1">
<base-menu <base-treemenu
ref="menu" ref="menu"
config="stv" config="stv"
:preselected-key="preselectedKey" :preselected-key="preselectedKey"