1515 */
1616
1717/* eslint-disable dot-notation */
18+ import moment from 'moment'
19+
1820import { 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'
2123import { ResourceKindType , ResourceVersionType } from '../../types'
2224import {
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-
298273export const getTriggerHistory = async ( {
299274 appId,
300275 envId,
0 commit comments