Skip to content

Commit

Permalink
list methods
Browse files Browse the repository at this point in the history
  • Loading branch information
jeffibm committed Jan 30, 2024
1 parent ce71035 commit 635ab05
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 2 deletions.
16 changes: 15 additions & 1 deletion app/javascript/components/AeInlineMethods/index.jsx
Original file line number Diff line number Diff line change
@@ -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';
Expand All @@ -10,6 +10,7 @@ const AeInlineMethod = ({ type }) => {
const [data, setData] = useState({
isModalOpen: false,
selectedNode: undefined,
list: [],
});

/** Function to show/hide the modal. */
Expand All @@ -33,9 +34,18 @@ const AeInlineMethod = ({ type }) => {
</Button>
);

console.log(data);

const renderList = () => (data.list.map((item) => (
<div key={item.key}>
<div>{item.fqname}</div>
</div>
)));

return (
<div>
{renderAddButton()}
{renderList()}
<Modal
primaryButtonDisabled={data.selectedNode === undefined}
size="lg"
Expand All @@ -46,6 +56,10 @@ const AeInlineMethod = ({ type }) => {
onRequestClose={() => showModal(false)}
onRequestSubmit={() => {
console.log('on onRequestSubmit');
setData({
...data,
list: data.list.push(data.selectedNode),
});
showModal(false);
}}
onSecondarySubmit={() => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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 ? <CaretDown16 className="tree-caret" /> : <CaretRight16 className="tree-caret" />;
Expand Down

0 comments on commit 635ab05

Please sign in to comment.