Skip to content

Commit 56ada60

Browse files
authored
NETOBSERV-268 frontend code styling (#541)
* prettier sort imports * sort imports + constants naming * flex + flexitem * TextContent and Text usage * interfaces for props * move helpers + voronoi as component * split dropdowns / panels when possible * fixes * removed unecessary CSS * fix voronoi container
1 parent e3fc21b commit 56ada60

File tree

149 files changed

+3302
-2978
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

149 files changed

+3302
-2978
lines changed

mocks/loki/flow_records.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
"values": [
1515
[
1616
"1708011867120999936",
17-
"{\"SrcK8S_Name\":\"ip-10-0-1-7.ec2.internal\",\"Bytes\":66,\"TimeFlowRttNs\":10000,\"Packets\":1,\"Interface\":\"br-ex\",\"SrcMac\":\"02:27:A1:A8:84:B9\",\"Proto\":6,\"SrcK8S_HostIP\":\"10.0.1.7\",\"SrcK8S_HostName\":\"ip-10-0-1-7.ec2.internal\",\"Flags\":16,\"DnsErrno\":0,\"TimeFlowStartMs\":1708011867121,\"TimeReceived\":1708011867,\"DstAddr\":\"10.0.1.140\",\"Etype\":2048,\"SrcPort\":50104,\"AgentIP\":\"10.0.1.7\",\"SrcK8S_OwnerType\":\"Node\",\"Dscp\":0,\"TimeFlowEndMs\":1708011867121,\"IfDirection\":1,\"SrcAddr\":\"10.0.1.7\",\"Duplicate\":false,\"DstMac\":\"02:7B:32:68:BE:65\",\"DstPort\":443}"
17+
"{\"SrcK8S_Name\":\"ip-10-0-1-7.ec2.internal\",\"Bytes\":66,\"TimeFlowRttNs\":10000,\"Packets\":1,\"Interfaces\":[\"br-ex\",\"test\"],\"SrcMac\":\"02:27:A1:A8:84:B9\",\"Proto\":6,\"SrcK8S_HostIP\":\"10.0.1.7\",\"SrcK8S_HostName\":\"ip-10-0-1-7.ec2.internal\",\"Flags\":16,\"DnsErrno\":0,\"TimeFlowStartMs\":1708011867121,\"TimeReceived\":1708011867,\"DstAddr\":\"10.0.1.140\",\"Etype\":2048,\"SrcPort\":50104,\"AgentIP\":\"10.0.1.7\",\"SrcK8S_OwnerType\":\"Node\",\"Dscp\":0,\"TimeFlowEndMs\":1708011867121,\"IfDirections\":[\"1\",\"0\"],\"SrcAddr\":\"10.0.1.7\",\"Duplicate\":false,\"DstMac\":\"02:7B:32:68:BE:65\",\"DstPort\":443,\"IcmpType\":1,\"IcmpCode\":1}"
1818
],
1919
[
2020
"1708011867120999936",

web/.prettierrc.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,5 +2,6 @@
22
"arrowParens": "avoid",
33
"printWidth": 120,
44
"singleQuote": true,
5-
"trailingComma": "none"
5+
"trailingComma": "none",
6+
"plugins": ["prettier-plugin-organize-imports"]
67
}

web/locales/en/plugin__netobserv-plugin.json

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -45,12 +45,13 @@
4545
"Dropped packets": "Dropped packets",
4646
"DNS latencies": "DNS latencies",
4747
"RTT": "RTT",
48+
"Display options": "Display options",
4849
"The level of details represented.": "The level of details represented.",
4950
"Scope": "Scope",
5051
"Long labels can reduce visibility.": "Long labels can reduce visibility.",
5152
"Truncate labels": "Truncate labels",
5253
"Single graph focus": "Single graph focus",
53-
"Display options": "Display options",
54+
"Query options": "Query options",
5455
"Conversation": "Conversation",
5556
"Flow": "Flow",
5657
"Loki": "Loki",
@@ -87,7 +88,6 @@
8788
"Depending on the matching and filter settings, several queries can be performed under the cover, each with this parameter set, resulting in more results after aggregation.": "Depending on the matching and filter settings, several queries can be performed under the cover, each with this parameter set, resulting in more results after aggregation.",
8889
"Top / Bottom": "Top / Bottom",
8990
"Limit": "Limit",
90-
"Query options": "Query options",
9191
"Refresh off": "Refresh off",
9292
"15 seconds": "15 seconds",
9393
"30 seconds": "30 seconds",
@@ -149,9 +149,6 @@
149149
"Switch between one way / back and forth filtering": "Switch between one way / back and forth filtering",
150150
"One way shows traffic strictly as defined per your filters": "One way shows traffic strictly as defined per your filters",
151151
"Back and forth shows traffic according to your filters, plus the related return traffic": "Back and forth shows traffic according to your filters, plus the related return traffic",
152-
"Source": "Source",
153-
"Destination": "Destination",
154-
"Common": "Common",
155152
"Filter already exists": "Filter already exists",
156153
"Hide filters": "Hide filters",
157154
"Show {{count}} filters": "Show {{count}} filters",
@@ -160,6 +157,8 @@
160157
"Collapse": "Collapse",
161158
"Expand": "Expand",
162159
"Quick filters": "Quick filters",
160+
"Source": "Source",
161+
"Destination": "Destination",
163162
"Step {{index}}/{{count}}": "Step {{index}}/{{count}}",
164163
"Step {{index}}/{{count}}_plural": "Step {{index}}/{{count}}",
165164
"Previous tip": "Previous tip",
@@ -212,9 +211,6 @@
212211
"Reset time range": "Reset time range",
213212
"Others": "Others",
214213
"Total dropped": "Total dropped",
215-
"(non nodes)": "(non nodes)",
216-
"(non pods)": "(non pods)",
217-
"internal": "internal",
218214
"Manage columns": "Manage columns",
219215
"Selected columns will appear in the table.": "Selected columns will appear in the table.",
220216
"Click and drag the items to reorder the columns in the table.": "Click and drag the items to reorder the columns in the table.",
@@ -302,6 +298,7 @@
302298
"Name": "Name",
303299
"IP": "IP",
304300
"No information available for this content. Change scope to get more details.": "No information available for this content. Change scope to get more details.",
301+
"Cluster name": "Cluster name",
305302
"Stats": "Stats",
306303
"Top 5 DNS latency": "Top 5 DNS latency",
307304
"Top 5 flow RTT": "Top 5 flow RTT",
@@ -315,7 +312,6 @@
315312
"Average rate": "Average rate",
316313
"Latest time": "Latest time",
317314
"Latest rate": "Latest rate",
318-
"Cluster name": "Cluster name",
319315
"Edge": "Edge",
320316
"Drops": "Drops",
321317
"Query is slow": "Query is slow",
@@ -424,6 +420,10 @@
424420
"Not a valid MAC address": "Not a valid MAC address",
425421
"Unknown protocol": "Unknown protocol",
426422
"Unknown direction": "Unknown direction",
423+
"Common": "Common",
424+
"(non nodes)": "(non nodes)",
425+
"(non pods)": "(non pods)",
426+
"internal": "internal",
427427
"P": "P",
428428
"Pps": "Pps",
429429
"minimum": "minimum",

web/package-lock.json

Lines changed: 28 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

web/package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,7 @@
7272
"mobx": "^5.15.7",
7373
"parse-duration": "^1.1.0",
7474
"prettier": "^2.5.1",
75+
"prettier-plugin-organize-imports": "^3.2.4",
7576
"pretty-quick": "^3.1.2",
7677
"react-transition-group": "^4.4.2",
7778
"style-loader": "^3.3.1",

web/src/api/loki.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
import { getFunctionFromId, getRateFunctionFromId } from '../utils/overview-panels';
21
import { FlowScope, MetricType, StatFunction } from '../model/flow-query';
32
import { cyrb53 } from '../utils/hash';
3+
import { getFunctionFromId, getRateFunctionFromId } from '../utils/overview-panels';
44
import { Field, Fields, Labels, Record } from './ipfix';
55

66
export interface AggregatedQueryResponse {

web/src/api/routes.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,18 +4,18 @@ import { buildExportQuery } from '../model/export-query';
44
import { FlowQuery, FlowScope, isTimeMetric } from '../model/flow-query';
55
import { ContextSingleton } from '../utils/context';
66
import { TimeRange } from '../utils/datetime';
7-
import { parseTopologyMetrics, parseGenericMetrics } from '../utils/metrics';
7+
import { parseGenericMetrics, parseTopologyMetrics } from '../utils/metrics';
88
import { AlertsResult, SilencedAlert } from './alert';
99
import { Field } from './ipfix';
1010
import {
1111
AggregatedQueryResponse,
12+
FlowMetricsResult,
1213
GenericMetricsResult,
1314
parseStream,
1415
RawTopologyMetrics,
1516
RecordsResult,
1617
Stats,
17-
StreamResult,
18-
FlowMetricsResult
18+
StreamResult
1919
} from './loki';
2020

2121
export const getFlowRecords = (params: FlowQuery): Promise<RecordsResult> => {

web/src/components/__tests-data__/filters.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
/* eslint-disable max-len */
2-
import { findFilter, getFilterDefinitions } from '../../utils/filter-definitions';
32
import { Filter, FilterId, FilterValue } from '../../model/filters';
3+
import { findFilter, getFilterDefinitions } from '../../utils/filter-definitions';
44
import { ColumnConfigSampleDefs } from './columns';
55

66
export const FilterConfigSampleDefs = [

web/src/components/__tests-data__/flows.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
import { parseStream, RecordsResult, StreamResult } from '../../api/loki';
2-
import { FlowDirection, Record } from '../../api/ipfix';
31
import flowsJson from '../../../../mocks/loki/flow_records.json';
2+
import { FlowDirection, Record } from '../../api/ipfix';
3+
import { parseStream, RecordsResult, StreamResult } from '../../api/loki';
44

55
export const FlowsMock: Record[] = (flowsJson.data.result as StreamResult[]).flatMap(r => parseStream(r));
66

web/src/components/__tests-data__/metrics.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
import { parseTopologyMetrics } from '../../utils/metrics';
21
import { RawTopologyMetrics, TopologyMetrics } from '../../api/loki';
2+
import { parseTopologyMetrics } from '../../utils/metrics';
33

44
export const metric1: RawTopologyMetrics = {
55
metric: {

0 commit comments

Comments
 (0)