@cryptotaxi247 / CoPilot / commits / 908c1d6a

updated api delete index

Davide Di Modica committed Oct 6, 2023 at 21:19 UTC 908c1d6a8f88cfd1a26df91f65b91d5e096dfd4d
5 files changed +34 -33
src/api/graylog.ts
+3 -1
@@ -20,7 +20,9 @@ export default {
20 return HttpClient.get<FlaskBaseResponse & { indexData: IndexData }>(`/graylog/indices`)
21 },
22 deleteIndex(indexName: string) {
23 - return HttpClient.delete<FlaskBaseResponse>(`/graylog/indices/${indexName}/delete`)
23 + return HttpClient.delete<FlaskBaseResponse>(`/graylog/index`, {
24 + data: { index_name: indexName }
25 + })
26 },
27 getInputsRunning() {
28 return HttpClient.get<FlaskBaseResponse & { inputs: Inputs }>(`/graylog/inputs/running`)
src/api/indices.ts
-3
@@ -14,8 +14,5 @@ export default {
14 },
15 getClusterHealth() {
16 return HttpClient.get<FlaskBaseResponse & { cluster_health: ClusterHealth }>("/wazuh_indexer/health")
17 - },
18 - deleteIndex(index: string) {
19 - return HttpClient.delete<FlaskBaseResponse>(`/graylog/indices/${index}/delete`)
17 }
18 }
src/components/indices/Details.vue
+21 -20
@@ -1,21 +1,24 @@
1 <template>
2 - <n-card class="index-details-box">
3 - <n-spin :show="loading">
4 - <div class="box-header">
5 - <h4 class="title">
6 - <span v-if="currentIndex">Below the details for index</span>
7 - <span v-else>Select an index to see the details</span>
8 - </h4>
9 - <div class="select-box" v-if="indices && indices.length">
10 - <n-select
11 - v-model:value="selectValue"
12 - placeholder="Indices list"
13 - clearable
14 - filterable
15 - :options="selectOptions"
16 - ></n-select>
2 + <n-spin :show="loading">
3 + <n-card class="index-details-box" segmented>
4 + <template #header>
5 + <div class="box-header">
6 + <div class="title">
7 + <span v-if="currentIndex">Below the details for index</span>
8 + <span v-else>Select an index to see the details</span>
9 + </div>
10 + <div class="select-box" v-if="indices && indices.length">
11 + <n-select
12 + v-model:value="selectValue"
13 + placeholder="Indices list"
14 + clearable
15 + filterable
16 + :options="selectOptions"
17 + ></n-select>
18 + </div>
19 </div>
18 - </div>
20 + </template>
21 +
22 <div class="details-box" v-if="currentIndex">
23 <div class="info">
24 <IndexCard :index="currentIndex" showActions @delete="clearCurrentIndex()" />
@@ -47,8 +50,8 @@
50 </n-scrollbar>
51 </n-card>
52 </div>
50 - </n-spin>
51 - </n-card>
53 + </n-card>
54 + </n-spin>
55 </template>
56
57 <script setup lang="ts">
@@ -155,8 +158,6 @@ onBeforeMount(() => {
158 }
159
160 .details-box {
158 - @apply mt-6;
159 -
161 .shards {
162 @apply mt-4;
163
src/components/indices/IndexCard.vue
+1 -1
@@ -96,7 +96,7 @@ const handleDelete = () => {
96 function deleteIndex() {
97 loading.value = true
98
99 - Api.indices
99 + Api.graylog
100 .deleteIndex(index.value.index)
101 .then(res => {
102 if (res.data.success) {
src/types/agents.d.ts
+9 -8
@@ -1,16 +1,17 @@
1 export interface Agent {
2 - agent_id: string
3 - client_id: string
4 - client_last_seen: string
5 - critical_asset: boolean
6 - hostname: string
2 id?: number
3 + agent_id: string
4 ip_address: string
9 - label: string
10 - last_seen: string
5 os: string
12 - velociraptor_client_version: string
6 + hostname: string
7 + label: string
8 + critical_asset: boolean
9 + wazuh_last_seen: string
10 + velociraptor_id: string
11 + velociraptor_last_seen: string
12 wazuh_agent_version: string
13 + velociraptor_agent_version: string
14 + customer_code: null | string
15 vulnerabilities?: AgentVulnerabilities[]
16 online?: boolean
17 }