-
-
Notifications
You must be signed in to change notification settings - Fork 5
SF-3757 Simplify draft sources configuration page #3763
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
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
| @@ -0,0 +1,162 @@ | ||||||
| <ng-container *transloco="let t; read: 'draft_sources'"> | ||||||
| <h1>{{ t("configure_draft_sources") }}</h1> | ||||||
|
|
||||||
| <mat-card> | ||||||
| <mat-card-header> | ||||||
| <mat-card-title>{{ t("train_language_model") }}</mat-card-title> | ||||||
| </mat-card-header> | ||||||
| <mat-card-content class="training-data-card-content"> | ||||||
| <h3 class="heading-left">{{ t("overview_reference") }} {{ parentheses(referenceLanguageDisplayName) }}</h3> | ||||||
|
|
||||||
| <div class="description-left">{{ t("select_primary_reference") }}</div> | ||||||
| <div class="inputs-left"> | ||||||
| @for (source of trainingSources; track $index) { | ||||||
| <app-project-select | ||||||
| [isDisabled]="loading || !appOnline" | ||||||
| [projects]="projects" | ||||||
| [resources]="resources" | ||||||
| [nonSelectableProjects]="nonSelectableProjects" | ||||||
| [value]="source?.paratextId" | ||||||
| [hiddenParatextIds]="getHiddenParatextIds(trainingSources, source?.paratextId)" | ||||||
| (valueChange)="sourceSelected(trainingSources, $index, $event)" | ||||||
| [placeholder]="projectPlaceholder(source)" | ||||||
| ></app-project-select> | ||||||
| } | ||||||
|
|
||||||
| @if (allowAddingATrainingSource) { | ||||||
| <div>{{ t("some_projects_use_back_translation") }}</div> | ||||||
| <button | ||||||
| mat-button | ||||||
| (click)="trainingSources.push(undefined); $event.preventDefault()" | ||||||
| class="add-another-project" | ||||||
| > | ||||||
| <mat-icon>add</mat-icon> {{ t("add_another_reference_project") }} | ||||||
| </button> | ||||||
| } | ||||||
| </div> | ||||||
|
|
||||||
| <span class="arrow mirror-rtl"><mat-icon>arrow_right_alt</mat-icon></span> | ||||||
| <h3 class="heading-right">{{ t("overview_translated_project") }} {{ parentheses(targetLanguageDisplayName) }}</h3> | ||||||
| <div class="description-right"> | ||||||
| @for (portion of i18n.interpolateVariables("draft_sources.project_always_used"); track $index) { | ||||||
| @if (portion.id === "currentProjectShortName") { | ||||||
| <strong>{{ currentProjectShortName }}</strong> | ||||||
| } | ||||||
| <!-- prettier-ignore --> | ||||||
| @else {{{ portion.text }}} | ||||||
| } | ||||||
| <!-- Select here any other projects to be used on the target side. All of these should be in the language of the target (<strong>{{ targetLanguageDisplayName }}</strong>). --> | ||||||
| </div> | ||||||
| <div class="inputs-right"> | ||||||
| @for (source of trainingTargets; track $index) { | ||||||
| <app-project-select | ||||||
| [isDisabled]="true" | ||||||
| [projects]="projects" | ||||||
| [resources]="resources" | ||||||
| [nonSelectableProjects]="nonSelectableProjects" | ||||||
| [value]="source?.paratextId" | ||||||
| [hiddenParatextIds]="getHiddenParatextIds(trainingTargets, source?.paratextId)" | ||||||
| [placeholder]="projectPlaceholder(source)" | ||||||
| ></app-project-select> | ||||||
| } | ||||||
| </div> | ||||||
| <div class="training-files"> | ||||||
| <mat-divider></mat-divider> | ||||||
| <h3>{{ t("additional_training_data_optional") }}</h3> | ||||||
| <div>{{ t("training_files_description", { sourceLanguageDisplayName, targetLanguageDisplayName }) }}</div> | ||||||
| <app-training-data-multi-select | ||||||
| [availableTrainingData]="availableTrainingFiles" | ||||||
| (trainingDataSelect)="onTrainingDataSelect($event)" | ||||||
| ></app-training-data-multi-select> | ||||||
| </div> | ||||||
| </mat-card-content> | ||||||
| </mat-card> | ||||||
|
|
||||||
| <mat-card> | ||||||
| <mat-card-header> | ||||||
| <mat-card-title> {{ t("generate_a_draft_from_the_language_model") }} </mat-card-title> | ||||||
| </mat-card-header> | ||||||
| <mat-card-content class="translation-data-card-content"> | ||||||
| <h3 class="heading-left">{{ t("overview_source") }} {{ parentheses(sourceLanguageDisplayName) }}</h3> | ||||||
| <div class="description-left">{{ t("select_project_to_translate") }}</div> | ||||||
| <div class="inputs-left"> | ||||||
| @for (source of draftingSources; track $index) { | ||||||
| <app-project-select | ||||||
| [isDisabled]="loading || !appOnline" | ||||||
| [projects]="projects" | ||||||
| [resources]="resources" | ||||||
| [nonSelectableProjects]="nonSelectableProjects" | ||||||
| [value]="source?.paratextId" | ||||||
| [hiddenParatextIds]="getHiddenParatextIds(draftingSources, source?.paratextId)" | ||||||
| (valueChange)="sourceSelected(draftingSources, $index, $event)" | ||||||
| [placeholder]="projectPlaceholder(source)" | ||||||
| ></app-project-select> | ||||||
| } | ||||||
| </div> | ||||||
| </mat-card-content> | ||||||
| </mat-card> | ||||||
|
|
||||||
| <app-language-codes-confirmation | ||||||
| class="confirm-language-codes" | ||||||
| [sources]="draftSourcesAsArray" | ||||||
| [clearCheckbox]="clearLanguageCodeConfirmationCheckbox" | ||||||
| (messageIfUserTriesToContinue)="languageCodeConfirmationMessageIfUserTriesToContinue = $event" | ||||||
| ></app-language-codes-confirmation> | ||||||
|
|
||||||
| <div class="component-footer"> | ||||||
| @if (!appOnline) { | ||||||
| <mat-error id="offline-message"> | ||||||
| {{ t("offline_message") }} | ||||||
| </mat-error> | ||||||
| } | ||||||
| <div class="page-actions"> | ||||||
| <button mat-button (click)="cancel()"><mat-icon>close</mat-icon>{{ t("cancel") }}</button> | ||||||
| <button id="save_button" mat-flat-button color="primary" (click)="save()" [disabled]="!appOnline"> | ||||||
| <mat-icon>check</mat-icon>{{ t("save_and_sync") }} | ||||||
| </button> | ||||||
| </div> | ||||||
| </div> | ||||||
|
|
||||||
| @if (getControlState("projectSettings") != null) { | ||||||
| <mat-card class="saving"> | ||||||
| <mat-card-header> | ||||||
| <mat-card-title>{{ t("saving_draft_sources") }}</mat-card-title> | ||||||
| </mat-card-header> | ||||||
| <mat-card-content> | ||||||
| <div class="saving-indicator"> | ||||||
| @if (getControlState("projectSettings") === ElementState.Submitting) { | ||||||
| <mat-spinner [diameter]="24" color="primary"></mat-spinner> {{ t("saving") }} | ||||||
| } @else if (getControlState("projectSettings") === ElementState.Submitted) { | ||||||
| <mat-icon class="success">checkmark</mat-icon> {{ t("all_changes_saved") }} | ||||||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🟡 Invalid Material Icon name In
Suggested change
Was this helpful? React with 👍 or 👎 to provide feedback. |
||||||
| } @else { | ||||||
| <mat-icon class="failure">error</mat-icon> {{ t("failed_to_save_changes") }} | ||||||
| } | ||||||
| </div> | ||||||
| @for (entry of syncStatus | keyvalue; track entry.key) { | ||||||
| <div> | ||||||
| @if (entry.value.knownToBeOnSF) { | ||||||
| @if (entry.value.isSyncing) { | ||||||
| <mat-spinner [diameter]="24"></mat-spinner> {{ entry.value.shortName }} - {{ t("state_syncing") }} | ||||||
| } @else { | ||||||
| @if (entry.value.lastSyncSuccessful) { | ||||||
| <mat-icon class="success">check</mat-icon> {{ entry.value.shortName }} - | ||||||
| {{ t("state_sync_successful") }} | ||||||
| } @else { | ||||||
| <mat-icon class="failure">error</mat-icon> {{ entry.value.shortName }} - | ||||||
| {{ t("state_sync_failed") }} | ||||||
| } | ||||||
| } | ||||||
| } @else { | ||||||
| <mat-spinner [diameter]="24"></mat-spinner> {{ entry.value.shortName }} - {{ t("state_connecting") }} | ||||||
| } | ||||||
| </div> | ||||||
| } | ||||||
| </mat-card-content> | ||||||
| @if (allProjectsSavedAndSynced || getControlState("projectSettings") === ElementState.Error) { | ||||||
| <mat-card-actions align="end"> | ||||||
| <button mat-button (click)="navigateToDrafting()"><mat-icon>close</mat-icon> {{ t("close") }}</button> | ||||||
| </mat-card-actions> | ||||||
| } | ||||||
| </mat-card> | ||||||
| } | ||||||
| </ng-container> | ||||||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🚩 Stepper removal means empty project-select slots can no longer be cleaned up
The old
goToStep()method cleaned upundefinedentries fromtrainingSources/draftingSourcesarrays when navigating between steps. With the stepper removed, there's no cleanup mechanism. If a user clicks "Add another reference project" but doesn't select anything, the empty slot persists with no way to remove it (the "Add another reference project" button disappears becauseallowAddingATrainingSourcecheckstrainingSources.length < 2). This doesn't cause a functional bug —save()filters out undefined values withfilter(notNull)— but it's a minor UX regression where users can't undo adding an empty slot.Was this helpful? React with 👍 or 👎 to provide feedback.