-
-
Notifications
You must be signed in to change notification settings - Fork 115
/
Copy pathmodule.js
58 lines (50 loc) · 1.85 KB
/
module.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
/* eslint-disable ember/classic-decorator-no-classic-methods, ember/no-computed-properties-in-native-classes, ember/no-get, prettier/prettier */
import { computed } from '@ember/object';
import { inject as service } from '@ember/service';
import { alias } from '@ember/object/computed';
import ClassController from '../classes/class';
import uniq from 'lodash.uniq';
import union from 'lodash.union';
export default class ModuleController extends ClassController {
@service
filterData;
@alias('filterData.sideNav.showPrivate')
showPrivateClasses;
@computed('model.submodules')
get submodules() {
return Object.keys(this.get('model.submodules'));
}
@computed('model.namespaces')
get namespaces() {
return Object.keys(this.get('model.namespaces'));
}
@computed('model.{privateclasses,publicclasses}', 'showPrivateClasses')
get classes() {
if (this.showPrivateClasses) {
return this.get('model.publicclasses').concat(
this.get('model.privateclasses')
);
}
return this.get('model.publicclasses');
}
@computed('classes', 'namespaces')
get classesAndNamespaces() {
return uniq(union(this.namespaces, this.classes).sort(), true);
}
@computed('model.{allstaticfunctions,staticfunctions}', 'showPrivateClasses')
get functionHeadings() {
if (this.get('model.allstaticfunctions') && this.showPrivateClasses) {
return Object.keys(this.get('model.allstaticfunctions')).sort();
} else if (this.get('model.staticfunctions')) {
return Object.keys(this.get('model.staticfunctions')).sort();
}
return {};
}
@computed('model.{allstaticfunctions,staticfunctions}', 'showPrivateClasses')
get functions() {
if (this.showPrivateClasses && this.get('model.allstaticfunctions')) {
return this.get('model.allstaticfunctions');
}
return this.get('model.staticfunctions');
}
}