@@ -63,10 +63,10 @@ let Empty = createClass({
63
63
} ) ;
64
64
65
65
const AccountSettingsPage = ( ) => (
66
- < AccountView section = 'Account Settings' >
67
- < AccountOverview />
68
- </ AccountView >
69
- ) ;
66
+ < AccountView section = 'Account Settings' >
67
+ < AccountOverview />
68
+ </ AccountView >
69
+ ) ;
70
70
71
71
const PARSE_DOT_COM_SERVER_INFO = {
72
72
features : {
@@ -121,8 +121,8 @@ export default class Dashboard extends React.Component {
121
121
}
122
122
123
123
componentDidMount ( ) {
124
- get ( '/parse-dashboard-config.json' ) . then ( ( { apps, newFeaturesInLatestVersion = [ ] } ) => {
125
- this . setState ( { newFeaturesInLatestVersion } ) ;
124
+ get ( '/parse-dashboard-config.json' ) . then ( ( { apps, newFeaturesInLatestVersion = [ ] } ) => {
125
+ this . setState ( { newFeaturesInLatestVersion} ) ;
126
126
let appInfoPromises = apps . map ( app => {
127
127
if ( app . serverURL . startsWith ( 'https://api.parse.com/1' ) ) {
128
128
//api.parse.com doesn't have feature availability endpoint, fortunately we know which features
@@ -135,25 +135,27 @@ export default class Dashboard extends React.Component {
135
135
'GET' ,
136
136
'serverInfo' ,
137
137
{ } ,
138
- { useMasterKey : true }
138
+ { useMasterKey : true }
139
139
) . then ( async serverInfo => {
140
140
const allowed = await get ( '/allowed-features.json' ) ;
141
- if ( Object . keys ( allowed ) . length === 0 ) {
142
- console . log ( 'allowed' , allowed , app ) ;
141
+ if ( Object . keys ( allowed ) . length === 0 ) {
143
142
app . serverInfo = serverInfo ;
144
143
return app ;
145
144
}
146
- if ( serverInfo . features . schemas && ! allowed . schemas ) {
147
- delete serverInfo . features . schemas ;
148
- } else if ( serverInfo . features . schemas && allowed . schemas ) {
149
- serverInfo . features . schemas = allowed . schemas ;
150
- }
151
- if ( serverInfo . features . push && ! allowed . push ) {
152
- delete serverInfo . features . push ;
153
- } else if ( serverInfo . features . push && allowed . push ) {
154
- serverInfo . features . push = allowed . push ;
145
+ for ( const feature in serverInfo . features ) {
146
+ switch ( allowed [ feature ] ) {
147
+ case false :
148
+ delete serverInfo . features [ feature ] ; //remove feature
149
+ break ;
150
+ case true :
151
+ continue ; //use unmodified
152
+ default :
153
+ for ( const detail in serverInfo . features [ feature ] ) {
154
+ if ( false === allowed [ feature ] [ detail ] )
155
+ serverInfo . features [ feature ] [ detail ] = false //disable detail
156
+ }
157
+ }
155
158
}
156
- console . log ( serverInfo ) ;
157
159
app . serverInfo = serverInfo ;
158
160
return app ;
159
161
} , error => {
@@ -183,12 +185,12 @@ export default class Dashboard extends React.Component {
183
185
}
184
186
} ) ;
185
187
return Promise . all ( appInfoPromises ) ;
186
- } ) . then ( function ( resolvedApps ) {
188
+ } ) . then ( function ( resolvedApps ) {
187
189
resolvedApps . forEach ( app => {
188
190
AppsManager . addApp ( app ) ;
189
191
} ) ;
190
- this . setState ( { configLoadingState : AsyncStatus . SUCCESS } ) ;
191
- } . bind ( this ) ) . catch ( ( { error } ) => {
192
+ this . setState ( { configLoadingState : AsyncStatus . SUCCESS } ) ;
193
+ } . bind ( this ) ) . catch ( ( { error} ) => {
192
194
this . setState ( {
193
195
configLoadingError : error ,
194
196
configLoadingState : AsyncStatus . FAILED
@@ -205,7 +207,7 @@ export default class Dashboard extends React.Component {
205
207
return < div className = { styles . empty } >
206
208
< div className = { center } >
207
209
< div className = { styles . cloud } >
208
- < Icon width = { 110 } height = { 110 } name = 'cloud-surprise' fill = '#1e3b4d' />
210
+ < Icon width = { 110 } height = { 110 } name = 'cloud-surprise' fill = '#1e3b4d' />
209
211
</ div >
210
212
{ /* use non-breaking hyphen for the error message to keep the filename on one line */ }
211
213
< div className = { styles . loadingError } > { this . state . configLoadingError . replace ( / - / g, '\u2011' ) } </ div >
@@ -219,128 +221,128 @@ export default class Dashboard extends React.Component {
219
221
</ AccountView >
220
222
) ;
221
223
222
- const SettingsRoute = ( { match } ) => (
223
- < SettingsData params = { match . params } >
224
+ const SettingsRoute = ( { match} ) => (
225
+ < SettingsData params = { match . params } >
224
226
< Switch >
225
- < Route path = { match . url + '/general' } component = { GeneralSettings } />
226
- < Route path = { match . url + '/keys' } component = { SecuritySettings } />
227
- < Route path = { match . url + '/users' } component = { UsersSettings } />
228
- < Route path = { match . url + '/push' } component = { PushSettings } />
229
- < Route path = { match . url + '/hosting' } component = { HostingSettings } />
227
+ < Route path = { match . url + '/general' } component = { GeneralSettings } />
228
+ < Route path = { match . url + '/keys' } component = { SecuritySettings } />
229
+ < Route path = { match . url + '/users' } component = { UsersSettings } />
230
+ < Route path = { match . url + '/push' } component = { PushSettings } />
231
+ < Route path = { match . url + '/hosting' } component = { HostingSettings } />
230
232
</ Switch >
231
233
</ SettingsData >
232
234
)
233
235
234
236
const JobsRoute = ( props ) => (
235
237
< Switch >
236
- < Route exact path = { props . match . path + '/new' } render = { ( props ) => (
238
+ < Route exact path = { props . match . path + '/new' } render = { ( props ) => (
237
239
< JobsData { ...props } params = { props . match . params } >
238
240
< JobEdit params = { props . match . params } />
239
241
</ JobsData >
240
- ) } />
241
- < Route path = { props . match . path + '/edit/:jobId' } render = { ( props ) => (
242
+ ) } />
243
+ < Route path = { props . match . path + '/edit/:jobId' } render = { ( props ) => (
242
244
< JobsData { ...props } params = { props . match . params } >
243
245
< JobEdit params = { props . match . params } />
244
246
</ JobsData >
245
- ) } />
246
- < Route path = { props . match . path + '/:section' } render = { ( props ) => (
247
+ ) } />
248
+ < Route path = { props . match . path + '/:section' } render = { ( props ) => (
247
249
< JobsData { ...props } params = { props . match . params } >
248
250
< Jobs { ...props } params = { props . match . params } />
249
251
</ JobsData >
250
- ) } />
251
- < Redirect from = { props . match . path } to = '/apps/:appId/jobs/all' />
252
+ ) } />
253
+ < Redirect from = { props . match . path } to = '/apps/:appId/jobs/all' />
252
254
</ Switch >
253
255
)
254
256
255
- const AnalyticsRoute = ( { match } ) => (
257
+ const AnalyticsRoute = ( { match} ) => (
256
258
< Switch >
257
- < Route path = { match . path + '/overview' } component = { AnalyticsOverview } />
258
- < Redirect exact from = { match . path + '/explorer' } to = '/apps/:appId/analytics/explorer/chart' />
259
- < Route path = { match . path + '/explorer/:displayType' } component = { Explorer } />
260
- < Route path = { match . path + '/retention' } component = { Retention } />
261
- < Route path = { match . path + '/performance' } component = { Performance } />
262
- < Route path = { match . path + '/slow_queries' } component = { SlowQueries } />
259
+ < Route path = { match . path + '/overview' } component = { AnalyticsOverview } />
260
+ < Redirect exact from = { match . path + '/explorer' } to = '/apps/:appId/analytics/explorer/chart' />
261
+ < Route path = { match . path + '/explorer/:displayType' } component = { Explorer } />
262
+ < Route path = { match . path + '/retention' } component = { Retention } />
263
+ < Route path = { match . path + '/performance' } component = { Performance } />
264
+ < Route path = { match . path + '/slow_queries' } component = { SlowQueries } />
263
265
</ Switch >
264
266
) ;
265
267
266
268
const BrowserRoute = ( props ) => {
267
269
if ( ShowSchemaOverview ) {
268
- return < SchemaOverview { ...props } params = { props . match . params } />
270
+ return < SchemaOverview { ...props } params = { props . match . params } />
269
271
}
270
- return < Browser { ...props } params = { props . match . params } />
272
+ return < Browser { ...props } params = { props . match . params } />
271
273
}
272
274
273
275
const ApiConsoleRoute = ( props ) => (
274
276
< Switch >
275
- < Route path = { props . match . path + '/rest' } render = { props => (
277
+ < Route path = { props . match . path + '/rest' } render = { props => (
276
278
< ApiConsole { ...props } >
277
- < RestConsole />
279
+ < RestConsole />
278
280
</ ApiConsole >
279
- ) } />
280
- < Route path = { props . match . path + '/graphql' } render = { props => (
281
+ ) } />
282
+ < Route path = { props . match . path + '/graphql' } render = { props => (
281
283
< ApiConsole { ...props } >
282
- < GraphQLConsole />
284
+ < GraphQLConsole />
283
285
</ ApiConsole >
284
- ) } />
285
- < Route path = { props . match . path + '/js_console' } render = { props => (
286
+ ) } />
287
+ < Route path = { props . match . path + '/js_console' } render = { props => (
286
288
< ApiConsole { ...props } >
287
- < Playground />
289
+ < Playground />
288
290
</ ApiConsole >
289
- ) } />
290
- < Redirect from = { props . match . path } to = '/apps/:appId/api_console/rest' />
291
+ ) } />
292
+ < Redirect from = { props . match . path } to = '/apps/:appId/api_console/rest' />
291
293
</ Switch >
292
294
)
293
295
294
- const AppRoute = ( { match } ) => (
295
- < AppData params = { match . params } >
296
+ const AppRoute = ( { match} ) => (
297
+ < AppData params = { match . params } >
296
298
< Switch >
297
- < Route path = { match . path + '/getting_started' } component = { Empty } />
298
- < Route path = { match . path + '/browser/:className/:entityId/:relationName' } component = { BrowserRoute } />
299
- < Route path = { match . path + '/browser/:className' } component = { BrowserRoute } />
300
- < Route path = { match . path + '/browser' } component = { BrowserRoute } />
301
- < Route path = { match . path + '/cloud_code' } component = { CloudCode } />
302
- < Route path = { match . path + '/cloud_code/*' } component = { CloudCode } />
303
- < Route path = { match . path + '/webhooks' } component = { Webhooks } />
299
+ < Route path = { match . path + '/getting_started' } component = { Empty } />
300
+ < Route path = { match . path + '/browser/:className/:entityId/:relationName' } component = { BrowserRoute } />
301
+ < Route path = { match . path + '/browser/:className' } component = { BrowserRoute } />
302
+ < Route path = { match . path + '/browser' } component = { BrowserRoute } />
303
+ < Route path = { match . path + '/cloud_code' } component = { CloudCode } />
304
+ < Route path = { match . path + '/cloud_code/*' } component = { CloudCode } />
305
+ < Route path = { match . path + '/webhooks' } component = { Webhooks } />
304
306
305
- < Route path = { match . path + '/jobs' } component = { JobsRoute } />
307
+ < Route path = { match . path + '/jobs' } component = { JobsRoute } />
306
308
307
- < Route path = { match . path + '/logs/:type' } render = { ( props ) => (
308
- < Logs { ...props } params = { props . match . params } />
309
- ) } />
310
- < Redirect from = { match . path + '/logs' } to = '/apps/:appId/logs/info' />
309
+ < Route path = { match . path + '/logs/:type' } render = { ( props ) => (
310
+ < Logs { ...props } params = { props . match . params } />
311
+ ) } />
312
+ < Redirect from = { match . path + '/logs' } to = '/apps/:appId/logs/info' />
311
313
312
- < Route path = { match . path + '/config' } component = { Config } />
313
- < Route path = { match . path + '/api_console' } component = { ApiConsoleRoute } />
314
- < Route path = { match . path + '/migration' } component = { Migration } />
314
+ < Route path = { match . path + '/config' } component = { Config } />
315
+ < Route path = { match . path + '/api_console' } component = { ApiConsoleRoute } />
316
+ < Route path = { match . path + '/migration' } component = { Migration } />
315
317
316
318
317
- < Redirect exact from = { match . path + '/push' } to = '/apps/:appId/push/new' />
318
- < Redirect exact from = { match . path + '/push/activity' } to = '/apps/:appId/push/activity/all' />
319
+ < Redirect exact from = { match . path + '/push' } to = '/apps/:appId/push/new' />
320
+ < Redirect exact from = { match . path + '/push/activity' } to = '/apps/:appId/push/activity/all' />
319
321
320
- < Route path = { match . path + '/push/activity/:category' } render = { ( props ) => (
321
- < PushIndex { ...props } params = { props . match . params } />
322
- ) } />
323
- < Route path = { match . path + '/push/audiences' } component = { PushAudiencesIndex } />
324
- < Route path = { match . path + '/push/new' } component = { PushNew } />
325
- < Route path = { match . path + '/push/:pushId' } render = { ( props ) => (
326
- < PushDetails { ...props } params = { props . match . params } />
327
- ) } />
322
+ < Route path = { match . path + '/push/activity/:category' } render = { ( props ) => (
323
+ < PushIndex { ...props } params = { props . match . params } />
324
+ ) } />
325
+ < Route path = { match . path + '/push/audiences' } component = { PushAudiencesIndex } />
326
+ < Route path = { match . path + '/push/new' } component = { PushNew } />
327
+ < Route path = { match . path + '/push/:pushId' } render = { ( props ) => (
328
+ < PushDetails { ...props } params = { props . match . params } />
329
+ ) } />
328
330
329
331
{ /* Unused routes... */ }
330
- < Redirect exact from = { match . path + '/analytics' } to = '/apps/:appId/analytics/overview' />
331
- < Route path = { match . path + '/analytics' } component = { AnalyticsRoute } />
332
- < Redirect exact from = { match . path + '/settings' } to = '/apps/:appId/settings/general' />
333
- < Route path = { match . path + '/settings' } component = { SettingsRoute } />
332
+ < Redirect exact from = { match . path + '/analytics' } to = '/apps/:appId/analytics/overview' />
333
+ < Route path = { match . path + '/analytics' } component = { AnalyticsRoute } />
334
+ < Redirect exact from = { match . path + '/settings' } to = '/apps/:appId/settings/general' />
335
+ < Route path = { match . path + '/settings' } component = { SettingsRoute } />
334
336
</ Switch >
335
337
</ AppData >
336
338
)
337
339
338
340
const Index = ( ) => (
339
341
< div >
340
342
< Switch >
341
- < Redirect exact from = '/apps/:appId' to = '/apps/:appId/browser' />
342
- < Route exact path = '/apps' component = { AppsIndexPage } />
343
- < Route path = '/apps/:appId' component = { AppRoute } />
343
+ < Redirect exact from = '/apps/:appId' to = '/apps/:appId/browser' />
344
+ < Route exact path = '/apps' component = { AppsIndexPage } />
345
+ < Route path = '/apps/:appId' component = { AppRoute } />
344
346
</ Switch >
345
347
</ div >
346
348
)
@@ -351,11 +353,11 @@ export default class Dashboard extends React.Component {
351
353
< title > Parse Dashboard</ title >
352
354
</ Helmet >
353
355
< Switch >
354
- < Route path = '/apps' component = { Index } />
355
- < Route path = '/account/overview' component = { AccountSettingsPage } />
356
- < Redirect from = '/account' to = '/account/overview' />
357
- < Redirect from = '/' to = '/apps' />
358
- < Route path = '*' component = { FourOhFour } />
356
+ < Route path = '/apps' component = { Index } />
357
+ < Route path = '/account/overview' component = { AccountSettingsPage } />
358
+ < Redirect from = '/account' to = '/account/overview' />
359
+ < Redirect from = '/' to = '/apps' />
360
+ < Route path = '*' component = { FourOhFour } />
359
361
</ Switch >
360
362
</ div >
361
363
</ Router >
0 commit comments