Skip to content

Commit 0401eea

Browse files
authored
Merge pull request #183 from Gid733/master
Added sorting & pagesize saving
2 parents a5bb64c + d238e2e commit 0401eea

File tree

23 files changed

+558
-287
lines changed

23 files changed

+558
-287
lines changed

eform-client/package.json

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -82,11 +82,11 @@
8282
"ts-node": "5.0.1",
8383
"tslint": "5.9.1",
8484
"typescript": "2.7.2",
85-
"wdio-chromedriver-service": "0.1.3",
85+
"wdio-chromedriver-service": "0.1.5",
8686
"wdio-dot-reporter": "0.0.10",
87-
"wdio-mocha-framework": "0.6.3",
88-
"wdio-selenium-standalone-service": "0.0.10",
87+
"wdio-mocha-framework": "0.6.4",
88+
"wdio-selenium-standalone-service": "0.0.11",
8989
"wdio-spec-reporter": "0.1.5",
90-
"webdriverio": "4.14.0"
90+
"webdriverio": "4.14.1"
9191
}
9292
}
Lines changed: 70 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,70 @@
1+
import {ApplicationPages} from 'src/app/common/enums/application-pages.enum';
2+
import {
3+
ApplicationPageModel,
4+
PageSettingsModel
5+
} from 'src/app/common/models/settings/application-page-settings.model';
6+
7+
export const ApplicationPagesSettings = [
8+
new ApplicationPageModel({
9+
name: ApplicationPages[ApplicationPages.Eforms],
10+
index: ApplicationPages.Eforms,
11+
settings: new PageSettingsModel({
12+
pageSize: 1000000,
13+
sort: 'id',
14+
isSortDsc: false
15+
})
16+
}
17+
),
18+
new ApplicationPageModel({
19+
name: ApplicationPages[ApplicationPages.DeviceUsers],
20+
index: ApplicationPages.DeviceUsers,
21+
settings: new PageSettingsModel({
22+
pageSize: 10
23+
})
24+
}
25+
),
26+
new ApplicationPageModel({
27+
name: ApplicationPages[ApplicationPages.Cases],
28+
index: ApplicationPages.Cases,
29+
settings: new PageSettingsModel({
30+
pageSize: 10
31+
})
32+
}
33+
),
34+
new ApplicationPageModel({
35+
name: ApplicationPages[ApplicationPages.AccountManagementUsers],
36+
index: ApplicationPages.AccountManagementUsers,
37+
settings: new PageSettingsModel({
38+
pageSize: 10
39+
})
40+
}
41+
),
42+
new ApplicationPageModel({
43+
name: ApplicationPages[ApplicationPages.Security],
44+
index: ApplicationPages.Security,
45+
settings: new PageSettingsModel({
46+
pageSize: 10
47+
})
48+
}
49+
),
50+
new ApplicationPageModel({
51+
name: ApplicationPages[ApplicationPages.EntitySearch],
52+
index: ApplicationPages.EntitySearch,
53+
settings: new PageSettingsModel({
54+
pageSize: 10,
55+
sort: 'id',
56+
isSortDsc: false
57+
})
58+
}
59+
),
60+
new ApplicationPageModel({
61+
name: ApplicationPages[ApplicationPages.EntitySelect],
62+
index: ApplicationPages.EntitySelect,
63+
settings: new PageSettingsModel({
64+
pageSize: 10,
65+
sort: 'id',
66+
isSortDsc: false
67+
})
68+
}
69+
)
70+
];
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
export enum ApplicationPages {
2+
Eforms = 0,
3+
DeviceUsers,
4+
Cases,
5+
AccountManagementUsers,
6+
Security,
7+
EntitySearch,
8+
EntitySelect
9+
}
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
export * from './application-pages-settings.const';
2+
export * from './application-pages.enum';
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
export class ApplicationPageModel {
2+
name: string;
3+
settings: PageSettingsModel = new PageSettingsModel();
4+
5+
constructor(data?: any) {
6+
if (data) {
7+
this.name = data.name;
8+
this.settings = data.settings;
9+
}
10+
}
11+
}
12+
13+
export class PageSettingsModel {
14+
pageSize: number;
15+
sort: string;
16+
isSortDsc: boolean;
17+
additional: Array<{key: string, value: string}> = [];
18+
19+
constructor(data?: any) {
20+
if (data) {
21+
this.pageSize = data.pageSize;
22+
this.sort = data.sort;
23+
this.isSortDsc = data.isSortDsc;
24+
}
25+
}
26+
}

eform-client/src/app/common/models/settings/index.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,3 +3,4 @@ export * from './admin-settings.model';
33
export * from './login-page-settings.model';
44
export * from './header-settings.model';
55
export * from './user-settings.model';
6+
export * from './application-page-settings.model';
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
<ng-select
2+
[items]="pageSizes"
3+
(ngModelChange)="updateCurrentPageSettings($event)"
4+
[clearable]="false"
5+
[(ngModel)]="pageSize"
6+
dropdownPosition="top"
7+
[placeholder]="'Display' | translate">
8+
</ng-select>
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
import {Component, EventEmitter, Input, Output} from '@angular/core';
2+
3+
@Component({
4+
selector: 'eform-page-size',
5+
templateUrl: './eform-page-size.component.html'
6+
})
7+
export class EformPageSizeComponent {
8+
@Input() pageSize: number;
9+
@Output() onPageSizeChanged: EventEmitter<number> = new EventEmitter<number>();
10+
pageSizes = [5, 10, 100, 1000, 100000];
11+
12+
constructor() {
13+
}
14+
15+
updateCurrentPageSettings(e: any) {
16+
this.onPageSizeChanged.emit(e);
17+
}
18+
}
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
11
export * from './eform-page-subheader/eform-page-subheader.component';
22
export * from './eform-pagination/eform-pagination.component';
33
export * from './eform-spinner/eform-spinner.component';
4+
export * from './eform-page-size/eform-page-size.component';

eform-client/src/app/common/modules/eform-shared/eform-shared.module.ts

Lines changed: 15 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,34 @@
11
import {NgModule} from '@angular/core';
22
import {CommonModule} from '@angular/common';
3+
import {FormsModule} from '@angular/forms';
4+
import {NgSelectModule} from '@ng-select/ng-select';
35
import {TranslateModule} from '@ngx-translate/core';
46

5-
import {EformPageSubheaderComponent, EformPaginationComponent, EformSpinnerComponent} from './components';
7+
import {
8+
EformPageSubheaderComponent,
9+
EformPaginationComponent,
10+
EformSpinnerComponent,
11+
EformPageSizeComponent
12+
} from './components';
613

714
@NgModule({
815
imports: [
916
CommonModule,
10-
TranslateModule
17+
TranslateModule,
18+
NgSelectModule,
19+
FormsModule
1120
],
1221
declarations: [
1322
EformPageSubheaderComponent,
1423
EformPaginationComponent,
15-
EformSpinnerComponent
24+
EformSpinnerComponent,
25+
EformPageSizeComponent
1626
],
1727
exports: [
1828
EformPageSubheaderComponent,
1929
EformPaginationComponent,
20-
EformSpinnerComponent
30+
EformSpinnerComponent,
31+
EformPageSizeComponent
2132
]
2233
})
2334
export class EformSharedModule {

0 commit comments

Comments
 (0)