Skip to content

Commit 21f8aa9

Browse files
kakshak07Kakshak Pravin Porwalopensearch-changeset-bot[bot]TackAdam
authored
added support for header with loading state in trace details page (#10753)
* added support for header with loading state Signed-off-by: Kakshak Pravin Porwal <[email protected]> * Changeset file for PR #10753 created/updated --------- Signed-off-by: Kakshak Pravin Porwal <[email protected]> Co-authored-by: Kakshak Pravin Porwal <[email protected]> Co-authored-by: opensearch-changeset-bot[bot] <154024398+opensearch-changeset-bot[bot]@users.noreply.github.com> Co-authored-by: Adam Tackett <[email protected]>
1 parent 73330da commit 21f8aa9

File tree

4 files changed

+15
-2
lines changed

4 files changed

+15
-2
lines changed

changelogs/fragments/10753.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
fix:
2+
- Added support for loading state in the header ([#10753](https://github.com/opensearch-project/OpenSearch-Dashboards/pull/10753))

src/plugins/explore/public/application/pages/traces/trace_details/public/utils/helper_functions.tsx

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,13 @@ export function round(value: number, precision: number = 0): number {
4545
return Math.round(value * multiplier) / multiplier;
4646
}
4747

48-
export function getServiceInfo(selectedSpan: any, traceId?: string): string {
48+
export function getServiceInfo(selectedSpan: any, traceId?: string, isLoading?: boolean): string {
49+
if (isLoading) {
50+
return i18n.translate('explore.traceDetails.header.loading', {
51+
defaultMessage: 'Loading trace...',
52+
});
53+
}
54+
4955
if (selectedSpan) {
5056
const serviceName =
5157
resolveServiceNameFromSpan(selectedSpan) ||

src/plugins/explore/public/application/pages/traces/trace_details/trace_view.test.tsx

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -426,6 +426,11 @@ describe('TraceDetails', () => {
426426
expect(result).toBe('');
427427
});
428428

429+
it('getServiceInfo function returns loading message when isLoading is true', () => {
430+
const result = getServiceInfo(null, undefined, true);
431+
expect(result).toBe('Loading trace...');
432+
});
433+
429434
it('NoMatchMessage component renders correctly', () => {
430435
const testTraceId = 'test-trace-123';
431436
const { container } = render(<NoMatchMessage traceId={testTraceId} />);

src/plugins/explore/public/application/pages/traces/trace_details/trace_view.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -625,7 +625,7 @@ export const TraceDetails: React.FC<TraceDetailsProps> = ({
625625
setMenuMountPoint={setMenuMountPoint}
626626
traceId={traceId}
627627
isFlyout={isFlyout}
628-
title={getServiceInfo(rootSpan, traceId)}
628+
title={getServiceInfo(rootSpan, traceId, isLoading)}
629629
traceDetailsLink={traceDetailsLink}
630630
/>
631631
);

0 commit comments

Comments
 (0)