Commit Graph

167 Commits (master)

Author SHA1 Message Date
Jason Stirnaman 999d16e821 hotfix(analytics): typo 2025-07-14 13:11:24 -05:00
Jason Stirnaman d20492b6fe chore(analytics): Migrate to GA4 Google tag. If on the local server, use debug mode and prevent tracking. Add the www.influxdata.com Google tag script. Remove the conditional from header.html. Remove the old, unused GTM ID 2025-06-25 21:47:48 -05:00
Jason Stirnaman 377a157faa chore(js): Cleanup and add note about list-filters 2025-06-09 17:45:36 -05:00
Jason Stirnaman 8193057986
Update assets/js/datetime.js
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
2025-06-09 17:17:34 -05:00
Jason Stirnaman 3609fc9c92 chore(ci): Fail the commit if a module imports or uses debug helpers 2025-06-09 17:12:40 -05:00
Jason Stirnaman 717ec5cd1d chore(js): Extract Hugo params imports to single-purpose modules, fix environment-specific Hugo configs, use Hugo environments instead of specifying the config file, configure source maps and ESM for development and testing 2025-06-09 16:46:26 -05:00
Jason Stirnaman cd087af85d chore(js): Format fixes 2025-06-09 14:42:38 -05:00
Jason Stirnaman 4973026adf Merge pull request #6079 from influxdata/chore-js-refactor-footer-scripts-modules
Chore: JavaScript: refactor footer scripts modules
2025-06-09 14:40:37 -05:00
Scott Anderson 48b7025fda
removed references to OCI in clustered, fix toc-contents js, closes influxdata/DAR#503 (#6125) 2025-06-05 17:38:26 -05:00
Jason Stirnaman f819f48de9
Revert "Chore: JavaScript: refactor footer scripts modules" 2025-06-05 09:46:37 -05:00
Scott Anderson ef5fc1862e updated js syntax and resolved merge conflicts 2025-06-04 14:51:27 -06:00
Jason Stirnaman aac841a749 fix(ci): Disable unnecessary SCSS processing when building JS assets.
- Build resources if not cached
- Ensure node_modules dependencies are available for asset processing
- Be more precise in the template when building assets in production mode and avoid conflicts with SCSS and CSS processing.
- Ignore node_modules when loading source maps
- Add .vscode/launch.json with debugging configuration for localhost:1313. In VSCode, go to Run and select the site to launch Chrome, connect to Developer Tools, and start debugging.
- Add support for debugging in VS Code without using source maps. Adds a debug helpers module for developers to use in IDE debugging and interact with the browser console. This is a workaround for lack of good source map support with js.Build and the Hugo asset pipeline.

Background:
Hugo and js.Build don't have good support for external source maps.
Internal source mapping is also unreliable; the base64 in the source map reference for some files is too long for the browser console to keep on 1 line--remaining characters are printed on the next line, resulting in a syntax error.
2025-06-04 14:21:26 -05:00
Jason Stirnaman f908bab51f Update assets/js/components/diagram.js
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
2025-06-04 13:24:51 -05:00
Jason Stirnaman d184f45434 Update assets/js/flux-group-keys.js
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
2025-06-04 13:24:51 -05:00
Jason Stirnaman c43df7508f chore(js): Remove unnecessary JS module config, remove redundant index.js 2025-06-04 13:24:51 -05:00
Jason Stirnaman 483b41753a fix(style): datetime shortcode text blends with dark background
- When span.current-timestamp (and related shortcodes) are children of .article--content, the text isn't visible in the dark theme--it blends with the background.
- Add specific style settings for datetime shortcodes so that the timestamp text is visible outside of a table.
2025-06-04 13:24:51 -05:00
Jason Stirnaman de585ddfe6 fix(js): datetime: import jquery, clone date before mutating, define variable 2025-06-04 13:24:51 -05:00
Jason Stirnaman 67d3044e4a Update assets/js/datetime.js
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
2025-06-04 13:24:51 -05:00
Jason Stirnaman e3f49f6e47 Update assets/js/datetime.js
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
2025-06-04 13:24:51 -05:00
Jason Stirnaman c214ff44a8 fix(js): Apply fixes for CoPilot suggestions. 2025-06-04 13:24:51 -05:00
Jason Stirnaman 0696335ff6 fix(js): Apply fixes suggested by CoPilot.
- Fix inverted logic from previous commit in feature-callouts.js
- Pass  to other functions in flux-group-keys.js
2025-06-04 13:24:51 -05:00
Jason Stirnaman bf40c43b40 fix(js): Minor JS fixes: declare variable in keybindings.js, improve selector specificity in flux-group-keys, add group-key shortcode example to example.md 2025-06-04 13:24:51 -05:00
Jason Stirnaman 812d294e42 ### Refactor keybindings to a component and replace deprecated detection method
- Extracted platform detection to its own  reusable utility module
- Eliminates deprecated Navigator.platform API usage; uses the User-Agent Client Hints API as the primary method when available
- Handles iOS and Android devices correctly
2025-06-04 13:24:51 -05:00
Jason Stirnaman 76511caf47 Improve DocSearch loading
1. Refactor JavaScript from search.html into a new DocSearch Component Module. The component needs to include: - Asynchronous loading of Algolia docsearch.min.js - Proper Algolia search facets:

  - Nested arrays for AND conditions: In Algolia, filters in the same array are combined with OR, while arrays in an array are combined with AND
  - Space after colon: Algolia's parser expects this specific format
2. Update Search HTML Template: refactor the search.html to use the new component:

3. Register the Component in main.js: update main.js to import and register our new DocSearch component:

Improve SearchInteractions event handler coordination with DocSearch:

- Improve SearchInteractions to dynamically detect the dropdown added by Algolia DocSearch and ensure that blur and focus event handlers are registered after the dropdown loads.

Benefits of This Approach:

Asynchronous Loading: DocSearch.js is now loaded asynchronously, improving page load performance
Search functionality is encapsulated as a component
Clean Separation: HTML template only contains configuration data, not implementation
Event Communication: Components can react to DocSearch initialization via events
SearchInteractions dynamically detects dropdown: Instead of waiting for an event or using setTimeout, we actively observe DOM changes to detect when the dropdown is created.
Nested Observation: A second observer monitors changes to the dropdown itself, allowing code to respond to style changes.
Better Event Handling: The blur handler checks if the related target is inside the search components, preventing unwanted dropdown closing.
Resource Cleanup: The cleanup function disconnects all observers, preventing memory leaks.
Additional Interaction Control: Adds an event listener to the dropdown to prevent unwanted blur events when interacting with search results.
2025-06-04 13:24:50 -05:00
Jason Stirnaman f3ca2f5388 fix(diagram): Mermaid.js: dynamic loading, support dark theme, background color for edgeLabel paragraph elements
- Fixes dynamic loading of Mermaid.js
- Adds MutationObserver to handle light/dark theme switching.
- Sets the background-color for edgeLabel p elements to override a white background that obscures text in the dark theme.
2025-06-04 13:24:50 -05:00
Jason Stirnaman e7780f5c42 fix(theme-switch): ThemeSwitch() should pass the component when calling Theme(). 2025-06-04 13:24:50 -05:00
Jason Stirnaman 947554dba9 WIP: removed remaining scripts from footer/javascript.html. Migrated to components and utilities. Conditionally imports Mermaid if page has a diagram. 2025-06-04 13:24:50 -05:00
Jason Stirnaman 2a500f0dc4 WIP: Refactored all scripts from footer.js into components. Removed footer.js. Exports jQuery ($) to a window global for use by other scripts. Scripts bundled into footer.js didn't reliably load after jQuery. 2025-06-04 13:24:50 -05:00
Jason Stirnaman 3ce6bb4c3d WIP: Removed unused home-interactions.js 2025-06-04 13:24:50 -05:00
Scott Anderson 451fb58521 fix: serverless url replacement bug 2025-06-03 17:11:16 -06:00
Jason Stirnaman 34f6bec51e
Update assets/js/components/diagram.js
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
2025-06-03 10:11:38 -05:00
Jason Stirnaman 130a662567
Update assets/js/flux-group-keys.js
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
2025-06-02 17:40:38 -05:00
Jason Stirnaman 95ab1a1430 chore(js): Remove unnecessary JS module config, remove redundant index.js 2025-06-02 15:14:45 -05:00
Jason Stirnaman d3f7ab3511 fix(style): datetime shortcode text blends with dark background
- When span.current-timestamp (and related shortcodes) are children of .article--content, the text isn't visible in the dark theme--it blends with the background.
- Add specific style settings for datetime shortcodes so that the timestamp text is visible outside of a table.
2025-06-02 13:05:02 -05:00
Jason Stirnaman 008499d73e fix(js): datetime: import jquery, clone date before mutating, define variable 2025-06-02 13:05:02 -05:00
Jason Stirnaman a318eb682e Update assets/js/datetime.js
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
2025-06-02 13:05:02 -05:00
Jason Stirnaman 4570018a38 Update assets/js/datetime.js
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
2025-06-02 13:05:02 -05:00
Jason Stirnaman 9cabc40a91 fix(js): Apply fixes for CoPilot suggestions. 2025-06-02 13:05:02 -05:00
Jason Stirnaman ec0c815377 fix(js): Apply fixes suggested by CoPilot.
- Fix inverted logic from previous commit in feature-callouts.js
- Pass  to other functions in flux-group-keys.js
2025-06-02 13:05:02 -05:00
Jason Stirnaman 4296293fcc fix(js): Minor JS fixes: declare variable in keybindings.js, improve selector specificity in flux-group-keys, add group-key shortcode example to example.md 2025-06-02 13:05:02 -05:00
Jason Stirnaman 9fc0ff36d3 ### Refactor keybindings to a component and replace deprecated detection method
- Extracted platform detection to its own  reusable utility module
- Eliminates deprecated Navigator.platform API usage; uses the User-Agent Client Hints API as the primary method when available
- Handles iOS and Android devices correctly
2025-06-02 13:05:02 -05:00
Jason Stirnaman 4bbf1d7094 Improve DocSearch loading
1. Refactor JavaScript from search.html into a new DocSearch Component Module. The component needs to include: - Asynchronous loading of Algolia docsearch.min.js - Proper Algolia search facets:

  - Nested arrays for AND conditions: In Algolia, filters in the same array are combined with OR, while arrays in an array are combined with AND
  - Space after colon: Algolia's parser expects this specific format
2. Update Search HTML Template: refactor the search.html to use the new component:

3. Register the Component in main.js: update main.js to import and register our new DocSearch component:

Improve SearchInteractions event handler coordination with DocSearch:

- Improve SearchInteractions to dynamically detect the dropdown added by Algolia DocSearch and ensure that blur and focus event handlers are registered after the dropdown loads.

Benefits of This Approach:

Asynchronous Loading: DocSearch.js is now loaded asynchronously, improving page load performance
Search functionality is encapsulated as a component
Clean Separation: HTML template only contains configuration data, not implementation
Event Communication: Components can react to DocSearch initialization via events
SearchInteractions dynamically detects dropdown: Instead of waiting for an event or using setTimeout, we actively observe DOM changes to detect when the dropdown is created.
Nested Observation: A second observer monitors changes to the dropdown itself, allowing code to respond to style changes.
Better Event Handling: The blur handler checks if the related target is inside the search components, preventing unwanted dropdown closing.
Resource Cleanup: The cleanup function disconnects all observers, preventing memory leaks.
Additional Interaction Control: Adds an event listener to the dropdown to prevent unwanted blur events when interacting with search results.
2025-06-02 13:05:02 -05:00
Jason Stirnaman d92d253242 fix(diagram): Mermaid.js: dynamic loading, support dark theme, background color for edgeLabel paragraph elements
- Fixes dynamic loading of Mermaid.js
- Adds MutationObserver to handle light/dark theme switching.
- Sets the background-color for edgeLabel p elements to override a white background that obscures text in the dark theme.
2025-06-02 12:51:52 -05:00
Jason Stirnaman 3c64c01f75 fix(theme-switch): ThemeSwitch() should pass the component when calling Theme(). 2025-06-02 12:51:52 -05:00
Jason Stirnaman f7a5c53ecf WIP: removed remaining scripts from footer/javascript.html. Migrated to components and utilities. Conditionally imports Mermaid if page has a diagram. 2025-06-02 12:51:52 -05:00
Jason Stirnaman ccf74df759 WIP: Refactored all scripts from footer.js into components. Removed footer.js. Exports jQuery ($) to a window global for use by other scripts. Scripts bundled into footer.js didn't reliably load after jQuery. 2025-06-02 12:51:52 -05:00
Jason Stirnaman db4048f9e3 WIP: Removed unused home-interactions.js 2025-06-02 12:51:52 -05:00
Jason Stirnaman 4cfff239f3 End-to-end testing, CI script, and JavaScript QoL improvements:
- **Environment variable formatting** - Updated environment variable configuration from array format to object format to comply with Lefthook schema validation requirements.
- **Unified link testing** - Consolidated multiple product-specific link testing commands into a single `e2e-links` command that processes all staged Markdown and HTML files across content directories.
- **Package script integration** - Modified commands to use centralized yarn scripts instead of direct execution, improving maintainability and consistency.
- **Source information extraction** - Enhanced to correctly extract and report source information from frontmatter.
- **URL and source mapping** - Improved handling of URL to source path mapping for better reporting.
- **Ignored anchor links configuration** - Added proper exclusion of behavior-triggering anchor links (like tab navigation) to prevent false positives.
- **Request options correction** - Fixed Cypress request options to ensure `failOnStatusCode` is properly set when `retryOnStatusCodeFailure` is enabled.
- **Improved error reporting** - Enhanced error reporting with more context about broken links.
- **New test scripts added** - Added centralized testing scripts for link checking and codeblock validation.
- **Product-specific test commands** - Added commands for each product version (InfluxDB v2, v3 Core, Enterprise, Cloud, etc.).
- **API docs testing** - Added specialized commands for testing API documentation links.
- **Comprehensive test runners** - Added commands to run all tests of a specific type (`test:links:all`, `test:codeblocks:all`).
- Fix Docker build command and update CONTRIBUTING.

chore(js): JavaScript QoL improvements:

- Refactor main.js with a componentRegistry object and clear initialization of components and globals
- Add a standard index.js with all necessary exports.
- Update javascript.html to use the index.js
- Remove jQuery script tag from header javascript.html (remains in footer)
- Update package file to improve module discovery.
- Improve Hugo and ESLint config for module discovery and ES6 syntax
2025-05-19 09:50:33 -05:00
Jason Stirnaman bf7b395b06 chore(code-placeholders): Support path-like patterns:
- Assigns the match expression to a data attribute (data-id) to use in eleement selection. Previously, it assigned the regex expression to input.id and used the ID to select the element when updating the placeholder value. A regex that starts with a slash causes an error; input#/path/to/match isn't a valid id.
- Supports placeholders like '\/path\/to\/file.parquet'
- Refactors code-placeholders to the component pattern.
2025-04-23 10:27:20 -05:00
Jason Stirnaman ae054efed7
Revert "chore(code-placeholders): Support path-like patterns:" 2025-04-23 10:21:02 -05:00