Alpha Change Tracker Plugin Documentation

The Alpha Change Tracker Plugin is designed to monitor changes in the workspace and prevent unintentional navigation away from unsaved modifications. This plugin can be accessed using ap.tracker and provides methods to track the “dirty” state of specific workspace areas.

Features

  • Tracks modifications in different workspace sections as caseDetails & mainMenuPage.
  • Supports navigation guard to prevent accidental data loss.
  • Displays an alert if unsaved changes exist when attempting to navigate away.

Methods

The plugin provides three core methods:

1. isDirty(type: string): boolean

  • Description: Checks if a specific workspace section has unsaved changes.

  • Parameters:

    • type (string): The workspace section to check. Accepted values:
      • "caseDetails"
      • "mainMenuPage"
  • Returns: true if there are unsaved changes, otherwise false.

  • Example:

    if (ap.tracker.isDirty("caseDetails")) {
        console.warn("Unsaved changes exist in case details!");
    }
    

2. markAsDirty(type: string): void

  • Description: Explicitly marks a section of the workspace as dirty (modified).

  • Parameters:

    • type (string): The workspace section to mark as dirty. Accepted values:
      • "caseDetails"
      • "mainMenuPage"
  • Example:

    ap.tracker.markAsDirty("mainMenuPage");
    

3. markAsClean(type: string): void

  • Description: Marks a workspace section as clean (no unsaved changes).

  • Parameters:

    • type (string): The workspace section to mark as clean. Accepted values:
      • "caseDetails"
      • "mainMenuPage"
  • Example:

    ap.tracker.markAsClean("caseDetails");
    

Enable Navigation Guard

  • If Navigation Guard is enabled and the workspace is dirty, the plugin prevents navigation away and prompts the user with an alert:
    “Do you want to navigate away without saving the changes?”

  • This ensures users do not lose unsaved modifications accidentally.
5 Likes