Skip to content

Commit 5db01d2

Browse files
authored
Merge branch 'develop' into feat/app-details-chat
2 parents de7ea11 + 488b86a commit 5db01d2

22 files changed

Lines changed: 284 additions & 104 deletions

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.15.0-pre-5",
3+
"version": "1.15.0-pre-7",
44
"description": "Supporting common component library",
55
"type": "module",
66
"main": "dist/index.js",

src/Shared/Analytics/analytics.ts

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
import ReactGA from 'react-ga4'
2+
import { UaEventOptions } from 'react-ga4/types/ga4'
3+
14
import { get } from '@Common/API'
25
import { ROUTES } from '@Common/Constants'
36

@@ -13,3 +16,11 @@ export const handleSendAnalyticsEventToServer = async (
1316
// Do nothing
1417
}
1518
}
19+
20+
export const handleAnalyticsEvent = ({ category, action }: Pick<UaEventOptions, 'category' | 'action'>) => {
21+
if (window._env_.GA_ENABLED && ReactGA?.event)
22+
ReactGA.event({
23+
category,
24+
action,
25+
})
26+
}

src/Shared/Components/AppStatusModal/AppStatusBody.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -169,7 +169,7 @@ export const AppStatusBody = ({
169169
<div className="flexbox-col px-20 dc__gap-16 dc__overflow-auto">
170170
{/* Info card */}
171171
<div className="flexbox-col pt-20">
172-
<div className="flexbox-col br-8 border__primary bg__primary shadow__card--secondary">
172+
<div className="flexbox-col br-8 border__primary bg__primary shadow__card--20">
173173
{infoCardItems.map((item, index) => (
174174
<InfoCardItem
175175
key={item.id}

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

Lines changed: 2 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,9 @@ import { ToggleResolveScopedVariables } from '@Shared/Components/ToggleResolveSc
2323
import { ReactComponent as Info } from '../../../../Assets/Icon/ic-info-filled.svg'
2424
import { MODES, YAMLStringify } from '../../../../Common'
2525
import { DEPLOYMENT_HISTORY_CONFIGURATION_LIST_MAP } from '../../../constants'
26-
import { DeploymentHistorySingleValue, DeploymentTemplateHistoryType } from '../types'
26+
import { DeploymentTemplateHistoryType } from '../types'
2727
import { DeploymentHistoryParamsType } from './types'
28+
import { renderDetailedValue } from './utils'
2829

2930
const DeploymentHistoryDiffView = ({
3031
currentConfiguration,
@@ -84,19 +85,6 @@ const DeploymentHistoryDiffView = ({
8485
setConvertVariables(!convertVariables)
8586
}
8687

87-
const renderDetailedValue = (
88-
parentClassName: string,
89-
singleValue: DeploymentHistorySingleValue,
90-
dataTestId: string,
91-
) => (
92-
<div className={`${parentClassName} px-16 py-8`}>
93-
<div className="cn-6 lh-16" data-testid={dataTestId}>
94-
{singleValue.displayName}
95-
</div>
96-
<div className="cn-9 fs-13 lh-20 dc__word-break">{singleValue.value}</div>
97-
</div>
98-
)
99-
10088
return (
10189
<div className="deployment-history-diff-view">
10290
{!previousConfigAvailable && (

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

Lines changed: 27 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,11 +17,12 @@
1717
import moment from 'moment'
1818

1919
import { DATE_TIME_FORMATS, ERROR_STATUS_CODE } from '@Common/Constants'
20+
import { Icon } from '@Shared/Components/Icon'
2021
import { SelectPickerOptionType } from '@Shared/Components/SelectPicker'
2122
import { DeploymentStatus } from '@Shared/Components/StatusComponent'
2223
import { DeploymentStageType } from '@Shared/constants'
2324

24-
import { History } from '../types'
25+
import { DeploymentHistorySingleValue, History } from '../types'
2526
import { renderPipelineDeploymentOptionDescription } from './helpers'
2627
import { DeploymentHistoryConfigDiffProps } from './types'
2728

@@ -88,3 +89,28 @@ export const isDeploymentHistoryConfigDiffNotFoundError = <T extends unknown>(re
8889

8990
export const getDeploymentHistoryConfigDiffError = <T extends unknown>(res: PromiseSettledResult<T>) =>
9091
res.status === 'rejected' && res.reason?.code !== ERROR_STATUS_CODE.NOT_FOUND ? res.reason : null
92+
93+
export const renderDetailedValue = (
94+
parentClassName: string,
95+
singleValue: DeploymentHistorySingleValue,
96+
dataTestId: string,
97+
) => (
98+
<div className={`${parentClassName} px-16 py-8 flexbox dc__content-space dc__gap-12`}>
99+
<div>
100+
<div className="cn-6 lh-16" data-testid={dataTestId}>
101+
{singleValue.displayName}
102+
</div>
103+
<div className="cn-9 fs-13 lh-20 dc__word-break">{singleValue.value}</div>
104+
</div>
105+
{singleValue.tooltipContent && (
106+
<Icon
107+
name="ic-info-outline"
108+
tooltipProps={{
109+
alwaysShowTippyOnHover: true,
110+
content: singleValue.tooltipContent,
111+
}}
112+
color={null}
113+
/>
114+
)}
115+
</div>
116+
)

src/Shared/Components/CICDHistory/TriggerOutput.tsx

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ import {
3131
useInterval,
3232
} from '../../../Common'
3333
import { DEPLOYMENT_STAGE_TO_NODE_MAP, EMPTY_STATE_STATUS } from '../../constants'
34-
import { TabGroup, TabGroupProps } from '../TabGroup'
34+
import { TabGroup } from '../TabGroup'
3535
import Artifacts from './Artifacts'
3636
import DeploymentDetailSteps from './DeploymentDetailSteps'
3737
import { DeploymentHistoryConfigDiff } from './DeploymentHistoryConfigDiff'
@@ -318,11 +318,6 @@ const TriggerOutput = ({
318318
(!!triggerDetailsResult?.result?.artifactId || !!triggerDetails?.artifactId),
319319
)
320320

321-
const tabs: TabGroupProps['tabs'] = useMemo(
322-
() => getTriggerOutputTabs(triggerDetails, deploymentAppType),
323-
[triggerDetails, deploymentAppType],
324-
)
325-
326321
useEffect(() => {
327322
if (triggerDetailsLoading) {
328323
return
@@ -417,7 +412,7 @@ const TriggerOutput = ({
417412
namespace={triggerDetails.namespace}
418413
/>
419414
<div className="pl-50 pr-20 pt-8 dc__border-bottom dc__position-sticky dc__top-0 bg__primary dc__zi-3">
420-
<TabGroup tabs={tabs} />
415+
<TabGroup tabs={getTriggerOutputTabs(triggerDetails, deploymentAppType)} />
421416
</div>
422417
</>
423418
)}

src/Shared/Components/CICDHistory/service.tsx

Lines changed: 20 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -15,19 +15,18 @@
1515
*/
1616

1717
/* eslint-disable dot-notation */
18+
import moment from 'moment'
19+
1820
import { get, getUrlWithSearchParams, ResponseType, ROUTES, sanitizeUserApprovalMetadata, trash } from '../../../Common'
19-
import { DEPLOYMENT_HISTORY_CONFIGURATION_LIST_MAP, EXTERNAL_TYPES } from '../../constants'
20-
import { decode } from '../../Helpers'
21+
import { DATE_TIME_FORMAT_STRING, DEPLOYMENT_HISTORY_CONFIGURATION_LIST_MAP, EXTERNAL_TYPES } from '../../constants'
22+
import { decode, isNullOrUndefined } from '../../Helpers'
2123
import { ResourceKindType, ResourceVersionType } from '../../types'
2224
import {
23-
DeploymentConfigurationsRes,
2425
DeploymentHistoryDetail,
25-
DeploymentHistoryDetailRes,
2626
DeploymentHistoryResult,
2727
DeploymentHistorySingleValue,
2828
DeploymentStatusDetailsResponse,
2929
FetchIdDataStatus,
30-
HistoryDiffSelectorRes,
3130
ModuleConfigResponse,
3231
TriggerDetailsResponseType,
3332
TriggerHistoryParamsType,
@@ -107,26 +106,7 @@ export function getManualSync(params: { appId: string; envId: string }): Promise
107106
return get(`${ROUTES.MANUAL_SYNC}/${params.appId}/${params.envId}`)
108107
}
109108

110-
export const getDeploymentHistoryList = (
111-
appId: string,
112-
pipelineId: string,
113-
triggerId: string,
114-
): Promise<DeploymentConfigurationsRes> => get(`app/history/deployed-configuration/${appId}/${pipelineId}/${triggerId}`)
115-
116-
export const getDeploymentHistoryDetail = (
117-
appId: string,
118-
pipelineId: string,
119-
id: string,
120-
historyComponent: string,
121-
historyComponentName: string,
122-
): Promise<DeploymentHistoryDetailRes> =>
123-
get(
124-
`app/history/deployed-component/detail/${appId}/${pipelineId}/${id}?historyComponent=${historyComponent
125-
.replace('-', '_')
126-
.toUpperCase()}${historyComponentName ? `&historyComponentName=${historyComponentName}` : ''}`,
127-
)
128-
129-
export const prepareDeploymentTemplateData = (rawData): Record<string, DeploymentHistorySingleValue> => {
109+
const prepareDeploymentTemplateData = (rawData): Record<string, DeploymentHistorySingleValue> => {
130110
const deploymentTemplateData = {}
131111
if (rawData.templateVersion) {
132112
deploymentTemplateData['templateVersion'] = { displayName: 'Chart Version', value: rawData.templateVersion }
@@ -140,7 +120,7 @@ export const prepareDeploymentTemplateData = (rawData): Record<string, Deploymen
140120
return deploymentTemplateData
141121
}
142122

143-
export const preparePipelineConfigData = (rawData): Record<string, DeploymentHistorySingleValue> => {
123+
const preparePipelineConfigData = (rawData): Record<string, DeploymentHistorySingleValue> => {
144124
const pipelineConfigData = {}
145125
if (rawData.pipelineTriggerType) {
146126
pipelineConfigData['pipelineTriggerType'] = {
@@ -149,15 +129,28 @@ export const preparePipelineConfigData = (rawData): Record<string, DeploymentHis
149129
}
150130
}
151131
if (rawData.strategy) {
132+
const { updatedBy, updatedOn, selectedAtRuntime } = rawData
152133
pipelineConfigData['strategy'] = {
153134
displayName: 'Deployment strategy',
154135
value: rawData.strategy,
136+
...(updatedBy && updatedOn && !isNullOrUndefined(selectedAtRuntime)
137+
? {
138+
tooltipContent: (
139+
<div className="flexbox-col br-4 w-200">
140+
<span className="fw-6">
141+
{selectedAtRuntime ? 'Selected at runtime' : 'Default Strategy'}
142+
</span>
143+
<span className="fw-4">{`${selectedAtRuntime ? '' : 'Last updated '}by ${updatedBy} at ${moment(updatedOn).format(DATE_TIME_FORMAT_STRING)}`}</span>
144+
</div>
145+
),
146+
}
147+
: {}),
155148
}
156149
}
157150
return pipelineConfigData
158151
}
159152

160-
export const prepareConfigMapAndSecretData = (
153+
const prepareConfigMapAndSecretData = (
161154
rawData,
162155
type: string,
163156
historyData: DeploymentHistoryDetail,
@@ -277,24 +270,6 @@ export const prepareHistoryData = (
277270
return historyData
278271
}
279272

280-
export const getDeploymentDiffSelector = (
281-
pipelineId: string,
282-
historyComponent,
283-
baseConfigurationId,
284-
historyComponentName,
285-
): Promise<HistoryDiffSelectorRes> => {
286-
const url = getUrlWithSearchParams(
287-
`${ROUTES.RESOURCE_HISTORY_DEPLOYMENT}/${ROUTES.CONFIG_CD_PIPELINE}/${ResourceVersionType.v1}`,
288-
{
289-
baseConfigurationId,
290-
historyComponent: historyComponent.replace('-', '_').toUpperCase(),
291-
filterCriteria: `cd-pipeline|id|${pipelineId}`,
292-
historyComponentName,
293-
},
294-
)
295-
return get(url)
296-
}
297-
298273
export const getTriggerHistory = async ({
299274
appId,
300275
envId,

src/Shared/Components/CICDHistory/types.tsx

Lines changed: 2 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ import {
2727
PromotionApprovalMetadataType,
2828
ReleaseTag,
2929
ResponseType,
30+
TooltipProps,
3031
UserApprovalMetadataType,
3132
useScrollable,
3233
} from '../../../Common'
@@ -529,15 +530,12 @@ export interface DeploymentStatusDetailRowType extends Pick<DeploymentStatusDeta
529530
deploymentDetailedData: DeploymentStatusDetailsBreakdownDataType
530531
}
531532

532-
export interface DeploymentConfigurationsRes extends ResponseType {
533-
result?: DeploymentTemplateList[]
534-
}
535-
536533
export interface DeploymentHistorySingleValue {
537534
displayName: string
538535
value: string
539536
variableSnapshot?: object
540537
resolvedValue?: string
538+
tooltipContent?: TooltipProps['content']
541539
}
542540
export interface DeploymentHistoryDetail {
543541
componentName?: string
@@ -552,23 +550,6 @@ export interface DeploymentTemplateHistoryType {
552550
rootClassName?: string
553551
}
554552

555-
export interface DeploymentHistoryDetailRes extends ResponseType {
556-
result?: DeploymentHistoryDetail
557-
}
558-
559-
export interface HistoryDiffSelectorList {
560-
id: number
561-
deployedOn: string
562-
deployedBy: string
563-
deploymentStatus: string
564-
wfrId?: number
565-
runSource?: RunSourceType
566-
}
567-
568-
export interface HistoryDiffSelectorRes {
569-
result?: HistoryDiffSelectorList[]
570-
}
571-
572553
export interface DeploymentHistorySidebarType {
573554
deploymentHistoryList: DeploymentTemplateList[]
574555
setDeploymentHistoryList: React.Dispatch<React.SetStateAction<DeploymentTemplateList[]>>

src/Shared/Components/DeploymentConfigDiff/DeploymentConfigDiff.scss

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,3 +51,26 @@
5151
}
5252
}
5353
}
54+
55+
.config-strategy-radio {
56+
.form__radio-item {
57+
border: none !important;
58+
}
59+
60+
.form__radio-item-content {
61+
padding-block: 6px;
62+
padding-inline: 0px;
63+
64+
.radio__button {
65+
margin-right: 8px;
66+
margin-top: 2px;
67+
}
68+
69+
.radio__title {
70+
font-size: 13px;
71+
line-height: 20px;
72+
font-weight: 400;
73+
color: var(--N900) !important;
74+
}
75+
}
76+
}

0 commit comments

Comments
 (0)