-
Notifications
You must be signed in to change notification settings - Fork 6
feat: Deployment History Config Diff & Scope Variables Support in Comparison View across Config Diff #304
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
Merged
RohitRaj011
merged 36 commits into
develop
from
feat/pipeline-deploy-config-diff-revamp
Oct 17, 2024
Merged
feat: Deployment History Config Diff & Scope Variables Support in Comparison View across Config Diff #304
Changes from 21 commits
Commits
Show all changes
36 commits
Select commit
Hold shift + click to select a range
ddff3ac
refactor: Collapsible List, DeploymentConfigDiffNavigation: add suppo…
RohitRaj011 b58d82b
feat: SelectPicker - add support to show tippy on option
RohitRaj011 97aab9d
refactor: DeploymentConfigDiff - css refactor, add prop to hide divid…
RohitRaj011 cb4a62a
feat: DeploymentConfigDiff - Scope Variables Support & code refactor
RohitRaj011 90dd9f1
chore: version bump
RohitRaj011 e5e69fd
Merge branch 'develop' of github.com:devtron-labs/devtron-fe-common-l…
RohitRaj011 ee0f3b1
feat: TriggerOutput - DeploymentHistoryConfigDiff - revamp UI - using…
RohitRaj011 4ee5946
Merge pull request #319 from devtron-labs/feat/deployment-history-dif…
RohitRaj011 0628827
Merge branch 'develop' of github.com:devtron-labs/devtron-fe-common-l…
RohitRaj011 b7a2280
chore: version bump
RohitRaj011 d0949d1
feat: DeploymentConfigDiff - UAT changes, code refactor; DeploymentHi…
RohitRaj011 75d62ec
chore: version bump
RohitRaj011 c6c937b
fix: useForm: null check missing
RohitRaj011 843c9dd
fix: DeploymentHistory - diff state not properly showing in some case…
RohitRaj011 480a9f5
Merge branch 'develop' of github.com:devtron-labs/devtron-fe-common-l…
RohitRaj011 d7b7271
chore: version bump
RohitRaj011 95dcbad
fix: DeploymentConfigDiff: review fixes
RohitRaj011 0600b59
Merge branch 'develop' of github.com:devtron-labs/devtron-fe-common-l…
RohitRaj011 901f32e
chore: version bump
RohitRaj011 0c15444
fix: SelecPicker: tooltipProps null check
RohitRaj011 56ef7a0
Merge branch 'develop' of github.com:devtron-labs/devtron-fe-common-l…
RohitRaj011 38c5093
feat: DeploymentConfigDiff - logic refactor for resolving deployment …
RohitRaj011 e3a9275
feat: DeploymentHistoryConfigDiff - uat changes, code refactor
RohitRaj011 b180a0c
feat: Collapse - add Collapse component, DeploymentConfigDiff - handl…
RohitRaj011 90c527f
chore: version bump
RohitRaj011 0765c0c
refactor: DeploymentHistoryConfigDiff - Handle case for no configurat…
RohitRaj011 fd6437b
chore: version bump
RohitRaj011 ac34854
feat: DeploymentHistoryConfigDiff - add NullState for previous/curren…
RohitRaj011 1ebf287
chore: version bump
RohitRaj011 41abc0a
fix: review fix
RohitRaj011 16211d5
refactor: DeploymentConfigDiff.utils - code refactor
RohitRaj011 5f78425
refactor: DeploymentConfigDiff.utils - code refactor
RohitRaj011 8d2118e
Merge pull request #354 from devtron-labs/feat/pipeline-deploy-config…
RohitRaj011 193d05c
refactor: CollapsibleList, DeploymentConfigDiffNavigation - icon size…
RohitRaj011 825eb9d
Merge branch 'develop' of github.com:devtron-labs/devtron-fe-common-l…
RohitRaj011 02dd3b4
chore: version bump
RohitRaj011 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
244 changes: 244 additions & 0 deletions
244
...Shared/Components/CICDHistory/DeploymentHistoryConfigDiff/DeploymentHistoryConfigDiff.tsx
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,244 @@ | ||
| import { useMemo, useRef, useState } from 'react' | ||
| import { generatePath, Route, Switch, useLocation, useRouteMatch } from 'react-router-dom' | ||
|
|
||
| import { getAppEnvDeploymentConfigList, getDeploymentTemplateValues } from '@Shared/Components/DeploymentConfigDiff' | ||
| import { useAsync } from '@Common/Helper' | ||
| import { EnvResourceType, getAppEnvDeploymentConfig } from '@Shared/Services' | ||
| import { groupArrayByObjectKey } from '@Shared/Helpers' | ||
| import ErrorScreenManager from '@Common/ErrorScreenManager' | ||
| import { Progressing } from '@Common/Progressing' | ||
| import { useUrlFilters } from '@Common/Hooks' | ||
|
|
||
| import { abortPreviousRequests, getIsRequestAborted } from '@Common/Api' | ||
| import { DeploymentHistoryConfigDiffCompare } from './DeploymentHistoryConfigDiffCompare' | ||
| import { DeploymentHistoryConfigDiffProps, DeploymentHistoryConfigDiffQueryParams } from './types' | ||
| import { getPipelineDeploymentsWfrIds, getPipelineDeployments, parseDeploymentHistoryDiffSearchParams } from './utils' | ||
| import { renderDeploymentHistoryConfig } from './helpers' | ||
|
|
||
| export const DeploymentHistoryConfigDiff = ({ | ||
| appName, | ||
| envName, | ||
| pipelineId, | ||
| wfrId, | ||
| triggerHistory, | ||
| setFullScreenView, | ||
| runSource, | ||
| resourceId, | ||
| renderRunSource, | ||
| }: DeploymentHistoryConfigDiffProps) => { | ||
| // HOOKS | ||
| const { path, params } = useRouteMatch() | ||
| const { pathname, search } = useLocation() | ||
|
|
||
| // CONSTANTS | ||
| const pipelineDeployments = useMemo(() => getPipelineDeployments(triggerHistory), [triggerHistory]) | ||
| const { currentWfrId, previousWfrId } = useMemo( | ||
| () => getPipelineDeploymentsWfrIds({ pipelineDeployments, wfrId }), | ||
| [pipelineDeployments, wfrId], | ||
| ) | ||
| const isPreviousDeploymentConfigAvailable = !!previousWfrId | ||
|
|
||
| // REFS | ||
| const deploymentTemplateResolvedDataAbortControllerRef = useRef(new AbortController()) | ||
|
|
||
| // URL FILTERS | ||
| const { compareWfrId } = useUrlFilters<string, DeploymentHistoryConfigDiffQueryParams>({ | ||
| parseSearchParams: parseDeploymentHistoryDiffSearchParams(previousWfrId), | ||
| }) | ||
|
|
||
| // STATES | ||
| const [convertVariables, setConvertVariables] = useState(false) | ||
|
|
||
| // ASYNC CALLS | ||
| // Load comparison deployment data | ||
| const [ | ||
| compareDeploymentConfigLoader, | ||
| compareDeploymentConfig, | ||
| compareDeploymentConfigErr, | ||
| reloadCompareDeploymentConfig, | ||
| ] = useAsync( | ||
| () => | ||
| Promise.all([ | ||
| getAppEnvDeploymentConfig({ | ||
| params: { | ||
| appName, | ||
| envName, | ||
| configArea: 'DeploymentHistory', | ||
| pipelineId, | ||
| wfrId: currentWfrId, | ||
| }, | ||
| }), | ||
| isPreviousDeploymentConfigAvailable | ||
| ? getAppEnvDeploymentConfig({ | ||
| params: { | ||
| appName, | ||
| envName, | ||
| configArea: 'DeploymentHistory', | ||
| pipelineId, | ||
| wfrId: compareWfrId, | ||
| }, | ||
| }) | ||
| : null, | ||
| ]), | ||
| [currentWfrId, compareWfrId], | ||
| ) | ||
|
|
||
| const [ | ||
| deploymentTemplateResolvedDataLoader, | ||
| deploymentTemplateResolvedData, | ||
| deploymentTemplateResolvedDataErr, | ||
| reloadDeploymentTemplateResolvedData, | ||
| ] = useAsync( | ||
| () => | ||
| abortPreviousRequests( | ||
| () => | ||
| Promise.all([ | ||
eshankvaish marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| getAppEnvDeploymentConfig({ | ||
| params: { | ||
| configArea: 'ResolveData', | ||
| appName, | ||
| envName, | ||
| }, | ||
| payload: { | ||
| values: getDeploymentTemplateValues( | ||
| compareDeploymentConfig[0].result?.deploymentTemplate, | ||
| ), | ||
| }, | ||
| signal: deploymentTemplateResolvedDataAbortControllerRef.current?.signal, | ||
| }), | ||
| getAppEnvDeploymentConfig({ | ||
| params: { | ||
| configArea: 'ResolveData', | ||
| appName, | ||
| envName, | ||
| }, | ||
| payload: { | ||
| values: getDeploymentTemplateValues( | ||
| compareDeploymentConfig[1].result?.deploymentTemplate, | ||
| ), | ||
| }, | ||
| signal: deploymentTemplateResolvedDataAbortControllerRef.current?.signal, | ||
| }), | ||
| ]), | ||
| deploymentTemplateResolvedDataAbortControllerRef, | ||
| ), | ||
| [convertVariables, compareDeploymentConfig], | ||
| convertVariables && !!compareDeploymentConfig, | ||
| ) | ||
|
|
||
| // METHODS | ||
| const reload = () => { | ||
| reloadCompareDeploymentConfig() | ||
| reloadDeploymentTemplateResolvedData() | ||
| } | ||
|
|
||
| const getNavItemHref = (resourceType: EnvResourceType, resourceName: string) => | ||
| `${generatePath(path, { ...params })}/${resourceType}${resourceName ? `/${resourceName}` : ''}${search}` | ||
|
|
||
| // Generate the deployment history config list | ||
| const deploymentConfigList = useMemo(() => { | ||
| const isDeploymentTemplateLoaded = !deploymentTemplateResolvedDataLoader && deploymentTemplateResolvedData | ||
| const isComparisonDataLoaded = !compareDeploymentConfigLoader && compareDeploymentConfig | ||
|
|
||
| const shouldLoadData = convertVariables | ||
| ? isComparisonDataLoaded && isDeploymentTemplateLoaded | ||
| : isComparisonDataLoaded | ||
|
|
||
| if (shouldLoadData) { | ||
| const compareList = isPreviousDeploymentConfigAvailable | ||
| ? compareDeploymentConfig[1].result | ||
| : { | ||
| configMapData: null, | ||
| deploymentTemplate: null, | ||
| secretsData: null, | ||
| isAppAdmin: false, | ||
| } | ||
| const currentList = compareDeploymentConfig[0].result | ||
|
|
||
| const configData = getAppEnvDeploymentConfigList({ | ||
| currentList, | ||
| compareList, | ||
| getNavItemHref, | ||
| convertVariables, | ||
| ...(convertVariables | ||
| ? { | ||
| currentDeploymentTemplateResolvedData: deploymentTemplateResolvedData[0].result, | ||
| compareDeploymentTemplateResolvedData: deploymentTemplateResolvedData[1].result, | ||
| } | ||
| : {}), | ||
| }) | ||
| return configData | ||
| } | ||
|
|
||
| return null | ||
| }, [ | ||
| isPreviousDeploymentConfigAvailable, | ||
| compareDeploymentConfigErr, | ||
| compareDeploymentConfig, | ||
| convertVariables, | ||
| deploymentTemplateResolvedDataLoader, | ||
| deploymentTemplateResolvedData, | ||
| ]) | ||
|
|
||
| const groupedDeploymentConfigList = useMemo( | ||
| () => (deploymentConfigList ? groupArrayByObjectKey(deploymentConfigList.configList, 'groupHeader') : []), | ||
| [deploymentConfigList], | ||
| ) | ||
|
|
||
| const isLoading = compareDeploymentConfigLoader || deploymentTemplateResolvedDataLoader | ||
| const isError = | ||
| compareDeploymentConfigErr || | ||
| (deploymentTemplateResolvedDataErr && !getIsRequestAborted(deploymentTemplateResolvedDataErr)) | ||
|
|
||
| return ( | ||
| <Switch> | ||
| <Route path={`${path}/:resourceType(${Object.values(EnvResourceType).join('|')})/:resourceName?`}> | ||
| <DeploymentHistoryConfigDiffCompare | ||
| {...deploymentConfigList} | ||
| isLoading={isLoading || (!isError && !deploymentConfigList)} | ||
| errorConfig={{ | ||
| code: compareDeploymentConfigErr?.code || deploymentTemplateResolvedDataErr?.code, | ||
| error: isError && !isLoading, | ||
| reload, | ||
| }} | ||
| envName={envName} | ||
| wfrId={wfrId} | ||
| previousWfrId={previousWfrId} | ||
| pipelineDeployments={pipelineDeployments} | ||
| setFullScreenView={setFullScreenView} | ||
| convertVariables={convertVariables} | ||
| setConvertVariables={setConvertVariables} | ||
| runSource={runSource} | ||
| resourceId={resourceId} | ||
| renderRunSource={renderRunSource} | ||
| /> | ||
| </Route> | ||
| <Route> | ||
| {isError && !isLoading ? ( | ||
| <ErrorScreenManager code={compareDeploymentConfigErr?.code} reload={reload} /> | ||
| ) : ( | ||
| <div className="p-16 flexbox-col dc__gap-16 bcn-0 h-100"> | ||
| {isLoading || (!isError && !deploymentConfigList) ? ( | ||
| <Progressing fullHeight size={48} /> | ||
| ) : ( | ||
| <> | ||
| <h3 className="fs-13 lh-20 fw-6 cn-9 m-0"> | ||
| Showing configuration change with respect to previous deployment | ||
| </h3> | ||
| <div className="flexbox-col dc__gap-12 dc__mxw-800"> | ||
| {Object.keys(groupedDeploymentConfigList).map((groupHeader) => | ||
| renderDeploymentHistoryConfig( | ||
| groupedDeploymentConfigList[groupHeader], | ||
| groupHeader !== 'UNGROUPED' ? groupHeader : null, | ||
| pathname, | ||
| ), | ||
| )} | ||
| </div> | ||
| </> | ||
| )} | ||
| </div> | ||
| )} | ||
| </Route> | ||
| </Switch> | ||
| ) | ||
| } | ||
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.