mirror of
https://github.com/mandiant/capa.git
synced 2026-02-04 19:12:01 -08:00
Merge pull request #2298 from s-ff/fixes-2288-2289-2290
web: fix global search and add UI tweaks
This commit is contained in:
@@ -7,7 +7,8 @@
|
||||
size="small"
|
||||
:filters="filters"
|
||||
:filterMode="filterMode"
|
||||
:globalFilterFields="['funcaddr', 'ruleName', 'namespace']"
|
||||
filterDisplay="row"
|
||||
:globalFilterFields="['address', 'rule', 'namespace']"
|
||||
>
|
||||
<template #header>
|
||||
<IconField>
|
||||
@@ -16,35 +17,47 @@
|
||||
</IconField>
|
||||
</template>
|
||||
|
||||
<Column field="address" sortable header="Function Address" :rowspan="3" class="w-min">
|
||||
<Column
|
||||
field="address"
|
||||
sortable
|
||||
header="Function Address"
|
||||
class="w-min"
|
||||
:showFilterMenu="false"
|
||||
:showClearButton="false"
|
||||
>
|
||||
<template #filter v-if="props.showColumnFilters">
|
||||
<InputText v-model="filters['address'].value" placeholder="Filter by name" />
|
||||
</template>
|
||||
<template #body="{ data }">
|
||||
<span class="font-monospace">{{ data.address }}</span>
|
||||
<span class="font-monospace text-base">{{ data.address }}</span>
|
||||
<span v-if="data.matchCount > 1" class="font-italic">
|
||||
({{ data.matchCount }} match{{ data.matchCount > 1 ? "es" : "" }})
|
||||
</span>
|
||||
</template>
|
||||
</Column>
|
||||
|
||||
<Column field="rule" sortable header="Matches" class="w-min">
|
||||
<Column field="rule" sortable header="Matches" class="w-min" :showFilterMenu="false" :showClearButton="false">
|
||||
<template #filter v-if="props.showColumnFilters">
|
||||
<InputText v-model="filters['rule'].value" placeholder="Filter by name" />
|
||||
</template>
|
||||
<template #body="{ data }">
|
||||
{{ data.rule }}
|
||||
<LibraryTag v-if="data.lib" />
|
||||
</template>
|
||||
</Column>
|
||||
|
||||
<Column field="namespace" sortable header="Namespace"></Column>
|
||||
<Column field="namespace" sortable header="Namespace" :showFilterMenu="false" :showClearButton="false">
|
||||
<template #filter v-if="props.showColumnFilters">
|
||||
<InputText v-model="filters['namespace'].value" placeholder="Filter by name" />
|
||||
</template>
|
||||
</Column>
|
||||
</DataTable>
|
||||
|
||||
<Dialog v-model:visible="sourceDialogVisible" :style="{ width: '50vw' }">
|
||||
<highlightjs lang="yml" :code="currentSource" class="bg-white" />
|
||||
</Dialog>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import { ref, computed, onMounted } from "vue";
|
||||
import DataTable from "primevue/datatable";
|
||||
import Column from "primevue/column";
|
||||
import Dialog from "primevue/dialog";
|
||||
import IconField from "primevue/iconfield";
|
||||
import InputIcon from "primevue/inputicon";
|
||||
import InputText from "primevue/inputtext";
|
||||
@@ -60,13 +73,20 @@ const props = defineProps({
|
||||
showLibraryRules: {
|
||||
type: Boolean,
|
||||
default: false
|
||||
},
|
||||
showColumnFilters: {
|
||||
type: Boolean,
|
||||
default: false
|
||||
}
|
||||
});
|
||||
|
||||
const filters = ref({ global: { value: null, matchMode: "contains" } });
|
||||
const filters = ref({
|
||||
global: { value: null, matchMode: "contains" },
|
||||
address: { value: null, matchMode: "contains" },
|
||||
rule: { value: null, matchMode: "contains" },
|
||||
namespace: { value: null, matchMode: "contains" }
|
||||
});
|
||||
const filterMode = ref("lenient");
|
||||
const sourceDialogVisible = ref(false);
|
||||
const currentSource = ref("");
|
||||
|
||||
const functionCapabilities = ref([]);
|
||||
|
||||
@@ -101,8 +121,10 @@ const tableData = computed(() => {
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
/* tighten up the spacing between rows */
|
||||
:deep(.p-datatable.p-datatable-sm .p-datatable-tbody > tr > td) {
|
||||
/* tighten up the spacing between rows, and change border color */
|
||||
:deep(.p-datatable-tbody > tr > td) {
|
||||
padding: 0.2rem 0.5rem !important;
|
||||
border-width: 0 0 1px 0;
|
||||
border-color: #97a0ab;
|
||||
}
|
||||
</style>
|
||||
|
||||
@@ -339,11 +339,6 @@ onMounted(() => {
|
||||
visibility: hidden !important;
|
||||
height: 1.3rem;
|
||||
}
|
||||
/* Disable the toggle button for rules */
|
||||
:deep(.p-treetable-tbody > tr:is([aria-level="1"]) > td > div > .p-treetable-node-toggle-button) {
|
||||
visibility: collapse !important;
|
||||
height: 1.3rem;
|
||||
}
|
||||
|
||||
/* Make all matches nodes (i.e. not rule names) slightly smaller,
|
||||
and tighten up the spacing between the rows */
|
||||
|
||||
@@ -16,13 +16,14 @@
|
||||
v-model="showLibraryRules"
|
||||
inputId="showLibraryRules"
|
||||
:binary="true"
|
||||
:disabled="showNamespaceChart"
|
||||
:disabled="showNamespaceChart || libraryRuleMatchesCount === 0"
|
||||
/>
|
||||
<label for="showLibraryRules">
|
||||
<span v-if="libraryRuleMatchesCount > 1">
|
||||
Show {{ libraryRuleMatchesCount }} library rule matches
|
||||
Show {{ libraryRuleMatchesCount }} distinct library rules
|
||||
</span>
|
||||
<span v-else>Show 1 library rule match</span>
|
||||
<span v-else-if="libraryRuleMatchesCount === 1">Show 1 distinct library rule</span>
|
||||
<span v-else>No library rules matched</span>
|
||||
</label>
|
||||
</div>
|
||||
<div class="flex flex-row align-items-center gap-2">
|
||||
|
||||
@@ -18,12 +18,14 @@
|
||||
v-if="doc.meta.flavor === 'static' && showCapabilitiesByFunctionOrProcess && !showNamespaceChart"
|
||||
:data="doc"
|
||||
:show-library-rules="showLibraryRules"
|
||||
:show-column-filters="showColumnFilters"
|
||||
/>
|
||||
<ProcessCapabilities
|
||||
v-else-if="doc.meta.flavor === 'dynamic' && showCapabilitiesByFunctionOrProcess && !showNamespaceChart"
|
||||
:data="doc"
|
||||
:show-capabilities-by-process="showCapabilitiesByFunctionOrProcess"
|
||||
:show-library-rules="showLibraryRules"
|
||||
:show-column-filters="showColumnFilters"
|
||||
/>
|
||||
<NamespaceChart v-else-if="showNamespaceChart" :data="doc" />
|
||||
</template>
|
||||
|
||||
Reference in New Issue
Block a user