Skip to content

Commit f3e6572

Browse files
Indicating when the body wasn't stored for the audited message (#2585)
* Indicating when the body wasn't stored for the audited message * Address saga history --------- Co-authored-by: Daniel Marbach <[email protected]>
1 parent f521388 commit f3e6572

File tree

4 files changed

+19
-4
lines changed

4 files changed

+19
-4
lines changed

src/Frontend/src/components/messages/BodyView.vue

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,10 @@ const body = computed(() => bodyState.value.data.value);
2525
<div v-if="bodyState.not_found" class="alert alert-info">Could not find the message body. This could be because the message URL is invalid or the corresponding message was processed and is no longer tracked by ServiceControl.</div>
2626
<div v-else-if="bodyState.failed_to_load" class="alert alert-info">Message body unavailable.</div>
2727
<LoadingSpinner v-else-if="bodyState.loading" />
28+
<div v-else-if="bodyState.data.no_content" class="alert alert-info">
29+
Body was too large and not stored. Edit <a href="https://docs.particular.net/servicecontrol/audit-instances/configuration#performance-tuning-servicecontrol-auditmaxbodysizetostore">ServiceControl/MaxBodySizeToStore</a> to be larger in the
30+
ServiceControl configuration.
31+
</div>
2832
<CodeEditor v-else-if="body !== undefined && contentType.isSupported" :model-value="body" :language="contentType.language" :read-only="true" :show-gutter="true"></CodeEditor>
2933
<div v-else-if="body && !contentType.isSupported" class="alert alert-warning">Message body cannot be displayed because content type "{{ bodyState.data.content_type }}" is not supported.</div>
3034
</div>

src/Frontend/src/components/messages/SagaDiagram/MessageDataBox.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ const body = computed(() => props.messageData.body.data.value || "");
3030
<div v-else-if="messageData.body.failed_to_load" class="message-data-box message-data-box-error">
3131
<span class="message-data-box-text--error">Failed to load message data, there might be a connection issue or the message may no longer be available.</span>
3232
</div>
33-
<div v-else-if="!messageDataLoading && (!messageData.body.data.value || messageData.body.not_found)" class="message-data-box">
33+
<div v-else-if="!messageDataLoading && (!messageData.body.data.value || messageData.body.not_found || messageData.body.data.no_content)" class="message-data-box">
3434
<span class="message-data-box-text--empty">No message body data available</span>
3535
</div>
3636
<div v-else-if="contentType.isSupported" class="message-data-box message-data-box-content">

src/Frontend/src/stores/MessageStore.ts

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ interface Model {
6161

6262
export const useMessageStore = defineStore("MessageStore", () => {
6363
const headers = ref<DataContainer<Header[]>>({ data: [] });
64-
const body = ref<DataContainer<{ value?: string; content_type?: string }>>({ data: {} });
64+
const body = ref<DataContainer<{ value?: string; content_type?: string; no_content?: boolean }>>({ data: {} });
6565
const state = reactive<DataContainer<Model>>({ data: { failure_metadata: {}, failure_status: {}, dialog_status: {}, invoked_saga: {} } });
6666
let bodyLoadedId = "";
6767
let conversationLoadedId = "";
@@ -204,6 +204,12 @@ export const useMessageStore = defineStore("MessageStore", () => {
204204
return;
205205
}
206206

207+
if (response.status === 204) {
208+
body.value.data.no_content = true;
209+
210+
return;
211+
}
212+
207213
const contentType = response.headers.get("content-type");
208214
body.value.data.content_type = contentType ?? "text/plain";
209215
body.value.data.value = await response.text();
@@ -288,7 +294,7 @@ export const useMessageStore = defineStore("MessageStore", () => {
288294

289295
await downloadBody();
290296

291-
if (!(body.value.not_found || body.value.failed_to_load)) {
297+
if (!(body.value.not_found || body.value.failed_to_load || body.value.data.no_content)) {
292298
exportString += "\n\nMESSAGE BODY\n";
293299
exportString += body.value.data.value;
294300
}

src/Frontend/src/stores/SagaDiagramStore.ts

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ import { useMessageStore } from "./MessageStore";
1010

1111
export interface SagaMessageData {
1212
message_id: string;
13-
body: DataContainer<{ value?: string; content_type?: string }>;
13+
body: DataContainer<{ value?: string; content_type?: string; no_content?: boolean }>;
1414
}
1515
export const useSagaDiagramStore = defineStore("SagaDiagramStore", () => {
1616
const sagaHistory = ref<SagaHistory | null>(null);
@@ -101,6 +101,11 @@ export const useSagaDiagramStore = defineStore("SagaDiagramStore", () => {
101101
return result;
102102
}
103103

104+
if (response.status === 204) {
105+
result.body.data.no_content = true;
106+
return result;
107+
}
108+
104109
const contentType = response.headers.get("content-type");
105110
result.body.data.content_type = contentType ?? "text/plain";
106111
result.body.data.value = await response.text();

0 commit comments

Comments
 (0)