added some todos and css to video reindex

This commit is contained in:
Lukas Heiligenbrunner 2020-07-04 00:45:18 +02:00
parent 3b1d85824f
commit 9ce867c6c8
3 changed files with 39 additions and 4 deletions

View File

@ -15,13 +15,13 @@ class GeneralSettings extends React.Component {
componentDidMount() {
const updateRequest = new FormData();
updateRequest.append('action', 'loadVideo');
updateRequest.append('movieid', this.props.movie_id);
updateRequest.append('action', 'loadGeneralSettings');
fetch('/api/videoload.php', {method: 'POST', body: updateRequest})
fetch('/api/settings.php', {method: 'POST', body: updateRequest})
.then((response) => response.json()
.then((result) => {
// todo 2020-07-3: set state here
// todo 2020-07-4: php and test code
}));
}
@ -29,7 +29,10 @@ class GeneralSettings extends React.Component {
return (
<>
<div className='GeneralForm'>
<Form>
<Form onSubmit={(e) => {
e.preventDefault();
this.saveSettings();
}}>
<Form.Row>
<Form.Group as={Col} controlId="formGridEmail">
<Form.Label>Video Path</Form.Label>
@ -67,6 +70,17 @@ class GeneralSettings extends React.Component {
</>
);
}
saveSettings() {
const updateRequest = new FormData();
updateRequest.append('action', 'saveGeneralSettings');
fetch('/api/settings.php', {method: 'POST', body: updateRequest})
.then((response) => response.json()
.then((result) => {
// todo 2020-07-4: settings result here
}));
}
}
export default GeneralSettings;

View File

@ -0,0 +1,13 @@
.indextextarea {
margin-top: 15px;
padding: 10px;
overflow-y: scroll;
overflow-x: auto;
min-height: 100px;
max-height: 300px;
width: 50%;
background-color: #c2c2c2;
border-radius: 5px;
}

View File

@ -1,4 +1,5 @@
import React from "react";
import "./MovieSettings.css"
class MovieSettings extends React.Component {
constructor(props) {
@ -35,12 +36,15 @@ class MovieSettings extends React.Component {
}
startReindex() {
document.getElementsByClassName("indextextarea")[0].innerHTML = "";
console.log("starting");
const updateRequest = new FormData();
// fetch all videos available
fetch('/api/extractvideopreviews.php', {method: 'POST', body: updateRequest})
.then((response) => response.json()
.then((result) => {
// todo 2020-07-4: some kind of start event
// maybe disable start btn
console.log("returned");
}))
.catch(() => {
@ -60,11 +64,15 @@ class MovieSettings extends React.Component {
.then((result) => {
if (result.contentAvailable === true) {
console.log(result);
// todo 2020-07-4: scroll to bottom of div here
this.setState({
// insert a string for each line
text: [...result.message.split("\n"),
...this.state.text]
});
} else {
// clear refresh interval if no content available
// todo 2020-07-4: maybe enable start btn again
clearInterval(this.myinterval);
}
}))