Skip to content

Fix elementOptions: rename typo 'ordeable' to 'orderable'#1585

Merged
jokob-sk merged 2 commits intonetalertx:mainfrom
sebingel:fix/ordeable-typo-refactoring
Apr 3, 2026
Merged

Fix elementOptions: rename typo 'ordeable' to 'orderable'#1585
jokob-sk merged 2 commits intonetalertx:mainfrom
sebingel:fix/ordeable-typo-refactoring

Conversation

@sebingel
Copy link
Copy Markdown
Contributor

@sebingel sebingel commented Apr 3, 2026

Summary

  • The key "ordeable" in elementOptions has been a typo for "orderable" since the beginning
  • The JS check in settings_utils.js used the same misspelled key, so the feature worked consistently on both sides — no functional breakage existed
  • Two entries in ui_settings/config.json already used the correct spelling, but with "orderable": "false" — so the spelling mismatch had no functional impact there either
  • This renames the key atomically across all 35 affected files for consistency and correctness

Changes

  • front/js/settings_utils.js: option.ordeableoption.orderable, isOrdeableisOrderable (6 occurrences)
  • server/initialise.py:245: "ordeable""orderable" in the hardcoded LOADED_PLUGINS JSON string
  • front/plugins/*/config.json (33 files, 90 occurrences): renamed via sed
  • front/multiEditCore.php:139: isOrdeableisOrderable (destructured property name alignment)

🔍 Related Issues

Closes #1584


📋 Type of Change

  • 🐛 Bug fix
  • ♻️ Code refactor

🧪 Testing Steps

  • Open /settings.php, navigate to any plugin section (e.g. ARP Scan) and verify that orderable multi-selects (e.g. "Set always columns") still support drag-to-reorder
  • Run grep -r "ordeable" front/plugins server front/js — expect zero results

✅ Checklist

  • I have read the Contribution Guidelines
  • I have tested my changes locally
  • I have updated relevant documentation (if applicable)
  • I have verified my changes do not break existing behavior
  • I am willing to respond to requested changes and feedback

🤖 Generated with Claude Code

Summary by CodeRabbit

Release Notes

  • Bug Fixes
    • Fixed property naming for select element ordering in configuration settings across multiple plugins, ensuring multi-select dropdowns function correctly.

The key 'ordeable' in elementOptions was a long-standing typo for the
correct English word 'orderable'. Since the JS check in settings_utils.js
used the same misspelled key, the feature appeared to work — but it was
relying on the consistent propagation of a typo across the entire codebase.

Two pre-existing entries in front/plugins/ui_settings/config.json already
used the correct spelling 'orderable', but these had no effect because the
JavaScript check (option.ordeable === 'true') never matched them. As a
result, orderable behavior was silently disabled for those two settings.

Changes:
- front/js/settings_utils.js: renamed option.ordeable → option.orderable
  and isOrdeable → isOrderable (6 occurrences, lines 792/823/824/880/1079/
  1192/1228). The JS key check is the authoritative definition of the
  elementOptions property name, so this must change atomically with all
  config files.

- server/initialise.py:245: renamed "ordeable" → "orderable" in the
  hardcoded JSON string for LOADED_PLUGINS setting. This string is the
  source-of-truth for that setting's elementOptions and is not auto-
  generated from the plugin config files.

- front/plugins/*/config.json (33 files, 90 occurrences): renamed all
  "ordeable": "true" entries to "orderable": "true" via sed. All plugins
  used the typo consistently; they must be updated in the same commit to
  avoid a broken intermediate state.

The two formerly broken 'orderable' entries in ui_settings/config.json
are now matched by the corrected JS check and work as intended.

Fixes netalertx#1584

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai bot commented Apr 3, 2026

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 2b8030e6-f5ff-44c5-814d-7c57066df9d6

📥 Commits

Reviewing files that changed from the base of the PR and between 4c117db and 998c38f.

📒 Files selected for processing (1)
  • front/multiEditCore.php

📝 Walkthrough

Walkthrough

This PR renames the misspelled select option key "ordeable""orderable" across front-end JS, plugin config JSONs, and server initialization metadata; it also renames internal identifiers (isOrdeableisOrderable) and updates downstream uses to reference the corrected name.

Changes

Cohort / File(s) Summary
Front-end settings logic
front/js/settings_utils.js, front/multiEditCore.php
Renamed internal identifier isOrdeableisOrderable; changed checks from option.ordeableoption.orderable; updated downstream usages (option parsing, value collection, select CSS class application, prop passing).
Plugin configuration files
front/plugins/.../config.json
front/plugins/__template/config.json, front/plugins/adguard_import/config.json, front/plugins/arp_scan/config.json, front/plugins/asuswrt_import/config.json, front/plugins/avahi_scan/config.json, front/plugins/ddns_update/config.json, front/plugins/dhcp_leases/config.json, front/plugins/dhcp_servers/config.json, front/plugins/dig_scan/config.json, front/plugins/freebox/config.json, front/plugins/icmp_scan/config.json, front/plugins/internet_ip/config.json, front/plugins/internet_speedtest/config.json, front/plugins/ipneigh/config.json, front/plugins/luci_import/config.json, front/plugins/mikrotik_scan/config.json, front/plugins/nbtscan_scan/config.json, front/plugins/newdev_template/config.json, front/plugins/nmap_dev_scan/config.json, front/plugins/nmap_scan/config.json, front/plugins/notification_processing/config.json, front/plugins/nslookup_scan/config.json, front/plugins/omada_sdn_imp/config.json, front/plugins/omada_sdn_openapi/config.json, front/plugins/pihole_api_scan/config.json, front/plugins/pihole_scan/config.json, front/plugins/snmp_discovery/config.json, front/plugins/sync/config.json, front/plugins/ui_settings/config.json, front/plugins/unifi_api_import/config.json, front/plugins/unifi_import/config.json, front/plugins/vendor_update/config.json, front/plugins/website_monitor/config.json
Fixed typo in elementOptions for multi-select controls: replaced "ordeable": "true" with "orderable": "true" in SET_ALWAYS / SET_EMPTY / WATCH / REPORT_ON and other select element definitions; no other config values changed.
Server initialization metadata
server/initialise.py
Updated inline JSON metadata for LOADED_PLUGINS setting: "ordeable":"true""orderable":"true".

Possibly related PRs

Poem

🐇 I hopped through JSON, keys in sight,
Replaced "ordeable" with proper might.
Now selects can order, neat and bright,
A little fix, a rabbit's delight! ✨

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately summarizes the main change: fixing the typo 'ordeable' to 'orderable' across the codebase, which is the primary purpose of this PR.
Linked Issues check ✅ Passed All coding requirements from issue #1584 are met: the misspelled 'ordeable' key was replaced with 'orderable' in JS (settings_utils.js, multiEditCore.php) and all 33 plugin config.json files plus server/initialise.py.
Out of Scope Changes check ✅ Passed All changes are directly related to fixing the 'ordeable' typo as specified in issue #1584; no unrelated modifications or scope creep detected.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
front/js/settings_utils.js (1)

1-1538: ⚠️ Potential issue | 🔴 Critical

Fix property name and return value inconsistency with multiEditCore.php.

The handleElementOptions() function has two mismatches with multiEditCore.php:

  1. Property name: Line 1103 checks for option.orderable === "true", but config.json files use ordeable (not orderable). Change to option.ordeable === "true".

  2. Return property: The function returns isOrderable, but multiEditCore.php (line 139) destructures isOrdeable, causing the variable to be undefined. Either rename the variable to isOrdeable throughout the function or adjust the return statement to match what multiEditCore.php expects.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@front/js/settings_utils.js` around lines 1 - 1538, The handleElementOptions
function currently checks option.orderable and returns isOrderable while
multiEditCore.php expects option.ordeable and the returned property name
isOrdeable; fix by reading option.ordeable === "true" (instead of orderable) and
return the property with the exact name expected by multiEditCore.php
(isOrdeable) or rename usages in multiEditCore.php to match—ensure both the
local variable (previously isOrderable) and the returned object property match
the identifier isOrdeable, and update any internal uses in handleElementOptions
(e.g., where you set addCss or logic relying on ordering) to reference the
renamed variable.
🧹 Nitpick comments (1)
front/js/settings_utils.js (1)

1226-1228: Pre-existing: const declaration in switch case without block scope.

The static analysis tool flags this const declaration inside a case block. While not introduced by this PR, it can cause issues if other cases accidentally reference addCss. Consider wrapping the case body in a block.

🔧 Suggested fix to add block scope
     switch (elementType) {
-      case 'select':
+      case 'select': {
         const multi = isMultiSelect ? "multiple" : "";
         const addCss = isOrderable ? "select2 select2-hidden-accessible" : "";
         // ... rest of case body ...
         break;
+      }

Apply similar blocks to other cases with const/let declarations.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@front/js/settings_utils.js` around lines 1226 - 1228, The const declarations
inside the switch case ('select') (variables multi and addCss that use
isMultiSelect and isOrderable) need to be scoped to a block to avoid hoisting
issues; wrap the case 'select' body in braces ({ ... }) so the consts are
block-scoped, and apply the same pattern to any other switch cases that declare
let/const to prevent cross-case name collisions.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@front/plugins/notification_processing/config.json`:
- Line 37: Revert the incorrect key value in the plugin config: change the
elementOptions entry that currently uses "orderable" back to the required
project spelling "ordeable" so the frontend continues to work; specifically
update the elementOptions array item (the object containing "multiple": "true")
to use "ordeable": "true" instead of "orderable": "true" and ensure no other
occurrences of "orderable" remain in this plugin's config.json.

---

Outside diff comments:
In `@front/js/settings_utils.js`:
- Around line 1-1538: The handleElementOptions function currently checks
option.orderable and returns isOrderable while multiEditCore.php expects
option.ordeable and the returned property name isOrdeable; fix by reading
option.ordeable === "true" (instead of orderable) and return the property with
the exact name expected by multiEditCore.php (isOrdeable) or rename usages in
multiEditCore.php to match—ensure both the local variable (previously
isOrderable) and the returned object property match the identifier isOrdeable,
and update any internal uses in handleElementOptions (e.g., where you set addCss
or logic relying on ordering) to reference the renamed variable.

---

Nitpick comments:
In `@front/js/settings_utils.js`:
- Around line 1226-1228: The const declarations inside the switch case
('select') (variables multi and addCss that use isMultiSelect and isOrderable)
need to be scoped to a block to avoid hoisting issues; wrap the case 'select'
body in braces ({ ... }) so the consts are block-scoped, and apply the same
pattern to any other switch cases that declare let/const to prevent cross-case
name collisions.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 72abed3f-499b-4715-8095-fdc17db1864c

📥 Commits

Reviewing files that changed from the base of the PR and between 9f3dbe2 and 4c117db.

📒 Files selected for processing (35)
  • front/js/settings_utils.js
  • front/plugins/__template/config.json
  • front/plugins/adguard_import/config.json
  • front/plugins/arp_scan/config.json
  • front/plugins/asuswrt_import/config.json
  • front/plugins/avahi_scan/config.json
  • front/plugins/ddns_update/config.json
  • front/plugins/dhcp_leases/config.json
  • front/plugins/dhcp_servers/config.json
  • front/plugins/dig_scan/config.json
  • front/plugins/freebox/config.json
  • front/plugins/icmp_scan/config.json
  • front/plugins/internet_ip/config.json
  • front/plugins/internet_speedtest/config.json
  • front/plugins/ipneigh/config.json
  • front/plugins/luci_import/config.json
  • front/plugins/mikrotik_scan/config.json
  • front/plugins/nbtscan_scan/config.json
  • front/plugins/newdev_template/config.json
  • front/plugins/nmap_dev_scan/config.json
  • front/plugins/nmap_scan/config.json
  • front/plugins/notification_processing/config.json
  • front/plugins/nslookup_scan/config.json
  • front/plugins/omada_sdn_imp/config.json
  • front/plugins/omada_sdn_openapi/config.json
  • front/plugins/pihole_api_scan/config.json
  • front/plugins/pihole_scan/config.json
  • front/plugins/snmp_discovery/config.json
  • front/plugins/sync/config.json
  • front/plugins/ui_settings/config.json
  • front/plugins/unifi_api_import/config.json
  • front/plugins/unifi_import/config.json
  • front/plugins/vendor_update/config.json
  • front/plugins/website_monitor/config.json
  • server/initialise.py

{
"elementType": "select",
"elementOptions": [{ "multiple": "true", "ordeable": "true" }],
"elementOptions": [{ "multiple": "true", "orderable": "true" }],
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🔴 Critical

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
# Description: Verify no remaining "ordeable" occurrences in the codebase

echo "=== Checking for remaining 'ordeable' in front/plugins ==="
rg -n '"ordeable"' front/plugins/ || echo "✓ No occurrences found in front/plugins"

echo ""
echo "=== Checking for remaining 'ordeable' in server/ ==="
rg -n '"ordeable"' server/ || echo "✓ No occurrences found in server/"

echo ""
echo "=== Checking for remaining 'ordeable' in front/js/ ==="
rg -n 'ordeable' front/js/ || echo "✓ No occurrences found in front/js/"

echo ""
echo "=== Verifying 'orderable' is now used consistently ==="
rg -c '"orderable"' front/plugins/ | head -20

Repository: netalertx/NetAlertX

Length of output: 1238


Revert to "ordeable" — this change breaks frontend functionality.

The migration from "ordeable" to "orderable" is incorrect. The elementOptions property in plugin config.json files requires the spelling "ordeable" (not "orderable") for proper frontend functionality. The current change will cause the frontend to malfunction. This property name spelling will be standardized across the project in the future, but for now it must remain "ordeable".

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@front/plugins/notification_processing/config.json` at line 37, Revert the
incorrect key value in the plugin config: change the elementOptions entry that
currently uses "orderable" back to the required project spelling "ordeable" so
the frontend continues to work; specifically update the elementOptions array
item (the object containing "multiple": "true") to use "ordeable": "true"
instead of "orderable": "true" and ensure no other occurrences of "orderable"
remain in this plugin's config.json.

@sebingel sebingel marked this pull request as draft April 3, 2026 18:47
…value

The rename of the elementOptions key from "ordeable" to "orderable" (part of
netalertx#1584) updated handleElementOptions() in settings_utils.js to return the
property as isOrderable. However, multiEditCore.php still destructured the
old name isOrdeable from that return value (line 139). Because JavaScript
object destructuring resolves properties by name, isOrdeable would silently
evaluate to undefined — no runtime error, just a broken binding.

The bug was masked because isOrdeable is not referenced after destructuring
in the current code of multiEditCore.php. The incorrect binding would become
a functional regression as soon as that code path is extended to actually
consume the orderable flag (e.g. to conditionally apply select2 sorting in
the multi-edit form).

Changes:
- front/multiEditCore.php:139 — isOrdeable → isOrderable
  Aligns the destructured property name with the renamed return key of
  handleElementOptions() so the binding resolves to the correct boolean
  value instead of undefined.

All 35 previously updated files already use the correct spelling; this was
the single remaining inconsistency. After this commit, grep for "isOrdeable"
and "ordeable" across front/ and server/ returns zero results.
@sebingel sebingel marked this pull request as ready for review April 3, 2026 20:04
@jokob-sk jokob-sk merged commit a8131a6 into netalertx:main Apr 3, 2026
5 checks passed
@sebingel sebingel deleted the fix/ordeable-typo-refactoring branch April 4, 2026 11:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Typo: "ordeable" should be "orderable" across codebase

2 participants