How to Embed Custom Panels (e.g. DVR) in the Workspace

Creating custom windows from Scripts

It is possible to integrate custom video-streaming panels into the Vehicle Tracker.

Requisites

Example: Window Displaying Vehicle DVR

If you have vehicles with cameras you can integrate a video URL from each vehicle.

1. Set up a user custom field with the label VehicleCameraURL.

2. Edit the vehicle adding the video-stream URL

mceclip0.png

3. Go to Admin > Development > App Builder and create a new App. The name of the app could be anything you want.

4. Inside this new app, go to step 2. Click Scripts, and add a new Click Script.

mceclip1.png

5. Select UserRightClickMenu as its kind. Call it Show Camera. Click Edit and add the following script:

var url = user.getCustomFieldValue('VehicleCameraURL');
 
if (url != null) {
  ui.iframe(
    'ShowCameraWindow',
    'Camera for ' + user.name,
    url
  )
}

mceclip2.png

6. Select the user that has the VehicleCameraURL value set when testing the script from the editor. Clicking Run Script will already open the URL in a new window, but you may close this window for now and save the script.

7. Click on Save.

Usage

If you have a user role with _UseClickScript privilege and Auto-allow new items enabled, the added script should immediately be available as a Show Camera option in the right click menu of the vehicle list.

mceclip3.png

Clicking the option will open a window and load the URL specified in VehicleCameraURL of the selected user. The final result can look like this:

vehicle_camera_v2.jpg

Saving the workspace through Workspace > Save will save the position of windows/panels created this way. On next reload, URL that was displayed last before saving the workspace will be immediately loaded.

Opening a URL in New Browser Window

You can also trigger opening a specific URL from a script in a new browser window. Here is how to modify the script in the above example to open a new browser window:

var url = user.getCustomFieldValue('VehicleCameraURL');
 
if (url != null) {
  ui.open(url)
}