Skip to content

Commit

Permalink
wip
Browse files Browse the repository at this point in the history
Signed-off-by: Jorge Turrado <jorge.turrado@scrm.lidl>
  • Loading branch information
JorTurFer committed Jun 20, 2023
1 parent 64daf34 commit b2d284b
Show file tree
Hide file tree
Showing 3 changed files with 37 additions and 4 deletions.
5 changes: 5 additions & 0 deletions pkg/apis/application/v1alpha1/types.go
Expand Up @@ -244,6 +244,11 @@ func (a *ApplicationSource) AllowsConcurrentProcessing() bool {
return true
}

// IsRef returns true when the application source is of type Ref
func (a *ApplicationSource) IsRef() bool {
return a.Ref != ""
}

// IsHelm returns true when the application source is of type Helm
func (a *ApplicationSource) IsHelm() bool {
return a.Chart != ""
Expand Down
7 changes: 5 additions & 2 deletions server/application/application.go
Expand Up @@ -1359,12 +1359,15 @@ func (s *Server) RevisionMetadata(ctx context.Context, q *application.RevisionMe
if err != nil {
return nil, err
}

revision := q.GetRevision()
var source *v1alpha1.ApplicationSource
if a.Spec.HasMultipleSources() {
for _, h := range a.Status.History {
if h.ID == int64(*q.VersionId) {
source = &h.Sources[*q.SourceIndex]
// if source.IsRef() {
// revision = source.TargetRevision
// }
}
}
if source == nil {
Expand Down Expand Up @@ -1392,7 +1395,7 @@ func (s *Server) RevisionMetadata(ctx context.Context, q *application.RevisionMe
defer ioutil.Close(conn)
return repoClient.GetRevisionMetadata(ctx, &apiclient.RepoServerRevisionMetadataRequest{
Repo: repo,
Revision: q.GetRevision(),
Revision: revision,
CheckSignature: len(proj.Spec.SignatureKeys) > 0,
})
}
Expand Down
Expand Up @@ -25,7 +25,6 @@ export const ApplicationDeploymentHistory = ({
const runEnd = nextDeployedAt ? moment(nextDeployedAt) : moment();
return {...info, nextDeployedAt, durationMs: runEnd.diff(moment(info.deployedAt)) / 1000};
});

return (
<div className='application-deployment-history'>
{recentDeployments.map((info, index) => (
Expand Down Expand Up @@ -70,7 +69,33 @@ export const ApplicationDeploymentHistory = ({
</div>
</div>
{selectedRollbackDeploymentIndex === index ?
info.sources.map((source, i) => (
info.sources === undefined ?
(
<React.Fragment>
<RevisionMetadataRows
applicationName={app.metadata.name}
applicationNamespace={app.metadata.namespace}
source={{...recentDeployments[index].source, targetRevision: recentDeployments[index].revision}}
index={0}
versionId={recentDeployments[index].id}
/>
<DataLoader
input={{...recentDeployments[index].source, targetRevision: recentDeployments[index].revision, appName: app.metadata.name}}
load={src => services.repos.appDetails(src, src.appName, app.spec.project, 0, recentDeployments[index].id)}>
{(details: models.RepoAppDetails) => (
<div>
<ApplicationParameters
application={{
...app,
spec: {...app.spec, source: recentDeployments[index].source}
}}
details={details}
/>
</div>
)}
</DataLoader>
</React.Fragment>
): info.sources.map((source, i) => (
<React.Fragment>
<div>
<div className='row'>
Expand Down

0 comments on commit b2d284b

Please sign in to comment.