Skip to content

Commit

Permalink
fix(report): garris#1166 approve button does not work on the filtered…
Browse files Browse the repository at this point in the history
… failed page.
  • Loading branch information
Jia Li committed Apr 9, 2020
1 parent b905dd4 commit aa06773
Show file tree
Hide file tree
Showing 5 changed files with 9 additions and 9 deletions.
6 changes: 3 additions & 3 deletions compare/output/index_bundle.js

Large diffs are not rendered by default.

5 changes: 2 additions & 3 deletions compare/src/components/molecules/ApproveButton.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ const REMOTE_PORT = 3000;
const APPROVE_STATUS_TO_LABEL_MAP = Object.freeze({
INITIAL: 'Approve',
PENDING: 'Pending...',
APPROVED: 'Approved',
FAILED: 'Approve'
});

Expand Down Expand Up @@ -65,8 +64,8 @@ class ApproveButton extends React.Component {
});

if (response.ok) {
this.setState({ approveStatus: 'APPROVED' });
this.props.approveTest(this.props.currentId, this.props.filterStatus);
this.setState({ approveStatus: 'INITIAL' });
this.props.approveTest(fileName, this.props.filterStatus);
} else {
const body = await response.json();
this.setState({ approveStatus: 'FAILED', errorMsg: body.error });
Expand Down
2 changes: 1 addition & 1 deletion compare/src/components/organisms/TestCard.js
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ export default class TestCard extends React.Component {
return (
<CardWrapper id={this.props.id} status={status}>
<ButtonsWrapper>
{status === 'fail' && isRemoteOption() && <ApproveButton fileName={info.fileName} currentId={this.props.numId} />}
{status === 'fail' && isRemoteOption() && <ApproveButton fileName={info.fileName}/>}
{!onlyText && (
<NavButtons currentId={this.props.numId} lastId={this.props.lastId} />
)}
Expand Down
4 changes: 2 additions & 2 deletions compare/src/reducers/tests.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@ const tests = (state = {}, action) => {
switch (action.type) {
case 'APPROVE_TEST':
return Object.assign({}, state, {
all: state.all.map((test, i) => {
if (i === action.id) {
all: state.all.map(test => {
if (test.pair && (test.pair.fileName === action.id)) {
return Object.assign({}, test, { status: 'pass' });
}
return test;
Expand Down
1 change: 1 addition & 0 deletions compare/webpack.config.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
const path = require('path');

module.exports = {
mode: 'development',
entry: './compare/src/index.js',
output: {
path: path.resolve(__dirname, 'output'),
Expand Down

0 comments on commit aa06773

Please sign in to comment.