diff --git a/ui/src/app/app.module.ts b/ui/src/app/app.module.ts index 2ca69f979..745219af9 100644 --- a/ui/src/app/app.module.ts +++ b/ui/src/app/app.module.ts @@ -9,7 +9,7 @@ import {RichSkillsLibraryComponent} from "./richskill/library/rich-skills-librar import {RichSkillPublicComponent} from "./richskill/detail/rich-skill-public/rich-skill-public.component" import {AppConfig} from "./app.config" import {RichSkillFormComponent} from "./richskill/form/rich-skill-form.component" -import {ReactiveFormsModule} from "@angular/forms" +import {FormsModule, ReactiveFormsModule} from "@angular/forms" import {LoadingObservablesDirective} from "./loading/loading-observables.directive" import {LoadingComponent} from "./loading/loading.component" import {HeaderComponent} from "./navigation/header.component" @@ -94,7 +94,8 @@ import {MyWorkspaceComponent} from "./my-workspace/my-workspace.component" import {CollectionPipe} from "./pipes" import { ConvertToCollectionComponent } from "./my-workspace/convert-to-collection/convert-to-collection.component" import {SharedModule} from "@shared/shared.module" -import {FormModule} from "./form/form.module" +import {OsmtFormModule} from "./form/osmt-form.module" +import { SizePaginationComponent } from "./table/skills-library-table/size-pagination/size-pagination.component" export function initializeApp( appConfig: AppConfig, @@ -201,6 +202,7 @@ export function initializeApp( MyWorkspaceComponent, CollectionPipe, ConvertToCollectionComponent, + SizePaginationComponent, ], imports: [ NgIdleKeepaliveModule.forRoot(), @@ -210,7 +212,8 @@ export function initializeApp( ReactiveFormsModule, CommonModule, SharedModule, - FormModule + OsmtFormModule, + FormsModule ], providers: [ EnvironmentService, diff --git a/ui/src/app/collection/collection-skill-search.component.html b/ui/src/app/collection/collection-skill-search.component.html index 3da166d55..dd51f7bb5 100644 --- a/ui/src/app/collection/collection-skill-search.component.html +++ b/ui/src/app/collection/collection-skill-search.component.html @@ -33,6 +33,8 @@
Select one or more RSDs in the table, or select all in the table heading, then use the action menu to publish, archive, unarchive, or add the selected RSDs to a collection.
diff --git a/ui/src/app/collection/detail/collection-public/collection-public.component.spec.ts b/ui/src/app/collection/detail/collection-public/collection-public.component.spec.ts index b0288f121..8a6e68a4a 100644 --- a/ui/src/app/collection/detail/collection-public/collection-public.component.spec.ts +++ b/ui/src/app/collection/detail/collection-public/collection-public.component.spec.ts @@ -164,4 +164,17 @@ describe("CollectionPublicComponent", () => { expect(component.from).toEqual((13 - 1) * 50) expect(component.results).toEqual(expected) }) + + describe( "sizeChange", () => { + it("Should set size of page, from and call handlePageClicked", () => { + const size = 100 + spyOn(component, "handlePageClicked").withArgs(1).and.callThrough() + + component.sizeChange(size) + + expect(component.from).toEqual(0) + expect(component.size).toEqual(size) + expect(component.handlePageClicked).toHaveBeenCalledTimes(1) + }) + }) }) diff --git a/ui/src/app/collection/detail/collection-public/collection-public.component.ts b/ui/src/app/collection/detail/collection-public/collection-public.component.ts index 821cdd8a1..61c674dd1 100644 --- a/ui/src/app/collection/detail/collection-public/collection-public.component.ts +++ b/ui/src/app/collection/detail/collection-public/collection-public.component.ts @@ -1,4 +1,4 @@ -import {Component, OnInit} from "@angular/core" +import {Component, OnInit, ViewChild} from "@angular/core" import {ApiSearch, PaginatedSkills} from "../../../richskill/service/rich-skill-search.service" import {RichSkillService} from "../../../richskill/service/rich-skill.service" import {ActivatedRoute, Router} from "@angular/router" @@ -10,6 +10,8 @@ import {PublishStatus} from "../../../PublishStatus" import {ApiCollection} from "../../ApiCollection" import {Title} from "@angular/platform-browser"; import {Whitelabelled} from "../../../../whitelabel"; +import {FormControl} from "@angular/forms" +import {SizePaginationComponent} from "../../../table/skills-library-table/size-pagination/size-pagination.component" @Component({ selector: "app-collection-public", @@ -17,6 +19,7 @@ import {Whitelabelled} from "../../../../whitelabel"; }) export class CollectionPublicComponent extends Whitelabelled implements OnInit { + @ViewChild(SizePaginationComponent) sizePagination!: SizePaginationComponent title = "Collection" uuidParam: string | null collection: ApiCollection | undefined @@ -30,6 +33,7 @@ export class CollectionPublicComponent extends Whitelabelled implements OnInit { columnSort: ApiSortOrder = ApiSortOrder.NameAsc showLibraryEmptyMessage = false + sizeControl: FormControl = new FormControl(this.size) constructor(protected router: Router, protected skillService: RichSkillService, @@ -39,6 +43,7 @@ export class CollectionPublicComponent extends Whitelabelled implements OnInit { protected titleService: Title ) { super() + this.sizeControl.valueChanges.subscribe(value => this.sizeChange(value)) this.uuidParam = this.route.snapshot.paramMap.get("uuid") } @@ -117,4 +122,15 @@ export class CollectionPublicComponent extends Whitelabelled implements OnInit { this.from = (newPageNo - 1) * this.size this.loadNextPage() } + + sizeChange(size: number): void { + this.size = size + this.from = 0 + this.handlePageClicked(1) + } + + get isSizePaginationVisible(): () => boolean { + return () => this.totalCount > this.sizePagination?.values[0] + } + } diff --git a/ui/src/app/collection/detail/manage-collection.component.html b/ui/src/app/collection/detail/manage-collection.component.html index cb051a084..24149889a 100644 --- a/ui/src/app/collection/detail/manage-collection.component.html +++ b/ui/src/app/collection/detail/manage-collection.component.html @@ -47,6 +47,9 @@