Skip to content

Fix ScriptTask UI button actions and scheduled job handling for current MeshCentral versions#69

Open
fud18 wants to merge 9 commits into
ryanblenis:masterfrom
fud18:master
Open

Fix ScriptTask UI button actions and scheduled job handling for current MeshCentral versions#69
fud18 wants to merge 9 commits into
ryanblenis:masterfrom
fud18:master

Conversation

@fud18

@fud18 fud18 commented Jul 2, 2026

Copy link
Copy Markdown

Fix ScriptTask UI compatibility and editor functionality for current MeshCentral versions

Summary

This pull request fixes several compatibility issues in the ScriptTask plugin that prevent normal operation on current versions of MeshCentral.

While testing the plugin against the latest MeshCentral release, several UI actions, scheduled task functions, and the script editor were either non-functional or generated server-side errors. This PR restores those features while preserving the plugin’s original workflow and behavior.

User Interface

Toolbar Improvements

  • Updated the toolbar to use modern MeshCentral-style buttons.
  • Fixed the following toolbar actions:
    • New
    • Rename
    • Edit
    • Delete
    • New Folder
    • Download
    • Run
    • Schedule on Selected
  • Removed conflicting event handling that caused button actions to execute twice or require multiple confirmations.
  • Simplified the button implementation for improved compatibility with current MeshCentral releases.

Script Editor

Save Functionality

Fixed an issue where editing a script did not properly save changes on current MeshCentral versions.

Changes include:

  • Fixed the Save callback to correctly update the parent window.
  • Fixed Save so the editor automatically closes after a successful save.
  • Renamed the Close button to Cancel for improved usability and consistency.
  • Preserved the existing editing workflow while restoring expected behavior.

Scheduled Jobs

Scheduling

  • Fixed scheduled job creation when only a single node is selected.
  • Fixed scheduled job creation for both single-node and multi-node selections.
  • Improved reliability of scheduled task management.

Schedule Deletion

  • Fixed deletion of scheduled jobs by correctly identifying the selected schedule row.
  • Eliminated issues where Delete actions failed because the incorrect DOM element was referenced.

Backend Improvements

Added validation before processing script content to prevent orphaned or invalid scheduled jobs from causing server exceptions.

This prevents errors similar to:

TypeError: Cannot read properties of undefined (reading 'content')

and previously:

TypeError: Cannot read properties of undefined (reading 'match')

when scheduled jobs reference missing or deleted scripts.

Instead of crashing, invalid scheduled jobs are now skipped safely.

Compatibility

These changes improve compatibility with current MeshCentral releases while maintaining backward compatibility with the existing plugin design.

No changes were made to the overall plugin workflow or user experience beyond restoring broken functionality.

Testing Performed

The following functionality has been tested successfully:

Script Management

  • ✅ Create Script
  • ✅ Rename Script
  • ✅ Edit Script
  • ✅ Save Script
  • ✅ Save and automatically close editor
  • ✅ Cancel editing
  • ✅ Delete Script
  • ✅ Create Folder
  • ✅ Download Script

Execution

  • ✅ Run Script
  • ✅ Schedule Script
  • ✅ Schedule on one node
  • ✅ Schedule on multiple nodes
  • ✅ Delete Scheduled Jobs

History

  • ✅ Script History
  • ✅ Node History

General

  • ✅ Plugin loads correctly on current MeshCentral versions
  • ✅ No JavaScript errors during normal operation
  • ✅ No server-side exceptions caused by invalid scheduled jobs

Goal

The goal of this pull request is to restore compatibility with current MeshCentral releases while preserving the original functionality and user workflow of the ScriptTask plugin.

This pull request intentionally focuses on bug fixes and compatibility improvements without introducing new features or altering the existing design.

Future enhancements—such as additional UI modernization, dark mode improvements, and code cleanup—can be submitted separately to keep this pull request focused and easy to review.

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.

1 participant