From d8dcad70f2050b0f4b38f39421bb8b5cc553e17a Mon Sep 17 00:00:00 2001 From: vmonakhov Date: Wed, 26 Feb 2025 16:03:08 +0300 Subject: [PATCH] Tuned 'Connect all' functionality --- src/components/CognateAnalysisModal/index.js | 66 +++++++++++++------- 1 file changed, 43 insertions(+), 23 deletions(-) diff --git a/src/components/CognateAnalysisModal/index.js b/src/components/CognateAnalysisModal/index.js index 9405e7dc..54f0f9df 100644 --- a/src/components/CognateAnalysisModal/index.js +++ b/src/components/CognateAnalysisModal/index.js @@ -2811,10 +2811,10 @@ class CognateAnalysisModal extends React.Component { /* Launches connection of suggestion specified by index. */ - sg_connect(index, window_log_flag = true) { + async sg_connect(index, window_log_flag = true, entry_id_str_list_cur = null, sg_state_list_cur = null) { const { suggestion_field_id, sg_select_list, sg_state_list, sg_count, sg_entry_map } = this.state; - const entry_id_str_list = Object.keys(sg_select_list[index]); + const entry_id_str_list = entry_id_str_list_cur || Object.keys(sg_select_list[index]); const entry_id_list = entry_id_str_list.map(str2id); @@ -2828,7 +2828,7 @@ class CognateAnalysisModal extends React.Component { sg_count }); - this.props + await this.props .connectGroup({ variables: { fieldId: suggestion_field_id, @@ -2848,7 +2848,7 @@ class CognateAnalysisModal extends React.Component { for (const entry_id_str of entry_id_str_list) { for (const sg_index of Object.keys(sg_entry_map[entry_id_str])) { - if (sg_state_list[sg_index] === "left") { + if ((sg_state_list_cur ? sg_state_list_cur[sg_index] : sg_state_list[sg_index]) === "left") { delete sg_select_list[sg_index][entry_id_str]; sg_entry_map[entry_id_str][sg_index] = false; @@ -2894,7 +2894,8 @@ class CognateAnalysisModal extends React.Component { sg_state_list, sg_count, sg_entry_map, - sg_current_page + sg_current_page, + computing } = this.state; /* Shows current suggestion state counts. */ @@ -2985,21 +2986,23 @@ class CognateAnalysisModal extends React.Component { // Not so good hack in the name of performance, // we just give our state to be modified in the child compoment. - +
+ +
) )} @@ -3038,7 +3041,13 @@ class CognateAnalysisModal extends React.Component {