comparison OrthancExplorer/explorer.js @ 2582:b3da733d984c jobs

job actions in Orthanc Explorer
author Sebastien Jodogne <s.jodogne@gmail.com>
date Fri, 11 May 2018 17:58:06 +0200
parents 3372c5255333
children 1b6a6d80b6f2
comparison
equal deleted inserted replaced
2581:8da2cffc2378 2582:b3da733d984c
1216 1216
1217 target.append(block); 1217 target.append(block);
1218 1218
1219 target.listview('refresh'); 1219 target.listview('refresh');
1220 1220
1221 $('#job-delete').closest('.ui-btn').show(); 1221 $('#job-cancel').closest('.ui-btn').hide();
1222 $('#job-retry').closest('.ui-btn').hide(); 1222 $('#job-retry').closest('.ui-btn').hide();
1223 $('#job-resubmit').closest('.ui-btn').hide(); 1223 $('#job-resubmit').closest('.ui-btn').hide();
1224 $('#job-pause').closest('.ui-btn').hide(); 1224 $('#job-pause').closest('.ui-btn').hide();
1225 $('#job-resume').closest('.ui-btn').hide(); 1225 $('#job-resume').closest('.ui-btn').hide();
1226 1226
1227 if (job.State == 'Running' || 1227 if (job.State == 'Running' ||
1228 job.State == 'Pending' || 1228 job.State == 'Pending' ||
1229 job.State == 'Retry') { 1229 job.State == 'Retry') {
1230 $('#job-cancel').closest('.ui-btn').show();
1230 $('#job-pause').closest('.ui-btn').show(); 1231 $('#job-pause').closest('.ui-btn').show();
1231 } 1232 }
1232 else if (job.State == 'Success') { 1233 else if (job.State == 'Success') {
1233 } 1234 }
1234 else if (job.State == 'Failure') { 1235 else if (job.State == 'Failure') {
1239 } 1240 }
1240 } 1241 }
1241 }); 1242 });
1242 } 1243 }
1243 }); 1244 });
1245
1246
1247
1248 function TriggerJobAction(action)
1249 {
1250 $.ajax({
1251 url: '../jobs/' + $.mobile.pageData.uuid + '/' + action,
1252 type: 'POST',
1253 async: false,
1254 complete: function(s) {
1255 window.location.reload();
1256 }
1257 });
1258 }
1259
1260 $('#job-cancel').live('click', function() {
1261 TriggerJobAction('cancel');
1262 });
1263
1264 $('#job-resubmit').live('click', function() {
1265 TriggerJobAction('resubmit');
1266 });
1267
1268 $('#job-pause').live('click', function() {
1269 TriggerJobAction('pause');
1270 });
1271
1272 $('#job-resume').live('click', function() {
1273 TriggerJobAction('resume');
1274 });