Fixes in scripts

This commit is contained in:
Antonio de la Rosa 2022-02-09 00:58:32 +01:00
parent cda8eb1232
commit 25d98341ac
3 changed files with 32 additions and 3 deletions

View file

@ -519,6 +519,10 @@ def pastafari2_get_multiprogress():
ids=request.args.get('ids', '[]') 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_ids=[str(i) for i in json.loads(ids)]
final_str=",".join(['%s']*len(final_ids)) final_str=",".join(['%s']*len(final_ids))
@ -531,7 +535,7 @@ def pastafari2_get_multiprogress():
logtask=LogTask(db) 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)) resp=make_response(json.dumps(arr_log))

View file

@ -6,8 +6,25 @@ echo '{"error": 0, "status": 0, "progress": 0, "no_progress":0, "message": "Inst
sleep 1 sleep 1
# 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 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 if [ $? -eq 0 ]; then
#echo "Installed python3 sucessfully if not error..." #echo "Installed python3 sucessfully if not error..."

View file

@ -1,5 +1,6 @@
<%inherit file="dashboard.phtml"/> <%inherit file="dashboard.phtml"/>
<%block name="content"> <%block name="content">
<p><a href="${url_for('.pastafari2_dashboard')}">${lang('pastafari2', 'servers', 'Servers')}</a> &gt;&gt; ${lang('pastafari2', 'task_progress', 'Task progress')}</p>
<h2>${name_task}</h2> <h2>${name_task}</h2>
<p>${description_task}</p> <p>${description_task}</p>
<hr /> <hr />
@ -16,12 +17,15 @@
<div id="finished" style="display:none;"> <div id="finished" style="display:none;">
<p><strong>All tasks were finished.</strong></p> <p><strong>All tasks were finished.</strong></p>
</div> </div>
<p><a href="${url_for('.pastafari2_dashboard')}">${lang('pastafari2', 'servers', 'Servers')}</a> &gt;&gt; ${lang('pastafari2', 'task_progress', 'Task progress')}</p>
</%block> </%block>
<%block name="jscript_block"> <%block name="jscript_block">
<script> <script>
ids=[]; ids=[];
task_completed=0;
//Get all tasks, next process 50 next progress. //Get all tasks, next process 50 next progress.
$.ajax({ $.ajax({
url: "${url_for('.pastafari2_get_servers_task')}", url: "${url_for('.pastafari2_get_servers_task')}",
@ -56,7 +60,7 @@ $.ajax({
function get_log() { function get_log() {
$.ajax({ $.ajax({
url: "${url_for('.pastafari2_get_multiprogress')}", url: "${url_for('.pastafari2_get_multiprogress')}?position=",
data: {ids: JSON.stringify(ids)}, data: {ids: JSON.stringify(ids)},
success: function (data) { success: function (data) {
@ -78,6 +82,10 @@ function get_log() {
if(data[i].status==1) { if(data[i].status==1) {
task_completed++;
if(data[i].error==0) { if(data[i].error==0) {
$('#task_'+data[i].task_id).find('i').removeClass('fa-cog fa-spin fa-fw').addClass('fa-check'); $('#task_'+data[i].task_id).find('i').removeClass('fa-cog fa-spin fa-fw').addClass('fa-check');