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"
|
"text-summary"
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
"proxy": "http://192.168.0.248",
|
"proxy": "http://192.168.0.42",
|
||||||
"homepage": "/",
|
"homepage": "/",
|
||||||
"eslintConfig": {
|
"eslintConfig": {
|
||||||
"extends": "react-app"
|
"extends": "react-app"
|
||||||
|
@ -13,10 +13,6 @@ class Preview extends React.Component {
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
componentWillUnmount() {
|
|
||||||
this.setState({});
|
|
||||||
}
|
|
||||||
|
|
||||||
componentDidMount() {
|
componentDidMount() {
|
||||||
this.setState({
|
this.setState({
|
||||||
previewpicture: null,
|
previewpicture: null,
|
||||||
@ -30,9 +26,9 @@ class Preview extends React.Component {
|
|||||||
fetch('/api/videoload.php', {method: 'POST', body: updateRequest})
|
fetch('/api/videoload.php', {method: 'POST', body: updateRequest})
|
||||||
.then((response) => response.text()
|
.then((response) => response.text()
|
||||||
.then((result) => {
|
.then((result) => {
|
||||||
this.setState(prevState => ({
|
this.setState({
|
||||||
...prevState.previewpicture, previewpicture: result
|
previewpicture: result
|
||||||
}));
|
});
|
||||||
}));
|
}));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -6,31 +6,58 @@ class GeneralSettings extends React.Component {
|
|||||||
constructor(props) {
|
constructor(props) {
|
||||||
super(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() {
|
render() {
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
Generalsettings here
|
|
||||||
<div className='GeneralForm'>
|
<div className='GeneralForm'>
|
||||||
<Form>
|
<Form>
|
||||||
<Form.Row>
|
<Form.Row>
|
||||||
<Form.Group as={Col} controlId="formGridEmail">
|
<Form.Group as={Col} controlId="formGridEmail">
|
||||||
<Form.Label>Video Path</Form.Label>
|
<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>
|
||||||
|
|
||||||
<Form.Group as={Col} controlId="formGridPassword">
|
<Form.Group as={Col} controlId="formGridPassword">
|
||||||
<Form.Label>Password</Form.Label>
|
<Form.Label>TV Show Path</Form.Label>
|
||||||
<Form.Control type="password" placeholder="Password" />
|
<Form.Control type='text' placeholder="/var/www/html/tvshow"/>
|
||||||
</Form.Group>
|
</Form.Group>
|
||||||
</Form.Row>
|
</Form.Row>
|
||||||
|
|
||||||
<Form.Group controlId="formGridAddress1">
|
<Form.Check
|
||||||
<Form.Label>Address</Form.Label>
|
type="switch"
|
||||||
<Form.Control placeholder="1234 Main St" />
|
id="custom-switch"
|
||||||
</Form.Group>
|
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">
|
<Button variant="primary" type="submit">
|
||||||
Submit
|
Submit
|
||||||
|
@ -16,5 +16,12 @@ describe('<GeneralSettings/>', function () {
|
|||||||
wrapper.unmount();
|
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