4b. Summarizer feature #17

Merged
senaduka merged 19 commits from summarizer-feature into master 2018-04-16 12:12:53 +02:00
Showing only changes of commit e138c6e09e - Show all commits

View File

@@ -155,14 +155,16 @@ class IntentDetails extends Component {
} }
handleQuestionEdit (e, index) { handleQuestionEdit (e, index) {
if (e.length >= QUESTION_MAX_LENGTH || !/^[a-z,.' ]*$/i.test (e)) return; const isQuestionInvalid = e.length >= QUESTION_MAX_LENGTH || !/^[a-z,.' ]*$/i.test (e);
if (isQuestionInvalid) return;
let newIntent = this.state.intent; let newIntent = this.state.intent;
newIntent.questions[index] = e; newIntent.questions[index] = e;
this.setState ({intent: newIntent}); this.setState ({intent: newIntent});
} }
handleIntentExplanationEdit (e, index) { handleIntentExplanationEdit (e, index) {
if (e.length >= INTENT_EXPLANATION_MAX_LENGTH || !/^[a-z,.' ]*$/i.test (e)) const isExplanationInvalid = e.length >= INTENT_EXPLANATION_MAX_LENGTH || !/^[a-z,.' ]*$/i.test (e);
if (isExplanationInvalid)
return; return;
let newIntent = this.state.intent; let newIntent = this.state.intent;
newIntent.intentExplanation = e; newIntent.intentExplanation = e;
@@ -170,21 +172,24 @@ class IntentDetails extends Component {
} }
handleAnswerEdit (e) { handleAnswerEdit (e) {
if (e.length >= ANSWER_MAX_LENGTH || !/^[a-z,.' ]*$/i.test (e)) return; const isAnswerInvalid = e.length >= ANSWER_MAX_LENGTH || !/^[a-z,.' ]*$/i.test (e);
if (isAnswerInvalid) return;
let newIntent = this.state.intent; let newIntent = this.state.intent;
newIntent.answer = e; newIntent.answer = e;
this.setState ({intent: newIntent}); this.setState ({intent: newIntent});
} }
handleAnswerSourceEdit (e) { handleAnswerSourceEdit (e) {
if (e.length >= ANSWER_MAX_LENGTH) return; const isAnswerSourceInvalid = e.length >= ANSWER_MAX_LENGTH;
if (isAnswerSourceInvalid) return;
let newIntent = this.state.intent; let newIntent = this.state.intent;
newIntent.externalAnswerSource = e; newIntent.externalAnswerSource = e;
this.setState ({intent: newIntent}); this.setState ({intent: newIntent});
} }
handleIntentNameEdit (e) { handleIntentNameEdit (e) {
if (e.length >= INTENT_NAME_MAX_LENGTH || !/^[a-z]*$/i.test (e)) return; const isIntentNameInvalid = e.length >= INTENT_NAME_MAX_LENGTH || !/^[a-z]*$/i.test (e);
if (isIntentNameInvalid) return;
let newIntent = this.state.intent; let newIntent = this.state.intent;
newIntent.intentName = e; newIntent.intentName = e;
this.setState ({intent: newIntent}); this.setState ({intent: newIntent});