Skip to content

Commit ce57a40

Browse files
committed
Frontend updates
1 parent a43b995 commit ce57a40

16 files changed

+264
-704
lines changed

src/SIL.XForge.Scripture/ClientApp/src/app/core/models/sf-project-settings.ts

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -8,14 +8,10 @@ export interface SFProjectSettings {
88
sourceParatextId?: string | null;
99
biblicalTermsEnabled?: boolean | null;
1010

11+
/* DraftSourcesSettingsChange */
1112
additionalTrainingDataFiles?: string[] | null;
12-
additionalTrainingSourceEnabled?: boolean | null;
13-
additionalTrainingSourceParatextId?: string | null;
14-
alternateSourceEnabled?: boolean | null;
15-
alternateSourceParatextId?: string | null;
16-
alternateTrainingSourceEnabled?: boolean | null;
17-
alternateTrainingSourceParatextId?: string | null;
18-
servalConfig?: string | null;
13+
draftingSourcesParatextIds?: string[] | null;
14+
trainingSourcesParatextIds?: string[] | null;
1915

2016
checkingEnabled?: boolean | null;
2117
usersSeeEachOthersResponses?: boolean | null;

src/SIL.XForge.Scripture/ClientApp/src/app/serval-administration/serval-project.component.spec.ts

Lines changed: 25 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -299,30 +299,31 @@ describe('ServalProjectComponent', () => {
299299
],
300300
translateConfig: {
301301
draftConfig: {
302-
alternateSourceEnabled: true,
303-
alternateSource: {
304-
paratextId: 'ptproject03',
305-
projectRef: 'project03',
306-
name: 'Project 03',
307-
shortName: 'P3',
308-
writingSystem: { tag: 'en' }
309-
},
310-
alternateTrainingSourceEnabled: true,
311-
alternateTrainingSource: {
312-
paratextId: 'ptproject04',
313-
projectRef: 'project04',
314-
name: 'Project 04',
315-
shortName: 'P4',
316-
writingSystem: { tag: 'en' }
317-
},
318-
additionalTrainingSourceEnabled: true,
319-
additionalTrainingSource: {
320-
paratextId: 'ptproject05',
321-
projectRef: 'project05',
322-
name: 'Project 05',
323-
shortName: 'P5',
324-
writingSystem: { tag: 'en' }
325-
},
302+
draftingSources: [
303+
{
304+
paratextId: 'ptproject03',
305+
projectRef: 'project03',
306+
name: 'Project 03',
307+
shortName: 'P3',
308+
writingSystem: { tag: 'en' }
309+
}
310+
],
311+
trainingSources: [
312+
{
313+
paratextId: 'ptproject04',
314+
projectRef: 'project04',
315+
name: 'Project 04',
316+
shortName: 'P4',
317+
writingSystem: { tag: 'en' }
318+
},
319+
{
320+
paratextId: 'ptproject05',
321+
projectRef: 'project05',
322+
name: 'Project 05',
323+
shortName: 'P5',
324+
writingSystem: { tag: 'en' }
325+
}
326+
],
326327
lastSelectedTrainingScriptureRanges: args.draftConfig?.lastSelectedTrainingScriptureRanges ?? undefined,
327328
lastSelectedTranslationScriptureRanges:
328329
args.draftConfig?.lastSelectedTranslationScriptureRanges ?? undefined,

src/SIL.XForge.Scripture/ClientApp/src/app/serval-administration/serval-projects.component.spec.ts

Lines changed: 32 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -191,20 +191,22 @@ class TestEnvironment {
191191
name: 'Project 01',
192192
translateConfig: {
193193
draftConfig: {
194-
alternateSourceEnabled: true,
195-
alternateSource: {
196-
paratextId: 'ptproject03',
197-
projectRef: 'project03',
198-
name: 'Project 03',
199-
shortName: 'P3'
200-
},
201-
alternateTrainingSourceEnabled: true,
202-
alternateTrainingSource: {
203-
paratextId: 'ptproject04',
204-
projectRef: 'project04',
205-
name: 'Project 04',
206-
shortName: 'P4'
207-
}
194+
draftingSources: [
195+
{
196+
paratextId: 'ptproject03',
197+
projectRef: 'project03',
198+
name: 'Project 03',
199+
shortName: 'P3'
200+
}
201+
],
202+
trainingSources: [
203+
{
204+
paratextId: 'ptproject04',
205+
projectRef: 'project04',
206+
name: 'Project 04',
207+
shortName: 'P4'
208+
}
209+
]
208210
},
209211
preTranslate: true,
210212
source: {
@@ -235,20 +237,22 @@ class TestEnvironment {
235237
shortName: 'P3',
236238
translateConfig: {
237239
draftConfig: {
238-
alternateSourceEnabled: true,
239-
alternateSource: {
240-
paratextId: 'resource16char02',
241-
projectRef: 'resource02',
242-
name: 'Resource 02',
243-
shortName: 'R2'
244-
},
245-
alternateTrainingSourceEnabled: true,
246-
alternateTrainingSource: {
247-
paratextId: 'resource16char03',
248-
projectRef: 'resource03',
249-
name: 'Resource 03',
250-
shortName: 'R3'
251-
}
240+
draftingSources: [
241+
{
242+
paratextId: 'resource16char02',
243+
projectRef: 'resource02',
244+
name: 'Resource 02',
245+
shortName: 'R2'
246+
}
247+
],
248+
trainingSources: [
249+
{
250+
paratextId: 'resource16char03',
251+
projectRef: 'resource03',
252+
name: 'Resource 03',
253+
shortName: 'R3'
254+
}
255+
]
252256
},
253257
preTranslate: false,
254258
source: {

src/SIL.XForge.Scripture/ClientApp/src/app/translate/draft-generation/confirm-sources/confirm-sources.stories.ts

Lines changed: 25 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -30,30 +30,31 @@ when(mockActivatedProject.changes$).thenReturn(
3030
paratextId: 'source-project'
3131
},
3232
draftConfig: {
33-
alternateTrainingSourceEnabled: true,
34-
alternateTrainingSource: {
35-
projectRef: 'alternate-training-source',
36-
shortName: 'ALT-TS',
37-
name: 'Alternate Training Source',
38-
paratextId: 'alternate-training-source',
39-
writingSystem: { tag: 'es' }
40-
},
41-
additionalTrainingSourceEnabled: true,
42-
additionalTrainingSource: {
43-
projectRef: 'additional-training-source',
44-
shortName: 'ADD-TS',
45-
name: 'Additional Training Source',
46-
paratextId: 'additional-training-source',
47-
writingSystem: { tag: 'es' }
48-
},
49-
alternateSourceEnabled: true,
50-
alternateSource: {
51-
projectRef: 'alternate-drafting-source',
52-
shortName: 'ADS',
53-
name: 'Alternate Drafting Source',
54-
paratextId: 'alternate-drafting-source',
55-
writingSystem: { tag: 'es' }
56-
}
33+
draftingSources: [
34+
{
35+
projectRef: 'first-drafting-source',
36+
shortName: 'FDS',
37+
name: 'First Drafting Source',
38+
paratextId: 'first-drafting-source',
39+
writingSystem: { tag: 'es' }
40+
}
41+
],
42+
trainingSources: [
43+
{
44+
projectRef: 'first-training-source',
45+
shortName: 'FTS',
46+
name: 'First Training Source',
47+
paratextId: 'first-training-source',
48+
writingSystem: { tag: 'es' }
49+
},
50+
{
51+
projectRef: 'second-training-source',
52+
shortName: 'STS',
53+
name: 'Second Training Source',
54+
paratextId: 'second-training-source',
55+
writingSystem: { tag: 'es' }
56+
}
57+
]
5758
}
5859
}
5960
})

src/SIL.XForge.Scripture/ClientApp/src/app/translate/draft-generation/draft-generation-steps/draft-generation-steps.component.spec.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -615,7 +615,7 @@ describe('DraftGenerationStepsComponent', () => {
615615
});
616616
});
617617

618-
describe('additional training source', () => {
618+
describe('two training sources', () => {
619619
const availableBooks = [{ bookNum: 2 }, { bookNum: 3 }];
620620
const allBooks = [{ bookNum: 1 }, ...availableBooks, { bookNum: 6 }, { bookNum: 7 }, { bookNum: 8 }];
621621
const draftingSourceBooks = availableBooks.concat({ bookNum: 7 });

src/SIL.XForge.Scripture/ClientApp/src/app/translate/draft-generation/draft-generation-steps/draft-generation-steps.component.ts

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -196,9 +196,7 @@ export class DraftGenerationStepsComponent implements OnInit {
196196
}
197197

198198
const trainingSourceBooks: Set<number> = new Set<number>(trainingSources[0]?.texts.map(t => t.bookNum));
199-
const additionalTrainingSourceBooks: Set<number> = new Set<number>(
200-
trainingSources[1]?.texts.map(t => t.bookNum)
201-
);
199+
const secondTrainingSourceBooks: Set<number> = new Set<number>(trainingSources[1]?.texts.map(t => t.bookNum));
202200

203201
for (const source of this.draftingSources) {
204202
this.availableTranslateBooks[source?.projectRef] = [];
@@ -284,7 +282,7 @@ export class DraftGenerationStepsComponent implements OnInit {
284282
} else {
285283
this.unusableTrainingSourceBooks.push(bookNum);
286284
}
287-
if (trainingSources[1] != null && additionalTrainingSourceBooks.has(bookNum)) {
285+
if (trainingSources[1] != null && secondTrainingSourceBooks.has(bookNum)) {
288286
this.availableTrainingBooks[trainingSources[1].projectRef].push({ number: bookNum, selected: selected });
289287
isPresentInASource = true;
290288
}

src/SIL.XForge.Scripture/ClientApp/src/app/translate/draft-generation/draft-generation.component.html

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -101,13 +101,13 @@ <h1>
101101
></transloco>
102102
</app-notice>
103103
}
104-
@if (!canAccessDraftSourceIfAvailable(additionalTrainingSource)) {
104+
@if (!canAccessDraftSourceIfAvailable(secondTrainingSource)) {
105105
<app-notice type="warning" icon="warning" data-test-id="warning-mix-source-no-access">
106106
<transloco
107107
key="draft_generation.info_alert_no_additional_training_source_access"
108108
[params]="{
109109
connectProjectUrl: { route: '/connect-project' },
110-
name: projectLabel(additionalTrainingSource)
110+
name: projectLabel(secondTrainingSource)
111111
}"
112112
></transloco>
113113
</app-notice>

0 commit comments

Comments
 (0)