q2_sdk.ui.modals — UUX Modals

For an in context view of these classes, check out the guide at Modals.

enum q2_sdk.ui.modals.ModalType(value)[source]

Bases: Enum

Enumeration for TectonModal modal_type

Valid values are as follows:

ERROR = <ModalType.ERROR: 'error'>
INFO = <ModalType.INFO: 'info'>
SUCCESS = <ModalType.SUCCESS: 'success'>
WARNING = <ModalType.WARNING: 'warning'>
class q2_sdk.ui.modals.ModalAction(action_label, external_route='', internal_route='', custom_action_hook=None)[source]

Bases: object

Defines Modal Action class if needing to redirect from a modal or supply custom hook that will be executed where a button on the modal is clicked.

Parameters:
  • action_label (str) – label for action button

  • external_route (str) – redirect to destinations within the Q2 application (e.g. activityCenter); will not be used if custom_action_hook is defined

  • internal_route (str) – routing key for the desired extension route destination on modal close. will remain on current route if empty. Can not be used in conjuction with custom_action_hook.

  • custom_action_hook – custom JS function name to be executed when the action is clicked function needs to be defined in Q2Form.custom_javascript. If function not available, will default to just redirecting to the landing page

class q2_sdk.ui.modals.Modal(modal_type, title, message='', modal_actions=None, show_close=True, **kwargs)[source]

Bases: object

Parent class for displaying Q2 Compliant modals in the Q2 Online interface

Parameters:
  • modal_type (ModalType) – success, error, warning

  • title (str) – modal title to be displayed

  • message – modal message to be displayed

  • modal_actions (Union[ModalAction, List[ModalAction]]) – Custom buttons for routing to external or internal routes or executing custom JS functions.

  • show_close – show default close button (true/false) when custom buttons are added. this button will always close modal and remain on current route, and always reads “Close”

class q2_sdk.ui.modals.TransRow(label, value)[source]

Bases: object

TransRow(label: str, value: str)

class q2_sdk.ui.modals.TectonModal(modal_type, title, message='', modal_actions=None, show_close=True, is_blocking=False, trans_info=None, info_list=None, addl_info=None, custom_markup=None, **kwargs)[source]

Bases: Modal

Parent class for displaying Tecton Compliant modals in the Q2 Online interface

Parameters:
  • modal_type (ModalType) – success, error, warning, info

  • title (str) – modal title to be displayed

  • message – modal message to be displayed

  • modal_actions (Union[ModalAction, List[ModalAction]]) – Custom buttons for routing to external or internal routes or executing custom JS functions.

  • show_close – show default close button (true/false) when custom buttons are added. this button will always close modal and remain on current route, and always reads “Close”

  • is_blocking – Disables the X or equivalent that allows the modal to be closed, forcing the user to make a choice to close the modal.

  • trans_info (List[TransRow]) – List of TransRow items to show in a structured label: value list

  • info_list (List[str]) – List of str to show in a list

  • addl_info (str) – str that is displayed below the message, transInfo, and infoList content.

  • custom_markup (str) – str that is displayed below the message but before transInfo.

class q2_sdk.ui.modals.SuccessModal(title, message, modal_actions=None, show_close=True, **kwargs)[source]

Bases: Modal

Returns a success code to Online with green checkmark to the user

Parameters:
  • modal_type – success, error, warning

  • title – modal title to be displayed

  • message – modal message to be displayed

  • modal_actions (Union[ModalAction, List[ModalAction]]) – Custom buttons for routing to external or internal routes or executing custom JS functions.

  • show_close – show default close button (true/false) when custom buttons are added. this button will always close modal and remain on current route, and always reads “Close”

class q2_sdk.ui.modals.ErrorModal(title, message, modal_actions=None, show_close=True, **kwargs)[source]

Bases: Modal

Returns an error code to Online with red error icon to the user

Parameters:
  • modal_type – success, error, warning

  • title – modal title to be displayed

  • message – modal message to be displayed

  • modal_actions (Union[ModalAction, List[ModalAction]]) – Custom buttons for routing to external or internal routes or executing custom JS functions.

  • show_close – show default close button (true/false) when custom buttons are added. this button will always close modal and remain on current route, and always reads “Close”

class q2_sdk.ui.modals.WarningModal(title, message, modal_actions=None, show_close=True, **kwargs)[source]

Bases: Modal

Returns modal with orange warning icon to the user

Parameters:
  • modal_type – success, error, warning

  • title – modal title to be displayed

  • message – modal message to be displayed

  • modal_actions (Union[ModalAction, List[ModalAction]]) – Custom buttons for routing to external or internal routes or executing custom JS functions.

  • show_close – show default close button (true/false) when custom buttons are added. this button will always close modal and remain on current route, and always reads “Close”

class q2_sdk.ui.modals.InfoModal(title, message, modal_actions=None, show_close=True, **kwargs)[source]

Bases: Modal

Returns modal with orange warning icon to the user

Parameters:
  • modal_type – success, error, warning

  • title – modal title to be displayed

  • message – modal message to be displayed

  • modal_actions (Union[ModalAction, List[ModalAction]]) – Custom buttons for routing to external or internal routes or executing custom JS functions.

  • show_close – show default close button (true/false) when custom buttons are added. this button will always close modal and remain on current route, and always reads “Close”