Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
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
Expand Up @@ -42,6 +42,7 @@ <h3>{{ 'collections.addToCollection.projectContributors' | translate }}</h3>
[(contributors)]="projectContributors"
[tableParams]="tableParams()"
[isLoading]="isContributorsLoading()"
[showLoadMore]="hasMoreContributors()"
[isLoadingMore]="isLoadingMore()"
(remove)="handleRemoveContributor($event)"
(loadMore)="loadMoreContributors()"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,15 +62,16 @@ export class ProjectContributorsStepComponent {
private readonly customConfirmationService = inject(CustomConfirmationService);
private readonly router = inject(Router);

readonly currentUser = select(UserSelectors.getCurrentUser);
readonly isContributorsLoading = select(ContributorsSelectors.isContributorsLoading);
readonly contributorsTotalCount = select(ContributorsSelectors.getContributorsTotalCount);
readonly selectedProject = select(ProjectsSelectors.getSelectedProject);
readonly currentUser = select(UserSelectors.getCurrentUser);
isLoadingMore = select(ContributorsSelectors.isContributorsLoadingMore);
readonly isLoadingMore = select(ContributorsSelectors.isContributorsLoadingMore);
readonly hasMoreContributors = select(ContributorsSelectors.hasMoreContributors);
readonly pageSize = select(ContributorsSelectors.getContributorsPageSize);

private initialContributors = select(ContributorsSelectors.getContributors);
readonly projectContributors = signal<ContributorModel[]>([]);
pageSize = select(ContributorsSelectors.getContributorsPageSize);

readonly tableParams = computed<TableParameters>(() => ({
...DEFAULT_TABLE_PARAMS,
Expand Down
1 change: 1 addition & 0 deletions src/app/features/contributors/contributors.component.html
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@ <h1 class="py-5 px-3 md:px-5 xl:px-4">{{ 'navigation.contributors' | translate }
[tableParams]="tableParams()"
[hasAdminAccess]="hasAdminAccess()"
[currentUserId]="currentUser()?.id"
[showLoadMore]="hasMoreContributors()"
[showCurator]="true"
[showInfo]="true"
[resourceType]="resourceType()"
Expand Down
5 changes: 3 additions & 2 deletions src/app/features/contributors/contributors.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -134,11 +134,12 @@ export class ContributorsComponent implements OnInit, OnDestroy {
readonly isContributorsLoading = select(ContributorsSelectors.isContributorsLoading);
readonly contributorsTotalCount = select(ContributorsSelectors.getContributorsTotalCount);
readonly isViewOnlyLinksLoading = select(ViewOnlyLinkSelectors.isViewOnlyLinksLoading);
readonly isLoadingMore = select(ContributorsSelectors.isContributorsLoadingMore);
readonly pageSize = select(ContributorsSelectors.getContributorsPageSize);
readonly hasMoreContributors = select(ContributorsSelectors.hasMoreContributors);
readonly hasAdminAccess = select(CurrentResourceSelectors.hasResourceAdminAccess);
readonly resourceAccessRequestEnabled = select(CurrentResourceSelectors.resourceAccessRequestEnabled);
readonly currentUser = select(UserSelectors.getCurrentUser);
pageSize = select(ContributorsSelectors.getContributorsPageSize);
isLoadingMore = select(ContributorsSelectors.isContributorsLoadingMore);

readonly tableParams = computed<TableParameters>(() => ({
...DEFAULT_TABLE_PARAMS,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
[tableParams]="tableParams()"
[isLoading]="isLoading()"
[isLoadingMore]="isLoadingMore()"
[showLoadMore]="hasMoreContributors()"
[showEmployment]="false"
[showEducation]="false"
[hasAdminAccess]="hasAdminAccess()"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,9 @@ export class ContributorsDialogComponent implements OnInit {
hasAdminAccess = select(MetadataSelectors.hasAdminAccess);
contributors = signal<ContributorModel[]>([]);
isLoadingMore = select(ContributorsSelectors.isContributorsLoadingMore);
hasMoreContributors = select(ContributorsSelectors.hasMoreContributors);
pageSize = select(ContributorsSelectors.getContributorsPageSize);

changesMade = signal<boolean>(false);

currentUser = select(UserSelectors.getCurrentUser);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ <h2>{{ 'common.labels.contributors' | translate }}</h2>
[(contributors)]="contributors"
[tableParams]="tableParams()"
[isLoading]="isContributorsLoading()"
[showLoadMore]="hasMoreContributors()"
[isLoadingMore]="isLoadingMore()"
(remove)="removeContributor($event)"
(loadMore)="loadMoreContributors()"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@ export class PreprintsContributorsComponent implements OnInit {
readonly contributors = signal<ContributorModel[]>([]);
readonly contributorsTotalCount = select(ContributorsSelectors.getContributorsTotalCount);
readonly isContributorsLoading = select(ContributorsSelectors.isContributorsLoading);
readonly hasMoreContributors = select(ContributorsSelectors.hasMoreContributors);
readonly isLoadingMore = select(ContributorsSelectors.isContributorsLoadingMore);
readonly pageSize = select(ContributorsSelectors.getContributorsPageSize);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ <h2 class="mb-2">{{ 'common.labels.contributors' | translate }}</h2>
[(contributors)]="contributors"
[tableParams]="tableParams()"
[isLoading]="isContributorsLoading()"
[showLoadMore]="hasMoreContributors()"
[isLoadingMore]="isLoadingMore()"
(remove)="removeContributor($event)"
(loadMore)="loadMoreContributors()"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@ export class RegistriesContributorsComponent implements OnInit, OnDestroy {

isContributorsLoading = select(ContributorsSelectors.isContributorsLoading);
contributorsTotalCount = select(ContributorsSelectors.getContributorsTotalCount);
hasMoreContributors = select(ContributorsSelectors.hasMoreContributors);
isLoadingMore = select(ContributorsSelectors.isContributorsLoadingMore);
pageSize = select(ContributorsSelectors.getContributorsPageSize);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -174,19 +174,19 @@
</td>
</tr>
}
</ng-template>

@if (showLoadMore() && index === contributors().length - 1) {
<ng-template #footer>
@if (showLoadMore()) {
<tr>
<td colspan="8" class="text-center">
<div class="flex justify-content-center">
<p-button
class="w-full"
styleClass="w-full"
(onClick)="loadMoreItems()"
[label]="'common.buttons.seeMore' | translate"
[loading]="isLoadingMore()"
/>
</div>
<td colspan="8">
<p-button
class="w-full"
styleClass="w-full"
(onClick)="loadMoreItems()"
[label]="'common.buttons.seeMore' | translate"
[loading]="isLoadingMore()"
/>
</td>
</tr>
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ export class ContributorsTableComponent {
showEducation = input(true);
showEmployment = input(true);
showInfo = input(false);
showLoadMore = input(false);
resourceType = input(ResourceType.Project);

currentUserId = input<string | undefined>(undefined);
Expand All @@ -69,12 +70,6 @@ export class ContributorsTableComponent {

deactivatedContributors = computed(() => this.contributors().some((contributor) => contributor.deactivated));

showLoadMore = computed(() => {
const currentLoadedItems = this.contributors().length;
const totalRecords = this.tableParams().totalRecords;
return currentLoadedItems > 0 && currentLoadedItems < totalRecords;
});

removeContributor(contributor: ContributorModel) {
this.remove.emit(contributor);
}
Expand Down
Loading