Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added a config file to enable/disable features in the tool #18

Merged
merged 1 commit into from
Jul 25, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading