new fields in general settings
and test for password switcher
This commit is contained in:
parent
08c2567551
commit
3b1d85824f
@ -27,7 +27,7 @@
|
||||
"text-summary"
|
||||
]
|
||||
},
|
||||
"proxy": "http://192.168.0.248",
|
||||
"proxy": "http://192.168.0.42",
|
||||
"homepage": "/",
|
||||
"eslintConfig": {
|
||||
"extends": "react-app"
|
||||
|
@ -13,10 +13,6 @@ class Preview extends React.Component {
|
||||
};
|
||||
}
|
||||
|
||||
componentWillUnmount() {
|
||||
this.setState({});
|
||||
}
|
||||
|
||||
componentDidMount() {
|
||||
this.setState({
|
||||
previewpicture: null,
|
||||
@ -30,9 +26,9 @@ class Preview extends React.Component {
|
||||
fetch('/api/videoload.php', {method: 'POST', body: updateRequest})
|
||||
.then((response) => response.text()
|
||||
.then((result) => {
|
||||
this.setState(prevState => ({
|
||||
...prevState.previewpicture, previewpicture: result
|
||||
}));
|
||||
this.setState({
|
||||
previewpicture: result
|
||||
});
|
||||
}));
|
||||
}
|
||||
|
||||
|
@ -6,31 +6,58 @@ class GeneralSettings extends React.Component {
|
||||
constructor(props) {
|
||||
super(props);
|
||||
|
||||
this.state = {};
|
||||
this.state = {
|
||||
tvshowsupport: false,
|
||||
videopath: "",
|
||||
tvshowpath: ""
|
||||
};
|
||||
}
|
||||
|
||||
componentDidMount() {
|
||||
const updateRequest = new FormData();
|
||||
updateRequest.append('action', 'loadVideo');
|
||||
updateRequest.append('movieid', this.props.movie_id);
|
||||
|
||||
fetch('/api/videoload.php', {method: 'POST', body: updateRequest})
|
||||
.then((response) => response.json()
|
||||
.then((result) => {
|
||||
// todo 2020-07-3: set state here
|
||||
}));
|
||||
}
|
||||
|
||||
render() {
|
||||
return (
|
||||
<>
|
||||
Generalsettings here
|
||||
<div className='GeneralForm'>
|
||||
<Form>
|
||||
<Form.Row>
|
||||
<Form.Group as={Col} controlId="formGridEmail">
|
||||
<Form.Label>Video Path</Form.Label>
|
||||
<Form.Control type="text" placeholder="todo password here" />
|
||||
<Form.Control type="text" placeholder="/var/www/html/video"/>
|
||||
</Form.Group>
|
||||
|
||||
<Form.Group as={Col} controlId="formGridPassword">
|
||||
<Form.Label>Password</Form.Label>
|
||||
<Form.Control type="password" placeholder="Password" />
|
||||
<Form.Label>TV Show Path</Form.Label>
|
||||
<Form.Control type='text' placeholder="/var/www/html/tvshow"/>
|
||||
</Form.Group>
|
||||
</Form.Row>
|
||||
|
||||
<Form.Group controlId="formGridAddress1">
|
||||
<Form.Label>Address</Form.Label>
|
||||
<Form.Control placeholder="1234 Main St" />
|
||||
</Form.Group>
|
||||
<Form.Check
|
||||
type="switch"
|
||||
id="custom-switch"
|
||||
label="Enable Password support"
|
||||
onChange={() => {
|
||||
this.setState({tvshowsupport: !this.state.tvshowsupport})
|
||||
}}
|
||||
/>
|
||||
|
||||
{this.state.tvshowsupport ?
|
||||
<Form.Group controlId="passwordfield">
|
||||
<Form.Label>Password</Form.Label>
|
||||
<Form.Control type="password" placeholder="**********"/>
|
||||
</Form.Group> : null
|
||||
}
|
||||
|
||||
|
||||
<Button variant="primary" type="submit">
|
||||
Submit
|
||||
|
@ -16,5 +16,12 @@ describe('<GeneralSettings/>', function () {
|
||||
wrapper.unmount();
|
||||
});
|
||||
|
||||
|
||||
it('test password hide/show switchbutton', function () {
|
||||
const wrapper = shallow(<GeneralSettings/>);
|
||||
|
||||
expect(wrapper.find("FormGroup").findWhere(it => it.props().controlId === "passwordfield")).toHaveLength(0);
|
||||
wrapper.find("FormCheck").findWhere(it => it.props().label === "Enable Password support").simulate("change");
|
||||
|
||||
expect(wrapper.find("FormGroup").findWhere(it => it.props().controlId === "passwordfield")).toHaveLength(1);
|
||||
});
|
||||
});
|
||||
|
Loading…
Reference in New Issue
Block a user