catch(error){
console.log(error);
}
+};
+
+export const deleteFeatureGroups = async (featureGroup_names) => {
+ console.log('deleting feature groups', featureGroup_names);
+ try {
+ let res = await axios.delete(`${CONSTANTS.UCMgr_baseUrl}/featureGroup`,
+ {
+ data: {
+ "featuregroups_list": featureGroup_names
+ }
+
+ }
+ );
+ console.log('Deletion response', res);
+ let result = 'FeatureGroup deletion initiated for selected featureGroups ,Result'
+ + '\n' + JSON.stringify(res.data);
+ alert(result);
+
+ } catch (error) {
+ console.log("error is : ", error);
+ }
};
\ No newline at end of file
import { Checkbox } from './Checkbox';
import Popup from './Popup';
import FeatureGroupInfo from './FeatureGroupInfo';
+import {deleteFeatureGroups} from './API_STATUS';
const ListFeatureGroup = (props) => {
const handleInfoClick = (featuregroup_name) => {
console.log("feature group name is : ", featuregroup_name)
setFeatureGroupName({
- featureGroupName : featuregroup_name
+ featureGroupName: featuregroup_name
});
setInfoPopup(true);
- };
+ };
+
+ const handleDelete = async (event) => {
+ console.log('handle delete starts..');
- const handleDme =(dme)=>{
- if(dme===true)return <p>Enabled</p>;
+ if (selectedFlatRows.length > 0) {
+ let featureGroup_names = [];
+ for (const row of selectedFlatRows) {
+ featureGroup_names.push({
+ featureGroup_name: row.original.featuregroup_name
+ })
+ }
+ console.log('selected featureGroups are :', featureGroup_names)
+ try {
+ await deleteFeatureGroups(featureGroup_names);
+ await fetchFeatureGroups();
+ } catch (error) {
+ console.log(error)
+ }
+ toggleAllRowsSelected(false);
+ } else {
+ alert('Please select more than one row')
+ }
+
+ }
+
+ const handleDme = (dme) => {
+ if (dme === true) return <p>Enabled</p>;
else return <p>Disabled</p>
};
Header: 'DataLake',
accessor: 'datalake'
},
- {
+ {
id: 'dme',
Header: 'DME',
accessor: 'dme',
- Cell: ({row}) => {
+ Cell: ({ row }) => {
return (
<div >
{handleDme(row.original.dme)}
</div>
- );
- }
+ );
+ }
},
{
id: 'info',
Header: 'Info',
- Cell : ({row}) => {
+ Cell: ({ row }) => {
return (
<div>
- <Button variant="info" onClick={() => handleInfoClick(row.original.featuregroup_name)}>Info</Button>
+ <Button variant="info" onClick={() => handleInfoClick(row.original.featuregroup_name)}>Info</Button>
</div>
- );
- }
- }
+ );
+ }
+ }
], []);
const data = useMemo(() => featureGroups, [featureGroups]);
const {
)
return (
<>
- <BTable className="Status_table" responsive striped bordered hover size="sm" {...getTableProps()}>
- <thead>
- {headerGroups.map(headerGroup => (
- <tr {...headerGroup.getHeaderGroupProps()}>
- {headerGroup.headers.map(column => (
- <th {...column.getHeaderProps()}>
- {column.render('Header')}
- </th>
- ))}
- </tr>
- ))}
- </thead>
- <tbody>
- {rows.map((row, i) => {
- prepareRow(row)
- return (
- <tr {...row.getRowProps()}>
- {row.cells.map(cell => {
- return (
- <th {...cell.getCellProps()}>
- {cell.render('Cell')}
- </th>
- )
- })}
+ <Button variant="success" size="sm" onClick={e => handleDelete(e)}>Delete</Button>{' '}
+ <BTable className="Status_table" responsive striped bordered hover size="sm" {...getTableProps()}>
+ <thead>
+ {headerGroups.map(headerGroup => (
+ <tr {...headerGroup.getHeaderGroupProps()}>
+ {headerGroup.headers.map(column => (
+ <th {...column.getHeaderProps()}>
+ {column.render('Header')}
+ </th>
+ ))}
</tr>
- )
- })}
- </tbody>
+ ))}
+ </thead>
+ <tbody>
+ {rows.map((row, i) => {
+ prepareRow(row)
+ return (
+ <tr {...row.getRowProps()}>
+ {row.cells.map(cell => {
+ return (
+ <th {...cell.getCellProps()}>
+ {cell.render('Cell')}
+ </th>
+ )
+ })}
+ </tr>
+ )
+ })}
+ </tbody>
</BTable>
<Popup show={infoPopup} onHide={closeInfoPopup} title="Feature Group Info">
<FeatureGroupInfo featureGroupName={featureGroupName} />