Status Color Indicator Unit Test
  • 10 Oct 2023
  • 1 Minute to read
  • Contributors

Status Color Indicator Unit Test


Article summary

This application explains how to setup and use the Status Color Indicator custom widget.

INSERT VIDEO HERE

Purpose
The purpose of the Status Color Indicator Unit Test is to allow users to learn and understand how to setup and use the Status Color Indicator custom widget in their Tulip applications. Custom widgets are coded widgets that sit on top of the Tulip platform to give additional functionality that is not currently part of the main platform. This specific custom widget displays a colored object in the application, based on an input and a previously defined key:value pair.

Setup
Custom Widget Plugins interact with your application through the use of properties and events. Prop are the shared data that exists between your application and widget, while Events are signals that your widget can send to your application. In your app editor you can build triggers based off these events. Events can be made to send data to your application as well.

The following props and events are used in the Status Color Indicator Custom Widget:
STATUSES: It's an object list containing the specific key:value pairs (e.g.: Machine statuses and their respective colors)
STATUS: Enter here the input (key), to display the color (value) associated with it.
OBJECT LIST EMPTY: This event triggers, when the STATUSES object list is empty. The widget display white background.
STATUS NOT DEFINED: This event occurs when the STATUS you entered is not defined in the STATUSES list. The widget displays black background.

How it Works
In the Status Color Indicator Custom Widget the user can define a list of status-color pairs in the STATUSES prop, then ties the STATUS prop to a static, variable, table record etc.. When this field iss populated, the widget checks if the text you entered exists in the predefined list, if yes, it displays the respective color of that status. If it doesn't exist, triggers an event and sets the background to black.
As best practices, it worths to show informative error messages in these triggers as well.


Was this article helpful?