Skip to content

Commit 4950b1e

Browse files
committed
Merge branch 'develop' of github.com:devtron-labs/devtron-fe-common-lib into refactor/key-value-table
2 parents 0ccf6ea + 023d109 commit 4950b1e

File tree

3 files changed

+26
-10
lines changed

3 files changed

+26
-10
lines changed

package-lock.json

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@devtron-labs/devtron-fe-common-lib",
3-
"version": "1.12.0-beta-3",
3+
"version": "1.12.0-pre-0",
44
"description": "Supporting common component library",
55
"type": "module",
66
"main": "dist/index.js",

src/Shared/Components/CICDHistory/DeploymentHistoryConfigDiff/DeploymentHistoryConfigDiff.tsx

Lines changed: 23 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -21,9 +21,9 @@ import { ReactComponent as ICError } from '@Icons/ic-error.svg'
2121
import ErrorScreenManager from '@Common/ErrorScreenManager'
2222
import { useAsync } from '@Common/Helper'
2323
import { useUrlFilters } from '@Common/Hooks'
24-
import { GenericEmptyState, InfoColourBar } from '@Common/index'
24+
import { GenericEmptyState, InfoColourBar, SortingOrder } from '@Common/index'
2525
import { Progressing } from '@Common/Progressing'
26-
import { getAppEnvDeploymentConfigList } from '@Shared/Components/DeploymentConfigDiff'
26+
import { DEPLOYMENT_CONFIG_DIFF_SORT_KEY, getAppEnvDeploymentConfigList } from '@Shared/Components/DeploymentConfigDiff'
2727
import { groupArrayByObjectKey } from '@Shared/Helpers'
2828
import { useMainContext } from '@Shared/Providers'
2929
import { EnvResourceType, getAppEnvDeploymentConfig, getCompareSecretsData } from '@Shared/Services'
@@ -125,7 +125,7 @@ export const DeploymentHistoryConfigDiff = ({
125125
`${generatePath(path, { ...params })}/${resourceType}${resourceName ? `/${resourceName}` : ''}${search}`
126126

127127
// Generate the deployment history config list
128-
const deploymentConfigList = useMemo(() => {
128+
const { deploymentConfigList, sortedDeploymentConfigList } = useMemo(() => {
129129
if (!compareDeploymentConfigLoader && compareDeploymentConfig) {
130130
const compareList =
131131
isPreviousDeploymentConfigAvailable && compareDeploymentConfig[1].status === 'fulfilled'
@@ -140,17 +140,30 @@ export const DeploymentHistoryConfigDiff = ({
140140
const currentList =
141141
compareDeploymentConfig[0].status === 'fulfilled' ? compareDeploymentConfig[0].value.result : null
142142

143+
// This data is displayed on the deployment history diff view page.
144+
// It requires dynamic sorting based on the current sortBy and sortOrder, which the user can modify using the Sort Button.
143145
const configData = getAppEnvDeploymentConfigList({
144146
currentList,
145147
compareList,
146148
getNavItemHref,
147149
convertVariables,
148150
sortingConfig: { sortBy, sortOrder },
149151
})
150-
return configData
152+
153+
// Sorting is hardcoded here because this data is displayed on the deployment history configuration tab.
154+
// The diff needs to be shown on sorted data, and no additional sorting will be applied.
155+
const sortedConfigData = getAppEnvDeploymentConfigList({
156+
currentList,
157+
compareList,
158+
getNavItemHref,
159+
convertVariables,
160+
sortingConfig: { sortBy: DEPLOYMENT_CONFIG_DIFF_SORT_KEY, sortOrder: SortingOrder.ASC },
161+
})
162+
163+
return { deploymentConfigList: configData, sortedDeploymentConfigList: sortedConfigData }
151164
}
152165

153-
return null
166+
return { deploymentConfigList: null, sortedDeploymentConfigList: null }
154167
}, [
155168
isPreviousDeploymentConfigAvailable,
156169
compareDeploymentConfigLoader,
@@ -170,8 +183,11 @@ export const DeploymentHistoryConfigDiff = ({
170183
)
171184

172185
const groupedDeploymentConfigList = useMemo(
173-
() => (deploymentConfigList ? groupArrayByObjectKey(deploymentConfigList.configList, 'groupHeader') : []),
174-
[deploymentConfigList],
186+
() =>
187+
sortedDeploymentConfigList
188+
? groupArrayByObjectKey(sortedDeploymentConfigList.configList, 'groupHeader')
189+
: [],
190+
[sortedDeploymentConfigList],
175191
)
176192

177193
/** Previous deployment config has 404 error. */

0 commit comments

Comments
 (0)