@@ -176,6 +176,7 @@ const computeCognateAnalysisMutation = gql`
176
176
translation_count
177
177
result
178
178
xlsx_url
179
+ json_url
179
180
figure_url
180
181
minimum_spanning_tree
181
182
embedding_2d
@@ -208,6 +209,7 @@ const computeSwadeshAnalysisMutation = gql`
208
209
transcription_count
209
210
result
210
211
xlsx_url
212
+ json_url
211
213
minimum_spanning_tree
212
214
embedding_2d
213
215
embedding_3d
@@ -236,6 +238,7 @@ const computeMorphCognateAnalysisMutation = gql`
236
238
transcription_count
237
239
result
238
240
xlsx_url
241
+ json_url
239
242
minimum_spanning_tree
240
243
embedding_2d
241
244
embedding_3d
@@ -1260,6 +1263,7 @@ class CognateAnalysisModal extends React.Component {
1260
1263
1261
1264
result : null ,
1262
1265
xlsx_url : "" ,
1266
+ json_url : "" ,
1263
1267
figure_url : "" ,
1264
1268
1265
1269
minimum_spanning_tree : [ ] ,
@@ -2118,11 +2122,12 @@ class CognateAnalysisModal extends React.Component {
2118
2122
for ( const language of this . state . language_list ) {
2119
2123
let p_count = 0 ;
2120
2124
2121
- for ( const { perspective } of language . perspective_list ) {
2125
+ for ( const { perspective, treePathList : [ subLanguage , ] } of language . perspective_list ) {
2122
2126
const p_key = id2str ( perspective . id ) ;
2123
2127
2124
2128
if ( this . state . perspectiveSelectionMap [ p_key ] ) {
2125
2129
perspectiveInfoList . push ( [
2130
+ subLanguage . __typename === "Language" ? subLanguage . id : this . baseLanguageId ,
2126
2131
perspective . id ,
2127
2132
this . fieldDict [ this . state . transcriptionFieldIdStrMap [ p_key ] ] . id ,
2128
2133
this . fieldDict [ this . state . translationFieldIdStrMap [ p_key ] ] . id ,
@@ -2138,7 +2143,8 @@ class CognateAnalysisModal extends React.Component {
2138
2143
} else {
2139
2144
perspectiveInfoList = this . perspective_list
2140
2145
2141
- . map ( ( { perspective } , index ) => [
2146
+ . map ( ( { perspective, treePathList : [ subLanguage , ] } , index ) => [
2147
+ subLanguage . __typename === "Language" ? subLanguage . id : this . baseLanguageId ,
2142
2148
perspective . id ,
2143
2149
this . fieldDict [ this . state . transcriptionFieldIdStrList [ index ] ] . id ,
2144
2150
this . fieldDict [ this . state . translationFieldIdStrList [ index ] ] . id ,
@@ -2798,9 +2804,28 @@ class CognateAnalysisModal extends React.Component {
2798
2804
2799
2805
const { language_list, perspectiveSelectionCountMap } = this . state ;
2800
2806
2807
+ const disabledCompute = (
2808
+ ( ! multi && ( this . perspective_list . length <= 1 ||
2809
+ ! this . state . perspectiveSelectionList . some ( enabled => enabled ) ) ) ||
2810
+ ( multi &&
2811
+ ( language_list . length <= 0 ||
2812
+ ( mode === "multi_reconstruction" &&
2813
+ language_list . filter ( language => perspectiveSelectionCountMap [ id2str ( language . id ) ] > 0 ) . length <=
2814
+ 1 ) ||
2815
+ perspectiveSelectionCountMap [ "" ] <= 0 ) ) ||
2816
+ this . state . computing
2817
+ )
2818
+
2801
2819
return (
2802
2820
< div >
2803
- < Modal closeIcon onClose = { this . props . closeModal } dimmer open size = "fullscreen" className = "lingvo-modal2" >
2821
+ < Modal
2822
+ onKeyDown = { e => {
2823
+ if ( e . key === 'Enter' && ! disabledCompute ) this . handleCreate ( ) ; } }
2824
+ tabIndex = "0"
2825
+ closeIcon
2826
+ onClose = { this . props . closeModal }
2827
+ dimmer open
2828
+ size = "fullscreen" className = "lingvo-modal2" >
2804
2829
< Modal . Header >
2805
2830
{ mode === "acoustic"
2806
2831
? this . context ( "Cognate acoustic analysis" )
@@ -2839,18 +2864,7 @@ class CognateAnalysisModal extends React.Component {
2839
2864
)
2840
2865
}
2841
2866
onClick = { this . handleCreate }
2842
- disabled = {
2843
- ( ! multi &&
2844
- ( this . perspective_list . length <= 1 ||
2845
- ! this . state . perspectiveSelectionList . some ( enabled => enabled ) ) ) ||
2846
- ( multi &&
2847
- ( language_list . length <= 0 ||
2848
- ( mode === "multi_reconstruction" &&
2849
- language_list . filter ( language => perspectiveSelectionCountMap [ id2str ( language . id ) ] > 0 ) . length <=
2850
- 1 ) ||
2851
- perspectiveSelectionCountMap [ "" ] <= 0 ) ) ||
2852
- this . state . computing
2853
- }
2867
+ disabled = { disabledCompute }
2854
2868
className = "lingvo-button-violet"
2855
2869
/>
2856
2870
< Button
@@ -2890,6 +2904,8 @@ class CognateAnalysisModal extends React.Component {
2890
2904
{ this . state . result . length > 0 && mode !== "suggestions" && mode !== "multi_suggestions" && (
2891
2905
< div className = "lingvo-cognate-text" style = { { paddingTop : "6px" , paddingBottom : "3px" } } >
2892
2906
< a href = { this . state . xlsx_url } > { this . context ( "XLSX-exported analysis results" ) } </ a >
2907
+ < p />
2908
+ < a href = { this . state . json_url } > { this . context ( "JSON-exported analysis results" ) } </ a >
2893
2909
</ div >
2894
2910
) }
2895
2911
0 commit comments