mirror of
https://github.com/hasura/graphql-engine.git
synced 2024-12-14 17:02:49 +03:00
console: update request payload event triggers (#358)
This commit is contained in:
parent
6c9d176921
commit
258885ad4d
@ -195,7 +195,7 @@ const loadEventLogs = triggerName => (dispatch, getState) => {
|
|||||||
],
|
],
|
||||||
where: { event: { trigger_name: triggerName } },
|
where: { event: { trigger_name: triggerName } },
|
||||||
order_by: ['-created_at'],
|
order_by: ['-created_at'],
|
||||||
limit: 20,
|
limit: 10,
|
||||||
},
|
},
|
||||||
}),
|
}),
|
||||||
};
|
};
|
||||||
|
@ -313,12 +313,12 @@ const ViewRows = ({
|
|||||||
showPagination={false}
|
showPagination={false}
|
||||||
SubComponent={logRow => {
|
SubComponent={logRow => {
|
||||||
const finalIndex = logRow.index;
|
const finalIndex = logRow.index;
|
||||||
|
const finalRow = currentRow.logs[finalIndex];
|
||||||
const currentPayload = JSON.stringify(
|
const currentPayload = JSON.stringify(
|
||||||
currentRow.payload,
|
finalRow.request,
|
||||||
null,
|
null,
|
||||||
4
|
4
|
||||||
);
|
);
|
||||||
const finalRow = currentRow.logs[finalIndex];
|
|
||||||
const finalResponse = JSON.parse(
|
const finalResponse = JSON.parse(
|
||||||
JSON.stringify(finalRow.response, null, 4)
|
JSON.stringify(finalRow.response, null, 4)
|
||||||
);
|
);
|
||||||
|
@ -306,12 +306,12 @@ const ViewRows = ({
|
|||||||
showPagination={false}
|
showPagination={false}
|
||||||
SubComponent={logRow => {
|
SubComponent={logRow => {
|
||||||
const finalIndex = logRow.index;
|
const finalIndex = logRow.index;
|
||||||
|
const finalRow = currentRow.logs[finalIndex];
|
||||||
const currentPayload = JSON.stringify(
|
const currentPayload = JSON.stringify(
|
||||||
currentRow.payload,
|
finalRow.request,
|
||||||
null,
|
null,
|
||||||
4
|
4
|
||||||
);
|
);
|
||||||
const finalRow = currentRow.logs[finalIndex];
|
|
||||||
// check if response is type JSON
|
// check if response is type JSON
|
||||||
let finalResponse = finalRow.response;
|
let finalResponse = finalRow.response;
|
||||||
try {
|
try {
|
||||||
|
@ -313,12 +313,12 @@ const ViewRows = ({
|
|||||||
showPagination={false}
|
showPagination={false}
|
||||||
SubComponent={logRow => {
|
SubComponent={logRow => {
|
||||||
const finalIndex = logRow.index;
|
const finalIndex = logRow.index;
|
||||||
|
const finalRow = currentRow.logs[finalIndex];
|
||||||
const currentPayload = JSON.stringify(
|
const currentPayload = JSON.stringify(
|
||||||
currentRow.payload,
|
finalRow.request,
|
||||||
null,
|
null,
|
||||||
4
|
4
|
||||||
);
|
);
|
||||||
const finalRow = currentRow.logs[finalIndex];
|
|
||||||
const finalResponse = JSON.parse(
|
const finalResponse = JSON.parse(
|
||||||
JSON.stringify(finalRow.response, null, 4)
|
JSON.stringify(finalRow.response, null, 4)
|
||||||
);
|
);
|
||||||
|
@ -46,7 +46,7 @@ class Schema extends Component {
|
|||||||
dispatch(push(`${appPrefix}/manage/triggers/add`));
|
dispatch(push(`${appPrefix}/manage/triggers/add`));
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
Create
|
Create Trigger
|
||||||
</button>
|
</button>
|
||||||
) : null}
|
) : null}
|
||||||
</div>
|
</div>
|
||||||
|
@ -95,7 +95,7 @@ const streamingLogsReducer = (triggerName, triggerList, logState, action) => {
|
|||||||
columns: ['*'],
|
columns: ['*'],
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
limit: 20,
|
limit: 10,
|
||||||
where: { event: { trigger_name: triggerName } },
|
where: { event: { trigger_name: triggerName } },
|
||||||
},
|
},
|
||||||
activePath: [triggerName],
|
activePath: [triggerName],
|
||||||
|
@ -80,7 +80,7 @@ class StreamingLogs extends Component {
|
|||||||
}
|
}
|
||||||
if (col === 'created_at') {
|
if (col === 'created_at') {
|
||||||
const formattedDate = new Date(r.created_at).toUTCString();
|
const formattedDate = new Date(r.created_at).toUTCString();
|
||||||
return formattedDate;
|
return <div className={conditionalClassname}>{formattedDate}</div>;
|
||||||
}
|
}
|
||||||
const content = r[col] === undefined ? 'NULL' : r[col].toString();
|
const content = r[col] === undefined ? 'NULL' : r[col].toString();
|
||||||
return <div className={conditionalClassname}>{content}</div>;
|
return <div className={conditionalClassname}>{content}</div>;
|
||||||
@ -103,15 +103,18 @@ class StreamingLogs extends Component {
|
|||||||
<div>
|
<div>
|
||||||
<button
|
<button
|
||||||
onClick={this.watchChanges.bind(this)}
|
onClick={this.watchChanges.bind(this)}
|
||||||
className={' btn btn-default'}
|
className={styles.watchBtn + ' btn btn-default'}
|
||||||
data-test="run-query"
|
data-test="run-query"
|
||||||
>
|
>
|
||||||
{this.state.isWatching ? (
|
{this.state.isWatching ? (
|
||||||
<span>
|
<span>
|
||||||
Streaming... <i className={'fa fa-spinner fa-spin'} />
|
<i className={'fa fa-pause'} /> Streaming...{' '}
|
||||||
|
<i className={'fa fa-spinner fa-spin'} />
|
||||||
</span>
|
</span>
|
||||||
) : (
|
) : (
|
||||||
'Stream Logs'
|
<span>
|
||||||
|
Stream Logs <i className={'fa fa-play'} />
|
||||||
|
</span>
|
||||||
)}
|
)}
|
||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
|
@ -257,3 +257,9 @@ a.expanded {
|
|||||||
padding-left: 5px;
|
padding-left: 5px;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.watchBtn {
|
||||||
|
i {
|
||||||
|
font-size: 12px;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user