Manual Reference Source
public class | source

DataSegment

Extends:

react~Component → DataSegment

DataSegment component enables fetching data using predefined function and showing segmented data in a simple manner.

It delivers alternative way of presenting fetched data to DataTable.

Access

Stage.Basic.DataSegment

Features

  • data pagination
  • selectable segments

Usage

Simple example

DataSegment_0

<DataSegment>

    <DataSegment.Action>
        <Button icon="rocket" />
    </DataSegment.Action>

    <DataSegment.Item>
        <h2>SegmentItem 1</h2>
    </DataSegment.Item>

    <DataSegment.Item>
        <h2>SegmentItem 2</h2>
    </DataSegment.Item>

    <DataSegment.Item>
        <h2>SegmentItem 3</h2>
    </DataSegment.Item>

    <DataSegment.Item>
        <h2>SegmentItem 4</h2>
    </DataSegment.Item>

</DataSegment>

Deployments list example

DataSegment_1

<DataSegment totalSize={this.props.data.total}
             pageSize={this.props.widget.configuration.pageSize}
             fetchData={this.props.fetchData}>
{
     this.props.data.items.map((item) => {
         return (
             <DataSegment.Item key={item.id} selected={item.isSelected} className={item.id}
                           onClick={()=>this.props.onSelectDeployment(item)}>
                 <div className="ui grid">
                     <div className="three wide center aligned column rightDivider">
                         <h3 className="ui icon header verticalCenter">{item.id}</h3>
                         <ResourceVisibility visibility={item.visibility} className="rightFloated"/>
                     </div>
                     <div className="two wide column">
                         <h5 className="ui icon header">Blueprint</h5>
                         <p>{item.blueprint_id}</p>
                     </div>
                     <div className="two wide column">
                         <h5 className="ui icon header">Created</h5>
                         <p>{item.created_at}</p>
                     </div>
                     <div className="two wide column">
                         <h5 className="ui icon header">Updated</h5>
                         <p>{item.updated_at}</p>
                     </div>
                     <div className="two wide column">
                         <h5 className="ui icon header">Creator</h5>
                         <p>{item.created_by}</p>
                     </div>
                     <div className="four wide column">
                         <h5 className="ui icon header">Nodes ({item.nodeSize})</h5>
                         <div className="ui four column grid">
                             <div className="column center aligned">
                                 <NodeState icon="checkmark" title="running" state="started" color="green"
                                            value={item.nodeStates.started}/>
                             </div>
                             <div className="column center aligned">
                                 <NodeState icon="spinner" title="in progress" state="uninitialized or created" color="yellow"
                                            value={_.add(item.nodeStates.uninitialized, item.nodeStates.created)}/>
                             </div>
                             <div className="column center aligned">
                                 <NodeState icon="exclamation" title="warning" state="undefined" color="orange"
                                            value={0}/>
                             </div>
                             <div className="column center aligned">
                                 <NodeState icon="remove" title="error" state="deleted or stopped" color="red"
                                            value={_.add(item.nodeStates.deleted, item.nodeStates.stopped)}/>
                             </div>
                         </div>
                     </div>

                     <div className="column action">
                         {
                             _.isEmpty(item.executions)
                             ?
                             <MenuAction item={item} onSelectAction={this.props.onMenuAction}/>
                             :
                             <ActiveExecutionStatus item={item.executions[0]} onCancelExecution={this.props.onCancelExecution}/>
                         }
                     </div>
                 </div>
             </DataSegment.Item>
        );
    })
}
</DataSegment>

Static Member Summary

Static Public Members
public static

Action: *

Segment action, see SegmentAction

public static

Item: *

Segment item, see SegmentItem

public static

propTypes

Static Public Members

public static Action: * source

Segment action, see SegmentAction

public static Item: * source

Segment item, see SegmentItem

public static propTypes: * source

propTypes

Properties:

NameTypeAttributeDescription
children object[]

primary content

fetchData Function
  • optional

used to fetch data

totalSize number
  • optional
  • default: -1

total number of data segments, if not specified pagination will not be set. It is used to calculate pagination pages.

fetchSize Function
  • optional
  • default: -1

if total number is unknown size of fetched data can be provided. Pagination pages will be added dynamically until fetchSize is not equal to page size

pageSize number
  • optional
  • default: 0

number of displayed rows on page

sizeMultiplier number
  • optional
  • default: 3

param related to pagination. List of page sizes is generated as multiplication of basic fixed values [1, 2, 3, 5, 10] by this param

className string
  • optional
  • default: ''

CSS classname

searchable boolean
  • optional
  • default: false

if true filtering and searching input to be added