Skip to content

3.3.2 SUBMOD.003.002 : Paging

NamidM edited this page May 20, 2021 · 21 revisions

Contents

Changelog

Version Date Author Comment
0.1 17.01.2021 Namid Marxen und Nils-Christopher Wiesenauer created
1.0 14.05.2021 Namid Marxen und Nils-Christopher Wiesenauer finished

1. Scope

The Module Documentations (MODs) describes the architecture, the interfaces and the main features of the module. It also describes the module/component test including the results. It can also serve as a programming or integration manual for the module. If there are some risks related to the module itself, they shall be noted and commented within this document.

2. Definitions

AML: Automation Markup Language

CRUD: Create Read Update Delete

GUI: Graphical User Interface

JSend: A specification that lays down some rules for how JSON responses from web servers should be formatted

SAS: System Architecture Specification

SRS: System Requirements Specification

3 Module requirements

3.1 User view

The user is given a clear overview over all files by paging the files. This way the user only sees a specific amount of files at a time and can change the pages on the GUI.

3.2 Requirements

The requirement LF50 is included in this submodule, because it gives the user the ability to list all files and page the results. The pages show a specific amount of files and give a clear overview.

3.3 Module Context

The submodule to add paging provides different pages to the user. It contains a fixed number of AML files at a time to get a good overview from all files. This function also provides a navigation between pages. It is a function just in the GUI and does not communicate with the REST API.

Component GUI Paging

4. Analysis

The submodule is important, because you can show a lot of files on one site by using pages. If you would have to load all files into one page, the browser could not handle so many files. It gives a clear overview and cleans up the main page.

5. Design

We implemented the paging system in the frontend with MatDataSource. For the paging we are using <mat-paginator></mat-paginator> to show a different amount of items per page. Because the pagin is only in the home.component, we integrated it directly into it.

5.1 Risks

If this submodule would not work, pages would not be shown and there would be no clear overview.

6. Implementation

Link to sourcecode: home.component

6.1 Paginator

For the paging we are using the paginator of our MatTableDataSource. Because we defined everything well and stored our loaded data in a MatTableDataSource Object, we are able to have different pages with a different amount of items in it. For selecting how many items should be shown, we are using <mat-paginator></mat-paginator>. The pages are created automatically with the MatTableDataSource.

home.component.ts

...
/** Datasource for Table */
dataSource: MatTableDataSource<FileData>;

/** MatPaginator ViewChild */
@ViewChild(MatPaginator) paginator: MatPaginator;
...

/** Initialize data */
async initData() {
  const res = await this.apiService.get('file');
  if (res.status === IResponseStatus.success) {
    this.dataSource = new MatTableDataSource(res.data);
    this.dataSource.paginator = this.paginator;
    this.dataSource.sort = this.sort;
  }
}

home.component.html

<mat-paginator [pageSizeOptions]="[10, 25, 100, 200]"></mat-paginator>

7. Module Test

Module Test Documentation

8. Summary

The submodule for paging provides the functionality to group files into pages. This way the user does not have to load all files into the list of files and can only show a specific amount of files per page. He can also change the pages and how many files are shown in one page. This function is implemented only in the GUI and does not communicate with the REST API. The paging system is implemented with the angular pagination system.

9. Appendix

9.1 References

  1. SRS (System Requirements Specification)
  2. SAS (System Architecuture Specification)
  3. Systemtestplan

9.2 Sourcecode

The source code of this module can be found here: aml-database-management-app/src/app/pages/general/home

Clone this wiki locally