Skip to content
This repository has been archived by the owner on Oct 29, 2019. It is now read-only.

Fix/e2e #121

Merged
merged 3 commits into from
Mar 1, 2018
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
Diff view
Prev Previous commit
Support traceIds
  • Loading branch information
hanahmily committed Mar 1, 2018
commit 811f17a78431bc8dff5d3af66e77d1caf2db8c47
4 changes: 2 additions & 2 deletions mock/trace.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,11 @@ export default {
data: {
queryBasicTraces: {
'traces|10': [{
operationName: '@url',
key: '@url',
duration: '@natural(100, 1000)',
start: '@datetime',
'isError|1': true,
traceId: '@guid',
'traceIds|1-3': ['@guid'],
}],
total: '@natural(5, 50)',
},
Expand Down
16 changes: 12 additions & 4 deletions src/components/TraceTable/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ class TraceTable extends PureComponent {
const columns = [
{
title: 'OperationName',
dataIndex: 'operationName',
dataIndex: 'key',
},
{
title: 'Duration',
Expand All @@ -33,15 +33,23 @@ class TraceTable extends PureComponent {
},
{
title: 'GlobalTraceId',
dataIndex: 'traceId',
render: (text, record) => {
const { traceIds = [] } = record;
if (traceIds.length < 1) {
return 'Nan';
}
if (traceIds.length > 1) {
return `${traceIds[0]} ...`;
} else {
return traceIds[0];
}
},
},
];

return (
<div className={styles.standardTable}>
<Table
loading={loading}
rowKey={record => record.traceId}
dataSource={traces}
columns={columns}
pagination={pagination}
Expand Down
10 changes: 5 additions & 5 deletions src/models/trace.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,11 @@ const dataQuery = `
query BasicTraces($condition: TraceQueryCondition) {
queryBasicTraces(condition: $condition) {
traces {
operationName
key: operationName
duration
start
isError
traceId
traceIds
}
total
}
Expand Down Expand Up @@ -82,16 +82,16 @@ export default generateModal({
yield put({
type: 'saveSpans',
payload: response,
traceId: payload.variables.traceId,
key: payload.key,
});
},
},
reducers: {
saveSpans(state, action) {
const { traceId } = action;
const { key } = action;
const { queryTrace: { spans } } = action.payload.data;
const { data: { queryBasicTraces: { traces } } } = state;
const trace = traces.find(t => t.traceId === traceId);
const trace = traces.find(t => t.key === key);
trace.spans = spans;
return {
...state,
Expand Down
13 changes: 8 additions & 5 deletions src/routes/Trace/Trace.js
Original file line number Diff line number Diff line change
Expand Up @@ -96,11 +96,14 @@ export default class Trace extends PureComponent {
}
handleTableExpand = (expanded, record) => {
const { dispatch } = this.props;
if (expanded && !record.spans) {
dispatch({
type: 'trace/fetchSpans',
payload: { variables: { traceId: record.traceId } },
});
if (expanded) {
const { traceIds = [] } = record;
if (traceIds.length > 0) {
dispatch({
type: 'trace/fetchSpans',
payload: { variables: { traceId: traceIds[0] }, key: record.key },
});
}
}
}
renderForm() {
Expand Down