Blame view
api/dashboard/src/components/CapecList.vue
2.03 KB
0d8c0f816 initial commit |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 |
<template> <div> <data-table ref="datatable" search-route="capec" @context-changed="onContextChanged" > <b-table ref="table" stacked="md" :fields="fields" :items="dataLoadProvider" :busy.sync="isBusy" empty-text="No records found" > <template v-slot:cell(_source.timestamp)="row"> {{ formatDate(row.item._source.timestamp) }} </template> <template v-slot:cell(actions)="row"> <b-button variant="info" title="Paths" class="mr-2" @click.stop="row.toggleDetails" > <fa :icon="row.detailsShowing ? 'arrow-up' : 'arrow-down'" /> </b-button> </template> <template slot="row-details" slot-scope="row"> <div v-if="row.item._source.tree"> <json-view :root-key="row.item._source.cve" :data="row.item._source.tree" /> </div> </template> </b-table> </data-table> </div> </template> <script> import { JSONView } from 'vue-json-component' import DataTable from './DataTable' export default { name: 'CapecList', components: { DataTable, 'json-view': JSONView }, data () { return { isBusy: false, fields: [ { key: '_source.timestamp', label: 'Timestamp' }, { key: '_source.signature_id', label: 'Signature ID' }, { key: '_source.signature', label: 'Signature' }, { key: '_source.category', label: 'Category' }, { key: '_source.cve', label: 'CVE' }, { key: 'actions', label: 'Actions' } ] } }, methods: { dataLoadProvider (ctx) { return this.$refs.datatable.loadData(ctx.sortBy, ctx.sortDesc) }, onContextChanged () { return this.$refs.table.refresh() }, formatDate (arg) { const tmp = new Date(arg).toString() return tmp.substring(0, tmp.length - 40) } } } </script> <style scoped> </style> |