- 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:
Paolo
2022-07-04 19:25:16 +02:00
parent 32daed2ad2
commit 60b3be3d64
11 changed files with 512 additions and 140 deletions
+20 -17
View File
@@ -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">