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 in applications.
Requirements
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
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.
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
)
}
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.
Clicking the option will open a window and load the URL specified in VehicleCameraURL of the selected user. The window can be added to your workspace as a panel. (Click right - select Panel)The final result can look like this:
Saving the workspace through Workspace > Save will save the position of windows/panels created this way. On the next reload, the 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) } |