From cf6d35d718fa8f034851b4653aa1fb6d0e6a9696 Mon Sep 17 00:00:00 2001 From: saharmehrpour Date: Wed, 24 Jul 2024 20:07:56 -0400 Subject: [PATCH] Added a config file to enable/diable features in the tool --- src/App.js | 15 ++++++++++++--- src/config.js | 4 ++++ src/ui/navBar.js | 19 +++++++++++-------- 3 files changed, 27 insertions(+), 11 deletions(-) create mode 100644 src/config.js diff --git a/src/App.js b/src/App.js index d91c76e..c6452ad 100644 --- a/src/App.js +++ b/src/App.js @@ -13,6 +13,7 @@ import NavBar from "./ui/navBar"; import HeaderBar from "./ui/headerBar"; import MinedRulesComponent from "./ui/MiningRules/minedRulesComponent"; import {hashConst} from "./ui/uiConstants"; +import {featureConfig} from "./config"; class App extends Component { constructor(props) { @@ -79,10 +80,16 @@ class App extends Component {
- + {featureConfig.MiningRules ? ( + + ) : ( +
+ {"The Mining Rules feature is disabled in this version of the tool."} +
+ )}
@@ -98,12 +105,14 @@ class App extends Component { } renderLoading() { + const loadingTitle = featureConfig.MiningRules ? + "Loading Files and Rules and Preprocessing" : "Loading Files and Rules"; return (
-

{"Loading Rules and Preprocessing"}

+

{loadingTitle}

diff --git a/src/config.js b/src/config.js new file mode 100644 index 0000000..adc7c32 --- /dev/null +++ b/src/config.js @@ -0,0 +1,4 @@ +export const featureConfig = { + MiningRules: true, + ActiveLLM: false, +}; diff --git a/src/ui/navBar.js b/src/ui/navBar.js index 6faed35..8f38df6 100644 --- a/src/ui/navBar.js +++ b/src/ui/navBar.js @@ -12,6 +12,7 @@ import {clickedOnBack, clickedOnForward} from "../actions"; import {hashConst} from "./uiConstants"; import ConfigComponent from "../ui/activeLLM/configComponent"; +import {featureConfig} from "../config"; export class NavBar extends Component { render() { @@ -35,23 +36,25 @@ export class NavBar extends Component { - Table of Contents + {"Table of Contents"} - All Rules + {"All Rules"} - Violated Rules + {"Violated Rules"} - - Learn Design Rules + + {"Learn Design Rules"} {featureConfig.MiningRules? "": " (Disabled)"} {/* Opt-In to activeLLM button */} - - - + {featureConfig.ActiveLLM ? ( + + + + ) : null} ); }