Skip to content

Commit 49243ca

Browse files
authored
Merge pull request #215 from vishnoianil/fix-knowledge-1.0.0
Fix knowledge submission issue
2 parents b4ebdf8 + 508699a commit 49243ca

File tree

2 files changed

+20
-20
lines changed

2 files changed

+20
-20
lines changed

deploy/k8s/overlays/openshift/prod/kustomization.yaml

+2-2
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ patches:
3636
patch: |-
3737
- op: replace
3838
path: /spec/template/spec/containers/0/image
39-
value: quay.io/instructlab-ui/ui:v1.0.0-beta # Override this image if you want to use a different UI image
39+
value: quay.io/instructlab-ui/ui:latest #Override this image if you want to use a different UI image
4040
4141
# Override the pathservice image for Openshift production deployment
4242
- target:
@@ -45,4 +45,4 @@ patches:
4545
patch: |-
4646
- op: replace
4747
path: /spec/template/spec/containers/0/image
48-
value: quay.io/instructlab-ui/pathservice:v1.0.0-beta # Override this image if you want to use a different pathservice image
48+
value: quay.io/instructlab-ui/pathservice:latest #Override this image if you want to use a different pathservice image

src/components/Contribute/Knowledge/index.tsx

+18-18
Original file line numberDiff line numberDiff line change
@@ -225,46 +225,46 @@ export const KnowledgeForm: React.FunctionComponent<KnowledgeFormProps> = ({ kno
225225
const contextStr = context.trim();
226226
if (contextStr.length == 0) {
227227
setDisableAction(true);
228-
return { errorMsg: 'Context is required', context: ValidatedOptions.error };
228+
return { msg: 'Context is required', status: ValidatedOptions.error };
229229
}
230230
const tokens = contextStr.split(/\s+/);
231231
if (tokens.length > 0 && tokens.length <= 500) {
232232
setDisableAction(!checkKnowledgeFormCompletion(knowledgeFormData));
233-
return { errorMsg: '', context: ValidatedOptions.success };
233+
return { msg: 'Valid Input', status: ValidatedOptions.success };
234234
}
235235
setDisableAction(true);
236236
const errorMsg = 'Context must be less than 500 words. Current word count: ' + tokens.length;
237-
return { errorMsg: errorMsg, context: ValidatedOptions.error };
237+
return { msg: errorMsg, status: ValidatedOptions.error };
238238
};
239239

240240
const validateQuestion = (question: string) => {
241241
const questionStr = question.trim();
242242
if (questionStr.length == 0) {
243243
setDisableAction(true);
244-
return { errorMsg: 'Question is required', context: ValidatedOptions.error };
244+
return { msg: 'Question is required', status: ValidatedOptions.error };
245245
}
246246
const tokens = questionStr.split(/\s+/);
247247
if (tokens.length > 0 && tokens.length < 250) {
248248
setDisableAction(!checkKnowledgeFormCompletion(knowledgeFormData));
249-
return { errorMsg: '', context: ValidatedOptions.success };
249+
return { msg: 'Valid input', status: ValidatedOptions.success };
250250
}
251251
setDisableAction(true);
252-
return { errorMsg: 'Question must be less than 250 words. Current word count: ' + tokens.length, context: ValidatedOptions.error };
252+
return { msg: 'Question must be less than 250 words. Current word count: ' + tokens.length, status: ValidatedOptions.error };
253253
};
254254

255255
const validateAnswer = (answer: string) => {
256256
const answerStr = answer.trim();
257257
if (answerStr.length == 0) {
258258
setDisableAction(true);
259-
return { errorMsg: 'Answer is required', context: ValidatedOptions.error };
259+
return { msg: 'Answer is required', status: ValidatedOptions.error };
260260
}
261261
const tokens = answerStr.split(/\s+/);
262262
if (tokens.length > 0 && tokens.length < 250) {
263263
setDisableAction(!checkKnowledgeFormCompletion(knowledgeFormData));
264-
return { errorMsg: '', context: ValidatedOptions.success };
264+
return { msg: 'Valid input', status: ValidatedOptions.success };
265265
}
266266
setDisableAction(true);
267-
return { errorMsg: 'Answer must be less than 250 words. Current word count: ' + tokens.length, context: ValidatedOptions.error };
267+
return { msg: 'Answer must be less than 250 words. Current word count: ' + tokens.length, status: ValidatedOptions.error };
268268
};
269269

270270
const handleContextInputChange = (seedExampleIndex: number, contextValue: string): void => {
@@ -283,11 +283,11 @@ export const KnowledgeForm: React.FunctionComponent<KnowledgeFormProps> = ({ kno
283283
const handleContextBlur = (seedExampleIndex: number): void => {
284284
const updatedSeedExamples = seedExamples.map((seedExample: SeedExample, index: number): SeedExample => {
285285
if (index === seedExampleIndex) {
286-
const { errorMsg, context } = validateContext(seedExample.context);
286+
const { msg, status } = validateContext(seedExample.context);
287287
return {
288288
...seedExample,
289-
isContextValid: context,
290-
validationError: errorMsg
289+
isContextValid: status,
290+
validationError: msg
291291
};
292292
}
293293
return seedExample;
@@ -323,11 +323,11 @@ export const KnowledgeForm: React.FunctionComponent<KnowledgeFormProps> = ({ kno
323323
...seedExample,
324324
questionAndAnswers: seedExample.questionAndAnswers.map((questionAndAnswerPair: QuestionAndAnswerPair, index: number) => {
325325
if (index === questionAndAnswerIndex) {
326-
const { errorMsg, context } = validateQuestion(questionAndAnswerPair.question);
326+
const { msg, status } = validateQuestion(questionAndAnswerPair.question);
327327
return {
328328
...questionAndAnswerPair,
329-
isQuestionValid: context,
330-
questionValidationError: errorMsg
329+
isQuestionValid: status,
330+
questionValidationError: msg
331331
};
332332
}
333333
return questionAndAnswerPair;
@@ -366,11 +366,11 @@ export const KnowledgeForm: React.FunctionComponent<KnowledgeFormProps> = ({ kno
366366
...seedExample,
367367
questionAndAnswers: seedExample.questionAndAnswers.map((questionAndAnswerPair: QuestionAndAnswerPair, index: number) => {
368368
if (index === questionAndAnswerIndex) {
369-
const { errorMsg, context } = validateAnswer(questionAndAnswerPair.answer);
369+
const { msg, status } = validateAnswer(questionAndAnswerPair.answer);
370370
return {
371371
...questionAndAnswerPair,
372-
isAnswerValid: context,
373-
answerValidationError: errorMsg
372+
isAnswerValid: status,
373+
answerValidationError: msg
374374
};
375375
}
376376
return questionAndAnswerPair;

0 commit comments

Comments
 (0)