File size: 1,142 Bytes
1e92f2d
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
import page, { type Callback, type Context } from '@automattic/calypso-router';
import { makeLayout, render as clientRender } from 'calypso/controller';
import { siteSelection, sites, navigation } from 'calypso/my-sites/controller';
import { LOGS_PHP, LOGS_WEB } from 'calypso/sites/components/site-preview-pane/constants';
import { siteDashboard, redirectToHostingFeaturesIfNotAtomic } from 'calypso/sites/controller';
import { phpErrorLogs, webServerLogs } from './controller';

export default function () {
	page( '/site-logs', siteSelection, sites, makeLayout, clientRender );

	const redirectSiteLogsToPhp: Callback = ( context: Context ) => {
		context.page.replace( `/site-logs/${ context.params.site }/php` );
	};
	page( '/site-logs/:site', redirectSiteLogsToPhp );

	page(
		'/site-logs/:site/php',
		siteSelection,
		redirectToHostingFeaturesIfNotAtomic,
		navigation,
		phpErrorLogs,
		siteDashboard( LOGS_PHP ),
		makeLayout,
		clientRender
	);
	page(
		'/site-logs/:site/web',
		siteSelection,
		redirectToHostingFeaturesIfNotAtomic,
		navigation,
		webServerLogs,
		siteDashboard( LOGS_WEB ),
		makeLayout,
		clientRender
	);
}