mirror of
https://github.com/FH-Complete/FHC-Core.git
synced 2026-07-25 16:44:28 +00:00
- Added new JS public/js/RESTClient.js as axios wrapper
- composer.json: added axios from github - Added new directory application/components/extensions/ - Added new utility function findResource to application/helpers/hlp_common_helper.php - Now the library libraries/FilterCmptLib loads the component definition php files from the extensions - views/system/logs/logsViewer now includes axios and restclient, removed the includes for ajaxlib and jQueryUI - Added includes for the RESTClient and axios to views/templates/FHC-Common and views/templates/FHC-Footer - Improved component js/components/Fetch - Components public/js/components/Filter.js and public/js/components/Navigation.js now they are making use of the Fetch component or/and the RESTClient
This commit is contained in:
@@ -1,3 +1,5 @@
|
||||
import {CoreFetchCmpt} from '../components/Fetch.js';
|
||||
|
||||
export const CoreNavigationCmpt = {
|
||||
data() {
|
||||
return {
|
||||
@@ -5,47 +7,39 @@ export const CoreNavigationCmpt = {
|
||||
sideMenu: {}
|
||||
};
|
||||
},
|
||||
created() {
|
||||
this.fetchDataHeader();
|
||||
this.fetchDataMenu();
|
||||
},
|
||||
created() {},
|
||||
props: {
|
||||
addHeaderMenuEntries: Object,
|
||||
addSideMenuEntries: Object
|
||||
},
|
||||
components: {
|
||||
CoreFetchCmpt
|
||||
},
|
||||
methods: {
|
||||
getNavigationPage() {
|
||||
return FHC_JS_DATA_STORAGE_OBJECT.called_path + "/" + FHC_JS_DATA_STORAGE_OBJECT.called_method;
|
||||
},
|
||||
fetchDataHeader() {
|
||||
// Retrives the header menu array
|
||||
FHC_AjaxClient.ajaxCallGet(
|
||||
return CoreRESTClient.get(
|
||||
'system/Navigation/header',
|
||||
{
|
||||
navigation_page: this.getNavigationPage()
|
||||
},
|
||||
{
|
||||
successCallback: this.setHeaders
|
||||
}
|
||||
);
|
||||
},
|
||||
setHeaders(data) {
|
||||
if (FHC_AjaxClient.hasData(data)) this.headerMenu = FHC_AjaxClient.getData(data);
|
||||
if (CoreRESTClient.hasData(data)) this.headerMenu = CoreRESTClient.getData(data);
|
||||
},
|
||||
fetchDataMenu() {
|
||||
// Retrives the side menu array
|
||||
FHC_AjaxClient.ajaxCallGet(
|
||||
return CoreRESTClient.get(
|
||||
'system/Navigation/menu',
|
||||
{
|
||||
navigation_page: this.getNavigationPage()
|
||||
},
|
||||
{
|
||||
successCallback: this.setSideMenu
|
||||
}
|
||||
);
|
||||
},
|
||||
setSideMenu(data) {
|
||||
if (FHC_AjaxClient.hasData(data)) this.sideMenu = FHC_AjaxClient.getData(data);
|
||||
if (CoreRESTClient.hasData(data)) this.sideMenu = CoreRESTClient.getData(data);
|
||||
},
|
||||
getDataBsToggle(header) {
|
||||
return !header.children ? null : 'dropdown';
|
||||
@@ -69,13 +63,22 @@ export const CoreNavigationCmpt = {
|
||||
}
|
||||
},
|
||||
template: `
|
||||
<!-- Load head menu -->
|
||||
<core-fetch-cmpt v-bind:api-function="fetchDataHeader" @data-fetched="setHeaders"></core-fetch-cmpt>
|
||||
<!-- Load side menu -->
|
||||
<core-fetch-cmpt v-bind:api-function="fetchDataMenu" @data-fetched="setSideMenu"></core-fetch-cmpt>
|
||||
|
||||
<!-- Top menu -->
|
||||
<nav class="navbar navbar-expand-lg navbar-header">
|
||||
<ul class="navbar-nav">
|
||||
<!-- 1st level -->
|
||||
<template v-for="header in headerMenuEntries">
|
||||
<li class="nav-item dropdown">
|
||||
<a class="nav-link header-menu-link-entry" v-bind:data-bs-toggle="this.getDataBsToggle(header)" v-bind:class="{ 'dropdown-toggle': header.children }" v-bind:href="header.link">
|
||||
<a class="nav-link header-menu-link-entry"
|
||||
v-bind:data-bs-toggle="this.getDataBsToggle(header)"
|
||||
v-bind:class="{ 'dropdown-toggle': header.children }"
|
||||
v-bind:href="header.link"
|
||||
>
|
||||
<i class="fa-solid fa-fw header-menu-icon" v-bind:class="'fa-' + header.icon" v-if="header.icon"></i> {{ header.description }}
|
||||
</a>
|
||||
<ul class="dropdown-menu" v-if="header.children">
|
||||
|
||||
Reference in New Issue
Block a user