Options
All
  • Public
  • Public/Protected
  • All
Menu

Class EventModal<SS>

Renders a div which is intended to be displayed as a modal dialogue displaying the parameters of an event as a table. The user can then adjust the parameters and finally launch the event. Moreover, the component makes sure that all parameters which have the required flag set actually have a value before enabling the submit button. The component also install keyup listeners which allow for launching the event or cancelling the dialogue using the keyboard.

param

Event for which the params should be rendered

param

Document ID of the current session

param

Trigger mode that the application is currently set to

param

Callback invoked when the user clicks the button to trigger the event

Type parameters

  • SS

Hierarchy

Index

Constructors

constructor

  • Parameters

    Returns EventModal

Properties

context

context: any

props

props: Readonly<object> & Readonly<EventModalProps>

refs

refs: object

Type declaration

  • [key: string]: ReactInstance

state

state: Readonly<EventModalState>

Private tableRef

tableRef: Nullable<HTMLTableElement>

Methods

Optional UNSAFE_componentWillMount

  • UNSAFE_componentWillMount(): void

Optional UNSAFE_componentWillReceiveProps

  • UNSAFE_componentWillReceiveProps(nextProps: Readonly<EventModalProps>, nextContext: any): void

Optional UNSAFE_componentWillUpdate

Private collectParams

  • collectParams(): List<object>
  • Gathers all event parameter values from the state and converts them into a serialisable format in which they can be submitted to the server.

    Returns List<object>

    The event params in a serialisable form

Optional componentDidCatch

  • componentDidCatch(error: Error, errorInfo: ErrorInfo): void
  • Catches exceptions generated in descendant components. Unhandled exceptions will cause the entire component tree to unmount.

    Parameters

    • error: Error
    • errorInfo: ErrorInfo

    Returns void

componentDidMount

  • componentDidMount(): void
  • Invoked after the component is first mounted. Creates a key handler which listens for either ESC or Enter and either closes the modal or launches the event and then closes the modal correspondingly. Moreover, if there is a valid table ref, it focuses the input to the first input element of the underlying table.

    Returns void

Optional componentDidUpdate

  • Called immediately after updating occurs. Not called for the initial render.

    The snapshot is only present if getSnapshotBeforeUpdate is present and returns non-null.

    Parameters

    Returns void

Optional componentWillMount

  • componentWillMount(): void

Optional componentWillReceiveProps

  • componentWillReceiveProps(nextProps: Readonly<EventModalProps>, nextContext: any): void

Optional componentWillUnmount

  • componentWillUnmount(): void
  • Called immediately before a component is destroyed. Perform any necessary cleanup in this method, such as cancelled network requests, or cleaning up any DOM elements created in componentDidMount.

    Returns void

Optional componentWillUpdate

Private convertParams

  • Takes a list of event parameters and converts them in such a way that they can be stored in the state variable. Replaces undefined and null with the appropriate default value for the parameter type if available.

    Parameters

    • parameters: Array<EventParams>

      A list of parameters to convert

    Returns List<EventParams>

forceUpdate

  • forceUpdate(callBack?: undefined | function): void
  • Parameters

    • Optional callBack: undefined | function

    Returns void

Private getButtonLabel

  • getButtonLabel(): string
  • Returns the label to be put on the submit button of the modal. The label depends on the triggerMode, flags in the event itself or possibly the verb field of the event if it is set.

    Returns string

    The label for the submit button

Optional getSnapshotBeforeUpdate

  • Runs before React applies the result of render to the document, and returns an object to be given to componentDidUpdate. Useful for saving things such as scroll position before render causes changes to it.

    Note: the presence of getSnapshotBeforeUpdate prevents any of the deprecated lifecycle events from running.

    Parameters

    Returns SS | null

Private isSubmitEnabled

  • isSubmitEnabled(): boolean
  • Checks all required param values and makes sure that the user has set a value. Returns true if all required fields were set.

    Returns boolean

    Whether all required fields are set

Private launchEvent

  • launchEvent(): Promise<void>
  • Callback invoked in response to the user clicking the submit button. Based on the given triggerMode, a different URL is composed which is then used to trigger the event with the given params. Invokes the onTriggered callback with either the argument success or error after the request has completed.

    Returns Promise<void>

render

  • render(): Element
  • Renders the component

    Returns Element

Private renderParamTable

  • renderParamTable(): undefined | Element
  • Takes the parameters contained in state and renders them as a table for the user to interact with. If the event does not contain any parameters no table is rendered and the method returns undefined.

    Returns undefined | Element

    The parameters as a table or undefined if there are no parameters

setState

  • setState<K>(state: function | null | S | object, callback?: undefined | function): void
  • Type parameters

    • K: keyof EventModalState

    Parameters

    • state: function | null | S | object
    • Optional callback: undefined | function

    Returns void

Optional shouldComponentUpdate

  • Called to determine whether the change in props and state should trigger a re-render.

    Component always returns true. PureComponent implements a shallow comparison on props and state and returns true if any props or states have changed.

    If false is returned, Component#render, componentWillUpdate and componentDidUpdate will not be called.

    Parameters

    Returns boolean

Private updateParamField

  • updateParamField(i: number, ev: ChangeEvent<HTMLInputElement>): void
  • Callback which is invoked when the user interacts with one of the input fields in the table of event parameters. Updates the state with the changed value.

    Parameters

    • i: number

      The index of the parameter in the list of event parameters

    • ev: ChangeEvent<HTMLInputElement>

      The original change event that was triggered

    Returns void

Generated using TypeDoc