Skip to content

Commit

Permalink
jobs 不在从数据库中读取
Browse files Browse the repository at this point in the history
  • Loading branch information
yueyongyue committed May 6, 2016
1 parent 23975c6 commit 159713d
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 30 deletions.
17 changes: 3 additions & 14 deletions jobs/views.py
Original file line number Diff line number Diff line change
@@ -1,24 +1,13 @@
from django.shortcuts import render
from shaker.shaker_core import *
from django.contrib.auth.decorators import login_required
from returner.models import Jids,Salt_returns
import os

@login_required(login_url="/account/login/")
def jobs_history(request):
#sapi = SaltAPI()
#jids = sapi.runner("jobs.list_jobs")
true = "true"
false = "false"
null = "null"
jid_list = []
jids = Salt_returns.objects.all().order_by('-id')[:100]
for jid in jids:
jid_dic = eval(jid.full_ret)
jid_dics = jid_dic.copy()
jid_dics.update({'alter_time': jid.alter_time})
jid_list.append(jid_dics)
return render(request, 'jobs/jobs_history.html', {'jids': jid_list})
sapi = SaltAPI()
jids = sapi.runner("jobs.list_jobs")
return render(request, 'jobs/jobs_history.html', {'jids': jids})

@login_required(login_url="/account/login/")
def jobs_manage(request):
Expand Down
18 changes: 2 additions & 16 deletions templates/jobs/jobs_history.html
Original file line number Diff line number Diff line change
Expand Up @@ -23,12 +23,11 @@ <h2 class="page-header">Jobs History</h2>
<th>Jid</th>
<th>Fun</th>
<th>Arg</th>
<th>Time</th>
<th>StartTime</th>
<th>Target</th>
<th>Success</th>
<th>User</th>
</tr>
</thead>
<!--
<tbody>
{% for jid,info in jids.items %}
<tr class="even gradeC">
Expand All @@ -46,19 +45,6 @@ <h2 class="page-header">Jobs History</h2>
</tr>
{% endfor %}
</tbody>
-->
<tbody>
{% for info in jids %}
<tr class="even gradeC">
<td><div class="tooltip-demo"><a href="/jobs/jobs_detail&{{ info.jid }}" data-toggle="tooltip" data-placement="left" title="jobs detail">{{ info.jid }}</a></div></td>
<td>{{ info.fun }}</td>
<td>{% for arg in info.fun_args %}{{ arg }}{% endfor %}</td>
<td>{{ info.alter_time|date:"Y-m-d" }} {{ info.alter_time|time:"H:i:s" }}</td>
<td style="table-layout: fixed;WORD-BREAK: break-all; WORD-WRAP: break-word">{{ info.id }}</td>
<td>{{ info.success }}</td>
</tr>
{% endfor %}
</tbody>
</table>
</div>
<!-- /.table-responsive -->
Expand Down

0 comments on commit 159713d

Please sign in to comment.