refactor
Davide Di Modica committed
Jan 29, 2024 at 19:43 UTC
5d2500dc05b3018b95f6d129f7d3d89c078e1d40
8 files changed
+8
-75
.vscode/extensions.json
+1
@@ -11,6 +11,7 @@
11
"ms-vscode.remtoe-remote-wsl",
12
"dbaeumer.vscode-eslint",
13
"Vue.volar",
14
+ "Gruntfuggly.todo-tree",
15
"Vue.vscode-typescript-vue-plugin"
16
]
17
}
src/api/graylog.ts
+1
-7
@@ -1,6 +1,6 @@
1
import { HttpClient } from "./httpClient"
2
import type { FlaskBaseResponse } from "@/types/flask.d"
3
-import type { Message, ThroughputMetric, IndexData } from "@/types/graylog/index.d"
3
+import type { Message, ThroughputMetric } from "@/types/graylog/index.d"
4
import type { Alerts, AlertsQuery } from "@/types/graylog/alerts.d"
5
import type { EventDefinition } from "@/types/graylog/event-definition.d"
6
import type { Stream } from "@/types/graylog/stream.d"
@@ -74,12 +74,6 @@ export default {
74
getPipelinesRules() {
75
return HttpClient.get<FlaskBaseResponse & { pipeline_rules: PipelineRule[] }>(`/graylog/pipeline/rules`)
76
},
77
-
78
- // TODO: review --------------------------------------------------------------------
79
-
80
- getIndices() {
81
- return HttpClient.get<FlaskBaseResponse & { indices: IndexData }>(`/graylog/indices`)
82
- },
77
deleteIndex(indexName: string) {
78
return HttpClient.delete<FlaskBaseResponse>(`/graylog/index`, {
79
data: { index_name: indexName }
src/components/alerts/Alert.vue
-2
@@ -220,8 +220,6 @@
220
</template>
221
222
<script setup lang="ts">
223
-// TODO: add global popover with map for coords property (agent_ip_geolocation) ??
224
-
223
import { computed, defineAsyncComponent, ref, toRefs } from "vue"
224
import { NPopover, NModal, NTabs, NTabPane, NInput } from "naive-ui"
225
import { useSettingsStore } from "@/stores/settings"
src/components/customers/CustomerItem.vue
-2
@@ -176,8 +176,6 @@
176
</template>
177
178
<script setup lang="ts">
179
-// TODO: add mablibre on location popup ??
180
-
179
import Icon from "@/components/common/Icon.vue"
180
import Badge from "@/components/common/Badge.vue"
181
import { computed, onBeforeMount, ref, toRefs, watch } from "vue"
src/components/indices/NodeAllocation.vue
+2
-3
@@ -67,10 +67,9 @@ const message = useMessage()
67
const indicesAllocation = ref<IndexAllocation[]>([])
68
const loading = ref(true)
69
70
-// TODO: to decide with Taylor
70
function getStatusPercent(percent: string | number | undefined | null) {
72
- if (parseFloat(percent?.toString() || "") < 20) return "error"
73
- if (parseFloat(percent?.toString() || "") < 40) return "warning"
71
+ if (parseFloat(percent?.toString() || "") > 90) return "error"
72
+ if (parseFloat(percent?.toString() || "") > 80) return "warning"
73
return "success"
74
}
75
src/components/indices/TopIndices.vue
+3
-5
@@ -44,11 +44,9 @@ function getOptions() {
44
.slice(0, 8)
45
.value()
46
47
- // TODO: slice here or after index health ??
48
-
49
- const green = data.filter(i => i.health === IndexHealth.GREEN).length
50
- const yellow = data.filter(i => i.health === IndexHealth.YELLOW).length
51
- const red = data.filter(i => i.health === IndexHealth.RED).length
47
+ const green = (indices.value || []).filter(i => i.health === IndexHealth.GREEN).length
48
+ const yellow = (indices.value || []).filter(i => i.health === IndexHealth.YELLOW).length
49
+ const red = (indices.value || []).filter(i => i.health === IndexHealth.RED).length
50
51
const sizeData: { value: number; name: string }[] = data.map(i => ({
52
value: i.store_size_value || 0,
src/components/soc/SocCases/SocCaseItem.vue
+1
-1
@@ -348,7 +348,7 @@ const tags = computed<string[]>(() => {
348
return []
349
}
350
351
- return _split(extendedInfo.value?.case_tags, ",").map(o => "#" + o)
351
+ return _split(extendedInfo.value?.case_tags, ",")
352
})
353
354
const properties = computed(() => {
src/types/graylog/index.d.ts
-55
@@ -13,58 +13,3 @@ export interface ThroughputMetric {
13
metric: string
14
value: number
15
}
16
-
17
-// TODO: review --------------------------------------------------------------------
18
-
19
-export interface Documents {
20
- count: number
21
- deleted: number
22
-}
23
-
24
-export interface OperationDetails {
25
- time_seconds: number
26
- total: number
27
-}
28
-
29
-// ShardDetails encapsulates all the details for both all_shards and primary_shards
30
-export interface ShardDetails {
31
- documents: Documents
32
- flush: OperationDetails
33
- get: OperationDetails
34
- index: OperationDetails
35
- merge: OperationDetails
36
- open_search_contexts: number
37
- refresh: OperationDetails
38
- search_fetch: OperationDetails
39
- search_query: OperationDetails
40
- segments: number
41
- store_size_bytes: number
42
-}
43
-
44
-// Routing information for each index
45
-export interface Routing {
46
- active: boolean
47
- id: number
48
- node_hostname: string
49
- node_id: string
50
- node_name: string
51
- primary: boolean
52
- relocating_to: null | string
53
- state: string
54
-}
55
-
56
-// Interface for each individual index like 'wazuh_00001'
57
-export interface IndexDetails {
58
- all_shards: ShardDetails
59
- primary_shards: ShardDetails
60
- reopened: boolean
61
- routing: Routing[]
62
-}
63
-
64
-// Main interface encapsulating the entire JSON structure of IndexData
65
-export interface IndexData {
66
- index_names: string[]
67
- indices: { [key: string]: IndexDetails }
68
- message: string
69
- success: boolean
70
-}