Search uses URI for added_from compatibility

This commit is contained in:
James Barnsley
2017-05-05 10:47:18 +12:00
parent 0894fe5109
commit af57e6f346
6 changed files with 18 additions and 22 deletions

View File

@ -11,24 +11,21 @@ export default class AddToQueueModal extends React.Component{
super(props)
this.state = {
uris: '',
at_position: 'end'
next: false
}
}
handleSubmit(e){
var uris = this.state.uris.split(',')
if (this.state.at_position == 'next'){
this.props.mopidyActions.enqueueURIsNext(uris)
}else{
this.props.mopidyActions.enqueueURIs(uris)
}
console.log(this.state)
this.props.mopidyActions.enqueueURIs(uris, null, this.state.next)
this.props.uiActions.closeModal()
}
render(){
return (
<div>
<h4>Add URI(s) to tracklist</h4>
<h4>Add URI(s) to queue</h4>
<form onSubmit={e => this.handleSubmit(e)}>
<div className="field text">
@ -43,19 +40,17 @@ export default class AddToQueueModal extends React.Component{
<label>
<input
type="radio"
name="at_position"
value="end"
checked={ this.state.at_position == 'end' }
onChange={ e => this.setState({ at_position: e.target.value })} />
name="next"
checked={!this.state.next}
onChange={e => this.setState({next: false})} />
<span className="label">Add to end</span>
</label>
<label>
<input
type="radio"
name="at_position"
value="next"
checked={ this.state.at_position == 'next' }
onChange={ e => this.setState({ at_position: e.target.value })} />
name="next"
checked={this.state.next}
onChange={e => this.setState({next: true})} />
<span className="label">Add after current track</span>
</label>
</div>

View File

@ -37,7 +37,7 @@ class SearchForm extends React.Component{
break
default:
hashHistory.push(global.baseURL+'search/all/'+this.state.query)
hashHistory.push(global.baseURL+'search/iris:search:all:'+this.state.query)
break
}

View File

@ -220,6 +220,7 @@ export let uriType = function( uri ){
case 'artist':
case 'album':
case 'playlist':
case 'search':
return exploded[1]
break

View File

@ -60,7 +60,7 @@ ReactDOM.render(
<Route path="settings" component={Settings} />
<Route path="debug" component={Debug} />
<Route path="search/:type/:query" component={Search} />
<Route path="search/iris::search::type::query" component={Search} />
<Route path="album/:uri" component={Album} />
<Route path="artist/:uri(/:sub_view)" component={Artist} />
<Route path="playlist/:uri" component={Playlist} />

View File

@ -375,8 +375,7 @@ const MopidyMiddleware = (function(){
store.dispatch(mopidyActions.enqueueURIsBatchDone())
store.dispatch(mopidyActions.enqueueUrisProcessor())
},
5000
//100
100
)
})
@ -452,6 +451,7 @@ const MopidyMiddleware = (function(){
instruct( socket, store, 'library.search', {query: {any: [action.query]}, uris: [action.uri_scheme]})
.then( response => {
if (response.length <= 0) return
if (typeof(response[0].tracks) === 'undefined') return
var tracks = response[0].tracks.splice(0,action.limit)

View File

@ -126,7 +126,7 @@ class Search extends React.Component{
return (
<div>
<section className="list-wrapper">
<TrackList tracks={ tracks } show_source_icon />
<TrackList tracks={tracks} uri={'iris:search:'+this.props.params.type+':'+this.props.params.query} show_source_icon />
<LazyLoadListener enabled={this.props['tracks_more'] && spotify_search_enabled} loadMore={ () => this.loadMore('tracks') }/>
</section>
</div>
@ -184,7 +184,7 @@ class Search extends React.Component{
<section className="list-wrapper">
<h4 className="left-padding"><Link to={global.baseURL+'search/'+this.props.params.query+'/tracks'}>Tracks</Link></h4>
<TrackList show_source_icon tracks={tracks} />
<TrackList tracks={tracks} uri={'iris:search:'+this.props.params.type+':'+this.props.params.query} show_source_icon />
<LazyLoadListener enabled={this.props['tracks_more'] && spotify_search_enabled} loadMore={ () => this.loadMore('tracks') }/>
</section>
@ -195,7 +195,7 @@ class Search extends React.Component{
handleTypeChange(val){
this.props.uiActions.hideContextMenu()
hashHistory.push(global.baseURL+'search/'+val+'/'+this.props.params.query)
hashHistory.push(global.baseURL+'search/iris:search:'+val+':'+this.props.params.query)
}
render(){