-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge remote-tracking branch 'origin/main' into feat/timeofday-custom…
…-component
- Loading branch information
Showing
8 changed files
with
76 additions
and
12 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
51 changes: 51 additions & 0 deletions
51
webapp/src/components/admin_console_settings/secret_text_setting.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
import React, {useEffect, useRef, useState} from 'react'; | ||
|
||
import BaseSetting from './base_setting'; | ||
|
||
type Props = { | ||
id: string; | ||
name: string; | ||
helpText: string; | ||
onChange: (value: string) => void; | ||
value: string; | ||
disabled?: boolean; | ||
}; | ||
|
||
const SecretTextSetting = (props: Props) => { | ||
const [value, setValue] = useState(''); | ||
const mounted = useRef(false); | ||
|
||
useEffect(() => { | ||
if (mounted.current) { | ||
setValue(props.value); | ||
return; | ||
} | ||
|
||
if (props.value) { | ||
setValue('*'.repeat(32)); | ||
} | ||
|
||
mounted.current = true; | ||
}, [props.value]); | ||
|
||
const handleChange = (newValue: string) => { | ||
setValue(newValue); | ||
}; | ||
|
||
return ( | ||
<BaseSetting | ||
{...props} | ||
> | ||
<input | ||
id={props.id} | ||
className='form-control' | ||
type='text' | ||
value={value} | ||
onChange={(e) => handleChange(e.target.value)} | ||
disabled={props.disabled} | ||
/> | ||
</BaseSetting> | ||
); | ||
}; | ||
|
||
export default SecretTextSetting; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters