console: update request payload event triggers (#358)

This commit is contained in:
Praveen Durairaj 2018-09-05 18:37:52 +05:30 committed by Shahidh K Muhammed
parent 6c9d176921
commit 258885ad4d
8 changed files with 22 additions and 13 deletions

View File

@ -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,
}, },
}), }),
}; };

View File

@ -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)
); );

View File

@ -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 {

View File

@ -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)
); );

View File

@ -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>

View File

@ -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],

View File

@ -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>

View File

@ -257,3 +257,9 @@ a.expanded {
padding-left: 5px; padding-left: 5px;
} }
} }
.watchBtn {
i {
font-size: 12px;
}
}