fix pendingactions ui

This commit is contained in:
wh1te909 2021-03-02 00:39:42 +00:00
parent ee6a167220
commit 8cc11fc102
2 changed files with 5 additions and 3 deletions

View File

@ -109,7 +109,6 @@ class FilterOptionsAuditLog(APIView):
class PendingActions(APIView):
def patch(self, request):
status_filter = "completed" if request.data["showCompleted"] else "pending"
completed = PendingAction.objects.filter(status="completed").count()
if "agentPK" in request.data.keys():
actions = PendingAction.objects.filter(
agent__pk=request.data["agentPK"], status=status_filter
@ -122,7 +121,8 @@ class PendingActions(APIView):
ret = {
"actions": PendingActionSerializer(actions, many=True).data,
"completed_count": completed,
"completed_count": PendingAction.objects.filter(status="completed").count(),
"total": PendingAction.objects.count(),
}
return Response(ret)

View File

@ -6,7 +6,7 @@
<q-space />
<q-btn dense flat icon="close" v-close-popup />
</q-bar>
<div v-if="completedCount !== 0" class="q-pa-md">
<div v-if="totalCount !== 0" class="q-pa-md">
<div class="row">
<div class="col">
<q-btn
@ -109,6 +109,7 @@ export default {
showCompleted: false,
selectedStatus: null,
completedCount: 0,
totalCount: 0,
actionType: null,
hostname: "",
pagination: {
@ -160,6 +161,7 @@ export default {
this.$axios
.patch("/logs/pendingactions/", data)
.then(r => {
this.totalCount = r.data.total;
this.completedCount = r.data.completed_count;
this.actions = Object.freeze(r.data.actions);
if (!!this.agentpk) this.hostname = r.data.actions[0].hostname;