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, as_columns=False, 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, Column]]) – 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”

  • as_columns (bool) – If true, reads input to dashboard as list of columns instead of rows, defaults to False.

  • 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.

activate()
Called when activating the section this card belongs to. Assigns unique IDs to everything

in the card.

add_comment(comment)
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.

delete_comment(comment_id)
edit_comment(comment_id, new_comment_message, editor)
Return type:

Comment

get_comment(comment_id)
Return type:

Comment

get_elements()
Return type:

Iterator[Element]

get_filters()
Return type:

Iterator[InputElement]

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.

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

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

save(link, is_ssf=False, user=None)

Save an element serialization into a Link.

Parameters:
  • link (Link) – The link to save the element to.

  • is_ssf (bool) – bool, whether flow is self service flow or not

  • user (Optional[str]) – str, the Flask session user

save_col(col, link, is_ssf=False)
save_row(row, link, is_ssf=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.

virtualitics_sdk.page.card.extract_inner_dashboards(card_content)

This method takes in card content that may include a dashboard and returns: 1. A new list of rows with the rows of internal dashboards flattened into the card 2. A list of the filter elements from all of the internal dashboards 3. The filter updater function from the last Dashboard in the list

Return type:

Tuple[List[Row], List[InputElement], Callable]

virtualitics_sdk.page.card.format_card_content(card_content, as_columns=False)
Return type:

List[Row]