Skip to content
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.

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

Version 6 #386

Open
wants to merge 76 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 20 commits
Commits
Show all changes
76 commits
Select commit Hold shift + click to select a range
6c99f0a
changed timestamps to new ISOstrings
osinkinroman May 12, 2022
4e3773c
changed stream to be directed in both ways
osinkinroman May 12, 2022
e5d12da
changed messageId to id
osinkinroman May 13, 2022
1b22b47
change streamInfo lastElement to lastId
osinkinroman May 13, 2022
2a083c1
resolve build conflicts
osinkinroman May 13, 2022
454961e
compatability with new api
osinkinroman May 19, 2022
8af70ff
resolve build conflicts
osinkinroman May 19, 2022
0d88fee
resolve build conflicts
osinkinroman May 19, 2022
617a1b7
[TH2-3758] Opening detailed info of some events crushes whole app
osinkinroman Jun 6, 2022
d12a5aa
fix for event's tree rendering
osinkinroman Jun 6, 2022
18c144e
fix for messages rendering with new api
osinkinroman Jun 6, 2022
c599516
resolve build conflicts
osinkinroman Jun 6, 2022
dc3b258
messages scroll fix
osinkinroman Jun 6, 2022
1739e6c
delete console.logs
osinkinroman Jun 6, 2022
b9732a7
fixed messageList generating for virtualized list
osinkinroman Jun 16, 2022
7e07801
fixed behavior when we have no parsedMessages
osinkinroman Jun 16, 2022
0cbab81
added subsequence id to message header and bump version
osinkinroman Jun 16, 2022
fe2c21c
Merge remote-tracking branch 'origin/master' into release_6.0
osinkinroman Jun 21, 2022
46b8917
Merge branch 'master' into version-6
osinkinroman Jun 21, 2022
ca36329
Merge pull request #380 from th2-net/version-6_merge_master
WbyNghbr Jun 27, 2022
7a10975
Merge branch 'master' into version-6
rzvdv Jun 29, 2022
420b5d9
Squashed commit of the following:
rzvdv Jun 29, 2022
707ba22
6.0 merge fixes
rzvdv Jun 29, 2022
4a52847
Revert "6.0 merge fixes"
rzvdv Jun 29, 2022
3405f55
Revert "Squashed commit of the following:"
rzvdv Jun 29, 2022
2965d6a
version bump
WbyNghbr Jul 4, 2022
08c8ac1
Fix messages loading
rzvdv Jul 7, 2022
308ece0
Fix build
rzvdv Jul 7, 2022
ec1340e
Fix build
rzvdv Jul 7, 2022
03e5c23
Bump version
rzvdv Jul 15, 2022
d1bf858
Fix messages & new styles
osinkinroman Jul 18, 2022
5c96671
Merge branch 'master' into version-6
rzvdv Jul 18, 2022
e9614ee
Bump version
rzvdv Jul 18, 2022
ea42958
Temp bug fix for messages loading
rzvdv Jul 18, 2022
693194c
Fix EmbeddedMessages
rzvdv Jul 18, 2022
afcb7bb
Merge branch 'master' into version-6
rzvdv Jul 20, 2022
feb526d
Merge branch 'master' into version-6
rzvdv Jul 20, 2022
002033c
version 6 new changes (#398)
osinkinroman Jul 26, 2022
a2f897b
[TH2-4001] Hide Soft Filter option from messages filter and fix highl…
osinkinroman Jul 27, 2022
753d87a
Merge branch 'master' into version-6
rzvdv Jul 27, 2022
e898523
[TH2-4008] Add bookmark and attached indicator for messages (#400)
osinkinroman Jul 27, 2022
4e87752
Merge branch 'master' into version-6
rzvdv Jul 29, 2022
572202d
Merge branch 'master' into version-6
rzvdv Aug 10, 2022
328dae7
Fix computeItemKey
rzvdv Aug 10, 2022
4f449d8
[TH2-4020] Add collapsed view for messages (#402)
osinkinroman Aug 10, 2022
97e8f1d
Merge branch 'master' into version-6
rzvdv Aug 11, 2022
9bc2079
Add useFilterConfig hook
rzvdv Aug 14, 2022
51dbb38
Fix SearchPanel load more button
rzvdv Aug 15, 2022
8618351
bookmark icon fix (#408)
osinkinroman Aug 15, 2022
1e977a5
Fix SearchStore load more
rzvdv Aug 15, 2022
7edcf34
[TH2-4091] Embedded message view toggler fix (#411)
osinkinroman Aug 16, 2022
95cfeda
[TH2-4095] Change message card view for case when displayRule is bina…
osinkinroman Aug 18, 2022
d287536
Fix message changes height when it's added to export
rzvdv Aug 23, 2022
ee26572
[TH2-4080] New filters panel (#409)
osinkinroman Aug 23, 2022
9aa22ee
Fix filter in embedded messages (#420)
osinkinroman Aug 23, 2022
6dd83a6
[TH2-3985] Fix bookmarks filtering
atachka Aug 24, 2022
e21c2d5
implemented strict mode (#422)
osinkinroman Aug 25, 2022
27933cc
Merge branch 'master' into version-6
rzvdv Sep 2, 2022
cacbf85
Fix ReplayModal
rzvdv Sep 2, 2022
76a844a
[TH2-4134] Message, linked to event always remain in the list, regard…
osinkinroman Sep 8, 2022
3ebe8a9
optional subsequence
rzvdv Sep 8, 2022
60a2fbb
Remove title for subsequence
rzvdv Sep 8, 2022
d946b89
[TH2-4146] Link in replay window doesn't change after fields filling …
osinkinroman Sep 12, 2022
f82b4fa
[TH-4145] fixed pinning filters in filters history
tesohi Sep 13, 2022
1ccf5b5
Merge branch 'master' into version-6 (#437)
osinkinroman Sep 13, 2022
6545c5a
bump version (#438)
osinkinroman Sep 13, 2022
37cce62
[TH2-4149] fixed applying "Binary" display rule after messages search
tesohi Sep 15, 2022
8d246b8
fixed displaying messages with raw type
tesohi Sep 15, 2022
6ad07c4
[Th2-4144] moved filters history and changed icon for excluded filter…
molotgor Sep 21, 2022
0eea6a9
Merge branch 'master' into version-6
rzvdv Nov 9, 2022
d445f92
Merge branch 'master' into version-6
rzvdv Nov 14, 2022
d3c9c0a
Fix styles
rzvdv Nov 14, 2022
3731ff1
Merge branch 'master' into version-6
rzvdv Nov 15, 2022
2c538aa
[TH2-4465] Change message expand button (#481)
osinkinroman Nov 22, 2022
cd7ed12
Merge branch 'master' into version-6
rzvdv Dec 16, 2022
71ad937
Search panel styles improvements
rzvdv Dec 16, 2022
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
Diff view
2 changes: 1 addition & 1 deletion package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "th2-rpt-viewer",
"version": "5.0.7",
"version": "6.0.1",
"description": "",
"main": "index.tsx",
"private": true,
Expand Down
16 changes: 10 additions & 6 deletions src/api/message.ts
Original file line number Diff line number Diff line change
Expand Up @@ -54,9 +54,9 @@ const messageHttpApi: MessageApiSchema = {
timelineDirection,
messageId: messageId.length > 0 ? messageId : null,
limit,
timestampFrom,
timestampTo,
stream: streams,
timestampFrom: timestampFrom ? new Date(timestampFrom).toISOString() : null,
timestampTo: timestampTo ? new Date(timestampTo).toISOString() : null,
stream: streams.flatMap(stream => [`${stream}:first`, `${stream}:second`]),
});

const res = await fetch(`backend/search/messages?${params}`, {
Expand All @@ -74,8 +74,8 @@ const messageHttpApi: MessageApiSchema = {
getMessagesIds: async (timestampFrom, timestampTo) => {
const params = createURLSearchParams({
idsOnly: true,
timestampFrom,
timestampTo,
timestampFrom: timestampFrom ? new Date(timestampFrom).toISOString() : null,
timestampTo: timestampTo ? new Date(timestampTo).toISOString() : null,
});
const res = await fetch(`backend/search/messages?${params}`);

Expand Down Expand Up @@ -129,7 +129,11 @@ const messageHttpApi: MessageApiSchema = {
throw new Error('One of startTimestamp or messageId must be specified');
}

const params = createURLSearchParams({ stream: streams, startTimestamp, messageId });
const params = createURLSearchParams({
stream: streams.flatMap(stream => [`${stream}:first`, `${stream}:second`]),
startTimestamp: startTimestamp ? new Date(startTimestamp).toISOString() : startTimestamp,
messageId,
});
const res = await fetch(`backend/messageIds/?${params}`, { signal });
if (res.ok) return res.json();

Expand Down
38 changes: 31 additions & 7 deletions src/api/sse.ts
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,17 @@ export interface EventSSEParams extends BaseSSEParams {
resumeFromId?: string;
}

export type MessageDirection = 'first' | 'second';

export const toStream = (
name: string,
direction: MessageDirection[] = ['first', 'second'],
): string[] => {
const res = direction.map(dir => `${name}:${dir}`);

return res;
};

export interface MessagesSSEParams extends BaseSSEParams {
stream: string[];
filters?: Array<MessagesSSEFilters>;
Expand Down Expand Up @@ -103,7 +114,11 @@ export interface MessageIdsEvent {
reason: string;
// session: messageId
messageIds: {
[session: string]: string | null;
[session: string]: {
hasStarted: boolean;
hasFinished: boolean;
lastId: string | null;
};
};
}

Expand Down Expand Up @@ -171,9 +186,9 @@ export function getMessagesSSEParamsFromFilter(
);

const queryParams: MessagesSSEParams = {
startTimestamp,
endTimestamp: endTimestamp || undefined,
stream: streams,
startTimestamp: startTimestamp ? new Date(startTimestamp).toISOString() : startTimestamp,
endTimestamp: endTimestamp ? new Date(endTimestamp).toISOString() : endTimestamp,
stream: streams.flatMap(stream => [`${stream}:first`, `${stream}:second`]),
searchDirection,
resultCountLimit,
filters: filtersToAdd,
Expand All @@ -185,15 +200,24 @@ export function getMessagesSSEParamsFromFilter(

const sseApi: SSESchema = {
getEventSource: config => {
// console.error(new Error());
const { type, queryParams } = config;
const params = createURLSearchParams({ ...queryParams });
const params = createURLSearchParams({
...queryParams,
startTimestamp: queryParams.startTimestamp
? new Date(queryParams.startTimestamp).toISOString()
: null,
endTimestamp: queryParams.endTimestamp
? new Date(queryParams.endTimestamp).toISOString()
: null,
});
return new EventSource(`backend/search/sse/${type}s/?${params}`);
},
getEventsTreeSource: (timeRange, filter, sseParams) => {
const paramFromFilter = filter ? getEventsSSEParamsFromFilter(filter) : {};
const params = createURLSearchParams({
startTimestamp: timeRange[0],
endTimestamp: timeRange[1],
startTimestamp: new Date(timeRange[0]).toISOString(),
endTimestamp: new Date(timeRange[1]).toISOString(),
...paramFromFilter,
...sseParams,
});
Expand Down
8 changes: 6 additions & 2 deletions src/components/bookmarks/BookmarksPanel.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -152,9 +152,13 @@ const BookmarkItemBase = (props: BookmarkItemProps) => {
: bookmark;

const itemInfo = {
id: isEventMessage(item) ? item.messageId : item.eventId,
id: isEventMessage(item) ? item.id : item.eventId,
status: isEventMessage(item) ? null : item.successful ? 'passed' : 'failed',
title: isEventMessage(item) ? item.messageType || 'unknown type' : item.eventName,
title: isEventMessage(item)
? item.parsedMessages
?.map(parsedMessage => parsedMessage.message.metadata.messageType)
.toString() || 'unknown type'
: item.eventName,
timestamp: getTimestampAsNumber(item),
type: item.type,
};
Expand Down
2 changes: 1 addition & 1 deletion src/components/embedded/EmbeddedEventHeader.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ export default function EmbeddedEventHeader(props: Props) {
<div className='event-header-card__time-label'>
<span className='event-header-card__time-label-full'>
{formatTime(startTimestampValue)}
</span>
</span>{' '}
</div>
{eventType && <span className='event-header-card__event-type'>{eventType}</span>}
</>
Expand Down
42 changes: 34 additions & 8 deletions src/components/embedded/EmbeddedMessage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,19 +15,40 @@
***************************************************************************** */

import React, { useEffect, useState } from 'react';
import { EventMessage, MessageViewType } from '../../models/EventMessage';
import { EventMessage, MessageViewType, EventMessageItem } from '../../models/EventMessage';
import MessageCardBase from '../message/message-card/MessageCardBase';
import SplashScreen from '../SplashScreen';

function EmbeddedMessage({ messageId }: { messageId: string }) {
const [message, setMessage] = useState<EventMessage | null>();
const [messageList, setMessageList] = React.useState<EventMessageItem[]>([]);
const [viewType, setViewType] = useState(MessageViewType.JSON);
const [errorStatus, setErrorStatus] = useState<string | null>(null);

useEffect(() => {
getMessage();
}, []);

useEffect(() => {
if (message)
message.parsedMessages?.forEach((parsedMessage, index) => {
const tempMessage = message;
const { parsedMessages, ...rest } = tempMessage;
const tempMessageItem: EventMessageItem = {
...rest,
parsedMessage: null,
parsedMessages: [],
};

tempMessageItem.parsedMessage = tempMessage.parsedMessages
? tempMessage.parsedMessages[index]
: null;
if (tempMessageItem.parsedMessages && tempMessageItem.parsedMessage)
tempMessageItem.parsedMessages[0] = tempMessageItem.parsedMessage;
setMessageList([...messageList, tempMessageItem]);
});
});

async function getMessage() {
const res = await fetch(`backend/message/${messageId}`);
if (res.ok) {
Expand All @@ -41,15 +62,20 @@ function EmbeddedMessage({ messageId }: { messageId: string }) {
throw new Error(errorStatus);
}

if (message) {
if (messageList) {
rzvdv marked this conversation as resolved.
Show resolved Hide resolved
return (
<div className='embedded-wrapper'>
<MessageCardBase
isEmbedded
message={message}
setViewType={setViewType}
viewType={viewType}
/>
{messageList.map((parsedMessage, index: number) => {
return (
<MessageCardBase
isEmbedded
key={`${parsedMessage.id}-${index}`}
message={parsedMessage}
setViewType={setViewType}
viewType={viewType}
/>
);
})}
</div>
);
}
Expand Down
51 changes: 33 additions & 18 deletions src/components/embedded/EmbeddedMessages.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,12 @@
* limitations under the License.
***************************************************************************** */

import React, { useState } from 'react';
import React from 'react';
import { Virtuoso, VirtuosoHandle } from 'react-virtuoso';
import { observer, Observer } from 'mobx-react-lite';
import moment from 'moment';
import { EventMessage, MessageViewType } from '../../models/EventMessage';
import { EventMessage, EventMessageItem } from '../../models/EventMessage';
import SplashScreen from '../SplashScreen';
import MessageCardBase from '../message/message-card/MessageCardBase';
import '../../styles/embedded.scss';
import api from '../../api';
import StateSaverProvider from '../util/StateSaverProvider';
Expand All @@ -30,26 +29,17 @@ import { raf } from '../../helpers/raf';
import EmbeddedMessagesStore from './embedded-stores/EmbeddedMessagesStore';
import MessagesUpdateButton from '../message/MessagesUpdateButton';
import EmbeddedMessagesFilterPanel from './EmbeddedMessagesFilterPanel';
import MessageCard from '../message/message-card/MessageCard';

const messagesStore = new EmbeddedMessagesStore(api);

const EmbeddedMessages = () => {
const { dataStore, scrolledIndex } = messagesStore;
const { updateStore } = dataStore;

const [viewType, setViewType] = useState(MessageViewType.JSON);

const renderMsg = (index: number, message: EventMessage) => {
return (
<MessageCardBase
isEmbedded
key={index}
message={message}
setViewType={setViewType}
viewType={viewType}
/>
);
};
const renderMsg = React.useCallback((index: number, message: EventMessageItem) => {
return <MessageCard message={message} />;
}, []);

const reportURL = React.useMemo(() => {
const messagesStoreState = {
Expand Down Expand Up @@ -132,7 +122,7 @@ export default function MessagesApp() {
interface Props {
computeItemKey?: (idx: number) => React.Key;
rowCount: number;
itemRenderer: (index: number, message: EventMessage) => React.ReactElement;
itemRenderer: (index: number, message: EventMessageItem) => React.ReactElement;
/*
Number objects is used here because in some cases (eg one message / action was
selected several times by different entities)
Expand All @@ -159,6 +149,31 @@ const MessagesVirtualizedList = observer((props: Props) => {
scrolledIndex,
} = props;

const [messageList, setMessageList] = React.useState<EventMessageItem[]>([]);

React.useEffect(() => {
messagesStore.dataStore.messages.forEach(message =>
message.parsedMessages?.forEach((parsedMessage, index) => {
const tempMessage = message;
const { parsedMessages, ...rest } = tempMessage;
const tempMessageItem: EventMessageItem = {
...rest,
parsedMessage: null,
parsedMessages: [],
};

tempMessageItem.parsedMessage = tempMessage.parsedMessages
? tempMessage.parsedMessages[index]
: null;

if (tempMessageItem.parsedMessages && tempMessageItem.parsedMessage)
tempMessageItem.parsedMessages[0] = tempMessageItem.parsedMessage;

setMessageList([...messageList, tempMessageItem]);
}),
);
}, [messagesStore.dataStore.messages]);

React.useEffect(() => {
if (scrolledIndex !== null) {
raf(() => {
Expand Down Expand Up @@ -214,7 +229,7 @@ const MessagesVirtualizedList = observer((props: Props) => {

return (
<Virtuoso
data={messagesStore.dataStore.messages}
data={messageList}
firstItemIndex={messagesStore.dataStore.startIndex}
ref={virtuoso}
overscan={overscan}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -187,10 +187,14 @@ export default class EmbeddedMessagesDataProviderStore implements MessagesDataSt

const [nextMessages, prevMessages] = await Promise.all([
this.searchChannelNext.loadAndSubscribe({
resumeMessageIds: extractMessageIds(messageIds.previous),
resumeMessageIds: extractMessageIds(
messageIds.next.filter((messageId, index) => index < 2),
rzvdv marked this conversation as resolved.
Show resolved Hide resolved
),
}),
this.searchChannelPrev.loadAndSubscribe({
resumeMessageIds: extractMessageIds(messageIds.next),
resumeMessageIds: extractMessageIds(
messageIds.previous.filter((messageId, index) => index < 2),
),
}),
]);

Expand All @@ -204,7 +208,7 @@ export default class EmbeddedMessagesDataProviderStore implements MessagesDataSt
} else {
const firstPrevMessage = prevMessages[0];
if (firstPrevMessage) {
this.messagesStore.scrollToMessage(firstPrevMessage.messageId);
this.messagesStore.scrollToMessage(firstPrevMessage.id);
}
}
};
Expand Down Expand Up @@ -274,10 +278,7 @@ export default class EmbeddedMessagesDataProviderStore implements MessagesDataSt
this.lastPreviousChannelResponseTimestamp = null;
const firstPrevMessage = messages[0];

if (
firstPrevMessage &&
firstPrevMessage.messageId === this.messages[this.messages.length - 1]?.messageId
) {
if (firstPrevMessage && firstPrevMessage.id === this.messages[this.messages.length - 1]?.id) {
messages.shift();
}

Expand All @@ -291,7 +292,7 @@ export default class EmbeddedMessagesDataProviderStore implements MessagesDataSt
this.messages = newMessagesList;

const selectedMessageId = this.messagesStore.selectedMessageId?.valueOf();
if (selectedMessageId && messages.find(m => m.messageId === selectedMessageId)) {
if (selectedMessageId && messages.find(m => m.id === selectedMessageId)) {
this.messagesStore.scrollToMessage(selectedMessageId);
}
}
Expand Down Expand Up @@ -330,7 +331,7 @@ export default class EmbeddedMessagesDataProviderStore implements MessagesDataSt
this.lastNextChannelResponseTimestamp = null;
const firstNextMessage = messages[this.messages.length - 1];

if (firstNextMessage && firstNextMessage.messageId === this.messages[0]?.messageId) {
if (firstNextMessage && firstNextMessage.id === this.messages[0]?.id) {
messages.pop();
}

Expand All @@ -345,7 +346,7 @@ export default class EmbeddedMessagesDataProviderStore implements MessagesDataSt
this.messages = newMessagesList;

const selectedMessageId = this.messagesStore.selectedMessageId?.valueOf();
if (selectedMessageId && messages.find(m => m.messageId === selectedMessageId)) {
if (selectedMessageId && messages.find(m => m.id === selectedMessageId)) {
this.messagesStore.scrollToMessage(selectedMessageId);
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ export default class EmbeddedMessagesStore {
@action
public scrollToMessage = async (messageId: string) => {
const messageIndex = this.dataStore.messages.findIndex(
(m: { messageId: string }) => m.messageId === messageId,
(m: { id: string }) => m.id === messageId,
);
if (messageIndex !== -1) {
this.scrolledIndex = new Number(messageIndex);
Expand Down
2 changes: 1 addition & 1 deletion src/components/event/EventCardHeader.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,7 @@ function EventCardHeader(props: Props) {
onMouseLeave={onMouseLeave}>
<span className='event-header-card__time-label-full'>
{formatTime(startTimestampValue)}
</span>
</span>{' '}
</div>
{eventType && (
<span className='event-header-card__event-type' onClick={handleTypeClick}>
Expand Down
Loading