Fixes in scripts
This commit is contained in:
parent
cda8eb1232
commit
25d98341ac
3 changed files with 32 additions and 3 deletions
|
|
@ -519,6 +519,10 @@ def pastafari2_get_multiprogress():
|
|||
|
||||
ids=request.args.get('ids', '[]')
|
||||
|
||||
position=0
|
||||
|
||||
#position=int(request.args.get('position', '0'))
|
||||
|
||||
final_ids=[str(i) for i in json.loads(ids)]
|
||||
|
||||
final_str=",".join(['%s']*len(final_ids))
|
||||
|
|
@ -531,7 +535,7 @@ def pastafari2_get_multiprogress():
|
|||
|
||||
logtask=LogTask(db)
|
||||
|
||||
arr_log=logtask.set_limit([20]).set_conditions('WHERE task_id IN ({})'.format(final_str), final_ids).select_to_array([], True)
|
||||
arr_log=logtask.set_limit([position, 20]).set_conditions('WHERE task_id IN ({})'.format(final_str), final_ids).select_to_array([], True)
|
||||
|
||||
resp=make_response(json.dumps(arr_log))
|
||||
|
||||
|
|
|
|||
|
|
@ -6,7 +6,24 @@ echo '{"error": 0, "status": 0, "progress": 0, "no_progress":0, "message": "Inst
|
|||
|
||||
sleep 1
|
||||
|
||||
sudo apt-get -y install python3 python3-pip
|
||||
# Get distro version using lsb_release
|
||||
|
||||
DISTRO=`( lsb_release -ds || cat /etc/*release || uname -om ) 2>/dev/null | head -n1`
|
||||
|
||||
if [[ $DISTRO =~ ^Debian ]]; then
|
||||
|
||||
sudo apt-get -y install python3 python3-pip
|
||||
|
||||
elif [[ $DISTRO =~ ^NAME=\"Arch ]]; then
|
||||
|
||||
sudo pacman -S python python-pip
|
||||
|
||||
else
|
||||
|
||||
echo "Sorry, Linux distro not supported"
|
||||
exit 1;
|
||||
|
||||
fi
|
||||
|
||||
if [ $? -eq 0 ]; then
|
||||
|
||||
|
|
|
|||
|
|
@ -1,5 +1,6 @@
|
|||
<%inherit file="dashboard.phtml"/>
|
||||
<%block name="content">
|
||||
<p><a href="${url_for('.pastafari2_dashboard')}">${lang('pastafari2', 'servers', 'Servers')}</a> >> ${lang('pastafari2', 'task_progress', 'Task progress')}</p>
|
||||
<h2>${name_task}</h2>
|
||||
<p>${description_task}</p>
|
||||
<hr />
|
||||
|
|
@ -16,12 +17,15 @@
|
|||
<div id="finished" style="display:none;">
|
||||
<p><strong>All tasks were finished.</strong></p>
|
||||
</div>
|
||||
<p><a href="${url_for('.pastafari2_dashboard')}">${lang('pastafari2', 'servers', 'Servers')}</a> >> ${lang('pastafari2', 'task_progress', 'Task progress')}</p>
|
||||
</%block>
|
||||
<%block name="jscript_block">
|
||||
<script>
|
||||
|
||||
ids=[];
|
||||
|
||||
task_completed=0;
|
||||
|
||||
//Get all tasks, next process 50 next progress.
|
||||
$.ajax({
|
||||
url: "${url_for('.pastafari2_get_servers_task')}",
|
||||
|
|
@ -56,7 +60,7 @@ $.ajax({
|
|||
function get_log() {
|
||||
|
||||
$.ajax({
|
||||
url: "${url_for('.pastafari2_get_multiprogress')}",
|
||||
url: "${url_for('.pastafari2_get_multiprogress')}?position=",
|
||||
data: {ids: JSON.stringify(ids)},
|
||||
success: function (data) {
|
||||
|
||||
|
|
@ -78,6 +82,10 @@ function get_log() {
|
|||
|
||||
if(data[i].status==1) {
|
||||
|
||||
task_completed++;
|
||||
|
||||
|
||||
|
||||
if(data[i].error==0) {
|
||||
|
||||
$('#task_'+data[i].task_id).find('i').removeClass('fa-cog fa-spin fa-fw').addClass('fa-check');
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue