diff --git a/src/app/applications/components/application-deployment-history/application-deployment-history.tsx b/src/app/applications/components/application-deployment-history/application-deployment-history.tsx index 9d001170ac82d..5bc3bca59b5be 100644 --- a/src/app/applications/components/application-deployment-history/application-deployment-history.tsx +++ b/src/app/applications/components/application-deployment-history/application-deployment-history.tsx @@ -4,6 +4,8 @@ import * as React from 'react'; import * as models from '../../../shared/models'; +import { DataLoader } from '../../../shared/components'; +import { services } from '../../../shared/services'; import { getParamsWithOverridesInfo } from '../utils'; require('./application-deployment-history.scss'); @@ -23,12 +25,7 @@ export const ApplicationDeploymentHistory = ({ const recentDeployments = deployments.map((info, i) => { const nextDeployedAt = i === 0 ? null : deployments[i - 1].deployedAt; const runEnd = nextDeployedAt ? moment(nextDeployedAt) : moment(); - let params = info.params || []; - if (selectedRollbackDeploymentIndex !== i) { - params = params.slice(0, 3); - } - const componentParams = getParamsWithOverridesInfo(params, info.componentParameterOverrides || []); - return {...info, componentParams, nextDeployedAt, durationMs: runEnd.diff(moment(info.deployedAt)) / 1000}; + return {...info, nextDeployedAt, durationMs: runEnd.diff(moment(info.deployedAt)) / 1000}; }); return ( @@ -57,21 +54,29 @@ export const ApplicationDeploymentHistory = ({ - {Array.from(info.componentParams.keys()).map((component) => ( - info.componentParams.get(component).map((param) => ( -
-
- {param.component}.{param.name}: -
-
- - {param.original && } - {param.value} - -
-
- )) - ))} + {selectedRollbackDeploymentIndex === index ? ( + services.applications.getManifest(app.metadata.name, info.revision)}> + {(manifest) => { + const componentParams = getParamsWithOverridesInfo(manifest.params, info.componentParameterOverrides || []); + return Array.from(componentParams.keys()).map((component: string) => ( + componentParams.get(component).map((param: (models.ComponentParameter & {original: string})) => ( +
+
+ {param.component}.{param.name}: +
+
+ + {param.original && } + {param.value} + +
+
+ )) + )); + }} +
+ ) + : null } ))} diff --git a/src/app/shared/services/applications-service.ts b/src/app/shared/services/applications-service.ts index 3befd7ca73ffb..68ed88a2fb913 100644 --- a/src/app/shared/services/applications-service.ts +++ b/src/app/shared/services/applications-service.ts @@ -3,6 +3,18 @@ import { Observable } from 'rxjs'; import * as models from '../models'; import requests from './requests'; +export interface ManifestQuery { + name: string; + revision?: string; +} +export interface ManifestResponse { + manifests: string[]; + namespace: string; + server: string; + revision: string; + params: models.ComponentParameter[]; +} + export class ApplicationsService { public list(projects: string[]): Promise { return requests.get('/applications').query({ project: projects }).then((res) => res.body as models.ApplicationList).then((list) => { @@ -14,6 +26,10 @@ export class ApplicationsService { return requests.get(`/applications/${name}`).query({refresh}).then((res) => this.parseAppFields(res.body)); } + public getManifest(name: string, revision: string): Promise { + return requests.get(`/applications/${name}/manifests`).query({name, revision} as ManifestQuery).then((res) => res.body as ManifestResponse); + } + public update(app: models.Application): Promise { (app.status.comparisonResult.resources || []).forEach((resource) => { resource.liveState = JSON.stringify(resource.liveState) as any;