Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SF-3077 Add UI for mixed training sources #2875

Draft
wants to merge 22 commits into
base: feature/SF-2900
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
22 commits
Select commit Hold shift + click to select a range
3aa0b59
Update Serval.Client to 1.7.0 and delete files on corpus deletion
pmachapman Oct 15, 2024
90fc806
Make ServalData.Corpora nullable
pmachapman Oct 16, 2024
1bc3323
Remove SFBiblicalTermsText and MockText
pmachapman Oct 20, 2024
67d6eb7
Add support for Parallel Corpora
pmachapman Oct 28, 2024
4f95aeb
Add per project scripture range configuration to C# backend
pmachapman Oct 28, 2024
b77ce78
Add per project scripture range configuration to frontend
pmachapman Oct 28, 2024
bde62e0
Add Parallel Corpora support to Pre-Translation Service
pmachapman Oct 29, 2024
87f4ff2
Code review fixes
pmachapman Oct 29, 2024
c7b3ec3
Restore updated learning rate for Serval lost in rebase
pmachapman Nov 3, 2024
e9fddc9
Improve code coverage
pmachapman Nov 3, 2024
5b64246
Code review fixes
pmachapman Nov 3, 2024
8f4f7a8
Update drafting to use parallel corpus identifier
pmachapman Nov 4, 2024
f9317e8
Use correct parallel corpus identifier for SMT
pmachapman Nov 4, 2024
4d37b9f
Add missing null conditional operators
pmachapman Nov 6, 2024
12ea0fe
Update Serval tools, and minor code clean ups
pmachapman Nov 10, 2024
8e45a8e
Update IdentityModel.AspNetCore to Duende.AccessTokenManagement
pmachapman Nov 10, 2024
1c4d576
Update Serval Downloader to support Parallel Corpora
pmachapman Nov 10, 2024
ddf718b
Remove unnecessary property from test environment
pmachapman Nov 12, 2024
b138af0
Fix merge of SF-3085 (#2859) from master
pmachapman Nov 24, 2024
ec2499f
Fix CodeQL warnings: Log entries created from user input
pmachapman Nov 24, 2024
8bed61c
Code review fixes
pmachapman Nov 26, 2024
1ac6820
SF-3077 Add UI for mixed training sources
RaymondLuong3 Nov 27, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<ng-container *transloco="let t; read: 'book_select'">
@if (availableBooks.length > 0 && !readonly) {
@if (availableBooks.length > 0 && !readonly && !basicMode) {
<div>
<mat-checkbox
class="ot-checkbox"
Expand Down Expand Up @@ -44,14 +44,20 @@
[disabled]="readonly"
(change)="onChipListChange(book)"
>
<mat-chip-option
[value]="book"
[selected]="book.selected"
[matTooltip]="t('book_progress', { percent: getPercentage(book) | l10nPercent })"
>
{{ "canon.book_names." + book.bookId | transloco }}
<div class="border-fill" [style.width]="book.progressPercentage + '%'"></div>
</mat-chip-option>
@if (!basicMode) {
<mat-chip-option
[value]="book"
[selected]="book.selected"
[matTooltip]="t('book_progress', { percent: getPercentage(book) | l10nPercent })"
>
{{ "canon.book_names." + book.bookId | transloco }}
<div class="border-fill" [style.width]="book.progressPercentage + '%'"></div>
</mat-chip-option>
} @else {
<mat-chip-option [value]="book" [selected]="book.selected">
{{ "canon.book_names." + book.bookId | transloco }}
</mat-chip-option>
}
</mat-chip-listbox>
}
</div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ export class BookMultiSelectComponent extends SubscriptionDisposable implements
@Input() availableBooks: number[] = [];
@Input() selectedBooks: number[] = [];
@Input() readonly: boolean = false;
@Input() basicMode: boolean = false;
@Output() bookSelect = new EventEmitter<number[]>();

protected loaded = false;
Expand Down
3 changes: 2 additions & 1 deletion src/SIL.XForge.Scripture/ClientApp/src/app/shared/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import { SFProjectProfileDoc } from '../core/models/sf-project-profile-doc';
import { roleCanAccessCommunityChecking, roleCanAccessTranslate } from '../core/models/sf-project-role-info';
import { SFProjectUserConfigDoc } from '../core/models/sf-project-user-config-doc';
import { SelectableProject } from '../core/paratext.service';
import { DraftSource } from '../translate/draft-generation/draft-sources.service';

// Regular expression for getting the verse from a segment ref
// Some projects will have the right to left marker in the segment attribute which we need to account for
Expand Down Expand Up @@ -190,7 +191,7 @@ export function checkAppAccess(
}
}

export function projectLabel(project: SelectableProject | undefined): string {
export function projectLabel(project: SelectableProject | DraftSource | undefined): string {
if (project == null || (!project.shortName && !project.name)) {
return '';
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,11 +63,13 @@ <h4 class="explanation">
</button>
</div>
</mat-step>
<mat-step [completed]="isTrainingOptional || userSelectedTrainingBooks.length > 0">
<mat-step [completed]="isTrainingOptional || userSelectedSourceTrainingBooks.length > 0">
<ng-template matStepLabel>
{{ t("choose_books_for_training_label") }}
</ng-template>
<h1 class="mat-headline-4">{{ t("choose_books_for_training") }}</h1>
<h2>Translated Books</h2>
<p>{{ targetProjectName }}</p>
<app-book-multi-select
[availableBooks]="availableTrainingBooks"
[selectedBooks]="initialSelectedTrainingBooks"
Expand Down Expand Up @@ -103,10 +105,34 @@ <h4 class="explanation">
</div>
</app-notice>
}
@if (unusableTranslateTargetBooks.length) {
<app-notice>
<transloco key="draft_generation_steps.unusable_target_books"></transloco>
</app-notice>
<h2>Reference Books</h2>
<p>{{ trainingSourceProjectName }}</p>
@if (selectableTrainingBooks.length === 0) {
<app-notice mode="basic" type="light"
>Training books will appear as you select books under Translated Books</app-notice
>
} @else {
<app-book-multi-select
[availableBooks]="selectableTrainingBooks"
[selectedBooks]="userSelectedSourceTrainingBooks"
[basicMode]="true"
(bookSelect)="onSourceTrainingBookSelect($event)"
></app-book-multi-select>
}
@if (trainingAdditionalSourceProjectName != null) {
<p>{{ trainingAdditionalSourceProjectName }}</p>
@if (selectableAdditionalTrainingBooks.length === 0) {
<app-notice mode="basic" type="light"
>Training books will appear as you select books under Translated Books</app-notice
>
} @else {
<app-book-multi-select
[availableBooks]="selectableAdditionalTrainingBooks"
[selectedBooks]="userSelectedAdditionalSourceTrainingBooks"
[basicMode]="true"
(bookSelect)="onAdditionalSourceTrainingBookSelect($event)"
></app-book-multi-select>
}
}
@if (showBookSelectionError) {
<app-notice type="error">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -238,9 +238,11 @@ describe('DraftGenerationStepsComponent', () => {
fixture.detectChanges();

expect(component.done.emit).toHaveBeenCalledWith({
translationBooks,
trainingDataFiles,
trainingBooks: trainingBooks.filter(book => !translationBooks.includes(book)),
trainingDataFiles,
trainingScriptureRanges: [],
translationBooks,
translationScriptureRanges: [],
fastTraining: false
} as DraftGenerationStepsResult);
expect(component.isStepsCompleted).toBe(true);
Expand Down Expand Up @@ -338,7 +340,9 @@ describe('DraftGenerationStepsComponent', () => {
expect(component.done.emit).toHaveBeenCalledWith({
trainingBooks,
trainingDataFiles,
trainingScriptureRanges: [],
translationBooks,
translationScriptureRanges: [],
fastTraining: true
} as DraftGenerationStepsResult);
expect(generateDraftButton['disabled']).toBe(true);
Expand Down
Loading
Loading