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 ModelRelationships from './ModelRelationships.jsx';
23 import { Link } from 'react-router-dom';
24 import {ExportExcel} from 'utils/ExportExcel.js';
25 let buildAttrList = ExportExcel.buildAttrList;
27 const modelCard = (props) => {
30 var navigateQueryBuilder = '';
31 var editModalIcon = '';
32 var requiredParams = buildAttrList(props.nodeType,[],'mandatory');
33 const properties = Object.keys(props.nodeProps).map((prop, idx) => {
35 for(var a in requiredParams){
36 if(requiredParams[a].value === prop){
37 description=requiredParams[a].description;
39 propKey = prop + ':' + btoa('<pre>' + props.nodeProps[prop].toString() + '</pre>');
41 propKey = propKey + ';' + prop + ':' + btoa('<pre>' + props.nodeProps[prop].toString() + '</pre>');
46 <p className='pre-wrap-text' key={idx}><strong title={description}>{prop}:</strong> {props.nodeProps[prop].toString()}</p>
49 let pathNameStr = '/customDslBuilder/' + props.nodeType + '/' + propKey;
50 editModalIcon = <a className={props.isWriteAllowed ? 'show' : 'hidden'} onClick={e => {props.openEditNodeModal(props.nodeUrl)}}><i style={{cursor: 'pointer'}} className="pull-right fa fa-pencil-square-o" aria-hidden="true"></i></a>;
51 navigateQueryBuilder = <Link
55 <i className={'icon-misc-operationsL pull-right'} role="img"></i>
58 <div className='card model-card'>
59 <div className='card-header'>
60 <h4 className='card-title'>{props['nodeType']}{editModalIcon}{navigateQueryBuilder}</h4>
62 <div className='card-header'>
65 <div className='card-content model-card-content'>
68 <div className='card-footer'>
69 <ModelRelationships historyStackString={props.historyStackString} relatives={props} openHistoryModal={props.openHistoryModal} />
75 export default modelCard;