@@ -26,104 +26,191 @@ export default class DashboardView extends React.Component {
26
26
this . context . currentApp . getMigrations ( ) . promise . then ( ( ) => this . forceUpdate ( ) ) ;
27
27
}
28
28
29
- let coreSubsections = [
30
- {
29
+ let coreSubsections = [ ]
30
+
31
+ if ( this . context . currentApp . enabledFeatures . dataBrowser ) {
32
+ coreSubsections . push ( {
31
33
name : 'Browser' ,
32
34
link : '/browser'
33
- } , {
35
+ } ) ;
36
+ }
37
+
38
+ if ( this . context . currentApp . enabledFeatures . cloudCode ) {
39
+ coreSubsections . push ( {
34
40
name : 'Cloud Code' ,
35
41
link : '/cloud_code'
36
- } , {
42
+ } ) ;
43
+ }
44
+
45
+ if ( this . context . currentApp . enabledFeatures . webhooks ) {
46
+ coreSubsections . push ( {
37
47
name : 'Webhooks' ,
38
48
link : '/webhooks'
39
- } , {
49
+ } ) ;
50
+ }
51
+
52
+ if ( this . context . currentApp . enabledFeatures . jobs ) {
53
+ coreSubsections . push ( {
40
54
name : 'Jobs' ,
41
55
link : '/jobs'
42
- } , {
56
+ } ) ;
57
+ }
58
+
59
+ if ( this . context . currentApp . enabledFeatures . logs ) {
60
+ coreSubsections . push ( {
43
61
name : 'Logs' ,
44
62
link : '/logs'
45
- } , {
63
+ } ) ;
64
+ }
65
+
66
+ if ( this . context . currentApp . enabledFeatures . config ) {
67
+ coreSubsections . push ( {
46
68
name : 'Config' ,
47
69
link : '/config'
48
- } , {
70
+ } ) ;
71
+ }
72
+
73
+ if ( this . context . currentApp . enabledFeatures . apiConsole ) {
74
+ coreSubsections . push ( {
49
75
name : 'API Console' ,
50
76
link : '/api_console'
51
- } ,
52
- ] ;
77
+ } ) ;
78
+ }
53
79
54
80
if ( this . context . currentApp . migration ) {
55
81
coreSubsections . push ( {
56
82
name : 'Migration' ,
57
83
link : '/migration' ,
58
84
} ) ;
59
85
}
86
+ let pushSubsections = [ ] ;
60
87
61
- let appSidebarSections = [
62
- {
88
+ if ( this . context . currentApp . enabledFeatures . push ) {
89
+ pushSubsections . push ( {
90
+ name : 'Activity' ,
91
+ link : '/push/activity'
92
+ } ) ;
93
+ }
94
+
95
+ if ( this . context . currentApp . enabledFeatures . pushAudiences ) {
96
+ pushSubsections . push ( {
97
+ name : 'Audiences' ,
98
+ link : '/push/audiences'
99
+ } ) ;
100
+ }
101
+
102
+ let analyticsSidebarSections = [ ] ;
103
+
104
+ if ( this . context . currentApp . enabledFeatures . analyticsOverview ) {
105
+ analyticsSidebarSections . push ( {
106
+ name : 'Overview' ,
107
+ link : '/analytics/overview'
108
+ } ) ;
109
+ }
110
+
111
+ if ( this . context . currentApp . enabledFeatures . explorer ) {
112
+ analyticsSidebarSections . push ( {
113
+ name : 'Explorer' ,
114
+ link : '/analytics/explorer'
115
+ } ) ;
116
+ }
117
+
118
+ if ( this . context . currentApp . enabledFeatures . retention ) {
119
+ analyticsSidebarSections . push ( {
120
+ name : 'Retention' ,
121
+ link : '/analytics/retention'
122
+ } ) ;
123
+ }
124
+
125
+ if ( this . context . currentApp . enabledFeatures . performance ) {
126
+ analyticsSidebarSections . push ( {
127
+ name : 'Performance' ,
128
+ link : '/analytics/performance'
129
+ } ) ;
130
+ }
131
+
132
+ if ( this . context . currentApp . enabledFeatures . slowQueryTool ) {
133
+ analyticsSidebarSections . push ( {
134
+ name : 'Slow Queries' ,
135
+ link : '/analytics/slow_queries'
136
+ } ) ;
137
+ }
138
+
139
+ let settingsSections = [ ] ;
140
+
141
+ if ( this . context . currentApp . enabledFeatures . generalSettings ) {
142
+ settingsSections . push ( {
143
+ name : 'General' ,
144
+ link : '/settings/general'
145
+ } ) ;
146
+ }
147
+
148
+ if ( this . context . currentApp . enabledFeatures . keysSettings ) {
149
+ settingsSections . push ( {
150
+ name : 'Security & Keys' ,
151
+ link : '/settings/keys'
152
+ } ) ;
153
+ }
154
+
155
+ if ( this . context . currentApp . enabledFeatures . usersSettings ) {
156
+ settingsSections . push ( {
157
+ name : 'Users' ,
158
+ link : '/settings/users'
159
+ } )
160
+ }
161
+
162
+ if ( this . context . currentApp . enabledFeatures . pushSettings ) {
163
+ settingsSections . push ( {
164
+ name : 'Push' ,
165
+ link : '/settings/push'
166
+ } ) ;
167
+ }
168
+
169
+ if ( this . context . currentApp . enabledFeatures . hostingEmailsSettings ) {
170
+ settingsSections . push ( {
171
+ name : 'Hosting and Emails' ,
172
+ link : '/settings/hosting'
173
+ } ) ;
174
+ }
175
+
176
+ let appSidebarSections = [ ]
177
+
178
+ if ( coreSubsections . length > 0 ) {
179
+ appSidebarSections . push ( {
63
180
name : 'Core' ,
64
181
icon : 'core' ,
65
182
link : '/browser' ,
66
183
subsections : coreSubsections ,
67
- } , {
184
+ } ) ;
185
+ }
186
+
187
+ if ( pushSubsections . length > 0 ) {
188
+ appSidebarSections . push ( {
68
189
name : 'Push' ,
69
190
icon : 'push-outline' ,
70
191
link : '/push' ,
71
192
style : { paddingLeft : '16px' } ,
72
- subsections : [
73
- {
74
- name : 'Activity' ,
75
- link : '/push/activity'
76
- } , {
77
- name : 'Audiences' ,
78
- link : '/push/audiences'
79
- }
80
- ]
81
- } , {
193
+ subsections : pushSubsections ,
194
+ } ) ;
195
+ }
196
+
197
+ if ( analyticsSidebarSections . length > 0 ) {
198
+ appSidebarSections . push ( {
82
199
name : 'Analytics' ,
83
200
icon : 'analytics-outline' ,
84
201
link : '/analytics' ,
85
- subsections : [
86
- {
87
- name : 'Overview' ,
88
- link : '/analytics/overview'
89
- } , {
90
- name : 'Explorer' ,
91
- link : '/analytics/explorer'
92
- } , {
93
- name : 'Retention' ,
94
- link : '/analytics/retention'
95
- } , {
96
- name : 'Performance' ,
97
- link : '/analytics/performance'
98
- } , {
99
- name : 'Slow Queries' ,
100
- link : '/analytics/slow_queries'
101
- }
102
- ]
103
- } , {
202
+ subsections : analyticsSidebarSections
203
+ } ) ;
204
+ }
205
+
206
+ if ( settingsSections . length > 0 ) {
207
+ appSidebarSections . push ( {
104
208
name : 'App Settings' ,
105
209
icon : 'gear-solid' ,
106
210
link : '/settings' ,
107
- subsections : [
108
- {
109
- name : 'General' ,
110
- link : '/settings/general'
111
- } , {
112
- name : 'Security & Keys' ,
113
- link : '/settings/keys'
114
- } , {
115
- name : 'Users' ,
116
- link : '/settings/users'
117
- } , {
118
- name : 'Push' ,
119
- link : '/settings/push'
120
- } , {
121
- name : 'Hosting and Emails' ,
122
- link : '/settings/hosting'
123
- } ,
124
- ]
125
- }
126
- ] ;
211
+ subsections : settingsSections
212
+ } ) ;
213
+ } ;
127
214
128
215
let sidebar = (
129
216
< Sidebar
0 commit comments