Redirect right after a message is sent (#831)
This commit is contained in:
parent
1b2b22f18a
commit
de33c13dc8
4 changed files with 1 additions and 15 deletions
|
@ -25,7 +25,6 @@ export interface Props {
|
||||||
) => void;
|
) => void;
|
||||||
messageSchema: TopicMessageSchema | undefined;
|
messageSchema: TopicMessageSchema | undefined;
|
||||||
schemaIsFetched: boolean;
|
schemaIsFetched: boolean;
|
||||||
messageIsSent: boolean;
|
|
||||||
messageIsSending: boolean;
|
messageIsSending: boolean;
|
||||||
partitions: Partition[];
|
partitions: Partition[];
|
||||||
}
|
}
|
||||||
|
@ -37,7 +36,6 @@ const SendMessage: React.FC<Props> = ({
|
||||||
sendTopicMessage,
|
sendTopicMessage,
|
||||||
messageSchema,
|
messageSchema,
|
||||||
schemaIsFetched,
|
schemaIsFetched,
|
||||||
messageIsSent,
|
|
||||||
messageIsSending,
|
messageIsSending,
|
||||||
partitions,
|
partitions,
|
||||||
}) => {
|
}) => {
|
||||||
|
@ -81,11 +79,6 @@ const SendMessage: React.FC<Props> = ({
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}, [schemaIsFetched]);
|
}, [schemaIsFetched]);
|
||||||
React.useEffect(() => {
|
|
||||||
if (messageIsSent) {
|
|
||||||
history.push(clusterTopicMessagesPath(clusterName, topicName));
|
|
||||||
}
|
|
||||||
}, [messageIsSent]);
|
|
||||||
|
|
||||||
const onSubmit = async (data: {
|
const onSubmit = async (data: {
|
||||||
key: string;
|
key: string;
|
||||||
|
@ -112,6 +105,7 @@ const SendMessage: React.FC<Props> = ({
|
||||||
headers,
|
headers,
|
||||||
partition,
|
partition,
|
||||||
});
|
});
|
||||||
|
history.push(clusterTopicMessagesPath(clusterName, topicName));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
|
@ -7,7 +7,6 @@ import {
|
||||||
getPartitionsByTopicName,
|
getPartitionsByTopicName,
|
||||||
getTopicMessageSchemaFetched,
|
getTopicMessageSchemaFetched,
|
||||||
getTopicMessageSending,
|
getTopicMessageSending,
|
||||||
getTopicMessageSent,
|
|
||||||
} from 'redux/reducers/topics/selectors';
|
} from 'redux/reducers/topics/selectors';
|
||||||
|
|
||||||
import SendMessage from './SendMessage';
|
import SendMessage from './SendMessage';
|
||||||
|
@ -31,7 +30,6 @@ const mapStateToProps = (
|
||||||
topicName,
|
topicName,
|
||||||
messageSchema: getMessageSchemaByTopicName(state, topicName),
|
messageSchema: getMessageSchemaByTopicName(state, topicName),
|
||||||
schemaIsFetched: getTopicMessageSchemaFetched(state),
|
schemaIsFetched: getTopicMessageSchemaFetched(state),
|
||||||
messageIsSent: getTopicMessageSent(state),
|
|
||||||
messageIsSending: getTopicMessageSending(state),
|
messageIsSending: getTopicMessageSending(state),
|
||||||
partitions: getPartitionsByTopicName(state, topicName),
|
partitions: getPartitionsByTopicName(state, topicName),
|
||||||
});
|
});
|
||||||
|
|
|
@ -72,7 +72,6 @@ const setupWrapper = (props?: Partial<Props>) => (
|
||||||
},
|
},
|
||||||
}}
|
}}
|
||||||
schemaIsFetched={false}
|
schemaIsFetched={false}
|
||||||
messageIsSent={false}
|
|
||||||
messageIsSending={false}
|
messageIsSending={false}
|
||||||
partitions={[
|
partitions={[
|
||||||
{
|
{
|
||||||
|
|
|
@ -72,11 +72,6 @@ export const getTopicMessageSchemaFetched = createSelector(
|
||||||
(status) => status === 'fetched'
|
(status) => status === 'fetched'
|
||||||
);
|
);
|
||||||
|
|
||||||
export const getTopicMessageSent = createSelector(
|
|
||||||
getTopicMessageSendingStatus,
|
|
||||||
(status) => status === 'fetched'
|
|
||||||
);
|
|
||||||
|
|
||||||
export const getTopicMessageSending = createSelector(
|
export const getTopicMessageSending = createSelector(
|
||||||
getTopicMessageSendingStatus,
|
getTopicMessageSendingStatus,
|
||||||
(status) => status === 'fetching'
|
(status) => status === 'fetching'
|
||||||
|
|
Loading…
Add table
Reference in a new issue