Skip to content
This repository was archived by the owner on Jul 17, 2025. It is now read-only.

Commit 4fe3ba1

Browse files
authored
support question answer project labelling (#356)
* add not empty conditions * support qa create and annotate * add question answer project
1 parent d2ceb48 commit 4fe3ba1

26 files changed

+591
-140
lines changed

annotation-app/src/app/components/edit-project/edit-project.component.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,7 @@ export class EditProjectComponent implements OnInit {
105105
this.msg = JSON.parse(JSON.stringify(this.msgInEdit));
106106
const al = this.msg.al;
107107
this.previousProjectName = this.msg.projectName;
108-
this.showLabel = !(this.msg.integration.source && this.msg.integration.externalId[0]);
108+
this.showLabel = !(this.msg.integration.source && this.msg.integration.externalId[0] || this.msg.projectType == 'qa');
109109
this.inputProjectName = this.msg.projectName;
110110
this.inputTaskInstruction = this.msg.taskInstructions;
111111
this.inputfrequency = al.frequency ? al.frequency : null;

annotation-app/src/app/components/projects/annotate/annotate.component.html

Lines changed: 75 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ <h2>{{ startFrom === 'review' ? 'Review Details' : 'Annotate Details' }}</h2>
5555
</div>
5656
</div>
5757
<div
58-
*ngIf="projectType !== 'ner' && projectType !== 'image' && projectType !== 'log'"
58+
*ngIf="projectType !== 'ner' && projectType !== 'qa' && projectType !== 'image' && projectType !== 'log'"
5959
class="clr-form-group form-group clr-row"
6060
style="margin-top: -0.5rem"
6161
>
@@ -100,6 +100,7 @@ <h3>Project Info</h3>
100100
{{
101101
projectInfo?.labelType == 'numericLabel' ||
102102
projectInfo.projectType == 'ner' ||
103+
projectInfo.projectType == 'qa' ||
103104
projectInfo.isMultipleLabel ||
104105
projectInfo.projectType == 'image' ||
105106
projectInfo.projectType == 'log'
@@ -273,7 +274,7 @@ <h3>History</h3>
273274
>
274275
<div *ngFor="let flag of item.historyDescription" class="historyText">
275276
<div
276-
*ngIf="projectType == 'ner' || projectType == 'log'"
277+
*ngIf="projectType == 'ner' || projectType == 'qa' || projectType == 'log'"
277278
title="{{ flag.text }}"
278279
>
279280
{{ flag.text }}
@@ -283,7 +284,7 @@ <h3>History</h3>
283284
</div>
284285
<div
285286
*ngIf="
286-
projectType !== 'ner' && projectType !== 'image' && projectType !== 'log'
287+
projectType !== 'ner' && projectType !== 'qa' && projectType !== 'image' && projectType !== 'log'
287288
"
288289
title="{{ flag.key + ':' + flag.value }}"
289290
>
@@ -450,7 +451,7 @@ <h2 class="originalH2" style="word-break: break-all">
450451
</div>
451452

452453
<div class="questionContainer">
453-
<div *ngIf="projectType !== 'ner' && projectType !== 'image' && projectType !== 'log'">
454+
<div *ngIf="projectType !== 'ner' && projectType !== 'qa' && projectType !== 'image' && projectType !== 'log'">
454455
<div
455456
class="textBox"
456457
[ngStyle]="{
@@ -508,7 +509,7 @@ <h2 class="originalH2" style="word-break: break-all">
508509
</div>
509510
</div>
510511
<!-- here is ner annotation content -->
511-
<div *ngIf="projectType === 'ner'" class="nerBox">
512+
<div *ngIf="projectType === 'ner' || projectType === 'qa'" class="nerBox">
512513
<div class="nerDisplayText">
513514
<div *ngFor="let ticket of sr.ticketQuestions">
514515
<p class="question-paragraph" style="word-break: break-word">
@@ -541,15 +542,18 @@ <h2 class="originalH2" style="word-break: break-all">
541542
(mouseenter)="mouseenterMark($event, spanText)"
542543
(mouseleave)="mouseleaveMark($event, spanText)"
543544
>
544-
<span (click)="clickShowMark($event, spanText)" class="selectText">{{
545-
spanText.text
546-
}}</span>
545+
<span
546+
(click)="clickShowMark($event, spanText)"
547+
class="selectText"
548+
title="{{ spanText.label }}"
549+
>{{spanText.text}}
550+
</span>
547551
<span
548552
class="entity"
549553
[style.color]="getLabelColor(spanText.label)"
550554
title="{{ spanText.label | uppercase }}"
551-
>{{ spanText.label }}</span
552-
>
555+
>{{ projectType == 'qa'? "" :spanText.label }}
556+
</span>
553557
<span
554558
*ngIf="isShowPopLabel && spanText.popUpLabel"
555559
class="entity"
@@ -878,6 +882,65 @@ <h4 style="margin-top: 2rem; margin-left: 0.5rem">
878882
&nbsp; &nbsp;
879883
</div>
880884
</div>
885+
886+
<div class="questionContainer" *ngIf="projectType == 'qa'">
887+
<div
888+
class="clr-control-container clr-error"
889+
style="margin-top: 1rem"
890+
[ngClass]="{ 'clr-error': clrErrorTip }"
891+
>
892+
<div class="clr-input-wrapper">
893+
<input
894+
type="text"
895+
id="inputQuestion"
896+
class="clr-input"
897+
placeholder="Add New The Question Here"
898+
(keyup.enter)="onAddQuestion($event)"
899+
(blur)="onAddQuestion($event)"
900+
(keyup)="onAddQuestion($event, true)"
901+
name="inputQuestion"
902+
[(ngModel)]="inputQuestion"
903+
[ngModelOptions]="{ standalone: true }"
904+
style="width:30em"
905+
/>
906+
<clr-icon class="clr-validate-icon" shape="exclamation-circle"></clr-icon>
907+
</div>
908+
<span class="clr-subtext">{{inputQuestionError}}</span>
909+
</div>
910+
911+
912+
<div *ngFor="let item of categories; let index=index" style="display: flex;" class="clr-row clr-control-container clr-error"
913+
(mouseenter)="onMouseEnter($event, index, item)"
914+
(mouseleave)="onMouseLeave($event)"
915+
[ngClass]="{ 'clr-error': editQuestionError }"
916+
>
917+
<label class="circle" [style.background-color]="getLabelColor(item)">&nbsp;&nbsp;<b>{{index+1}}</b></label>
918+
<clr-radio-wrapper class="clr-col-10">
919+
<input type="radio" clrRadio name="questionRadio" class="questionRadio"
920+
value="{{item}}"
921+
(change)="onSelectingEntity($event, index, index)"
922+
[attr.checked]="index == 0?'checked': null "
923+
/>
924+
<label (change)="editQuestion($event, index)">
925+
<textarea
926+
type="text"
927+
value="{{categories[index]}}"
928+
style="width:max-content;"
929+
style="border:none; width: 100%;"
930+
[disabled]="editQuestionError && editQuestionItem != index"
931+
>
932+
</textarea>
933+
</label>
934+
</clr-radio-wrapper>
935+
<clr-icon class="clr-col-1"
936+
shape="trash"
937+
*ngIf="deleteQuestionItem === index"
938+
(click)="deleteQuestion(index)"
939+
></clr-icon>
940+
<clr-icon *ngIf="editQuestionItem === index" class="clr-validate-icon" shape="exclamation-circle"></clr-icon>
941+
<span *ngIf="editQuestionItem === index" class="clr-subtext">{{editQuestionError}}</span>
942+
</div>
943+
</div>
881944
<!-- multiple checkbox labels -->
882945
<div
883946
class="questionContainer"
@@ -1064,7 +1127,8 @@ <h4 style="margin-top: 2rem; margin-left: 0.5rem">
10641127
multipleLabelList.length == 0 &&
10651128
spansList.length == 0 &&
10661129
currentBoundingData.length == 0 &&
1067-
!isNumeric
1130+
!isNumeric ||
1131+
editQuestionError
10681132
"
10691133
title="{{
10701134
multipleLabelList.length > 0 ||

annotation-app/src/app/components/projects/annotate/annotate.component.scss

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -955,3 +955,12 @@ label .label-leftBoard {
955955
pointer-events: none;
956956
}
957957
}
958+
959+
.circle {
960+
width: 2em;
961+
height: 100%;
962+
border-radius: 50%;
963+
display:"inline-block";
964+
margin-left: 1em;
965+
margin-right: 0.5em;
966+
}

0 commit comments

Comments
 (0)