card

class virtualitics_sdk.page.card.Card(title, content, subtitle='', description='', _id=None, show_title=True, show_description=True, page_update=None, update_elems=None, updater_text=None, filters=None, filter_update=None, show_comments=False, show_export=False, show_share=False)

Bases: object

A container for elements on a Page. A Section is made up of Cards.

Parameters:
  • title (str) – The title for this Card.

  • content (List[Union[Element, Row]]) – The elements contained in this Card.

  • subtitle (str) – The subtitle for this Card, defaults to “”.

  • description (str) – The description for this Card, defaults to “”.

  • _id (Optional[str]) – ID of the card. Defaults to autogenerated UUID.

  • show_title (bool) – Whether to show the title on the page when rendered, defaults to True.

  • show_description (bool) – Whether to show the description to the page when rendered, defaults to True.

  • page_update (Optional[Callable]) – Updater function. Allows for handling dynamic page update on a page Takes a StoreInterface and optionally client runners as arguments, defaults to None.

  • update_elems (Union[str, List[str], None]) – A list of element titles for required inputs the card updater function needs to run. If only a single element is required, this argument can be a string. Defaults to None.

  • updater_text (Optional[str]) – The text to show on the update button. If this value is not set, the frontend will default to showing the text, “Update”

  • filters (Optional[List[InputElement]]) – A list of input elements that can be used as input to the card’s filter function, defaults to None.

  • filter_update (Optional[Callable]) – Another updater function to call in combination with filter inputs

  • show_comments (bool) – Whether or not to share the comments icon on this card. Defaults to False for non-Dashboard Steps This value always be True with Dashboard Steps.

  • show_export (bool) – Whether or not to share the export icon on this card. Defaults to False for non-Dashboard Steps This value always be True with Dashboard Steps.

  • show_share (bool) – Whether or not to share the share icon on this card. Defaults to False for non-Dashboard Steps This value always be True with Dashboard Steps.

EXAMPLE:

# Imports
from virtualitics_sdk.page.card import Card
. . .
# Example usage
class ExStep(Step):
  def run(self, flow_metadata):
    store_interface = StoreInterface(**flow_metadata)
    page = store_interface.get_page()
    . . .
    card = Card(title="Example Card", content=[example_element])
    page.add_card_to_section(card, "")
add_content(content, ratio=None, index=None)

Add content to a Card.

Parameters:
  • content (Union[Row, List[Element], Element]) – The element(s) to add to the Card.

  • ratio (Optional[List[Union[int, float]]]) – The relative widths of the elements inside the Row,

  • index (Optional[int]) – The index to add the content to. If None, it will default to appending the content to the end of the card

defaults to all elements having the same width.

remove_item(element_title, quiet=False)

This function removes an element in a dashboard, which can be used in conjunction with the card’s updater of filter_update function to provide dynamic page updates.

Parameters:
  • element_title (str) – The title of the element to be updated.

  • quiet (bool) – If True, do not return an error if there is no element with that title found on the page. Defaults to False

to_json()
Return type:

dict

update_item(element_title, new_element)

This function updates an element in a dashboard, which can be used in conjunction with the card’s updater or filter_update function to provide dynamic page updates.

Parameters:
  • element_title (str) – The title of the element to be updated.

  • new_element (Element) – The new element that will replace currently existing element.