From fff448fa860b73cf9f16986df0583695f88440b5 Mon Sep 17 00:00:00 2001 From: vmonakhov Date: Fri, 12 Jul 2024 22:01:56 +0300 Subject: [PATCH] Merged verb and adverd valency functionalities -- https://github.com/ispras/lingvodoc-react/issues/1128 (#1130) * fixes and refactoring * common names --- src/pages/Adverb/index.js | 21 ++++++++++++--------- src/pages/Valency/index.js | 21 ++++++++++++--------- 2 files changed, 24 insertions(+), 18 deletions(-) diff --git a/src/pages/Adverb/index.js b/src/pages/Adverb/index.js index 8dfa213f..0d1d0411 100644 --- a/src/pages/Adverb/index.js +++ b/src/pages/Adverb/index.js @@ -74,24 +74,24 @@ export const adverbDataQuery = gql` `; const createAdverbDataMutation = gql` - mutation createAdverbData($perspectiveId: LingvodocID!) { - create_adverb_data(perspective_id: $perspectiveId) { + mutation createAdverbData($perspectiveId: LingvodocID!, $valencyKind: String!) { + create_valency_data(perspective_id: $perspectiveId, valency_kind: $valencyKind) { triumph } } `; const setAdverbAnnotationMutation = gql` - mutation setAdverbAnnotation($annotationList: [AdverbInstanceAnnotation]!) { - set_adverb_annotation(annotation_list: $annotationList) { + mutation setAdverbAnnotation($annotationList: [ValencyInstanceAnnotation]!, $valencyKind: String!) { + set_valency_annotation(annotation_list: $annotationList, valency_kind: $valencyKind) { triumph } } `; const saveAdverbDataMutation = gql` - mutation saveAdverbData($perspectiveId: LingvodocID!) { - save_adverb_data(perspective_id: $perspectiveId) { + mutation saveAdverbData($perspectiveId: LingvodocID!, $valencyKind: String!) { + save_valency_data(perspective_id: $perspectiveId, valency_kind: $valencyKind) { triumph data_url } @@ -738,7 +738,8 @@ class Adverb extends React.Component { this.props .createAdverbData({ variables: { - perspectiveId: this.state.perspective.id + perspectiveId: this.state.perspective.id, + valencyKind: 'adverb' } }) .then( @@ -811,7 +812,8 @@ class Adverb extends React.Component { this.props .saveAdverbData({ variables: { - perspectiveId: this.state.perspective.id + perspectiveId: this.state.perspective.id, + valencyKind: 'adverb' } }) .then( @@ -841,7 +843,8 @@ class Adverb extends React.Component { this.props .setAdverbAnnotation({ variables: { - annotationList: annotation_list + annotationList: annotation_list, + valencyKind: 'adverb' } }) .then( diff --git a/src/pages/Valency/index.js b/src/pages/Valency/index.js index de8ee53b..c073deae 100644 --- a/src/pages/Valency/index.js +++ b/src/pages/Valency/index.js @@ -72,16 +72,16 @@ export const valencyDataQuery = gql` `; const createValencyDataMutation = gql` - mutation createValencyData($perspectiveId: LingvodocID!) { - create_valency_data(perspective_id: $perspectiveId) { + mutation createValencyData($perspectiveId: LingvodocID!, $valencyKind: String!) { + create_valency_data(perspective_id: $perspectiveId, valency_kind: $valencyKind) { triumph } } `; const saveValencyDataMutation = gql` - mutation saveValencyData($perspectiveId: LingvodocID!) { - save_valency_data(perspective_id: $perspectiveId) { + mutation saveValencyData($perspectiveId: LingvodocID!, $valencyKind: String!) { + save_valency_data(perspective_id: $perspectiveId, valency_kind: $valencyKind) { triumph data_url } @@ -89,8 +89,8 @@ const saveValencyDataMutation = gql` `; const setValencyAnnotationMutation = gql` - mutation setValencyAnnotation($annotationList: [ValencyInstanceAnnotation]!) { - set_valency_annotation(annotation_list: $annotationList) { + mutation setValencyAnnotation($annotationList: [ValencyInstanceAnnotation]!, $valencyKind: String!) { + set_valency_annotation(annotation_list: $annotationList, valency_kind: $valencyKind) { triumph } } @@ -706,7 +706,8 @@ class Valency extends React.Component { this.props .createValencyData({ variables: { - perspectiveId: this.state.perspective.id + perspectiveId: this.state.perspective.id, + valencyKind: 'verb' } }) .then( @@ -779,7 +780,8 @@ class Valency extends React.Component { this.props .saveValencyData({ variables: { - perspectiveId: this.state.perspective.id + perspectiveId: this.state.perspective.id, + valencyKind: 'verb' } }) .then( @@ -809,7 +811,8 @@ class Valency extends React.Component { this.props .setValencyAnnotation({ variables: { - annotationList: annotation_list + annotationList: annotation_list, + valencyKind: 'verb' } }) .then(