From 267f5b297258a65f081732b3c26e9faac11652ad Mon Sep 17 00:00:00 2001 From: Paolo Date: Thu, 14 Jul 2022 11:28:06 +0200 Subject: [PATCH] - Added new directory public/js/apps/LogsViewer/ - Moved public/js/apps/LogsViewer.js to public/js/apps/LogsViewer/ - Added new JS file public/js/apps/LogsViewer/TabulatorSetup.js to setup the tabulator in the LogsViewer app - Added new property tabulatorEvents to the FilterCmpt to subscribe events for the tabulator --- application/views/system/logs/logsViewer.php | 17 ++----- public/js/apps/{ => LogsViewer}/LogsViewer.js | 11 +++-- public/js/apps/LogsViewer/TabulatorSetup.js | 46 +++++++++++++++++++ public/js/components/filter/Filter.js | 14 +++++- 4 files changed, 70 insertions(+), 18 deletions(-) rename public/js/apps/{ => LogsViewer}/LogsViewer.js (68%) create mode 100644 public/js/apps/LogsViewer/TabulatorSetup.js diff --git a/application/views/system/logs/logsViewer.php b/application/views/system/logs/logsViewer.php index a7d25f4d3..2d83a3087 100644 --- a/application/views/system/logs/logsViewer.php +++ b/application/views/system/logs/logsViewer.php @@ -12,7 +12,7 @@ 'global' => array('mailAnXversandt'), 'ui' => array('bitteEintragWaehlen') ), - 'customJSModules' => array('public/js/apps/LogsViewer.js') + 'customJSModules' => array('public/js/apps/LogsViewer/LogsViewer.js') ); $this->load->view('templates/FHC-Header', $includesArray); @@ -35,19 +35,8 @@ diff --git a/public/js/apps/LogsViewer.js b/public/js/apps/LogsViewer/LogsViewer.js similarity index 68% rename from public/js/apps/LogsViewer.js rename to public/js/apps/LogsViewer/LogsViewer.js index 25f274f58..391a6eaba 100644 --- a/public/js/apps/LogsViewer.js +++ b/public/js/apps/LogsViewer/LogsViewer.js @@ -15,13 +15,18 @@ * along with this program. If not, see . */ -import {CoreFilterCmpt} from '../components/filter/Filter.js'; -import {CoreNavigationCmpt} from '../components/navigation/Navigation.js'; +import {LogsViewerTabulatorOptions} from './TabulatorSetup.js'; +import {LogsViewerTabulatorEventHandlers} from './TabulatorSetup.js'; + +import {CoreFilterCmpt} from '../../components/filter/Filter.js'; +import {CoreNavigationCmpt} from '../../components/navigation/Navigation.js'; const logsViewerApp = Vue.createApp({ data() { return { - appSideMenuEntries: {} + appSideMenuEntries: {}, + logsViewerTabulatorOptions: LogsViewerTabulatorOptions, + logsViewerTabulatorEventHandlers: LogsViewerTabulatorEventHandlers }; }, components: { diff --git a/public/js/apps/LogsViewer/TabulatorSetup.js b/public/js/apps/LogsViewer/TabulatorSetup.js new file mode 100644 index 000000000..377b04ed6 --- /dev/null +++ b/public/js/apps/LogsViewer/TabulatorSetup.js @@ -0,0 +1,46 @@ +/** + * Copyright (C) 2022 fhcomplete.org + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +/** + * + */ +export const LogsViewerTabulatorOptions = { + height: 500, + layout: 'fitColumns', + columns: [ + {title: 'Log ID', field: 'LogId'}, + {title: 'Request ID', field: 'RequestId'}, + {title: 'Execution time', field: 'ExecutionTime'}, + {title: 'Executed by', field: 'ExecutedBy'}, + {title: 'Description', field: 'Description'}, + {title: 'Data', field: 'Data'}, + {title: 'Web service type', field: 'WebserviceType'} + ] +}; + +/** + * + */ +export const LogsViewerTabulatorEventHandlers = [ + { + event: "rowClick", + handler: function(e, row) { + alert(row.getData().Data); + } + } +]; + diff --git a/public/js/components/filter/Filter.js b/public/js/components/filter/Filter.js index 57bf86bda..e460842e0 100644 --- a/public/js/components/filter/Filter.js +++ b/public/js/components/filter/Filter.js @@ -32,7 +32,8 @@ export const CoreFilterCmpt = { type: String, required: true }, - tabulatorOptions: Object + tabulatorOptions: Object, + tabulatorEvents: Array }, data() { return { @@ -133,6 +134,17 @@ export const CoreFilterCmpt = { "#filterTableDataset", tabulatorOptions ); + + // + if (Array.isArray(this.tabulatorEvents) && this.tabulatorEvents.length > 0) + { + // + for (let i = 0; i < this.tabulatorEvents.length; i++) + { + // + this.tabulator.on(this.tabulatorEvents[i].event, this.tabulatorEvents[i].handler); + } + } }, methods: { /**