From 09215f73969fb07dfce319c97f8842cc5e9b74a3 Mon Sep 17 00:00:00 2001 From: Richie Rump Date: Thu, 22 May 2025 13:06:31 -0400 Subject: [PATCH 01/20] Upgraded Statistics Parser into the future. Upgraded all modules to the current version, replaced them with newer modules, or removed them all together. Includes: jQuery, Bootstrap, DataTables, Moment -> Luxon, Numeral (removed), Purl (removed), jQuery Cookies (removed). --- .gitignore | 4 + src/about.html | 62 ++++++----- src/assets/css/style.css | 4 +- src/assets/data/languagetext-en.json | 3 + src/assets/data/languagetext-es.json | 3 + src/assets/data/languagetext-it.json | 3 + src/assets/js/statsioparser.js | 153 +++++++++++++++++++-------- src/index.html | 129 ++++++++++++---------- 8 files changed, 237 insertions(+), 124 deletions(-) diff --git a/.gitignore b/.gitignore index 2b5f8f8..4696a19 100644 --- a/.gitignore +++ b/.gitignore @@ -106,3 +106,7 @@ _UpgradeReport_Files/ Backup*/ UpgradeLog*.XML src/sql/Dashboard Query Scratch.sql + +# Node Modules +node_modules/ +dist/ diff --git a/src/about.html b/src/about.html index 2388b4c..fdced7b 100644 --- a/src/about.html +++ b/src/about.html @@ -8,10 +8,13 @@ - - + - + + + + + - - - - +
-
StatisticsIOParser.com is now StatisticsParser.com! New name, same great taste!
+

Statistics Parser

@@ -69,9 +77,9 @@

Statistics Parser

-
@@ -80,18 +88,20 @@

Statistics Parser

-
- +
@@ -106,49 +116,60 @@

Statistics Parser

- + + + + + + From 24827b67a37b5e2c3aa307bf05c366602bf568ca Mon Sep 17 00:00:00 2001 From: Richie Rump Date: Thu, 22 May 2025 13:23:09 -0400 Subject: [PATCH 02/20] Moved example checkbox to the options dropdown. Close #29. Close #30 --- src/assets/js/statsioparser.js | 4 ++-- src/index.html | 39 ++++++---------------------------- 2 files changed, 8 insertions(+), 35 deletions(-) diff --git a/src/assets/js/statsioparser.js b/src/assets/js/statsioparser.js index 5d33486..15a32fe 100644 --- a/src/assets/js/statsioparser.js +++ b/src/assets/js/statsioparser.js @@ -496,7 +496,6 @@ function clearResult() { document.getElementById("result").innerHTML = ''; } else { document.getElementById("statiotext").value = ''; - document.getElementById("exampleCheck").checked = false; } document.getElementById("clearButton").innerHTML = 'Clear Text'; } @@ -557,4 +556,5 @@ function getLanguageText(languageType = 'en', urlStatsOutput) { resolve(langText); }); }); -} \ No newline at end of file +} + diff --git a/src/index.html b/src/index.html index 29cb73e..2a8f2c3 100644 --- a/src/index.html +++ b/src/index.html @@ -12,11 +12,7 @@ - - - - @@ -75,7 +70,7 @@

Statistics Parser

This site is entirely written in JavaScript and HTML. So your data stays where it should...in your browser. Your data is never sent to a server. The site also uses the awesome Bootstrap CSS framework so a regular SQL hack like myself can create great looking sites. JQuery and the DataTables plug-in are also used to format the STATISTICS IO results. The source for this site is located on GitHub if you're so inclined to take a peek at it (view source is also an option...I'm just sayin').

- I hope you find this site useful. If you have any questions or comments feel free to hit me up over on my blog or twitter. Enjoy. + I hope you find this site useful. If you have any questions or comments feel free to hit me up over on my BlueSky (@jorriss.bsky.social) account. Enjoy.

Richie

@@ -97,48 +92,16 @@

Special Thanks

Built and maintained by Richie Rump (BlueSky - @jorriss.bsky.social) and the fine folks at Brent Ozar Unlimited.

-

version

+

version __VERSIONNUMBER__

+ - - - - - - - - - - - - - + + diff --git a/src/assets/css/style.css b/src/assets/css/style.css deleted file mode 100644 index 58dc97e..0000000 --- a/src/assets/css/style.css +++ /dev/null @@ -1,136 +0,0 @@ -textarea { - border: 1px solid #999999; - width: 100%; - padding: 7px 0 7px 7px; - position: relative; -} - -label { - font-weight: normal; -} - -table { - font-size: 12px; -} - -h1 { - font-weight: bold; -} - -td { - white-space: pre; /* CSS 2.0 */ - white-space: pre-wrap; /* CSS 2.1 */ - white-space: pre-line; /* CSS 3.0 */ - white-space: -pre-wrap; /* Opera 4-6 */ - white-space: -o-pre-wrap; /* Opera 7 */ - white-space: -moz-pre-wrap; /* Mozilla */ - white-space: -hp-pre-wrap; /* HP Printers */ - word-wrap: break-word; /* IE 5+ */ -} - -.container { - width: 940px; -} - -.button-padding { - padding: 0px 7px 0px 7px; -} - -.button-inner-margin { - margin-left: 10px; -} - -.remove-margin { - padding: 0 !important; - margin: 0 !important; -} - -.navbar-brand { - font-size: 20px; -} -.error-text { - color: red; - font-weight: bold; -} - -.strong-text { - font-weight: bold; -} -.table-nonfluid { - width: 550px; -} - -.td-column-timetype { - width: 300px; -} - -.td-total { - font-weight:bold; -} - -.th-column { - padding: 4px 20px 4px 5px !important; -} - -.column-small { - width: 40px !important; -} - -.column-medium { - width: 70px !important; -} - -.column-large { - width: 85px !important; -} - -.column-xlarge { - width: 100px !important; -} - -.td-column-right { - text-align: right !important; - padding-right: 20px !important; -} - -.footer-column { - font-weight: bold; - padding: 4px 20px 4px 5px !important; -} - -.footer { - text-align: center; - padding: 30px 0; - margin-top: 70px; - border-top: 1px solid #e5e5e5; - background-color: #f5f5f5; -} - -.scroll-to-top { - position: fixed; - bottom: 20px; - left: 75px; - width: 40px; - height: 40px; - border-radius: 50%; - background-color: transparent; - color: #333333; - border: none; - cursor: pointer; - display: none; - align-items: center; - justify-content: center; - font-size: 20px; - box-shadow: 0 2px 5px rgba(0,0,0,0.1); - transition: all 0.3s ease; - z-index: 1000; -} - -.scroll-to-top:hover { - background-color: rgba(13, 110, 253, 0.1); - transform: translateY(-2px); -} - -.scroll-to-top.visible { - display: flex; -} \ No newline at end of file diff --git a/src/assets/js/statisticsparser.js b/src/assets/js/modules/displaystats.js similarity index 97% rename from src/assets/js/statisticsparser.js rename to src/assets/js/modules/displaystats.js index 1107b76..08378a9 100644 --- a/src/assets/js/statisticsparser.js +++ b/src/assets/js/modules/displaystats.js @@ -1,8 +1,7 @@ // Import dependencies import { DateTime, Duration } from 'luxon'; import DataTable from 'datatables.net-dt'; -import { parseData, rowEnum } from './modules/parser.js'; - +import { parseData, rowEnum } from './parser.js'; // Display functionality function formatNumber(value, langvalue = 'en') { @@ -47,7 +46,7 @@ function formatExtendedTimestamp(text, locale = 'en') { } } -function createDataTable(tableid, data, columns) { +function createDataTable(tableid, data, columns, showScrollbar = false) { return new DataTable(`#${tableid}`, { data: data, columns: columns, @@ -55,8 +54,8 @@ function createDataTable(tableid, data, columns) { ordering: true, searching: false, paging: false, - scrollY: localStorage.getItem("tableScrollbar") === 'true' ? '200px' : false, - scrollCollapse: false, + scrollY: showScrollbar ? '200px' : false, + scrollCollapse: showScrollbar ? true : false, order: [[0, 'asc']] // Default sort by row number }); } @@ -515,7 +514,7 @@ function displayTimeTotalTable(executiondata, compiledata, lang) { return table; } -function displayParsedData(parsedData, lang) { +export function displayParsedData(parsedData, showScrollbar, lang) { let outputElement = document.getElementById('result'); let columns = displayIOTableColumns(lang); @@ -526,7 +525,7 @@ function displayParsedData(parsedData, lang) { case rowEnum.IO: let table = displayIOTable(rowData, columns, lang); outputElement.appendChild(table); - createDataTable(rowData.tableid, rowData.data, columns); + createDataTable(rowData.tableid, rowData.data, columns, showScrollbar); break; case rowEnum.ExecutionTime: outputElement.appendChild(displayTimeTable(rowData, lang)); @@ -556,16 +555,7 @@ function displayParsedData(parsedData, lang) { let totalsColumns = displayIOTotalTableColumns(lang); outputElement.appendChild(displayIOTotalTable(parsedData.total.iototal, totalsColumns, lang)); outputElement.appendChild(document.createElement('br')); - createDataTable(parsedData.total.iototal.tableid, parsedData.total.iototal.data, totalsColumns); + createDataTable(parsedData.total.iototal.tableid, parsedData.total.iototal.data, totalsColumns, showScrollbar); } outputElement.appendChild(displayTimeTotalTable(parsedData.total.executiontotal, parsedData.total.compiletotal, lang)); -} - -export function parseText(lang) { - const text = document.getElementById("statiotext").value; - const parsedData = parseData(text, lang); - - displayParsedData(parsedData, lang); - - return parsedData; -} +} \ No newline at end of file diff --git a/src/assets/js/modules/language.js b/src/assets/js/modules/language.js index 292f80e..ce8e898 100644 --- a/src/assets/js/modules/language.js +++ b/src/assets/js/modules/language.js @@ -7,9 +7,9 @@ */ function determineLangFilename(langType) { const languageFiles = { - 'en': 'assets/data/languagetext-en.json', - 'es': 'assets/data/languagetext-es.json', - 'it': 'assets/data/languagetext-it.json' + 'en': './data/languagetext-en.json', + 'es': './data/languagetext-es.json', + 'it': './data/languagetext-it.json' }; return languageFiles[langType] || languageFiles['en']; @@ -40,7 +40,11 @@ export async function getLanguageText(languageType = 'en') { } catch (error) { console.error('Error loading language file:', error); // Fallback to English if there's an error - return getLanguageText('en'); + if (languageType != 'en') { + return getLanguageText('en'); + } else { + throw new Error('Error loading language file: ' + error); + } } } @@ -53,6 +57,10 @@ export function updateUIElements(langText) { if (langText.showexample) { document.getElementById("exampleText").innerHTML = langText.showexample; } + + if (langText.tableshavescrollbars) { + document.getElementById("scrollbarOptionText").innerHTML = langText.tableshavescrollbars; + } // Update button texts if (langText.buttonclear) { @@ -80,8 +88,8 @@ export function updateUIElements(langText) { * @param {string} [urlStatsOutput] - Optional stats output from URL * @returns {Promise} Promise resolving to the language text object */ -export async function initializeLanguage(initialLang = 'en', urlStatsOutput) { - const langText = await getLanguageText(initialLang, urlStatsOutput); +export async function initializeLanguage(initialLang = 'en',) { + const langText = await getLanguageText(initialLang); updateUIElements(langText); return langText; } \ No newline at end of file diff --git a/src/assets/js/modules/parser.js b/src/assets/js/modules/parser.js index 17fb3fe..2d082c1 100644 --- a/src/assets/js/modules/parser.js +++ b/src/assets/js/modules/parser.js @@ -369,13 +369,3 @@ export function parseData(text, lang) { return parsedData; } - -/** - * Main parsing function that processes input and returns structured data - * @param {Object} lang - Language object for text - * @returns {Object} Parsed data object - */ -export function parseText(lang) { - const text = document.getElementById("statiotext").value; - return parseData(text, lang); -} \ No newline at end of file diff --git a/src/assets/js/modules/ui.js b/src/assets/js/modules/ui.js index 04b6564..c7508b6 100644 --- a/src/assets/js/modules/ui.js +++ b/src/assets/js/modules/ui.js @@ -111,14 +111,6 @@ export function toggleResultControls(hasData) { document.getElementById("resultControls").style.display = hasData ? 'block' : 'none'; } -/** - * Updates the version number display - * @param {string} version - The version number to display - */ -export function displayVersionNumber(version) { - document.getElementById("versionNumber").innerHTML = version; -} - /** * Initializes all UI components * @param {Object} lang - Language object for text diff --git a/src/index.html b/src/index.html index 72a73ea..7f1de1e 100644 --- a/src/index.html +++ b/src/index.html @@ -101,7 +101,7 @@

Statistics Parser

- +