Skip to content

Commit f151d32

Browse files
committed
Made API keys hidden (password fields) in the query translator module
1 parent a421ee9 commit f151d32

File tree

4 files changed

+8
-0
lines changed

4 files changed

+8
-0
lines changed

src/component/field/Field.tsx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ const NeoField = ({
1515
select = false,
1616
disabled = undefined,
1717
variant = undefined,
18+
password = false,
1819
helperText = undefined,
1920
defaultValueLabel = undefined,
2021
defaultValue = undefined,
@@ -77,6 +78,7 @@ const NeoField = ({
7778
variant={variant}
7879
label={label}
7980
helpText={helperText}
81+
type={password ? 'password' : 'text'}
8082
disabled={disabled}
8183
value={value != null ? value : defaultValue}
8284
fluid

src/component/field/Setting.tsx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,7 @@ const NeoSetting = ({
7272
defaultValue,
7373
disabled = undefined,
7474
helperText = undefined,
75+
password = false,
7576
onChange,
7677
onClick = () => {},
7778
style = { width: '100%', marginBottom: '10px', marginRight: '10px', marginLeft: '10px' },
@@ -104,6 +105,7 @@ const NeoSetting = ({
104105
disabled={disabled}
105106
helperText={helperText}
106107
value={value}
108+
password={password}
107109
defaultValue={''}
108110
placeholder={`${defaultValue}`}
109111
style={style}

src/extensions/query-translator/QueryTranslatorConfig.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ interface ClientSettingEntry {
1010
label: string;
1111
type: SELECTION_TYPES;
1212
default: any;
13+
password?: boolean;
1314
authentication?: boolean; // Required for authentication, the user should insert all the required fields before trying to authenticate
1415
hasAuthButton?: boolean; // Append a button at the end of the selector to trigger an auth request.
1516
methodFromClient?: string; // String that contains the name of the client function to call to retrieve the data needed to fill the option
@@ -47,6 +48,7 @@ export const QUERY_TRANSLATOR_CONFIG: QueryTranslatorConfig = {
4748
label: 'OpenAI API Key',
4849
type: SELECTION_TYPES.TEXT,
4950
default: '',
51+
password: true,
5052
hasAuthButton: true,
5153
authentication: true,
5254
},
@@ -74,6 +76,7 @@ export const QUERY_TRANSLATOR_CONFIG: QueryTranslatorConfig = {
7476
label: 'Subscription Key',
7577
type: SELECTION_TYPES.TEXT,
7678
default: '',
79+
password: true,
7780
hasAuthButton: true,
7881
authentication: true,
7982
},

src/extensions/query-translator/component/ClientSettings.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -155,6 +155,7 @@ export const ClientSettings = ({
155155
name={setting}
156156
value={localSettings[setting]}
157157
disabled={disabled}
158+
password={defaultSettings[setting].password}
158159
type={defaultSettings[setting].type}
159160
label={defaultSettings[setting].label}
160161
defaultValue={defaultSettings[setting].default}

0 commit comments

Comments
 (0)