File tree Expand file tree Collapse file tree 11 files changed +44
-41
lines changed Expand file tree Collapse file tree 11 files changed +44
-41
lines changed Original file line number Diff line number Diff line change 1
1
import Controller from '@ember/controller' ;
2
2
import { tracked } from '@glimmer/tracking' ;
3
3
4
- import { reads } from 'macro-decorators' ;
5
-
6
4
import { pagination } from '../utils/pagination' ;
7
5
8
6
export default class CategoriesController extends Controller {
@@ -11,11 +9,13 @@ export default class CategoriesController extends Controller {
11
9
@tracked per_page = 100 ;
12
10
@tracked sort = 'alpha' ;
13
11
14
- @reads ( 'model.meta.total' ) totalItems ;
15
-
16
12
@pagination ( ) pagination ;
17
13
18
14
get currentSortBy ( ) {
19
15
return this . sort === 'crates' ? '# Crates' : 'Alphabetical' ;
20
16
}
17
+
18
+ get totalItems ( ) {
19
+ return this . model . meta . total ?? 0 ;
20
+ }
21
21
}
Original file line number Diff line number Diff line change 1
1
import Controller from '@ember/controller' ;
2
2
import { tracked } from '@glimmer/tracking' ;
3
3
4
- import { reads } from 'macro-decorators' ;
5
-
6
4
import { pagination } from '../../utils/pagination' ;
7
5
8
6
export default class CategoryIndexController extends Controller {
@@ -11,8 +9,6 @@ export default class CategoryIndexController extends Controller {
11
9
@tracked per_page = 10 ;
12
10
@tracked sort = 'recent-downloads' ;
13
11
14
- @reads ( 'model.meta.total' ) totalItems ;
15
-
16
12
@pagination ( ) pagination ;
17
13
18
14
category = null ;
@@ -30,4 +26,8 @@ export default class CategoryIndexController extends Controller {
30
26
return 'Recent Downloads' ;
31
27
}
32
28
}
29
+
30
+ get totalItems ( ) {
31
+ return this . model . meta . total ?? 0 ;
32
+ }
33
33
}
Original file line number Diff line number Diff line change 1
1
import Controller from '@ember/controller' ;
2
2
import { tracked } from '@glimmer/tracking' ;
3
3
4
- import { reads } from 'macro-decorators' ;
5
-
6
4
import { pagination } from '../../utils/pagination' ;
7
5
8
6
export default class ReverseDependenciesController extends Controller {
@@ -11,7 +9,9 @@ export default class ReverseDependenciesController extends Controller {
11
9
@tracked per_page = 10 ;
12
10
@tracked crate = null ;
13
11
14
- @reads ( 'model.meta.total' ) totalItems ;
15
-
16
12
@pagination ( ) pagination ;
13
+
14
+ get totalItems ( ) {
15
+ return this . model . meta . total ?? 0 ;
16
+ }
17
17
}
Original file line number Diff line number Diff line change 1
1
import Controller from '@ember/controller' ;
2
2
import { tracked } from '@glimmer/tracking' ;
3
3
4
- import { reads } from 'macro-decorators' ;
5
-
6
4
import { pagination } from '../utils/pagination' ;
7
5
8
6
export default class CratesController extends Controller {
@@ -11,7 +9,6 @@ export default class CratesController extends Controller {
11
9
@tracked per_page = 50 ;
12
10
@tracked sort = 'recent-downloads' ;
13
11
14
- @reads ( 'model.meta.total' ) totalItems ;
15
12
@pagination ( ) pagination ;
16
13
17
14
get currentSortBy ( ) {
@@ -27,4 +24,8 @@ export default class CratesController extends Controller {
27
24
return 'Alphabetical' ;
28
25
}
29
26
}
27
+
28
+ get totalItems ( ) {
29
+ return this . model . meta . total ?? 0 ;
30
+ }
30
31
}
Original file line number Diff line number Diff line change 1
1
import Controller from '@ember/controller' ;
2
2
import { tracked } from '@glimmer/tracking' ;
3
3
4
- import { reads } from 'macro-decorators' ;
5
-
6
4
import { pagination } from '../utils/pagination' ;
7
5
8
6
export default class KeywordIndexController extends Controller {
@@ -11,8 +9,6 @@ export default class KeywordIndexController extends Controller {
11
9
@tracked per_page = 10 ;
12
10
@tracked sort = 'recent-downloads' ;
13
11
14
- @reads ( 'model.crates.meta.total' ) totalItems ;
15
-
16
12
@pagination ( ) pagination ;
17
13
18
14
get currentSortBy ( ) {
@@ -28,4 +24,8 @@ export default class KeywordIndexController extends Controller {
28
24
return 'Recent Downloads' ;
29
25
}
30
26
}
27
+
28
+ get totalItems ( ) {
29
+ return this . model . crates . meta . total ?? 0 ;
30
+ }
31
31
}
Original file line number Diff line number Diff line change 1
1
import Controller from '@ember/controller' ;
2
2
import { tracked } from '@glimmer/tracking' ;
3
3
4
- import { reads } from 'macro-decorators' ;
5
-
6
4
import { pagination } from '../utils/pagination' ;
7
5
8
6
export default class KeywordsController extends Controller {
@@ -11,11 +9,13 @@ export default class KeywordsController extends Controller {
11
9
@tracked per_page = 10 ;
12
10
@tracked sort = 'crates' ;
13
11
14
- @reads ( 'model.meta.total' ) totalItems ;
15
-
16
12
@pagination ( ) pagination ;
17
13
18
14
get currentSortBy ( ) {
19
15
return this . sort === 'crates' ? '# Crates' : 'Alphabetical' ;
20
16
}
17
+
18
+ get totalItems ( ) {
19
+ return this . model . meta . total ?? 0 ;
20
+ }
21
21
}
Original file line number Diff line number Diff line change 1
1
import Controller from '@ember/controller' ;
2
2
import { tracked } from '@glimmer/tracking' ;
3
3
4
- import { reads } from 'macro-decorators' ;
5
-
6
4
import { pagination } from '../../utils/pagination' ;
7
5
8
6
// TODO: reduce duplicatoin with controllers/crates
@@ -13,8 +11,6 @@ export default class MeCratesController extends Controller {
13
11
@tracked per_page = 10 ;
14
12
@tracked sort = 'alpha' ;
15
13
16
- @reads ( 'model.meta.total' ) totalItems ;
17
-
18
14
@pagination ( ) pagination ;
19
15
20
16
get currentSortBy ( ) {
@@ -30,4 +26,8 @@ export default class MeCratesController extends Controller {
30
26
return 'Alphabetical' ;
31
27
}
32
28
}
29
+
30
+ get totalItems ( ) {
31
+ return this . model . meta . total ?? 0 ;
32
+ }
33
33
}
Original file line number Diff line number Diff line change 1
1
import Controller from '@ember/controller' ;
2
2
import { tracked } from '@glimmer/tracking' ;
3
3
4
- import { reads } from 'macro-decorators' ;
5
-
6
4
import { pagination } from '../../utils/pagination' ;
7
5
8
6
// TODO: reduce duplicatoin with controllers/me/crates
@@ -13,11 +11,13 @@ export default class FollowingController extends Controller {
13
11
@tracked per_page = 10 ;
14
12
@tracked sort = 'alpha' ;
15
13
16
- @reads ( 'model.meta.total' ) totalItems ;
17
-
18
14
@pagination ( ) pagination ;
19
15
20
16
get currentSortBy ( ) {
21
17
return this . sort === 'downloads' ? 'Downloads' : 'Alphabetical' ;
22
18
}
19
+
20
+ get totalItems ( ) {
21
+ return this . model . meta . total ?? 0 ;
22
+ }
23
23
}
Original file line number Diff line number Diff line change @@ -29,8 +29,6 @@ export default class SearchController extends Controller {
29
29
return ! this . dataTask . lastComplete && this . dataTask . isRunning ;
30
30
}
31
31
32
- @reads ( 'model.meta.total' ) totalItems ;
33
-
34
32
@pagination ( ) pagination ;
35
33
36
34
get pageTitle ( ) {
@@ -75,4 +73,8 @@ export default class SearchController extends Controller {
75
73
76
74
return await this . store . query ( 'crate' , searchOptions ) ;
77
75
} ) ;
76
+
77
+ get totalItems ( ) {
78
+ return this . model . meta . total ?? 0 ;
79
+ }
78
80
}
Original file line number Diff line number Diff line change 1
1
import Controller from '@ember/controller' ;
2
2
import { tracked } from '@glimmer/tracking' ;
3
3
4
- import { reads } from 'macro-decorators' ;
5
-
6
4
import { pagination } from '../utils/pagination' ;
7
5
8
6
export default class TeamController extends Controller {
@@ -11,8 +9,6 @@ export default class TeamController extends Controller {
11
9
@tracked per_page = 10 ;
12
10
@tracked sort = 'alpha' ;
13
11
14
- @reads ( 'model.crates.meta.total' ) totalItems ;
15
-
16
12
@pagination ( ) pagination ;
17
13
18
14
get currentSortBy ( ) {
@@ -28,4 +24,8 @@ export default class TeamController extends Controller {
28
24
return 'Alphabetical' ;
29
25
}
30
26
}
27
+
28
+ get totalItems ( ) {
29
+ return this . model . crates . meta . total ?? 0 ;
30
+ }
31
31
}
You can’t perform that action at this time.
0 commit comments