Skip to content

Commit d05ff10

Browse files
committed
Frontend updates
1 parent 9bdc367 commit d05ff10

File tree

15 files changed

+262
-700
lines changed

15 files changed

+262
-700
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.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>

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

Lines changed: 19 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -438,17 +438,16 @@ describe('DraftGenerationComponent', () => {
438438
});
439439
});
440440

441-
describe('user must have access to training source project (aka alternate training source project)', () => {
442-
it('should show warning when no access to training source project', () => {
441+
describe('user must have access to the first training source project', () => {
442+
it('should show warning when no access', () => {
443443
const env = new TestEnvironment(() => {
444444
mockDraftSourcesService.getDraftProjectSources.and.returnValue(
445445
of({
446446
draftingSources: [{} as DraftSource],
447447
trainingSources: [
448448
{
449449
noAccess: true
450-
} as DraftSource,
451-
undefined
450+
} as DraftSource
452451
],
453452
trainingTargets: [{} as DraftSource]
454453
} as DraftSourcesAsArrays)
@@ -460,16 +459,15 @@ describe('DraftGenerationComponent', () => {
460459
expect(env.getElementByTestId('warning-training-source-no-access')).not.toBeNull();
461460
});
462461

463-
it('should not show warning when no access to alternate source project and not back translation nor pre-translate approved', () => {
462+
it('should not show warning when no access and not back translation nor pre-translate approved', () => {
464463
const env = new TestEnvironment(() => {
465464
mockDraftSourcesService.getDraftProjectSources.and.returnValue(
466465
of({
467466
draftingSources: [{} as DraftSource],
468467
trainingSources: [
469468
{
470469
noAccess: true
471-
} as DraftSource,
472-
undefined
470+
} as DraftSource
473471
],
474472
trainingTargets: [{} as DraftSource]
475473
} as DraftSourcesAsArrays)
@@ -490,8 +488,7 @@ describe('DraftGenerationComponent', () => {
490488
trainingSources: [
491489
{
492490
noAccess: true
493-
} as DraftSource,
494-
undefined
491+
} as DraftSource
495492
],
496493
trainingTargets: [{} as DraftSource]
497494
} as DraftSourcesAsArrays)
@@ -502,7 +499,7 @@ describe('DraftGenerationComponent', () => {
502499
expect(env.getElementByTestId('warning-training-source-no-access')).toBeNull();
503500
});
504501

505-
it('should not show warning when source project is not set', () => {
502+
it('should not show warning when the drafting source is not set', () => {
506503
// Because then we merely direct the user to configure sources.
507504
const env = new TestEnvironment(() => {
508505
mockDraftSourcesService.getDraftProjectSources.and.returnValue(
@@ -511,8 +508,7 @@ describe('DraftGenerationComponent', () => {
511508
trainingSources: [
512509
{
513510
noAccess: true
514-
} as DraftSource,
515-
undefined
511+
} as DraftSource
516512
],
517513
trainingTargets: [{} as DraftSource]
518514
} as DraftSourcesAsArrays)
@@ -523,7 +519,7 @@ describe('DraftGenerationComponent', () => {
523519
expect(env.getElementByTestId('warning-training-source-no-access')).toBeNull();
524520
});
525521

526-
it('should show warning even when no access to alternate source project', () => {
522+
it('should show warning even when no access to drafting source project', () => {
527523
const env = new TestEnvironment(() => {
528524
mockDraftSourcesService.getDraftProjectSources.and.returnValue(
529525
of({
@@ -535,8 +531,7 @@ describe('DraftGenerationComponent', () => {
535531
trainingSources: [
536532
{
537533
noAccess: true
538-
} as DraftSource,
539-
undefined
534+
} as DraftSource
540535
],
541536
trainingTargets: [{} as DraftSource]
542537
} as DraftSourcesAsArrays)
@@ -547,16 +542,15 @@ describe('DraftGenerationComponent', () => {
547542
expect(env.getElementByTestId('warning-training-source-no-access')).not.toBeNull();
548543
});
549544

550-
it('should not show warning when access to alternate training source project', () => {
545+
it('should not show warning when user has access to the project', () => {
551546
const env = new TestEnvironment(() => {
552547
mockDraftSourcesService.getDraftProjectSources.and.returnValue(
553548
of({
554549
draftingSources: [{} as DraftSource],
555550
trainingSources: [
556551
{
557552
noAccess: false
558-
} as DraftSource,
559-
undefined
553+
} as DraftSource
560554
],
561555
trainingTargets: [{} as DraftSource]
562556
} as DraftSourcesAsArrays)
@@ -568,10 +562,8 @@ describe('DraftGenerationComponent', () => {
568562
});
569563
});
570564

571-
describe('user must have access to additional training source project', () => {
572-
// i.e. in addition to the "alternate training source project".
573-
574-
it('should show warning when no access to additional training source project', () => {
565+
describe('user must have access to the second training source project', () => {
566+
it('should show warning when no access', () => {
575567
const env = new TestEnvironment(() => {
576568
mockDraftSourcesService.getDraftProjectSources.and.returnValue(
577569
of({
@@ -591,7 +583,7 @@ describe('DraftGenerationComponent', () => {
591583
expect(env.getElementByTestId('warning-mix-source-no-access')).not.toBeNull();
592584
});
593585

594-
it('should not show warning when no access to additional training source project and not back translation nor pre-translate approved', () => {
586+
it('should not show warning when no access and not back translation nor pre-translate approved', () => {
595587
const env = new TestEnvironment(() => {
596588
mockDraftSourcesService.getDraftProjectSources.and.returnValue(
597589
of({
@@ -633,8 +625,7 @@ describe('DraftGenerationComponent', () => {
633625
expect(env.getElementByTestId('warning-mix-source-no-access')).toBeNull();
634626
});
635627

636-
it('should not show warning when source project is not set', () => {
637-
// Because we merely direct the user to configure sources.
628+
it('should not show warning when the drafting source is not set', () => {
638629
const env = new TestEnvironment(() => {
639630
mockDraftSourcesService.getDraftProjectSources.and.returnValue(
640631
of({
@@ -654,7 +645,7 @@ describe('DraftGenerationComponent', () => {
654645
expect(env.getElementByTestId('warning-mix-source-no-access')).toBeNull();
655646
});
656647

657-
it('should show warning even when no access to source project', () => {
648+
it('should show warning even when no access to the drafting source', () => {
658649
const env = new TestEnvironment(() => {
659650
mockDraftSourcesService.getDraftProjectSources.and.returnValue(
660651
of({
@@ -678,7 +669,7 @@ describe('DraftGenerationComponent', () => {
678669
expect(env.getElementByTestId('warning-mix-source-no-access')).not.toBeNull();
679670
});
680671

681-
it('should show warning even when no access to training source project', () => {
672+
it('should show warning even when no access to the first training source project', () => {
682673
const env = new TestEnvironment(() => {
683674
mockDraftSourcesService.getDraftProjectSources.and.returnValue(
684675
of({
@@ -700,7 +691,7 @@ describe('DraftGenerationComponent', () => {
700691
expect(env.getElementByTestId('warning-mix-source-no-access')).not.toBeNull();
701692
});
702693

703-
it('should not show warning when access to additional training source project', () => {
694+
it('should not show warning when user has access to the second training source project', () => {
704695
const env = new TestEnvironment(() => {
705696
mockDraftSourcesService.getDraftProjectSources.and.returnValue(
706697
of({

0 commit comments

Comments
 (0)