Merge pull request #303 from getmaxun/list-back
feat: navigate across capture list stages
This commit is contained in:
@@ -161,6 +161,7 @@
|
|||||||
"confirm_pagination": "Paginierung bestätigen",
|
"confirm_pagination": "Paginierung bestätigen",
|
||||||
"confirm_limit": "Limit bestätigen",
|
"confirm_limit": "Limit bestätigen",
|
||||||
"finish_capture": "Erfassung abschließen",
|
"finish_capture": "Erfassung abschließen",
|
||||||
|
"back": "Zurück",
|
||||||
"finish": "Fertig",
|
"finish": "Fertig",
|
||||||
"cancel": "Abbrechen",
|
"cancel": "Abbrechen",
|
||||||
"delete": "Löschen"
|
"delete": "Löschen"
|
||||||
|
|||||||
@@ -162,6 +162,7 @@
|
|||||||
"confirm_pagination": "Confirm Pagination",
|
"confirm_pagination": "Confirm Pagination",
|
||||||
"confirm_limit": "Confirm Limit",
|
"confirm_limit": "Confirm Limit",
|
||||||
"finish_capture": "Finish Capture",
|
"finish_capture": "Finish Capture",
|
||||||
|
"back": "Back",
|
||||||
"finish": "Finish",
|
"finish": "Finish",
|
||||||
"cancel": "Cancel",
|
"cancel": "Cancel",
|
||||||
"delete": "Delete"
|
"delete": "Delete"
|
||||||
|
|||||||
@@ -162,6 +162,7 @@
|
|||||||
"confirm_pagination": "Confirmar Paginación",
|
"confirm_pagination": "Confirmar Paginación",
|
||||||
"confirm_limit": "Confirmar Límite",
|
"confirm_limit": "Confirmar Límite",
|
||||||
"finish_capture": "Finalizar Captura",
|
"finish_capture": "Finalizar Captura",
|
||||||
|
"back": "Atrás",
|
||||||
"finish": "Finalizar",
|
"finish": "Finalizar",
|
||||||
"cancel": "Cancelar",
|
"cancel": "Cancelar",
|
||||||
"delete": "Eliminar"
|
"delete": "Eliminar"
|
||||||
|
|||||||
@@ -162,6 +162,7 @@
|
|||||||
"confirm_pagination": "ページネーションを確認",
|
"confirm_pagination": "ページネーションを確認",
|
||||||
"confirm_limit": "制限を確認",
|
"confirm_limit": "制限を確認",
|
||||||
"finish_capture": "取得を完了",
|
"finish_capture": "取得を完了",
|
||||||
|
"back": "戻る",
|
||||||
"finish": "完了",
|
"finish": "完了",
|
||||||
"cancel": "キャンセル",
|
"cancel": "キャンセル",
|
||||||
"delete": "削除"
|
"delete": "削除"
|
||||||
|
|||||||
@@ -162,6 +162,7 @@
|
|||||||
"confirm_pagination": "确认分页",
|
"confirm_pagination": "确认分页",
|
||||||
"confirm_limit": "确认限制",
|
"confirm_limit": "确认限制",
|
||||||
"finish_capture": "完成捕获",
|
"finish_capture": "完成捕获",
|
||||||
|
"back": "返回",
|
||||||
"finish": "完成",
|
"finish": "完成",
|
||||||
"cancel": "取消",
|
"cancel": "取消",
|
||||||
"delete": "删除"
|
"delete": "删除"
|
||||||
|
|||||||
@@ -68,7 +68,7 @@ export const BrowserWindow = () => {
|
|||||||
|
|
||||||
const { socket } = useSocketStore();
|
const { socket } = useSocketStore();
|
||||||
const { notify } = useGlobalInfoStore();
|
const { notify } = useGlobalInfoStore();
|
||||||
const { getText, getList, paginationMode, paginationType, limitMode } = useActionContext();
|
const { getText, getList, paginationMode, paginationType, limitMode, captureStage } = useActionContext();
|
||||||
const { addTextStep, addListStep } = useBrowserSteps();
|
const { addTextStep, addListStep } = useBrowserSteps();
|
||||||
|
|
||||||
const onMouseMove = (e: MouseEvent) => {
|
const onMouseMove = (e: MouseEvent) => {
|
||||||
@@ -144,7 +144,7 @@ export const BrowserWindow = () => {
|
|||||||
// for non-list steps
|
// for non-list steps
|
||||||
setHighlighterData(data);
|
setHighlighterData(data);
|
||||||
}
|
}
|
||||||
}, [highlighterData, getList, socket, listSelector, paginationMode, paginationType]);
|
}, [highlighterData, getList, socket, listSelector, paginationMode, paginationType, captureStage]);
|
||||||
|
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
@@ -158,6 +158,13 @@ export const BrowserWindow = () => {
|
|||||||
};
|
};
|
||||||
}, [socket, onMouseMove]);
|
}, [socket, onMouseMove]);
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
if (captureStage === 'initial' && listSelector) {
|
||||||
|
socket?.emit('setGetList', { getList: true });
|
||||||
|
socket?.emit('listSelector', { selector: listSelector });
|
||||||
|
}
|
||||||
|
}, [captureStage, listSelector, socket]);
|
||||||
|
|
||||||
const handleClick = (e: React.MouseEvent<HTMLDivElement>) => {
|
const handleClick = (e: React.MouseEvent<HTMLDivElement>) => {
|
||||||
if (highlighterData && canvasRef?.current) {
|
if (highlighterData && canvasRef?.current) {
|
||||||
const canvasRect = canvasRef.current.getBoundingClientRect();
|
const canvasRect = canvasRef.current.getBoundingClientRect();
|
||||||
|
|||||||
@@ -382,6 +382,23 @@ export const RightSidePanel: React.FC<RightSidePanelProps> = ({ onFinishCapture
|
|||||||
}
|
}
|
||||||
}, [captureStage, paginationType, limitType, customLimit, startPaginationMode, stopPaginationMode, startLimitMode, stopLimitMode, notify, stopCaptureAndEmitGetListSettings, getListSettingsObject]);
|
}, [captureStage, paginationType, limitType, customLimit, startPaginationMode, stopPaginationMode, startLimitMode, stopLimitMode, notify, stopCaptureAndEmitGetListSettings, getListSettingsObject]);
|
||||||
|
|
||||||
|
const handleBackCaptureList = useCallback(() => {
|
||||||
|
switch (captureStage) {
|
||||||
|
case 'limit':
|
||||||
|
stopLimitMode();
|
||||||
|
setShowLimitOptions(false);
|
||||||
|
startPaginationMode();
|
||||||
|
setShowPaginationOptions(true);
|
||||||
|
setCaptureStage('pagination');
|
||||||
|
break;
|
||||||
|
case 'pagination':
|
||||||
|
stopPaginationMode();
|
||||||
|
setShowPaginationOptions(false);
|
||||||
|
setCaptureStage('initial');
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}, [captureStage, stopLimitMode, startPaginationMode, stopPaginationMode]);
|
||||||
|
|
||||||
const handlePaginationSettingSelect = (option: PaginationType) => {
|
const handlePaginationSettingSelect = (option: PaginationType) => {
|
||||||
updatePaginationType(option);
|
updatePaginationType(option);
|
||||||
};
|
};
|
||||||
@@ -456,6 +473,14 @@ export const RightSidePanel: React.FC<RightSidePanelProps> = ({ onFinishCapture
|
|||||||
{getList && (
|
{getList && (
|
||||||
<>
|
<>
|
||||||
<Box display="flex" justifyContent="space-between" gap={2} style={{ margin: '15px' }}>
|
<Box display="flex" justifyContent="space-between" gap={2} style={{ margin: '15px' }}>
|
||||||
|
{(captureStage === 'pagination' || captureStage === 'limit') && (
|
||||||
|
<Button
|
||||||
|
variant="outlined"
|
||||||
|
onClick={handleBackCaptureList}
|
||||||
|
>
|
||||||
|
{t('right_panel.buttons.back')}
|
||||||
|
</Button>
|
||||||
|
)}
|
||||||
<Button
|
<Button
|
||||||
variant="outlined"
|
variant="outlined"
|
||||||
onClick={handleConfirmListCapture}
|
onClick={handleConfirmListCapture}
|
||||||
@@ -466,7 +491,9 @@ export const RightSidePanel: React.FC<RightSidePanelProps> = ({ onFinishCapture
|
|||||||
captureStage === 'limit' ? t('right_panel.buttons.confirm_limit') :
|
captureStage === 'limit' ? t('right_panel.buttons.confirm_limit') :
|
||||||
t('right_panel.buttons.finish_capture')}
|
t('right_panel.buttons.finish_capture')}
|
||||||
</Button>
|
</Button>
|
||||||
<Button variant="outlined" color="error" onClick={discardGetList}>{t('right_panel.buttons.discard')}</Button>
|
<Button variant="outlined" color="error" onClick={discardGetList}>
|
||||||
|
{t('right_panel.buttons.discard')}
|
||||||
|
</Button>
|
||||||
</Box>
|
</Box>
|
||||||
</>
|
</>
|
||||||
)}
|
)}
|
||||||
|
|||||||
Reference in New Issue
Block a user