From 635ab05141890076bfedf2aba72715efc0a50f4a Mon Sep 17 00:00:00 2001 From: JEFFREY-Bonson Date: Tue, 30 Jan 2024 08:54:50 +0530 Subject: [PATCH] list methods --- .../components/AeInlineMethods/index.jsx | 16 +++++++++++++++- .../components/MiqTreeView/MiqTreeParentNode.jsx | 2 +- 2 files changed, 16 insertions(+), 2 deletions(-) diff --git a/app/javascript/components/AeInlineMethods/index.jsx b/app/javascript/components/AeInlineMethods/index.jsx index 0cd2eea24bd6..f4a12d72cf2b 100644 --- a/app/javascript/components/AeInlineMethods/index.jsx +++ b/app/javascript/components/AeInlineMethods/index.jsx @@ -1,6 +1,6 @@ /* eslint-disable jsx-a11y/no-static-element-interactions */ /* eslint-disable jsx-a11y/click-events-have-key-events */ -import React, { useState } from 'react'; +import React, { useEffect, useState } from 'react'; import PropTypes from 'prop-types'; import { Modal, Button, ModalBody } from 'carbon-components-react'; import MiqTree from '../MiqTreeView'; @@ -10,6 +10,7 @@ const AeInlineMethod = ({ type }) => { const [data, setData] = useState({ isModalOpen: false, selectedNode: undefined, + list: [], }); /** Function to show/hide the modal. */ @@ -33,9 +34,18 @@ const AeInlineMethod = ({ type }) => { ); + console.log(data); + + const renderList = () => (data.list.map((item) => ( +
+
{item.fqname}
+
+ ))); + return (
{renderAddButton()} + {renderList()} { onRequestClose={() => showModal(false)} onRequestSubmit={() => { console.log('on onRequestSubmit'); + setData({ + ...data, + list: data.list.push(data.selectedNode), + }); showModal(false); }} onSecondarySubmit={() => { diff --git a/app/javascript/components/MiqTreeView/MiqTreeParentNode.jsx b/app/javascript/components/MiqTreeView/MiqTreeParentNode.jsx index 9cb22e518cbf..01f4ab9b4ae2 100644 --- a/app/javascript/components/MiqTreeView/MiqTreeParentNode.jsx +++ b/app/javascript/components/MiqTreeView/MiqTreeParentNode.jsx @@ -15,7 +15,7 @@ const MiqTreeParentNode = ({ if (!item) { return undefined; } - if (selectableItem(item, selectKey)) { + if (selectableItem(item, selectKey) || !item.lazyLoad) { return undefined; } return item.state.expanded ? : ;