Skip to content

Commit

Permalink
Added a config file to enable/diable features in the tool
Browse files Browse the repository at this point in the history
  • Loading branch information
saharmehrpour committed Jul 25, 2024
1 parent 720473f commit cf6d35d
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 11 deletions.
15 changes: 12 additions & 3 deletions src/App.js
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down Expand Up @@ -79,10 +80,16 @@ class App extends Component {
</div>
<div id={"learnDesignRules"}
className={
([hashConst.learnDesignRules].indexOf(this.props.currentHash[0]) === -1 ) ?
([hashConst.learnDesignRules].indexOf(this.props.currentHash[0]) === -1) ?
"main container hidden" : "main container"
}>
<MinedRulesComponent/>
{featureConfig.MiningRules ? (
<MinedRulesComponent/>
) : (
<div>
{"The Mining Rules feature is disabled in this version of the tool."}
</div>
)}
</div>
<div style={{width: "100%", height: "100px"}}/>
</div>
Expand All @@ -98,12 +105,14 @@ class App extends Component {
}

renderLoading() {
const loadingTitle = featureConfig.MiningRules ?
"Loading Files and Rules and Preprocessing" : "Loading Files and Rules";
return (<div id={"loadingGif"}
className={(this.state.loadingGif ? "" : "hidden")}>
<div className={"overlayLoading"}>
<div className={"spinnerContainer"}>
<div className={"loadingTitle"}>
<h3>{"Loading Rules and Preprocessing"}</h3>
<h3>{loadingTitle}</h3>
</div>
<div className="spinner"/>
</div>
Expand Down
4 changes: 4 additions & 0 deletions src/config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
export const featureConfig = {
MiningRules: true,
ActiveLLM: false,
};
19 changes: 11 additions & 8 deletions src/ui/navBar.js
Original file line number Diff line number Diff line change
Expand Up @@ -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() {
Expand All @@ -35,23 +36,25 @@ export class NavBar extends Component {
</NavItem>

<NavItem eventKey={1}>
Table of Contents
{"Table of Contents"}
</NavItem>
<NavItem eventKey={2}>
All Rules
{"All Rules"}
</NavItem>
<NavItem eventKey={3}>
Violated Rules
{"Violated Rules"}
</NavItem>
<NavItem eventKey={4}>
Learn Design Rules
<NavItem eventKey={4} disabled={!featureConfig.MiningRules}>
{"Learn Design Rules"} {featureConfig.MiningRules? "": " (Disabled)"}
</NavItem>
</Nav>
</Navbar.Collapse>
{/* Opt-In to activeLLM button */}
<span>
<ConfigComponent/>
</span>
{featureConfig.ActiveLLM ? (
<span>
<ConfigComponent/>
</span>
) : null}
</Navbar>
);
}
Expand Down

0 comments on commit cf6d35d

Please sign in to comment.