Skip to content

Commit

Permalink
add tooltip in PrebuiltSetting (microsoft#798)
Browse files Browse the repository at this point in the history
  • Loading branch information
yongbing-chen authored Dec 1, 2020
1 parent 31073cc commit f5cdccd
Show file tree
Hide file tree
Showing 5 changed files with 45 additions and 15 deletions.
6 changes: 6 additions & 0 deletions src/common/localization/en-us.ts
Original file line number Diff line number Diff line change
Expand Up @@ -245,6 +245,12 @@ export const english: IAppStrings = {
inProgress: "Analysis in progress...",
anlayWithPrebuiltModels: "Analyze ${name} (preview)",
},
prebuiltSetting:{
endpointTooltip: "e.g: https://xxx.cognitiveservices.azure.com/",
endpointPlaceholder: "need endpoint",
apiKeyTooltip: "get key info from Azure Subscription Resource Keys & Endpoint page",
apiKeyPlaceholder: "need apikey",
},
layoutPredict:{
title: "Layout analyze",
inProgress: "Analysis in progress...",
Expand Down
6 changes: 6 additions & 0 deletions src/common/localization/es-cl.ts
Original file line number Diff line number Diff line change
Expand Up @@ -244,6 +244,12 @@ export const spanish: IAppStrings = {
inProgress: "Análisis en curso...",
anlayWithPrebuiltModels: "Análisis ${name} (versión preliminar)",
},
prebuiltSetting:{
endpointTooltip: "Establecer el punto final eg: https://xxx.cognitiveservices.azure.com/",
endpointPlaceholder: "necesita punto final",
apiKeyTooltip:"Obtener información clave de la página de claves de recursos y terminales de suscripción de Azure",
apiKeyPlaceholder: "necesita apiKey"
},
layoutPredict:{
title: "Análisis de diseño",
inProgress: "Análisis en curso...",
Expand Down
8 changes: 7 additions & 1 deletion src/common/strings.ts
Original file line number Diff line number Diff line change
Expand Up @@ -242,7 +242,13 @@ export interface IAppStrings {
uploadFile: string;
inProgress: string;
anlayWithPrebuiltModels: string;
}
};
prebuiltSetting:{
endpointTooltip: string;
endpointPlaceholder: string;
apiKeyTooltip: string;
apiKeyPlaceholder: string;
};
layoutPredict:{
title:string;
inProgress: string;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
.apikeyContainer {
display: flex;
margin-bottom: 30px;
.ms-TooltipHost,
.apikey {
width: 100%;
}
Expand Down
39 changes: 25 additions & 14 deletions src/react/components/common/prebuiltSetting/prebuiltSetting.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import {DefaultButton, FontIcon, TextField} from '@fluentui/react';
import {DefaultButton, FontIcon, TextField, TooltipHost} from '@fluentui/react';
import React from 'react';
import {strings} from '../../../../common/strings';
import {getGreenWithWhiteBackgroundTheme, getPrimaryGreyTheme} from '../../../../common/themes';
import {IPrebuiltSettings} from '../../../../models/applicationState';
import IAppPrebuiltSettingsActions from '../../../../redux/actions/prebuiltSettingsActions';
Expand All @@ -26,23 +27,33 @@ export class PrebuiltSetting extends React.Component<IPrebuiltSettingProps, IPre
<div className="p-3 prebuilt-setting" style={{marginTop: "8px"}}>
<h5>Service configuration</h5>
<div style={{marginBottom: "3px"}}>Form recognizer service endpoint</div>
<TextField
className="mb-1"
theme={getGreenWithWhiteBackgroundTheme()}
value={this.props.prebuiltSettings?.serviceURI}
onChange={this.setInputedServiceURI}
disabled={disabled}
/>
<div style={{marginBottom: "3px"}}>API key</div>
<div className="apikeyContainer">
<TooltipHost
content={strings.prebuiltSetting.endpointTooltip}>
<TextField
className="apikey"
className="mb-1"
name="endpointUrl"
placeholder={strings.prebuiltSetting.endpointPlaceholder}
theme={getGreenWithWhiteBackgroundTheme()}
type={this.state.showInputedAPIKey ? "text" : "password"}
value={this.props.prebuiltSettings?.apiKey}
onChange={this.setInputedAPIKey}
value={this.props.prebuiltSettings?.serviceURI}
onChange={this.setInputedServiceURI}
disabled={disabled}
/>
</TooltipHost>
<div style={{marginBottom: "3px"}}>API key</div>
<div className="apikeyContainer">
<TooltipHost
content={strings.prebuiltSetting.apiKeyTooltip}>
<TextField
className="apikey"
name="apikey"
placeholder={strings.prebuiltSetting.apiKeyPlaceholder}
theme={getGreenWithWhiteBackgroundTheme()}
type={this.state.showInputedAPIKey ? "text" : "password"}
value={this.props.prebuiltSettings?.apiKey}
onChange={this.setInputedAPIKey}
disabled={disabled}
/>
</TooltipHost>
<DefaultButton
className="portected-input-margin"
theme={getPrimaryGreyTheme()}
Expand Down

0 comments on commit f5cdccd

Please sign in to comment.