UNPKG

cluedin-widget

Version:

This is the project for creating and managing widgets in CluedIn.

66 lines (57 loc) 2.88 kB
import React, { Component } from 'react' import ProviderIcons from '../providerIcons.jsx' import EntityIcon from '../EntityIcon.jsx' import EntityLink from '../EntityLink.jsx' import { makeNoValueRow, makePropHtml, findFromKey, makeLinkHtml, makeBadgeHtml } from '../../helpers/properties.jsx' var noStatus = makeNoValueRow( 'Status' ); var noPriority = makeNoValueRow( 'Priority' ); var noUrl = makeNoValueRow( 'Url' ); var noChannel = makeNoValueRow( 'Channel' ); var noMailProp = makeNoValueRow( 'From Email' ); var noNameProp = makeNoValueRow( 'From Name' ); export default class Issue extends Component { render() { const { entity } = this.props; var statusProp = findFromKey( entity.properties, 'status' ); var priorityProp = findFromKey( entity.properties, 'priority' ); var OriginalUrlProp = findFromKey( entity.properties, 'url' ); var channel = findFromKey( entity.properties, 'channel' ); var fromMailProp = findFromKey( entity.properties, 'frommail' ); var fromNameProp = findFromKey( entity.properties, 'fromName' ); let statusHtml = statusProp ? makeBadgeHtml( statusProp ) : noStatus; let priorityHtml = priorityProp ? makePropHtml( priorityProp ) : noPriority; let originalUrlHtml = OriginalUrlProp ? makeLinkHtml( OriginalUrlProp ) : noUrl; let channelHtml = channel ? makePropHtml( channel ) : noChannel; let fromMailHtml = fromMailProp ? makePropHtml( fromMailProp ) : noMailProp; let fromNameHtml = fromNameProp ? makePropHtml( fromNameProp ) : noNameProp; return ( <div className="cluedIn_entity_row"> <div className="cluedIn_entity_row_sub"> <ProviderIcons providers={entity.providers}></ProviderIcons> <EntityIcon entityType={entity.data.entityType}></EntityIcon> <EntityLink entity={entity}></EntityLink> </div> <div className="cluedIn_row cluedIn_row_notCentered cluedIn_entity_table"> <div className="cluedIn_col s6"> {statusHtml} </div> <div className="cluedIn_col s6"> {priorityHtml} </div> <div className="cluedIn_col s6"> {originalUrlHtml} </div> <div className="cluedIn_col s6"> {channelHtml} </div> <div className="cluedIn_col s6"> {fromMailHtml} </div> <div className="cluedIn_col s6"> {fromNameHtml} </div> </div> </div> ); } }