2 * ============LICENSE_START=======================================================
4 * ================================================================================
5 * Copyright © 2017-2021 AT&T Intellectual Property. All rights reserved.
6 * ================================================================================
7 * Licensed under the Apache License, Version 2.0 (the "License");
8 * you may not use this file except in compliance with the License.
9 * You may obtain a copy of the License at
11 * http://www.apache.org/licenses/LICENSE-2.0
13 * Unless required by applicable law or agreed to in writing, software
14 * distributed under the License is distributed on an "AS IS" BASIS,
15 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 * See the License for the specific language governing permissions and
17 * limitations under the License.
18 * ============LICENSE_END=========================================================
21 import React from 'react';
22 import moment from "moment";
23 import Col from 'react-bootstrap/lib/Col';
24 import Panel from 'react-bootstrap/lib/Panel';
26 const historyCard = (props) => {
27 if(props && props.node && props.node.properties){
28 const properties = (props.node.properties).map((prop, idx) => {
31 <Panel.Heading className="custom-accordion">
32 <Panel.Title toggle> <strong>{prop.key}</strong> : {'' + prop.value}</Panel.Title>
35 <Panel.Body className='cardwrap'>
36 <p><strong>Last Updated By:</strong> {prop.sot}</p>
37 <p><strong>Last Updated (time):</strong> {moment(prop.timestamp).format('dddd, MMMM Do, YYYY h:mm:ss A')}</p>
38 <p><strong>Transaction Id:</strong> {(prop['tx-id']) ? prop['tx-id'] : 'N/A'}</p>
45 //TODO handle no relationships and no attributes
47 const relationships = (props.node['related-to']).map((prop, idx) => {
49 <p key={idx}><strong>{prop['node-type']}:</strong> {prop.url} {prop['relationship-label']} (added by {prop.sot} on {moment(prop.timestamp).format('dddd, MMMM Do, YYYY h:mm:ss A')})</p>
54 <Col className={""+(props.split ? 'col-lg-4' : 'col-lg-12')}>
55 <div className='card model-card'>
56 <div className='card-header'>
57 <h4 className='card-title'>{props.node.primaryHeader}</h4>
59 <div className='card-header'>
60 {props.node.secondaryHeader}
62 <div className='card-content model-card-content'>
65 <div className='card-footer'>
69 <button type='button' className='btn btn-outline-primary'>
75 <Panel.Body className='cardwrap'>
86 <Col className={""+(props.split ? 'col-lg-4' : 'col-lg-12')}>
87 <div className='card model-card'>
88 <div className='card-header'>
89 <h4 className='card-title'>No State Found</h4>
91 <div className='card-content model-card-content'>
92 No State was found at the provided timestamp. Please try another timestamp.
100 export default historyCard;