Press n or j to go to the next uncovered block, b, p or k for the previous block.
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 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 | 2x 2x 2x 2x 2x 2x 2x 2x 2x 2x 6x 6x 3x 1x 1x 3x 3x 1x 6x 2x 7x 7x 7x 7x 7x 1x 6x 6x 6x 2x | /* * Copyright 2022 Harness Inc. All rights reserved. * Use of this source code is governed by the PolyForm Shield 1.0.0 license * that can be found in the licenses directory at the root of this repository, also available at * https://polyformproject.org/wp-content/uploads/2020/06/PolyForm-Shield-1.0.0.txt. */ import React from 'react' import { Layout, PageError, PageSpinner } from '@wings-software/uicore' import { useStrings } from 'framework/strings' import { ModuleName } from 'framework/types/ModuleName' import { FetchPlansQuery, useFetchPlansQuery } from 'services/common/services' import { isCDCommunity, useLicenseStore } from 'framework/LicenseStore/LicenseStoreContext' import { Editions } from '@common/constants/SubscriptionTypes' import Plans from './Plans' import CommunityPlans from './CommunityPlans' interface SubscriptionPlansProps { module: ModuleName } interface PlanTabsProps { module: ModuleName plans?: FetchPlansQuery['pricing'] } const PlanTabs: React.FC<PlanTabsProps> = ({ module, plans }) => { const getPlanByModule = (): React.ReactElement => { switch (module) { case ModuleName.CI: return ( <Plans module={module} plans={plans?.ciSaasPlans} featureCaption={plans?.ciSaasFeatureCaption} featureGroup={plans?.ciSaasFeatureGroup} /> ) case ModuleName.CF: return ( <Plans module={module} plans={plans?.ffPlans} featureCaption={plans?.ffFeatureCaption} featureGroup={plans?.ffFeatureGroup} /> ) case ModuleName.CD: return ( <Plans module={module} plans={plans?.cdPlans?.filter(plan => plan?.title?.toUpperCase() !== Editions.COMMUNITY)} featureCaption={plans?.cdFeatureCaption?.filter( caption => caption?.title?.toUpperCase() !== Editions.COMMUNITY )} featureGroup={plans?.cdFeatureGroup} /> ) case ModuleName.CE: return ( <Plans module={module} plans={plans?.ccPlans} featureCaption={plans?.ccFeatureCaption} featureGroup={plans?.ccFeatureGroup} /> ) } return <></> } return getPlanByModule() } const SubscriptionPlans: React.FC<SubscriptionPlansProps> = ({ module }) => { const { licenseInformation } = useLicenseStore() const [result, executeQuery] = useFetchPlansQuery() const { data, fetching, error } = result const { getString } = useStrings() if (isCDCommunity(licenseInformation)) { return <CommunityPlans /> } Iif (fetching) { return <PageSpinner /> } Iif (error) { return ( <PageError message={error.message || getString('somethingWentWrong')} onClick={() => executeQuery({ requestPolicy: 'cache-and-network' }) } /> ) } return ( <Layout.Vertical width={'90%'}> <PlanTabs module={module} plans={data?.pricing} /> </Layout.Vertical> ) } export default SubscriptionPlans |