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 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 | 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 2x 2x 1x 2x 2x 2x 2x 2x 2x 1x 1x 1x 2x 2x 1x | /* * Copyright 2021 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, { useEffect, useState } from 'react' import { useParams } from 'react-router-dom' import { Heading, Layout, Tabs, Tab, Icon, Text, HarnessDocTooltip, PageHeader, PageBody, PageSpinner } from '@wings-software/uicore' import { Breadcrumbs } from '@common/components/Breadcrumbs/Breadcrumbs' import routes from '@common/RouteDefinitions' import { useGetPerspective, CEView } from 'services/ce/' import PerspectiveBuilder from '../../components/PerspectiveBuilder' import ReportsAndBudgets from '../../components/PerspectiveReportsAndBudget/PerspectiveReportsAndBudgets' import css from './CreatePerspectivePage.module.scss' const PerspectiveHeader: React.FC<{ title: string }> = ({ title }) => { const { accountId } = useParams<{ perspectiveId: string; accountId: string }>() return ( <Layout.Horizontal> <Layout.Vertical> <Breadcrumbs links={[ { url: routes.toCEPerspectives({ accountId }), label: 'Perspectives' }, { label: '', url: '#' } ]} /> <Heading color="grey800" level={2}> {title} </Heading> </Layout.Vertical> </Layout.Horizontal> ) } const CreatePerspectivePage: React.FC = () => { const tabHeadings = ['1. Perspective Builder', '2. Reports and Budget'] const [selectedTabId, setSelectedTabId] = useState(tabHeadings[0]) const [perspectiveData, setPerspectiveData] = useState<CEView | null>(null) const { perspectiveId, accountId } = useParams<{ perspectiveId: string accountId: string }>() const { data: perspectiveRes, loading, error } = useGetPerspective({ queryParams: { perspectiveId: perspectiveId, accountIdentifier: accountId } }) useEffect(() => { Eif (perspectiveRes?.data) { const data = perspectiveRes.data setPerspectiveData(data) } }, [perspectiveRes?.data]) // const perspectiveData = perspectiveRes?.resource Iif (error) { const errorMessage = (error.data as any).message return ( <> <PageHeader title={<PerspectiveHeader title={perspectiveData?.name || perspectiveId} />} /> <PageBody> <Text margin="xxxlarge" color="red800" icon="error" iconProps={{ color: 'red800' }} > {errorMessage} </Text> </PageBody> </> ) } return ( <> <PageHeader title={<PerspectiveHeader title={perspectiveData?.name || perspectiveId} />} /> {loading && <PageSpinner />} <PageBody> {perspectiveData && ( <div className={css.mainContainer}> <div></div> <Tabs id="perspectiveBuilder" onChange={(id: string) => setSelectedTabId(id)} selectedTabId={selectedTabId} data-tabId={selectedTabId} > <Tab id={tabHeadings[0]} panel={ <PerspectiveBuilder perspectiveData={perspectiveData} onNext={resource => { setSelectedTabId(tabHeadings[1]) setPerspectiveData(resource) }} /> } panelClassName={css.panelClass} title={ <> <span data-tooltip-id="perspectiveBuilder" className={css.tab}> {tabHeadings[0]} </span> <HarnessDocTooltip tooltipId="perspectiveBuilder" useStandAlone={true} /> </> } data-testid={tabHeadings[0]} /> <Icon name="chevron-right" height={20} size={20} margin={{ right: 'small', left: 'small' }} color={'grey400'} style={{ alignSelf: 'center' }} /> <Tab disabled={selectedTabId === tabHeadings[0]} id={tabHeadings[1]} panelClassName={css.panelClass} title={ <> <span data-tooltip-id="perspectiveReportsAndBudget" className={css.tab}> {tabHeadings[1]} </span> <HarnessDocTooltip tooltipId="perspectiveReportsAndBudget" useStandAlone={true} /> </> } panel={ <ReportsAndBudgets onPrevButtonClick={() => { setSelectedTabId(tabHeadings[0]) }} values={perspectiveData} /> } data-testid={tabHeadings[1]} /> </Tabs> </div> )} </PageBody> </> ) } export default CreatePerspectivePage |