- Removed inlcudes of RESTClient from PHP (FHC-Common, FHC-Footer and views/system/logs/logsViewer)

- Changed RESTClient to be a JS module
- Now RESTClient is included via JS in the app LogsViewer and in component Navigation
- Added new directory public/js/components/navigation
- Moved component Navigation to public/js/components/navigation
- Moved API calls of the Navigation component to public/js/components/navigation/API.js
- Navigation component now imports public/js/components/navigation/API.js
This commit is contained in:
Paolo
2022-07-06 09:48:15 +02:00
parent 2927682dae
commit ce9aa4c388
7 changed files with 46 additions and 21 deletions
@@ -5,7 +5,6 @@
'bootstrap5' => true,
'fontawesome6' => true,
'jquery3' => true,
'restclient' => true,
'tablesorter2' => true,
'vue3' => true,
'filtercomponent' => true,
@@ -38,7 +38,6 @@
$filterwidget = isset($filterwidget) ? $filterwidget : false;
$navigationcomponent = isset($navigationcomponent) ? $navigationcomponent : false;
$navigationwidget = isset($navigationwidget) ? $navigationwidget : false;
$restclient = isset($restclient) ? $restclient : false;
$tablecomponent = isset($tablecomponent) ? $tablecomponent : false;
$tablewidget = isset($tablewidget) ? $tablewidget : false;
$udfs = isset($udfs) ? $udfs : false;
@@ -132,9 +132,6 @@
// PhrasesLib JS
if ($phrases != null) generateJSsInclude('public/js/PhrasesLib.js');
// RESTClient
if ($restclient === true) generateJSsInclude('public/js/RESTClient.js');
// TableWidget JS
if ($tablewidget === true) generateJSsInclude('public/js/TableWidget.js');
+1 -1
View File
@@ -35,7 +35,7 @@ const CRC_HTTP_POST_METHOD = "post";
/**
* Definition and initialization of the object CoreRESTClient
*/
const CoreRESTClient = {
export const CoreRESTClient = {
//------------------------------------------------------------------------------------------------------------------
// Public methods
+2 -2
View File
@@ -1,5 +1,5 @@
import {CoreFilterCmpt} from '../components/Filter.js';
import {CoreNavigationCmpt} from '../components/Navigation.js';
import {CoreFilterCmpt} from '../components/filter/Filter.js';
import {CoreNavigationCmpt} from '../components/navigation/Navigation.js';
const logsViewerApp = Vue.createApp({
data() {
+38
View File
@@ -0,0 +1,38 @@
import {CoreRESTClient} from '../../RESTClient.js';
const CORE_NAVIGATION_CMPT_TIMEOUT = 2000;
/**
*
*/
export const CoreNavigationAPIs = {
/**
*
*/
getHeader: function(navigationPage) {
return CoreRESTClient.get(
'system/Navigation/header',
{
navigation_page: navigationPage
},
{
timeout: CORE_NAVIGATION_CMPT_TIMEOUT
}
);
},
/**
*
*/
getMenu: function(navigationPage) {
return CoreRESTClient.get(
'system/Navigation/menu',
{
navigation_page: navigationPage
},
{
timeout: CORE_NAVIGATION_CMPT_TIMEOUT
}
);
}
}
@@ -1,4 +1,6 @@
import {CoreFetchCmpt} from '../components/Fetch.js';
import {CoreNavigationAPIs} from './API.js';
import {CoreRESTClient} from '../../RESTClient.js';
import {CoreFetchCmpt} from '../../components/Fetch.js';
export const CoreNavigationCmpt = {
data() {
@@ -20,23 +22,13 @@ export const CoreNavigationCmpt = {
return FHC_JS_DATA_STORAGE_OBJECT.called_path + "/" + FHC_JS_DATA_STORAGE_OBJECT.called_method;
},
fetchDataHeader() {
return CoreRESTClient.get(
'system/Navigation/header',
{
navigation_page: this.getNavigationPage()
}
);
return CoreNavigationAPIs.getHeader(this.getNavigationPage());
},
setHeaders(data) {
if (CoreRESTClient.hasData(data)) this.headerMenu = CoreRESTClient.getData(data);
},
fetchDataMenu() {
return CoreRESTClient.get(
'system/Navigation/menu',
{
navigation_page: this.getNavigationPage()
}
);
return CoreNavigationAPIs.getMenu(this.getNavigationPage());
},
setSideMenu(data) {
if (CoreRESTClient.hasData(data)) this.sideMenu = CoreRESTClient.getData(data);