import React from 'react' import ColumnCard from './ColumnCard' import yang from '../yang/leaf-utils.js' export default class extends React.Component { render() { try { const { model, path, isReadonly, properties, editElement } = this.props; const element = model.getElement(path); console.debug(`LeafGroup: ${element.name}`); const container = element.value; const leaves = properties.reduce((leaves, property, index) => { const itemPath = path.slice(); itemPath.push(property.name); const props = { model, 'path': itemPath }; let value = (container && container[property.name]); let valueIsSet = yang.isValueSet(property, value); if (!valueIsSet) { value = yang.getDefaultValue(property); valueIsSet = yang.isValueSet(property, value); } if (valueIsSet) { value = yang.getDisplayValue(property, value); } valueIsSet && leaves.push(
{`${property.name}`}
{value}
); return leaves; }, []) return (
{leaves}
) } catch (e) { console.error("component render", e); } } }