In admin we added a updatehandler so that a child can update this parent element. Also added our new sidebar for filtering our requested items by query and category.
This commit is contained in:
@@ -20,10 +20,16 @@ class AdminComponent extends React.Component {
|
|||||||
this.state = {
|
this.state = {
|
||||||
requested_objects: '',
|
requested_objects: '',
|
||||||
}
|
}
|
||||||
|
|
||||||
|
this.updateHandler = this.updateHandler.bind(this)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Fetches all requested elements and updates the state with response
|
// Fetches all requested elements and updates the state with response
|
||||||
componentWillMount() {
|
componentWillMount() {
|
||||||
|
this.fetchRequestedItems()
|
||||||
|
}
|
||||||
|
|
||||||
|
fetchRequestedItems() {
|
||||||
fetchJSON('https://apollo.kevinmidboe.com/api/v1/plex/requests/all', 'GET')
|
fetchJSON('https://apollo.kevinmidboe.com/api/v1/plex/requests/all', 'GET')
|
||||||
.then(result => {
|
.then(result => {
|
||||||
this.setState({
|
this.setState({
|
||||||
@@ -32,6 +38,10 @@ class AdminComponent extends React.Component {
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
updateHandler() {
|
||||||
|
this.fetchRequestedItems()
|
||||||
|
}
|
||||||
|
|
||||||
// Displays loginform if not logged in and passes response from
|
// Displays loginform if not logged in and passes response from
|
||||||
// api call to sidebar and infoPanel through props
|
// api call to sidebar and infoPanel through props
|
||||||
verifyLoggedIn() {
|
verifyLoggedIn() {
|
||||||
@@ -52,16 +62,17 @@ class AdminComponent extends React.Component {
|
|||||||
|
|
||||||
return (
|
return (
|
||||||
<div>
|
<div>
|
||||||
<div style={adminCSS.sidebar}>
|
|
||||||
<Sidebar
|
|
||||||
requested_objects={this.state.requested_objects}
|
|
||||||
listItemSelected={listItemSelected}
|
|
||||||
/>
|
|
||||||
</div>
|
|
||||||
<div style={adminCSS.selectedObjectPanel}>
|
<div style={adminCSS.selectedObjectPanel}>
|
||||||
<AdminRequestInfo
|
<AdminRequestInfo
|
||||||
selectedRequest={selectedRequest}
|
selectedRequest={selectedRequest}
|
||||||
listItemSelected={listItemSelected}
|
listItemSelected={listItemSelected}
|
||||||
|
updateHandler = {this.updateHandler}
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
<div style={adminCSS.sidebar}>
|
||||||
|
<Sidebar
|
||||||
|
requested_objects={this.state.requested_objects}
|
||||||
|
listItemSelected={listItemSelected}
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
Reference in New Issue
Block a user