Skip to content
This repository was archived by the owner on May 13, 2025. It is now read-only.
Merged
Show file tree
Hide file tree
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
14 changes: 6 additions & 8 deletions src/pages/Stream/Views/Manage/UpdateCustomPartitionField.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ const UpdateFieldButtons = (props: { onClose: () => void; onUpdateClick: () => v
return (
<Box>
{!props.isUpdating ? (
<Stack gap={4} style={{ display: 'flex', flexDirection: 'row'}} >
<Stack gap={4} style={{ display: 'flex', flexDirection: 'row' }}>
<Tooltip label="Update" withArrow position="top">
<IconCheck className={classes.infoEditBtn} onClick={() => props.onUpdateClick()} stroke={1.6} size={16} />
</Tooltip>
Expand All @@ -32,19 +32,17 @@ export default function UpdateCustomPartitionField(props: { timePartition: strin
const isStaticSchema = _.get(info, 'static_schema_flag', false);
const existingCustomPartition = _.get(info, 'custom_partition', '-').split(',');
const [partitionFields] = useStreamStore((store) => store.fieldNames);
const [value, setValue] = useState<string[] | undefined>(existingCustomPartition);
const [value, setValue] = useState<string[]>([]);
const [updating, setUpdating] = useState<boolean>(false);
const [showEditField, setShowEditField] = useState<boolean>(false);
const [error, setError] = useState<string | null>(null);
const { updateLogStreamMutation } = useLogStream();
const { getStreamInfoRefetch } = useGetStreamInfo(props.currentStream);

// eject '-' from value array
useEffect(()=> {
if(value?.length ===1 && value.includes('-')){
setValue([])
}
},[])
useEffect(() => {
const customPartition: string = _.get(info, 'custom_partition', 'EMPTY_VALUE');
setValue(customPartition !== 'EMPTY_VALUE' ? customPartition.split(',') : []);
}, [props.currentStream, info]);

const onChangeValue = useCallback(
(value: string[]) => {
Expand Down
8 changes: 6 additions & 2 deletions src/pages/Stream/Views/Manage/UpdateTimePartitionLimit.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import _ from 'lodash';
import { useStreamStore } from '../../providers/StreamProvider';
import { ChangeEvent, useCallback, useState } from 'react';
import { ChangeEvent, useCallback, useState, useEffect } from 'react';
import { useLogStream } from '@/hooks/useLogStream';
import { useGetStreamInfo } from '@/hooks/useGetStreamInfo';
import { Box, Loader, Stack, TextInput, Tooltip, Text, Group } from '@mantine/core';
Expand Down Expand Up @@ -37,6 +37,10 @@ function UpdateTimePartitionLimit(props: { timePartition: string; currentStream:
const { updateLogStreamMutation } = useLogStream();
const { getStreamInfoRefetch } = useGetStreamInfo(props.currentStream);

useEffect(() => {
setValue(timePartitonLimit);
}, [props.currentStream, info]);

const onChange = useCallback(
(e: ChangeEvent<HTMLInputElement>) => {
const inputTime = e.target.value;
Expand Down Expand Up @@ -102,7 +106,7 @@ function UpdateTimePartitionLimit(props: { timePartition: string; currentStream:
)}
</Group>
{showEditField ? (
<Group style={{ flexDirection: 'row',alignItems:"baseline" }} gap={6}>
<Group style={{ flexDirection: 'row', alignItems: 'baseline' }} gap={6}>
<TextInput
placeholder="Max Historical Difference"
value={value}
Expand Down