kopia lustrzana https://github.com/bugout-dev/moonstream
Add fixes for stream service get parametrs.
rodzic
309e510598
commit
86263290b4
|
@ -80,8 +80,8 @@ const EntriesNavigation = () => {
|
||||||
const loadMoreButtonRef = useRef(null);
|
const loadMoreButtonRef = useRef(null);
|
||||||
|
|
||||||
const [streamBoundary, setStreamBoundary] = useState({
|
const [streamBoundary, setStreamBoundary] = useState({
|
||||||
start_time: 0,
|
start_time: null,
|
||||||
end_time: 0,
|
end_time: null,
|
||||||
include_start: false,
|
include_start: false,
|
||||||
include_end: true,
|
include_end: true,
|
||||||
next_event_time: null,
|
next_event_time: null,
|
||||||
|
@ -174,12 +174,6 @@ const EntriesNavigation = () => {
|
||||||
// }
|
// }
|
||||||
// };
|
// };
|
||||||
|
|
||||||
useEffect(() => {
|
|
||||||
if (!streamBoundary.start_time && !streamBoundary.end_time) {
|
|
||||||
refetch();
|
|
||||||
}
|
|
||||||
}, [streamBoundary]);
|
|
||||||
|
|
||||||
const setFilterProps = useCallback(
|
const setFilterProps = useCallback(
|
||||||
(filterIdx, props) => {
|
(filterIdx, props) => {
|
||||||
const newFilterProps = [...newFilterState];
|
const newFilterProps = [...newFilterState];
|
||||||
|
@ -514,8 +508,8 @@ const EntriesNavigation = () => {
|
||||||
onClick={() => {
|
onClick={() => {
|
||||||
remove();
|
remove();
|
||||||
setStreamBoundary({
|
setStreamBoundary({
|
||||||
start_time: 0,
|
start_time: null,
|
||||||
end_time: 0,
|
end_time: null,
|
||||||
include_start: false,
|
include_start: false,
|
||||||
include_end: true,
|
include_end: true,
|
||||||
next_event_time: null,
|
next_event_time: null,
|
||||||
|
@ -557,7 +551,7 @@ const EntriesNavigation = () => {
|
||||||
)}
|
)}
|
||||||
</Stack>
|
</Stack>
|
||||||
{entries
|
{entries
|
||||||
?.sort((a, b) => b.timestamp - a.timestamp)
|
?.sort((a, b) => b.timestamp - a.timestamp) // TODO(Andrey) improve that for bi chunks of data sorting can take time
|
||||||
.map((entry, idx) => (
|
.map((entry, idx) => (
|
||||||
<StreamEntry
|
<StreamEntry
|
||||||
key={`entry-list-${idx}`}
|
key={`entry-list-${idx}`}
|
||||||
|
@ -586,9 +580,20 @@ const EntriesNavigation = () => {
|
||||||
</Button>
|
</Button>
|
||||||
</Center>
|
</Center>
|
||||||
) : (
|
) : (
|
||||||
""
|
<Center>
|
||||||
|
{!isFetching ? (
|
||||||
|
"Тransactions not found. You can subscribe to more addresses in Subscriptions menu."
|
||||||
|
) : (
|
||||||
|
<Button
|
||||||
|
isLoading
|
||||||
|
loadingText="Loading"
|
||||||
|
variant="outline"
|
||||||
|
colorScheme="suggested"
|
||||||
|
></Button>
|
||||||
)}
|
)}
|
||||||
{streamBoundary.previous_event_time && isLoading && (
|
</Center>
|
||||||
|
)}
|
||||||
|
{streamBoundary.previous_event_time && isLoading ? (
|
||||||
<Center>
|
<Center>
|
||||||
<Spinner
|
<Spinner
|
||||||
//hidden={!isFetchingMore}
|
//hidden={!isFetchingMore}
|
||||||
|
@ -600,6 +605,8 @@ const EntriesNavigation = () => {
|
||||||
speed="1.5s"
|
speed="1.5s"
|
||||||
/>
|
/>
|
||||||
</Center>
|
</Center>
|
||||||
|
) : (
|
||||||
|
""
|
||||||
)}
|
)}
|
||||||
</Flex>
|
</Flex>
|
||||||
</Flex>
|
</Flex>
|
||||||
|
|
|
@ -9,15 +9,32 @@ export const getStream = ({
|
||||||
end_time,
|
end_time,
|
||||||
include_start,
|
include_start,
|
||||||
include_end,
|
include_end,
|
||||||
}) =>
|
}) => {
|
||||||
http({
|
let params = {};
|
||||||
|
|
||||||
|
if (searchTerm) {
|
||||||
|
params.q = encodeURIComponent(searchTerm);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (start_time) {
|
||||||
|
params.start_time = encodeURIComponent(start_time);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (end_time) {
|
||||||
|
params.end_time = encodeURIComponent(end_time);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (include_start) {
|
||||||
|
params.include_start = encodeURIComponent(true);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (include_end) {
|
||||||
|
params.include_end = encodeURIComponent(true);
|
||||||
|
}
|
||||||
|
|
||||||
|
return http({
|
||||||
method: "GET",
|
method: "GET",
|
||||||
url: `${API}/streams/`,
|
url: `${API}/streams/`,
|
||||||
params: {
|
params: params,
|
||||||
q: searchTerm,
|
|
||||||
start_time: encodeURIComponent(start_time),
|
|
||||||
end_time: encodeURIComponent(end_time),
|
|
||||||
include_start: encodeURIComponent(include_start),
|
|
||||||
include_end: encodeURIComponent(include_end),
|
|
||||||
},
|
|
||||||
});
|
});
|
||||||
|
};
|
||||||
|
|
Ładowanie…
Reference in New Issue