Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

get-station-overview-for-old-station #1653

Merged
Merged
Changes from all commits
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
11 changes: 5 additions & 6 deletions ui_src/src/domain/stationOverview/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ import { StringCodec, JSONCodec } from 'nats.ws';
const initializeState = {
stationMetaData: { is_native: true },
stationSocketData: {},
stationPartition: 1,
stationPartition: null,
stationFunctions: {}
};
let sub;
Expand Down Expand Up @@ -63,9 +63,9 @@ const StationOverview = () => {
const getStaionMetaData = async () => {
try {
let data = await httpRequest('GET', `${ApiEndpoints.GET_STATION}?station_name=${stationName}`);

data.created_at = await parsingDate(data.created_at);
stationDispatch({ type: 'SET_STATION_META_DATA', payload: data });
stationDispatch({ type: 'SET_STATION_PARTITION', payload: data?.partitions_list ? 1 : -1 });
} catch (error) {
if (error.status === 404) {
history.push(pathDomains.stations);
Expand Down Expand Up @@ -95,8 +95,9 @@ const StationOverview = () => {
// if (socketOn) {
// getStationDetails();
// }
getStationDetails();
}, [stationState?.stationPartition || stationState?.stationSocketData?.total_messages || stationState?.stationSocketData?.total_dls_messages, stationName]);
// getStationDetails();
stationState?.stationPartition && getStationDetails();
}, [stationState?.stationPartition]);

// const startListen = async () => {
// const jc = JSONCodec();
Expand Down Expand Up @@ -164,8 +165,6 @@ const StationOverview = () => {
setisLoading(true);
dispatch({ type: 'SET_ROUTE', payload: 'stations' });
getStaionMetaData();
getStationDetails();
stationDispatch({ type: 'SET_STATION_PARTITION', payload: 1 });
}, [stationName]);

return (
Expand Down