8000 Hide HistorySizeBytes when value is 0 and hide SuggestContinueAsNew when value is false by laurakwhit · Pull Request #1309 · temporalio/ui · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

Hide HistorySizeBytes when value is 0 and hide SuggestContinueAsNew when value is false #1309

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

Sign up for GitHub < 8000 /div>

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Apr 19, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
10000
Diff view
24 changes: 24 additions & 0 deletions src/lib/utilities/get-single-attribute-for-event.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import { describe, expect, it } from 'vitest';
import {
getSingleAttributeForEvent,
shouldDisplayAsExecutionLink,
shouldDisplayAttribute,
} from './get-single-attribute-for-event';

describe('getSingleAttributeForEvent', () => {
Expand Down Expand Up @@ -165,3 +166,26 @@ describe('shouldDisplayAsExecutionLink', () => {
expect(shouldDisplayAsExecutionLink('inlineRunIdSample')).toBe(false);
});
});

describe('shouldDisplayAttribute', () => {
it('should return false for certain attribute values', () => {
expect(shouldDisplayAttribute('', null)).toBe(false);
expect(shouldDisplayAttribute('', undefined)).toBe(false);
expect(shouldDisplayAttribute('', '')).toBe(false);
expect(shouldDisplayAttribute('', '0s')).toBe(false);
expect(shouldDisplayAttribute('type', '')).toBe(false);
expect(shouldDisplayAttribute('suggestContinueAsNew', false)).toBe(false);
expect(shouldDisplayAttribute('historySizeBytes', '0')).toBe(false);
});

it('should return false for certain attributes', () => {
expect(shouldDisplayAttribute('type', '')).toBe(false);
});

it('should return false for certain atrributes with unpopulated values', () => {
expect(shouldDisplayAttribute('suggestContinueAsNew', true)).toBe(true);
expect(shouldDisplayAttribute('suggestContinueAsNew', false)).toBe(false);
expect(shouldDisplayAttribute('historySizeBytes', '256')).toBe(true);
expect(shouldDisplayAttribute('historySizeBytes', '0')).toBe(false);
});
});
7 changes: 7 additions & 0 deletions src/lib/utilities/get-single-attribute-for-event.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,11 @@ export const shouldDisplayAsPlainText = (key: string): boolean => {
return keysForPlainText.has(key);
};

const keysToOmitIfNoValue: Readonly<Set<string>> = new Set([
'suggestContinueAsNew',
'historySizeBytes',
]);

export const shouldDisplayAttribute = (
key: string,
value: unknown,
Expand All @@ -41,6 +46,8 @@ export const shouldDisplayAttribute = (
if (value === '') return false;
if (value === '0s') return false;
if (key === 'type') return false;
if ((!value || value === '0') && keysToOmitIfNoValue.has(key)) return false;

return true;
};

Expand Down
0