Skip to content

Commit 799eebb

Browse files
committed
Merge branch 'master' into reverse_local_events_timeout
# Conflicts: # src/Frontend/src/components/messages/SequenceDiagram/EndpointsComponent.vue # src/Frontend/src/components/messages/SequenceDiagram/HandlersComponent.vue # src/Frontend/src/components/messages/SequenceDiagram/RoutesComponent.vue # src/Frontend/src/resources/SequenceDiagram/RoutedMessage.ts # src/Frontend/src/stores/SequenceDiagramStore.ts
2 parents 821947e + ce631fa commit 799eebb

File tree

8 files changed

+56
-14
lines changed

8 files changed

+56
-14
lines changed

src/Frontend/package-lock.json

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

src/Frontend/package.json

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@
2626
"bootstrap": "^5.3.3",
2727
"bootstrap-icons": "^1.11.3",
2828
"codemirror": "^6.0.1",
29+
"lodash.debounce": "^4.0.8",
2930
"lossless-json": "^4.0.2",
3031
"memoize-one": "^6.0.0",
3132
"moment": "^2.30.1",
@@ -48,6 +49,7 @@
4849
"@testing-library/vue": "^8.1.0",
4950
"@tsconfig/node18": "^18.2.4",
5051
"@types/bootstrap": "^5.2.10",
52+
"@types/lodash": "^4.17.16",
5153
"@types/node": "^22.13.10",
5254
"@vitejs/plugin-vue": "^5.2.3",
5355
"@vitest/coverage-v8": "^3.0.9",

src/Frontend/src/components/CopyToClipboard.vue

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<script setup lang="ts">
22
import { Tippy, TippyComponent } from "vue-tippy";
3-
import { useTemplateRef } from "vue";
3+
import { ref, useTemplateRef, watch } from "vue";
44
55
const props = withDefaults(
66
defineProps<{
@@ -11,14 +11,16 @@ const props = withDefaults(
1111
);
1212
1313
const tippyRef = useTemplateRef<TippyComponent | null>("tippyRef");
14-
let timeoutId: number;
14+
const timeoutId = ref(0);
1515
1616
async function copyToClipboard() {
1717
await navigator.clipboard.writeText(props.value);
18-
window.clearTimeout(timeoutId);
18+
1919
tippyRef.value?.show();
20-
timeoutId = window.setTimeout(() => tippyRef.value?.hide(), 3000);
20+
timeoutId.value = window.setTimeout(() => tippyRef.value?.hide(), 3000);
2121
}
22+
23+
watch(timeoutId, (_, previousTimeoutId) => window.clearTimeout(previousTimeoutId));
2224
</script>
2325

2426
<template>

src/Frontend/src/components/FilterInput.vue

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,23 @@
11
<script setup lang="ts">
2+
import { ref, watch } from "vue";
3+
import debounce from "lodash/debounce";
4+
25
const model = defineModel<string>({ required: true });
6+
const props = withDefaults(defineProps<{ placeholder?: string; ariaLabel?: string }>(), { placeholder: "Filter by name...", ariaLabel: "filter by name" });
7+
const localInput = ref<string>(model.value);
8+
9+
const debounceUpdateModel = debounce((value: string) => {
10+
model.value = value;
11+
}, 600);
12+
13+
watch(localInput, (newValue) => {
14+
debounceUpdateModel(newValue);
15+
});
316
</script>
417

518
<template>
619
<div role="search" aria-label="filter" class="filter-input">
7-
<input type="search" placeholder="Filter by name..." aria-label="filter by name" class="form-control-static filter-input" v-model="model" />
20+
<input type="search" :placeholder="props.placeholder" :aria-label="props.ariaLabel" class="form-control-static filter-input" v-model="localInput" />
821
</div>
922
</template>
1023

src/Frontend/src/components/messages/HeadersView.vue

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
<script setup lang="ts">
22
import { ExtendedFailedMessage } from "@/resources/FailedMessage";
33
import CopyToClipboard from "@/components/CopyToClipboard.vue";
4+
import FilterInput from "@/components/FilterInput.vue";
45
import { computed, ref } from "vue";
56
const props = defineProps<{
67
message: ExtendedFailedMessage;
@@ -26,7 +27,9 @@ const filteredHeaders = computed(() => {
2627
<div class="col">
2728
<div class="text-search-container">
2829
<div class="text-search">
29-
<input type="search" aria-label="Filter by name" v-model="searchTerm" class="form-control format-text" placeholder="Search for a header key or value..." />
30+
<div class="filter-group">
31+
<FilterInput v-model="searchTerm" :aria-label="`Search for a header key or value`" :placeholder="'Search for a header key or value...'" />
32+
</div>
3033
</div>
3134
</div>
3235
</div>
@@ -76,11 +79,7 @@ const filteredHeaders = computed(() => {
7679
width: 100%;
7780
max-width: 40rem;
7881
}
79-
.format-text {
80-
font-weight: unset;
81-
font-size: 14px;
82-
min-width: 120px;
83-
}
82+
8483
.filters {
8584
background-color: #f3f3f3;
8685
margin-top: 5px;

src/Frontend/src/components/messages/SequenceDiagram/EndpointsComponent.vue

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ interface EndpointSurround {
2222
stroke: string;
2323
}
2424
25+
const Endpoint_Width = 260;
2526
const Endpoint_Gap = 30;
2627
const Endpoint_Image_Width = 20;
2728
@@ -91,7 +92,7 @@ function setEndpointRef(el: SVGTextElement, index: number) {
9192
:stroke-width="endpoint.surround.strokeWidth"
9293
:stroke="endpoint.surround.stroke"
9394
></rect>
94-
<g :transform="`translate(${(endpoint.x ?? Endpoint_Width / 2) - ((endpoint.textWidth ?? 0) + Endpoint_Image_Width) / 2},0)`">
95+
<g :transform="`translate(${(endpoint.x ?? Endpoint_Width / 2) - ((endpoint.textWidth ?? 0) + Endpoint_Image_Width) / 2}, 0)`">
9596
<path fill="var(--gray40)" d="M 0,0 M 18,18 M 0,2 v 14 h 14 v -4 h -6 v -6 h 6 v -4 h -14 M 9,7 v 4 h 9 v -4"></path>
9697
<text :x="Endpoint_Image_Width" y="10" alignment-baseline="middle" text-anchor="start" :ref="(el) => setEndpointRef(el as SVGTextElement, i)">{{ endpoint.name }}</text>
9798
</g>

src/Frontend/test/specs/heartbeats/configuring-heartbeats.spec.ts

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import { test, describe } from "../../drivers/vitest/driver";
22
import * as precondition from "../../preconditions";
3-
import { expect } from "vitest";
3+
import { expect, vi } from "vitest";
44
import { getNothingToConfigureStatus } from "./questions/getNothingToConfigureStatus";
55
import { navigateToHeartbeatsConfiguration, navigateToUnHealthyHeartbeats } from "./actions/navigateToHeartbeatsTabs";
66
import { getEndpointsForConfiguration } from "./questions/getEndpointsForConfiguration";
@@ -12,6 +12,11 @@ import { healthyEndpointTemplate } from "../../mocks/heartbeat-endpoint-template
1212
import { setHeartbeatFilter } from "./actions/setHeartbeatFilter";
1313
import { getHeartbeatFilterValue } from "./questions/getHeartbeatFilterValue";
1414

15+
vi.mock("lodash/debounce", () => ({
16+
// eslint-disable-next-line @typescript-eslint/no-unsafe-function-type
17+
default: (fn: Function) => fn,
18+
}));
19+
1520
describe("FEATURE: Heartbeats configuration", () => {
1621
describe("RULE: A list of all endpoints with the heartbeats plug-in installed should be displayed", () => {
1722
test("EXAMPLE: With no endpoints, the text 'Nothing to configure' should be displayed", async ({ driver }) => {

src/Frontend/test/specs/monitoring/filtering-endpoints.spec.ts

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { expect } from "vitest";
1+
import { vi, expect } from "vitest";
22
import { test, describe } from "../../drivers/vitest/driver";
33
import { enterFilterString } from "./actions/enterFilterString";
44
import { groupEndpointsBy } from "./actions/groupEndpointsBy";
@@ -8,6 +8,11 @@ import { currentFilterValueToBe } from "./questions/currentFilterValueToBe";
88
import { endpointsNames } from "./questions/endpointsNames";
99
import * as precondition from "../../preconditions";
1010

11+
vi.mock("lodash/debounce", () => ({
12+
// eslint-disable-next-line @typescript-eslint/no-unsafe-function-type
13+
default: (fn: Function) => fn,
14+
}));
15+
1116
describe("FEATURE: Endpoint filtering", () => {
1217
describe("RULE: List of monitoring endpoints should be filterable by the name", () => {
1318
[

0 commit comments

Comments
 (0)