[DURACOM-304] remove control flow

This commit is contained in:
FrancescoMolinaro
2025-01-30 12:14:07 +01:00
parent bc06839926
commit f77ce869f8
2 changed files with 14 additions and 13 deletions

View File

@@ -17,7 +17,7 @@ import { getFirstSucceededRemoteDataPayload } from '../../../../../../core/share
import { PaginatedList } from '../../../../../../core/data/paginated-list.model'; import { PaginatedList } from '../../../../../../core/data/paginated-list.model';
import { VocabularyEntry } from '../../../../../../core/submission/vocabularies/models/vocabulary-entry.model'; import { VocabularyEntry } from '../../../../../../core/submission/vocabularies/models/vocabulary-entry.model';
import { PageInfo } from '../../../../../../core/shared/page-info.model'; import { PageInfo } from '../../../../../../core/shared/page-info.model';
import { EMPTY, expand, reduce } from "rxjs"; import { BehaviorSubject, EMPTY, expand, map, reduce, tap } from "rxjs";
export interface ListItem { export interface ListItem {
id: string; id: string;

View File

@@ -1,4 +1,4 @@
@if (submissionCcLicenses) { <ng-container *ngIf="selectedCcLicense">
<div class="mb-4 ccLicense-select"> <div class="mb-4 ccLicense-select">
<div ngbDropdown> <div ngbDropdown>
<input id="cc-license-dropdown" <input id="cc-license-dropdown"
@@ -18,22 +18,23 @@
[infiniteScrollUpDistance]="1.5" [infiniteScrollUpDistance]="1.5"
[fromRoot]="true" [fromRoot]="true"
[scrollWindow]="false"> [scrollWindow]="false">
<ng-container *ngIf="submissionCcLicenses?.length === 0; else licensesList">
@if(submissionCcLicenses?.length === 0) {
<button class="dropdown-item disabled"> <button class="dropdown-item disabled">
{{ 'submission.sections.ccLicense.none' | translate }} {{ 'submission.sections.ccLicense.none' | translate }}
</button> </button>
} @else { </ng-container>
@for(license of submissionCcLicenses; track license.id) {
<button class="dropdown-item" (click)="selectCcLicense(license)">
{{ license.name }}
</button>
}
}
</div> </div>
</div>
</div> </div>
</div> </ng-container>
}
<ng-template #licensesList>
<ng-container *ngFor="let license of submissionCcLicenses">
<button class="dropdown-item" (click)="selectCcLicense(license)">
{{ license.name }}
</button>
</ng-container>
</ng-template>
<ng-container *ngIf="getSelectedCcLicense()"> <ng-container *ngIf="getSelectedCcLicense()">