Skip to content

Commit

Permalink
Merge branch 'trunk' into update/stats_set_last_xxx_days_end_yesterday
Browse files Browse the repository at this point in the history
  • Loading branch information
dognose24 committed Nov 28, 2024
2 parents d71ea24 + 3db330b commit 7a3ed16
Show file tree
Hide file tree
Showing 33 changed files with 1,028 additions and 501 deletions.
4 changes: 4 additions & 0 deletions client/components/panel/style.scss
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,10 @@
padding: 0;
}

.upsell-nudge {
width: 100%;
}

// TODO: remove after the untangling/hosting-menu flag is enabled
#primary > & {
margin-left: auto;
Expand Down
110 changes: 65 additions & 45 deletions client/hosting/deployments/index.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import page from '@automattic/calypso-router';
import { isEnabled } from '@automattic/calypso-config';
import page, { type Context } from '@automattic/calypso-router';
import {
makeLayout,
render as clientRender,
Expand All @@ -18,51 +19,70 @@ import {
export default function () {
page( '/github-deployments', siteSelection, sites, makeLayout, clientRender );

page(
'/github-deployments/:site',
siteSelection,
redirectToHostingPromoIfNotAtomic,
redirectHomeIfIneligible,
navigation,
deploymentsList,
siteDashboard( DOTCOM_GITHUB_DEPLOYMENTS ),
makeLayout,
clientRender
);
if ( isEnabled( 'untangling/hosting-menu' ) ) {
page( '/github-deployments/:site', ( context: Context ) => {
page.redirect( `/sites/tools/deployments/${ context.params.site }` );
} );
page( '/github-deployments/:site/create', ( context: Context ) => {
page.redirect( `/sites/tools/deployments/${ context.params.site }/create` );
} );
page( '/github-deployments/:site/manage/:deploymentId', ( context: Context ) => {
page.redirect(
`/sites/tools/deployments/${ context.params.site }/manage/${ context.params.deploymentId }`
);
} );
page( '/github-deployments/:site/logs/:deploymentId', ( context: Context ) => {
page.redirect(
`/sites/tools/deployments/${ context.params.site }/logs/${ context.params.deploymentId }`
);
} );
} else {
page(
'/github-deployments/:site',
siteSelection,
redirectToHostingPromoIfNotAtomic,
redirectHomeIfIneligible,
navigation,
deploymentsList,
siteDashboard( DOTCOM_GITHUB_DEPLOYMENTS ),
makeLayout,
clientRender
);

page(
'/github-deployments/:site/create',
siteSelection,
redirectToHostingPromoIfNotAtomic,
redirectHomeIfIneligible,
navigation,
deploymentCreation,
siteDashboard( DOTCOM_GITHUB_DEPLOYMENTS ),
makeLayout,
clientRender
);
page(
'/github-deployments/:site/create',
siteSelection,
redirectToHostingPromoIfNotAtomic,
redirectHomeIfIneligible,
navigation,
deploymentCreation,
siteDashboard( DOTCOM_GITHUB_DEPLOYMENTS ),
makeLayout,
clientRender
);

page(
'/github-deployments/:site/manage/:deploymentId',
siteSelection,
redirectToHostingPromoIfNotAtomic,
redirectHomeIfIneligible,
navigation,
deploymentManagement,
siteDashboard( DOTCOM_GITHUB_DEPLOYMENTS ),
makeLayout,
clientRender
);
page(
'/github-deployments/:site/manage/:deploymentId',
siteSelection,
redirectToHostingPromoIfNotAtomic,
redirectHomeIfIneligible,
navigation,
deploymentManagement,
siteDashboard( DOTCOM_GITHUB_DEPLOYMENTS ),
makeLayout,
clientRender
);

page(
'/github-deployments/:site/logs/:deploymentId',
siteSelection,
redirectToHostingPromoIfNotAtomic,
redirectHomeIfIneligible,
navigation,
deploymentRunLogs,
siteDashboard( DOTCOM_GITHUB_DEPLOYMENTS ),
makeLayout,
clientRender
);
page(
'/github-deployments/:site/logs/:deploymentId',
siteSelection,
redirectToHostingPromoIfNotAtomic,
redirectHomeIfIneligible,
navigation,
deploymentRunLogs,
siteDashboard( DOTCOM_GITHUB_DEPLOYMENTS ),
makeLayout,
clientRender
);
}
}
30 changes: 19 additions & 11 deletions client/hosting/hosting-features/index.tsx
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { isEnabled } from '@automattic/calypso-config';
import page, { Context as PageJSContext } from '@automattic/calypso-router';
import { addQueryArgs } from '@wordpress/url';
import { makeLayout, render as clientRender, redirectIfP2 } from 'calypso/controller';
Expand All @@ -18,15 +19,22 @@ const redirectForNonSimpleSite = ( context: PageJSContext, next: () => void ) =>

export default function () {
page( '/hosting-features', siteSelection, sites, makeLayout, clientRender );
page(
'/hosting-features/:site',
siteSelection,
navigation,
redirectForNonSimpleSite,
redirectIfP2,
hostingFeatures,
siteDashboard( DOTCOM_HOSTING_FEATURES ),
makeLayout,
clientRender
);

if ( isEnabled( 'untangling/hosting-menu' ) ) {
page( '/hosting-features/:site', ( context: PageJSContext ) => {
page.redirect( `/sites/tools/${ context.params.site }` );
} );
} else {
page(
'/hosting-features/:site',
siteSelection,
navigation,
redirectForNonSimpleSite,
redirectIfP2,
hostingFeatures,
siteDashboard( DOTCOM_HOSTING_FEATURES ),
makeLayout,
clientRender
);
}
}
64 changes: 37 additions & 27 deletions client/hosting/logs/index.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import page, { type Callback } from '@automattic/calypso-router';
import { isEnabled } from '@automattic/calypso-config';
import page, { type Callback, type Context } from '@automattic/calypso-router';
import {
makeLayout,
render as clientRender,
Expand All @@ -16,31 +17,40 @@ import { phpErrorLogs, webServerLogs } from './controller';
export default function () {
page( '/site-logs', siteSelection, sites, makeLayout, clientRender );

const redirectSiteLogsToPhp: Callback = ( context ) => {
context.page.replace( `/site-logs/${ context.params.site }/php` );
};
page( '/site-logs/:site', redirectSiteLogsToPhp );
if ( isEnabled( 'untangling/hosting-menu' ) ) {
page( '/site-logs/:site', ( context: Context ) => {
page.redirect( `/sites/tools/logs/${ context.params.site }` );
} );
page( '/site-logs/:site/:type', ( context: Context ) => {
page.redirect( `/sites/tools/logs/${ context.params.site }/${ context.params.type }` );
} );
} else {
const redirectSiteLogsToPhp: Callback = ( context ) => {
context.page.replace( `/site-logs/${ context.params.site }/php` );
};
page( '/site-logs/:site', redirectSiteLogsToPhp );

page(
'/site-logs/:site/php',
siteSelection,
redirectToHostingPromoIfNotAtomic,
redirectHomeIfIneligible,
navigation,
phpErrorLogs,
siteDashboard( DOTCOM_LOGS_PHP ),
makeLayout,
clientRender
);
page(
'/site-logs/:site/web',
siteSelection,
redirectToHostingPromoIfNotAtomic,
redirectHomeIfIneligible,
navigation,
webServerLogs,
siteDashboard( DOTCOM_LOGS_WEB ),
makeLayout,
clientRender
);
page(
'/site-logs/:site/php',
siteSelection,
redirectToHostingPromoIfNotAtomic,
redirectHomeIfIneligible,
navigation,
phpErrorLogs,
siteDashboard( DOTCOM_LOGS_PHP ),
makeLayout,
clientRender
);
page(
'/site-logs/:site/web',
siteSelection,
redirectToHostingPromoIfNotAtomic,
redirectHomeIfIneligible,
navigation,
webServerLogs,
siteDashboard( DOTCOM_LOGS_WEB ),
makeLayout,
clientRender
);
}
}
31 changes: 19 additions & 12 deletions client/hosting/monitoring/index.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import page from '@automattic/calypso-router';
import { isEnabled } from '@automattic/calypso-config';
import page, { type Context } from '@automattic/calypso-router';
import {
makeLayout,
render as clientRender,
Expand All @@ -12,15 +13,21 @@ import { redirectHomeIfIneligible, siteMonitoring } from './controller';
export default function () {
page( '/site-monitoring', siteSelection, sites, makeLayout, clientRender );

page(
'/site-monitoring/:site',
siteSelection,
redirectToHostingPromoIfNotAtomic,
redirectHomeIfIneligible,
navigation,
siteMonitoring,
siteDashboard( DOTCOM_MONITORING ),
makeLayout,
clientRender
);
if ( isEnabled( 'untangling/hosting-menu' ) ) {
page( '/site-monitoring/:site', ( context: Context ) => {
page.redirect( `/sites/tools/monitoring/${ context.params.site }` );
} );
} else {
page(
'/site-monitoring/:site',
siteSelection,
redirectToHostingPromoIfNotAtomic,
redirectHomeIfIneligible,
navigation,
siteMonitoring,
siteDashboard( DOTCOM_MONITORING ),
makeLayout,
clientRender
);
}
}
100 changes: 57 additions & 43 deletions client/hosting/overview/index.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import page from '@automattic/calypso-router';
import { isEnabled } from '@automattic/calypso-config';
import page, { Context as PageJSContext } from '@automattic/calypso-router';
import {
makeLayout,
render as clientRender,
Expand All @@ -18,50 +19,63 @@ import { hostingOverview, hostingConfiguration, hostingActivate } from './contro

export default function () {
page( '/overview', siteSelection, sites, makeLayout, clientRender );
page(
'/overview/:site',
siteSelection,
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
// @ts-ignore
redirectIfCurrentUserCannot( 'manage_options' ),
redirectIfP2,
redirectIfJetpackNonAtomic,
navigation,
hostingOverview,
siteDashboard( DOTCOM_OVERVIEW ),
makeLayout,
clientRender
);

if ( isEnabled( 'untangling/hosting-menu' ) ) {
page( '/overview/:site', ( context: PageJSContext ) => {
page.redirect( `/sites/overview/${ context.params.site }` );
} );
} else {
page(
'/overview/:site',
siteSelection,
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
// @ts-ignore
redirectIfCurrentUserCannot( 'manage_options' ),
redirectIfP2,
redirectIfJetpackNonAtomic,
navigation,
hostingOverview,
siteDashboard( DOTCOM_OVERVIEW ),
makeLayout,
clientRender
);
}

page( '/hosting-config', siteSelection, sites, makeLayout, clientRender );

page(
'/hosting-config/:site_id',
siteSelection,
navigation,
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
// @ts-ignore
redirectIfCurrentUserCannot( 'manage_options' ),
redirectToHostingPromoIfNotAtomic,
handleHostingPanelRedirect,
hostingConfiguration,
siteDashboard( DOTCOM_HOSTING_CONFIG ),
makeLayout,
clientRender
);
if ( isEnabled( 'untangling/hosting-menu' ) ) {
page( '/hosting-config/:site', ( context: PageJSContext ) => {
page.redirect( `/sites/tools/${ context.params.site }` );
} );
} else {
page(
'/hosting-config/:site_id',
siteSelection,
navigation,
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
// @ts-ignore
redirectIfCurrentUserCannot( 'manage_options' ),
redirectToHostingPromoIfNotAtomic,
handleHostingPanelRedirect,
hostingConfiguration,
siteDashboard( DOTCOM_HOSTING_CONFIG ),
makeLayout,
clientRender
);

page(
'/hosting-config/activate/:site_id',
siteSelection,
navigation,
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
// @ts-ignore
redirectIfCurrentUserCannot( 'manage_options' ),
redirectToHostingPromoIfNotAtomic,
handleHostingPanelRedirect,
hostingActivate,
siteDashboard( DOTCOM_HOSTING_CONFIG ),
makeLayout,
clientRender
);
page(
'/hosting-config/activate/:site_id',
siteSelection,
navigation,
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
// @ts-ignore
redirectIfCurrentUserCannot( 'manage_options' ),
redirectToHostingPromoIfNotAtomic,
handleHostingPanelRedirect,
hostingActivate,
siteDashboard( DOTCOM_HOSTING_CONFIG ),
makeLayout,
clientRender
);
}
}
Loading

0 comments on commit 7a3ed16

Please sign in to comment.