diff --git a/src/index.css b/src/index.css
index fb47c58..5109401 100644
--- a/src/index.css
+++ b/src/index.css
@@ -1043,6 +1043,29 @@ img.tutorialSmallImage {
/* cluster view */
+.search-bar-container {
+ position: relative;
+ margin-bottom: 20px;
+}
+
+.search-input {
+ width: 30%;
+ padding: 10px 20px 10px 40px;
+ font-size: 16px;
+ border: 2px solid #ccc;
+ border-radius: 5px;
+ transition: border-color 0.3s;
+}
+
+.search-icon {
+ position: absolute;
+ left: 10px;
+ top: 50%;
+ transform: translateY(-50%);
+ color: #ccc;
+ font-size: 20px;
+}
+
.minedRulesComponent .guiBoundingBox {
padding-top: 5px !important;
}
diff --git a/src/ui/MiningRules/minedRulesComponent.js b/src/ui/MiningRules/minedRulesComponent.js
index da00e5b..e9c1d10 100644
--- a/src/ui/MiningRules/minedRulesComponent.js
+++ b/src/ui/MiningRules/minedRulesComponent.js
@@ -15,7 +15,7 @@ import {Button} from "react-bootstrap";
import {
FaAngleDown, FaAngleUp,
FaCaretDown,
- FaCaretUp,
+ FaCaretUp, FaSearch,
} from "react-icons/fa";
import "rc-slider/assets/index.css";
@@ -57,6 +57,7 @@ class MinedRulesComponent extends Component {
view: this.views.default_view,
minedRules: [],
minedRulesGrouped: [], // [{key, value}]
+ searchTerm: "",
loadingTitle: "Mining Rules",
message: "",
cluster: [],
@@ -302,78 +303,104 @@ class MinedRulesComponent extends Component {
renderClusters() {
const countRules = this.state.minedRules.reduce((sum, group) => sum + group.rulePadStates.length, 0);
+ const handleSearchChange = (event) => {
+ this.setState({searchTerm: event.target.value});
+ };
if (this.state.minedRules.length > 0 && countRules === 0) {
return (
No rule is found.
);
}
+ const filteredRules = this.state.minedRulesGrouped.filter((group) =>
+ group.key.toLowerCase().includes(this.state.searchTerm.toLowerCase()),
+ );
- return this.state.minedRulesGrouped.map((identifierGroup, index) => {
- const childrenKeys = Object.keys(identifierGroup.value.children);
- if (childrenKeys.length === 0) {
- return null;
- }
- const keyParts = identifierGroup.key.split("%");
- const identifierType = keyParts[0];
- const identifierValue = keyParts[1];
- const parentElementId =
- featureGroupInformation[identifierGroup.value.children[childrenKeys[0]].fileGroup].rootId[0];
- const expandedClass = "expanded";
-
- const thenParts = childrenKeys.map((key) => {
- const fileGroup = identifierGroup.value.children[key].fileGroup;
- const title = featureGroupInformation[fileGroup].mergeKeys[1]
- .replace(/\b\w/g, (char) => char.toUpperCase());
- const content = this.renderThenPart(key, identifierGroup);
- return {title, content};
- });
+ return (
+
+ {/* ADDED: Search bar */}
+
+
+
+
- const isRuleExpanded = this.state.isExpanded && this.state.expandedIdentifierGroupIndex === index;
- const hidden = !this.state.isExpanded || this.state.expandedIdentifierGroupIndex !== index;
- const classNameHidden = hidden ? "hidden" : "";
+ {filteredRules.map((identifierGroup, index) => {
+ const childrenKeys = Object.keys(identifierGroup.value.children);
+ if (childrenKeys.length === 0) {
+ return null;
+ }
+ const keyParts = identifierGroup.key.split("%");
+ const identifierType = keyParts[0];
+ const identifierValue = keyParts[1];
+ const parentElementId =
+ featureGroupInformation[identifierGroup.value.children[childrenKeys[0]].fileGroup].rootId[0];
+ const expandedClass = "expanded";
+
+ const thenParts = childrenKeys.map((key) => {
+ const fileGroup = identifierGroup.value.children[key].fileGroup;
+ const title = featureGroupInformation[fileGroup].mergeKeys[1]
+ .replace(/\b\w/g, (char) => char.toUpperCase());
+ const content = this.renderThenPart(key, identifierGroup);
+ return {title, content};
+ });
- return (
-
-
-
- {"Rules applied on "}
- {identifierType}
- {" "}
-
- {identifierValue}
-
-
- {isRuleExpanded ?
-
this.setState({isExpanded: false})}>
-
:
-
this.setState({isExpanded: true, expandedIdentifierGroupIndex: index})}>
-
+ const isRuleExpanded = this.state.isExpanded && this.state.expandedIdentifierGroupIndex === index;
+ const hidden = !this.state.isExpanded || this.state.expandedIdentifierGroupIndex !== index;
+ const classNameHidden = hidden ? "hidden" : "";
+
+ return (
+
+
+
+ {"Rules applied on "}
+ {identifierType}
+ {" "}
+
+ {identifierValue}
+
+
+ {isRuleExpanded ?
+
this.setState({isExpanded: false})}>
+
:
+
this.setState({
+ isExpanded: true,
+ expandedIdentifierGroupIndex: index,
+ })}>
+
+
+ }
+
+
+
+ {`IF a ${identifierType} is named ${identifierValue}`}
+
+
+
+
{`THEN the ${identifierType} may have:`}
+
+
- }
-
-
-
- {`IF a ${identifierType} is named ${identifierValue}`}
-
-
-
-
{`THEN the ${identifierType} may have:`}
-
-
-
- );
- });
+ );
+ })}
+
+ );
}
renderThenPart(key, identifierGroup) {