misp-modules/website/app/templates/history.html

106 lines
3.9 KiB
HTML
Raw Normal View History

2024-02-07 14:39:19 +01:00
<!--
Author: David Cruciani
-->
{% extends 'base.html' %}
{% block content %}
2024-02-08 11:30:55 +01:00
<h1 id="top">History</h1>
2024-02-07 14:39:19 +01:00
<hr>
<br>
2024-02-19 10:27:48 +01:00
<!-- pagination -->
<nav aria-label="Page navigation example" v-if="history && history.nb_pages > 1">
<ul class="pagination">
<li :class="{'page-item': true, 'disabled': current_page == 1}">
<button class="page-link" @click="get_history(Math.max(1, current_page-1))">Previous</button>
</li>
<template v-for="cp in history.nb_pages">
<li :class="{'page-item': true, 'active': current_page==cp}"><button class="page-link" @click="get_history(cp)">[[cp]]</button></li>
</template>
<li :class="{'page-item': true, 'disabled': current_page == history.nb_pages}">
<button class="page-link" @click="get_history(Math.min(current_page+1, history.nb_pages))">Next</button>
</li>
</ul>
</nav>
<!-- pagination -->
2024-02-07 14:39:19 +01:00
<div v-if="history">
2024-02-19 10:27:48 +01:00
<template v-for="h in history.history">
<div class="list-group" style="margin-bottom: 20px;">
<a :href="'/query/'+h.uuid" class="list-group-item list-group-item-action">
<div class="d-flex w-100 justify-content-between">
<h5 class="mb-1">[[h.query.join(", ")]]</h5>
<small><i>[[h.uuid]]</i></small>
</div>
<p class="mb-1" style="color: green;"><u>Input Attribute</u>:</p>
<div>[[h.input]]</div>
<br>
<p class="mb-1" style="color: #2000ff;"><u>Modules</u>:</p>
<div>
2024-02-22 11:41:07 +01:00
[[h.modules.join(", ")]]
</div>
<div class="d-flex w-100 justify-content-between">
<div></div>
<small><i>[[h.query_date]]</i></small>
</div>
</a>
</div>
2024-02-07 15:53:43 +01:00
</template>
2024-02-07 14:39:19 +01:00
</div>
2024-02-19 10:27:48 +01:00
<!-- pagination -->
<nav aria-label="Page navigation example" v-if="history && history.nb_pages > 1">
<ul class="pagination">
<li :class="{'page-item': true, 'disabled': current_page == 1}">
<button class="page-link" @click="get_history(Math.max(1, current_page-1))">Previous</button>
</li>
<template v-for="cp in history.nb_pages">
<li :class="{'page-item': true, 'active': current_page==cp}"><button class="page-link" @click="get_history(cp)">[[cp]]</button></li>
</template>
<li :class="{'page-item': true, 'disabled': current_page == history.nb_pages}">
<button class="page-link" @click="get_history(Math.min(current_page+1, history.nb_pages))">Next</button>
</li>
</ul>
</nav>
<!-- pagination -->
2024-02-07 14:39:19 +01:00
<span id="goTop">[<a href="#top">Go Back Top</a>]</span>
{% endblock %}
{% block script %}
<script type="module">
const { createApp, ref, onMounted, nextTick, defineComponent} = Vue
import {message_list} from '/static/js/toaster.js'
2024-02-20 14:10:32 +01:00
import history_view from '/static/js/history/history_view.js'
2024-02-07 14:39:19 +01:00
createApp({
delimiters: ['[[', ']]'],
2024-02-12 15:33:47 +01:00
components: {
history_view
},
2024-02-07 14:39:19 +01:00
setup() {
const history = ref({})
2024-02-19 10:27:48 +01:00
const current_page = ref(1)
2024-02-07 14:39:19 +01:00
2024-02-19 10:27:48 +01:00
async function get_history(page){
let res = await fetch("/get_history?page=" + page)
2024-02-07 14:39:19 +01:00
let loc = await res.json()
history.value = loc
2024-02-19 10:27:48 +01:00
current_page.value = page
2024-02-07 14:39:19 +01:00
}
2024-02-19 10:27:48 +01:00
get_history(1)
2024-02-07 14:39:19 +01:00
return {
message_list,
history,
2024-02-19 10:27:48 +01:00
current_page,
get_history
2024-02-07 14:39:19 +01:00
}
}
2024-02-19 14:01:06 +01:00
}).mount('.container-fluid')
2024-02-07 14:39:19 +01:00
</script>
{% endblock %}