-
Notifications
You must be signed in to change notification settings - Fork 390
upcoming: [UIE-9813] - Implement routing for Cloud Manager Marketplace #13222
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. Weβll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: develop
Are you sure you want to change the base?
Changes from all commits
4e71453
72bb820
fc0b67c
fc71b8a
ec21e88
a3700f1
c73c46e
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,5 @@ | ||
| --- | ||
| "@linode/manager": Upcoming Features | ||
| --- | ||
|
|
||
| Implement routing for Cloud Manager Marketplace ([#13222](https://github.com/linode/manager/pull/13222)) |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -22,6 +22,7 @@ | |
| import { useIsDatabasesEnabled } from 'src/features/Databases/utilities'; | ||
| import { useIsACLPLogsEnabled } from 'src/features/Delivery/deliveryUtils'; | ||
| import { useIsIAMEnabled } from 'src/features/IAM/hooks/useIsIAMEnabled'; | ||
| import { useIsMarketplaceV2Enabled } from 'src/features/Marketplace/utils'; | ||
| import { useIsNetworkLoadBalancerEnabled } from 'src/features/NetworkLoadBalancers/utils'; | ||
| import { useIsPlacementGroupsEnabled } from 'src/features/PlacementGroups/utils'; | ||
| import { useFlags } from 'src/hooks/useFlags'; | ||
|
|
@@ -54,13 +55,15 @@ | |
| | 'Longview' | ||
| | 'Maintenance' | ||
| | 'Managed' | ||
| | 'Marketplace' | ||
| | 'Marketplace' // TODO: Cloud Manager Marketplace - Remove marketplace references once 'Quick Deploy Apps' is fully rolled out | ||
|
Check warning on line 58 in packages/manager/src/components/PrimaryNav/PrimaryNav.tsx
|
||
| | 'Metrics' | ||
| | 'Monitor' | ||
| | 'Network Load Balancer' | ||
| | 'NodeBalancers' | ||
| | 'Object Storage' | ||
| | 'Partner Referrals' | ||
| | 'Placement Groups' | ||
| | 'Quick Deploy Apps' | ||
| | 'Quotas' | ||
| | 'Service Transfers' | ||
| | 'StackScripts' | ||
|
|
@@ -121,6 +124,8 @@ | |
|
|
||
| const { isNetworkLoadBalancerEnabled } = useIsNetworkLoadBalancerEnabled(); | ||
|
|
||
| const { isMarketplaceFeatureEnabled } = useIsMarketplaceV2Enabled(); | ||
|
|
||
| const { | ||
| data: preferences, | ||
| error: preferencesError, | ||
|
|
@@ -176,9 +181,18 @@ | |
| }, | ||
| { | ||
| attr: { 'data-qa-one-click-nav-btn': true }, | ||
| display: 'Marketplace', | ||
| display: !isMarketplaceFeatureEnabled | ||
| ? 'Marketplace' | ||
| : 'Quick Deploy Apps', | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I would strongly recommend revisiting your naming conventions. You're "enabling marketplace", which essentially is removing marketplace. This is the kind of semantic logic pitfall that leads to bad DX and bugs down the line. Not sure if you had semantic requirements for your tickets, but if so I'd advise to correct the course before moving further. At the very least, if you can't change your flag (which i think you still should do), make sure your logic utilities reference It also is the opposite of the account capability you're introducing VS the legacy capability..
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. You're right. Thanks for pointing this out. I've renamed the flag to |
||
| to: '/linodes/create/marketplace', | ||
| }, | ||
| { | ||
| attr: { 'data-qa-one-click-nav-btn': true }, | ||
| display: 'Partner Referrals', | ||
| hide: !isMarketplaceFeatureEnabled, | ||
| isBeta: isMarketplaceFeatureEnabled, | ||
| to: '/cloud-marketplace/catalog', | ||
| }, | ||
| ], | ||
| name: 'Compute', | ||
| }, | ||
|
|
@@ -353,6 +367,7 @@ | |
| isIAMBeta, | ||
| isIAMEnabled, | ||
| iamRbacPrimaryNavChanges, | ||
| isMarketplaceFeatureEnabled, | ||
| isNetworkLoadBalancerEnabled, | ||
| limitsEvolution, | ||
| ] | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,8 @@ | ||
| import { Notice } from '@linode/ui'; | ||
| import * as React from 'react'; | ||
|
|
||
| export const MarketplaceLanding = () => { | ||
| return ( | ||
| <Notice variant="info">Partner Referral Catalog is coming soon...</Notice> | ||
| ); | ||
| }; |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,9 @@ | ||
| import { createLazyRoute } from '@tanstack/react-router'; | ||
|
|
||
| import { MarketplaceLanding } from './MarketplaceLanding'; | ||
|
|
||
| export const marketplaceLazyRoute = createLazyRoute( | ||
| '/cloud-marketplace/catalog' | ||
| )({ | ||
| component: MarketplaceLanding, | ||
| }); |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,23 @@ | ||
| import { useFlags } from 'src/hooks/useFlags'; | ||
|
|
||
| /** | ||
| * Returns whether or not features related to the Marketplace project | ||
| * should be enabled. | ||
| * | ||
| * Note: Currently, this just uses the `marketplaceV2` feature flag as a source of truth, | ||
| * but will eventually also look at account capabilities if available. | ||
| */ | ||
| export const useIsMarketplaceV2Enabled = () => { | ||
| const flags = useFlags(); | ||
|
|
||
| if (!flags) { | ||
| return { | ||
| isMarketplaceFeatureEnabled: false, | ||
| }; | ||
| } | ||
|
|
||
| // @TODO: Cloud Manager Marketplace - check for customer tag/account capability when it exists | ||
|
Check warning on line 19 in packages/manager/src/features/Marketplace/utils.ts
|
||
| return { | ||
| isMarketplaceFeatureEnabled: flags.marketplaceV2, | ||
| }; | ||
| }; | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,23 @@ | ||
| import { NotFound } from '@linode/ui'; | ||
| import { Outlet } from '@tanstack/react-router'; | ||
| import React from 'react'; | ||
|
|
||
| import { DocumentTitleSegment } from 'src/components/DocumentTitle'; | ||
| import { ProductInformationBanner } from 'src/components/ProductInformationBanner/ProductInformationBanner'; | ||
| import { SuspenseLoader } from 'src/components/SuspenseLoader'; | ||
| import { useIsMarketplaceV2Enabled } from 'src/features/Marketplace/utils'; | ||
|
|
||
| export const MarketplaceRoute = () => { | ||
| const { isMarketplaceFeatureEnabled } = useIsMarketplaceV2Enabled(); | ||
|
|
||
| if (!isMarketplaceFeatureEnabled) { | ||
| return <NotFound />; | ||
| } | ||
| return ( | ||
| <React.Suspense fallback={<SuspenseLoader />}> | ||
| <DocumentTitleSegment segment="Partner Referrals" /> | ||
| <ProductInformationBanner bannerLocation="Marketplace" /> | ||
| <Outlet /> | ||
| </React.Suspense> | ||
| ); | ||
| }; |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,32 @@ | ||
| import { createRoute, redirect } from '@tanstack/react-router'; | ||
|
|
||
| import { rootRoute } from '../root'; | ||
| import { MarketplaceRoute } from './MarketplaceRoute'; | ||
|
|
||
| export const marketplaceRoute = createRoute({ | ||
| component: MarketplaceRoute, | ||
| getParentRoute: () => rootRoute, | ||
| path: 'cloud-marketplace', | ||
| }); | ||
|
|
||
| export const marketplaceLandingRoute = createRoute({ | ||
| beforeLoad: async () => { | ||
| throw redirect({ to: '/cloud-marketplace/catalog' }); | ||
| }, | ||
| getParentRoute: () => marketplaceRoute, | ||
| path: '/', | ||
| }); | ||
|
|
||
| export const marketplaceCatlogRoute = createRoute({ | ||
| getParentRoute: () => marketplaceRoute, | ||
| path: '/catalog', | ||
| }).lazy(() => | ||
| import('src/features/Marketplace/marketplaceLazyRoute').then( | ||
| (m) => m.marketplaceLazyRoute | ||
| ) | ||
| ); | ||
|
|
||
| export const marketplaceRouteTree = marketplaceRoute.addChildren([ | ||
| marketplaceLandingRoute, | ||
| marketplaceCatlogRoute, | ||
| ]); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can we also change this const to
isMarketplaceV2FeatureEnabled?