Skip to content

Commit

Permalink
Hide the upload predict result toggle in the production environment. (
Browse files Browse the repository at this point in the history
…microsoft#871)

* Hide predict mode toggle in prod env.

* Hide predict mode toggle in prod env.

* Use enablePredictionFileSelection in the apiconfig.json file to decide whether display the prediction file toggler or not.

* Replace "enablePredictionFileSelection" with "enablePredictionResultUpload" and change the default value
  • Loading branch information
simotw authored Feb 9, 2021
1 parent dabee73 commit 35002d3
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 11 deletions.
3 changes: 2 additions & 1 deletion src/appConfig.json
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
{
"enableAPIVersionSelection" : true
"enableAPIVersionSelection" : true,
"enablePredictionResultUpload": true
}
4 changes: 2 additions & 2 deletions src/common/appInfo.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,10 @@ export interface IAppInfo {
description: string;
/** Flag for if API version is selectable */
enableAPIVersionSelection: boolean;

enablePredictionResultUpload: boolean;
}

/**
* Gets current application info
*/
export const appInfo = { ...packageJson, enableAPIVersionSelection: appConfig["enableAPIVersionSelection"] } as IAppInfo;
export const appInfo = { ...packageJson, enableAPIVersionSelection: appConfig["enableAPIVersionSelection"], enablePredictionResultUpload: appConfig["enablePredictionResultUpload"] } as IAppInfo;
2 changes: 2 additions & 0 deletions src/common/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ appVersionArr[1] = appVersionArr[1] + "-preview";
const appVersion = appVersionArr.join(".");

const enableAPIVersionSelection = appInfo.enableAPIVersionSelection;
const enablePredictionResultUpload = appInfo.enablePredictionResultUpload;
const apiVersion = "v2.1-preview.2";

/**
Expand All @@ -20,6 +21,7 @@ export const constants = {
appVersion,
apiVersion,
enableAPIVersionSelection,
enablePredictionResultUpload,
projectFormTempKey: "projectForm",
projectFileExtensionOld: ".vott",
projectFileExtension: ".fott",
Expand Down
18 changes: 10 additions & 8 deletions src/react/components/pages/prebuiltPredict/prebuiltPredictPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -272,14 +272,16 @@ export class PrebuiltPredictPage extends React.Component<IPrebuiltPredictPagePro
</div>
</div>
<Separator className="separator-right-pane-main">2. Get prediction.</Separator>
<div className="p-3" style={{ marginTop: "8px" }}>
<Toggle theme={getLightGreyTheme()}
className="predict-mode-toggle"
defaultChecked
onText="Call live service"
offText="Use predicted file"
onChange={this.handleLiveModeToggleChange} />
</div>
{constants.enablePredictionResultUpload &&
<div className="p-3" style={{ marginTop: "8px" }}>
<Toggle theme={getLightGreyTheme()}
className="predict-mode-toggle"
defaultChecked
onText="Call live service"
offText="Use predicted file"
onChange={this.handleLiveModeToggleChange} />
</div>
}
{!this.state.liveMode &&
<div className="p-3" style={{ marginTop: "-2rem" }}>
<PredictionFilePicker
Expand Down

0 comments on commit 35002d3

Please sign in to comment.