mirror of
https://github.com/RetroShare/RetroShare.git
synced 2025-07-23 14:41:04 -04:00
webui: searchresult cross-checking with downloads
This commit is contained in:
parent
3bbd370242
commit
bbdb04fd78
1 changed files with 21 additions and 3 deletions
|
@ -18,6 +18,16 @@ module.exports = {
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
var dl_ids = [];
|
||||||
|
|
||||||
|
var downloads =rs("transfers/downloads");
|
||||||
|
if (downloads !== undefined) {
|
||||||
|
downloads.map(function(item){
|
||||||
|
dl_ids.push(item.hash);
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
return m("div",[
|
return m("div",[
|
||||||
m("h2","turtle file search results"),
|
m("h2","turtle file search results"),
|
||||||
m("h3", "searchtext: " + searchdetail + " (" + results.length + ")"),
|
m("h3", "searchtext: " + searchdetail + " (" + results.length + ")"),
|
||||||
|
@ -29,21 +39,29 @@ module.exports = {
|
||||||
m("th",""),
|
m("th",""),
|
||||||
]),
|
]),
|
||||||
results.map(function(file){
|
results.map(function(file){
|
||||||
|
if (dl_ids.indexOf(file.hash)>=0) {
|
||||||
|
file.state="in download queue"
|
||||||
|
}
|
||||||
return m("tr",[
|
return m("tr",[
|
||||||
m("th",file.name),
|
m("th",file.name),
|
||||||
m("th",file.size),
|
m("th",file.size),
|
||||||
m("th",[
|
m("th",[
|
||||||
m("span.btn", {
|
file.state === undefined
|
||||||
|
? m("span.btn", {
|
||||||
onclick:function(){
|
onclick:function(){
|
||||||
rs.request("transfers/control_download", {
|
rs.request("transfers/control_download", {
|
||||||
action: "begin",
|
action: "begin",
|
||||||
name: file.name,
|
name: file.name,
|
||||||
size: file.size,
|
size: file.size,
|
||||||
hash: file.hash,
|
hash: file.hash,
|
||||||
|
}, function(){
|
||||||
|
result="added";
|
||||||
});
|
});
|
||||||
|
m.startComputation();
|
||||||
|
m.endComputation();
|
||||||
}
|
}
|
||||||
},
|
}, "download")
|
||||||
"download")
|
: file.state
|
||||||
]),
|
]),
|
||||||
])
|
])
|
||||||
})
|
})
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue