1
- import { DataLoader , DropDownMenu , Duration } from 'argo-ui' ;
1
+ import { DropDownMenu , Duration } from 'argo-ui' ;
2
2
import { InitiatedBy } from './initiated-by' ;
3
3
import * as moment from 'moment' ;
4
4
import * as React from 'react' ;
5
- import { Revision , Timestamp } from '../../../shared/components' ;
5
+ import { Timestamp } from '../../../shared/components' ;
6
6
import * as models from '../../../shared/models' ;
7
- import { services } from '../../../shared/services' ;
8
- import { ApplicationParameters } from '../application-parameters/application-parameters' ;
9
- import { RevisionMetadataRows } from './revision-metadata-rows' ;
10
7
import './application-deployment-history.scss' ;
8
+ import { ApplicationDeploymentHistoryDetails } from './application-deployment-history-details' ;
11
9
12
10
export const ApplicationDeploymentHistory = ( {
13
11
app,
14
12
rollbackApp,
15
- selectedRollbackDeploymentIndex,
16
13
selectDeployment
17
14
} : {
18
15
app : models . Application ;
19
- selectedRollbackDeploymentIndex : number ;
20
16
rollbackApp : ( info : models . RevisionHistory ) => any ;
21
17
selectDeployment : ( index : number ) => any ;
22
18
} ) => {
@@ -27,8 +23,6 @@ export const ApplicationDeploymentHistory = ({
27
23
return { ...info , nextDeployedAt, durationMs : runEnd . diff ( moment ( info . deployedAt ) ) / 1000 } ;
28
24
} ) ;
29
25
30
- const [ showParameterDetails , setShowParameterDetails ] = React . useState ( Boolean ) ;
31
-
32
26
return (
33
27
< div className = 'application-deployment-history' >
34
28
{ recentDeployments . map ( ( info , index ) => (
@@ -78,104 +72,8 @@ export const ApplicationDeploymentHistory = ({
78
72
</ div >
79
73
</ div >
80
74
</ div >
81
- { selectedRollbackDeploymentIndex === index ? (
82
- info . sources === undefined ? (
83
- < React . Fragment >
84
- < div >
85
- < div className = 'row' >
86
- < div className = 'columns small-3' > Revision:</ div >
87
- < div className = 'columns small-9' >
88
- < Revision repoUrl = { info . source . repoURL } revision = { info . revision } />
89
- </ div >
90
- </ div >
91
- </ div >
92
- < RevisionMetadataRows
93
- applicationName = { app . metadata . name }
94
- applicationNamespace = { app . metadata . namespace }
95
- source = { { ...recentDeployments [ index ] . source , targetRevision : recentDeployments [ index ] . revision } }
96
- index = { 0 }
97
- versionId = { recentDeployments [ index ] . id }
98
- />
99
- < button
100
- type = 'button'
101
- className = 'argo-button argo-button--base application-deployment-history__show-parameter-details'
102
- onClick = { ( ) => setShowParameterDetails ( ! showParameterDetails ) } >
103
- { showParameterDetails ? 'Hide details' : 'Show details' }
104
- </ button >
105
75
106
- { showParameterDetails && (
107
- < DataLoader
108
- input = { { ...recentDeployments [ index ] . source , targetRevision : recentDeployments [ index ] . revision , appName : app . metadata . name } }
109
- load = { src => services . repos . appDetails ( src , src . appName , app . spec . project , 0 , recentDeployments [ index ] . id ) } >
110
- { ( details : models . RepoAppDetails ) => (
111
- < div >
112
- < ApplicationParameters
113
- application = { {
114
- ...app ,
115
- spec : { ...app . spec , source : recentDeployments [ index ] . source }
116
- } }
117
- details = { details }
118
- />
119
- </ div >
120
- ) }
121
- </ DataLoader >
122
- ) }
123
- </ React . Fragment >
124
- ) : (
125
- info . sources . map ( ( source , i ) => (
126
- < React . Fragment key = { `${ index } _${ i } ` } >
127
- { i > 0 ? < div className = 'separator' /> : null }
128
- < div >
129
- < div className = 'row' >
130
- < div className = 'columns small-3' > Revision:</ div >
131
- < div className = 'columns small-9' >
132
- < Revision repoUrl = { source . repoURL } revision = { info . revisions [ i ] } />
133
- </ div >
134
- </ div >
135
- </ div >
136
- < RevisionMetadataRows
137
- applicationName = { app . metadata . name }
138
- applicationNamespace = { app . metadata . namespace }
139
- source = { { ...source , targetRevision : recentDeployments [ index ] . revisions [ i ] } }
140
- index = { i }
141
- versionId = { recentDeployments [ index ] . id }
142
- />
143
- < button
144
- type = 'button'
145
- className = 'argo-button argo-button--base application-deployment-history__show-parameter-details'
146
- onClick = { ( ) => setShowParameterDetails ( ! showParameterDetails ) } >
147
- { showParameterDetails ? 'Hide details' : 'Show details' }
148
- </ button >
149
-
150
- { showParameterDetails && (
151
- < DataLoader
152
- input = { {
153
- ...source ,
154
- targetRevision : recentDeployments [ index ] . revisions [ i ] ,
155
- index : i ,
156
- versionId : recentDeployments [ index ] . id ,
157
- appName : app . metadata . name
158
- } }
159
- load = { src => services . repos . appDetails ( src , src . appName , app . spec . project , i , recentDeployments [ index ] . id ) } >
160
- { ( details : models . RepoAppDetails ) => (
161
- < div >
162
- < ApplicationParameters
163
- application = { {
164
- ...app ,
165
- spec : { ...app . spec , source}
166
- } }
167
- details = { details }
168
- />
169
- </ div >
170
- ) }
171
- </ DataLoader >
172
- ) }
173
- </ React . Fragment >
174
- ) )
175
- )
176
- ) : (
177
- < p > Click to see source details.</ p >
178
- ) }
76
+ < ApplicationDeploymentHistoryDetails index = { index } info = { info } app = { app } />
179
77
</ div >
180
78
</ div >
181
79
) ) }
0 commit comments