From 83f14ffbfb9f2e4e3a87c3a50ba3fe93ca2cb4df Mon Sep 17 00:00:00 2001 From: wjywbs Date: Thu, 31 Oct 2019 07:11:36 -0400 Subject: [PATCH] Add metric graphs on cronjob, job and pod list pages. (#4465) * Add metric graphs on cronjob, job and pod list pages. * fix test --- .../common/components/resourcelist/cronjob/component.ts | 6 +++++- .../common/components/resourcelist/cronjob/template.html | 3 +++ .../common/components/resourcelist/job/component.ts | 5 ++++- .../common/components/resourcelist/job/template.html | 3 +++ .../common/components/resourcelist/pod/component.ts | 5 ++++- .../common/components/resourcelist/pod/template.html | 3 +++ src/app/frontend/overview/component.spec.ts | 1 + .../frontend/resource/workloads/cronjob/list/component.ts | 2 +- src/app/frontend/resource/workloads/job/list/component.ts | 2 +- src/app/frontend/resource/workloads/pod/list/component.ts | 2 +- src/app/frontend/typings/backendapi.d.ts | 2 ++ 11 files changed, 28 insertions(+), 6 deletions(-) diff --git a/src/app/frontend/common/components/resourcelist/cronjob/component.ts b/src/app/frontend/common/components/resourcelist/cronjob/component.ts index 5c32b13dc7fc..54348db74616 100644 --- a/src/app/frontend/common/components/resourcelist/cronjob/component.ts +++ b/src/app/frontend/common/components/resourcelist/cronjob/component.ts @@ -14,7 +14,7 @@ import {HttpParams} from '@angular/common/http'; import {ChangeDetectionStrategy, ChangeDetectorRef, Component, Input} from '@angular/core'; -import {CronJob, CronJobList} from '@api/backendapi'; +import {CronJob, CronJobList, Metric} from '@api/backendapi'; import {Observable} from 'rxjs/Observable'; import {ResourceListWithStatuses} from '../../../resources/list'; import {NotificationsService} from '../../../services/global/notifications'; @@ -30,6 +30,9 @@ import {ListGroupIdentifier, ListIdentifier} from '../groupids'; }) export class CronJobListComponent extends ResourceListWithStatuses { @Input() endpoint = EndpointManager.resource(Resource.cronJob, true).list(); + @Input() showMetrics = false; + cumulativeMetrics: Metric[]; + constructor( private readonly cronJob_: NamespacedResourceService, notifications: NotificationsService, @@ -55,6 +58,7 @@ export class CronJobListComponent extends ResourceListWithStatuses + +
{ @Input() title: string; @Input() endpoint = EndpointManager.resource(Resource.job, true).list(); + @Input() showMetrics = false; + cumulativeMetrics: Metric[]; constructor( private readonly job_: NamespacedResourceService, @@ -66,6 +68,7 @@ export class JobListComponent extends ResourceListWithStatuses { } map(jobList: JobList): Job[] { + this.cumulativeMetrics = jobList.cumulativeMetrics; return jobList.jobs; } diff --git a/src/app/frontend/common/components/resourcelist/job/template.html b/src/app/frontend/common/components/resourcelist/job/template.html index 5cdbec339d05..daa59f7450e3 100644 --- a/src/app/frontend/common/components/resourcelist/job/template.html +++ b/src/app/frontend/common/components/resourcelist/job/template.html @@ -14,6 +14,9 @@ limitations under the License. --> + +
{ @Input() endpoint = EndpointManager.resource(Resource.pod, true).list(); + @Input() showMetrics = false; + cumulativeMetrics: Metric[]; constructor( private readonly podList: NamespacedResourceService, @@ -65,6 +67,7 @@ export class PodListComponent extends ResourceListWithStatuses { } map(podList: PodList): Pod[] { + this.cumulativeMetrics = podList.cumulativeMetrics; return podList.pods; } diff --git a/src/app/frontend/common/components/resourcelist/pod/template.html b/src/app/frontend/common/components/resourcelist/pod/template.html index e2f8ee142496..9214258ee770 100644 --- a/src/app/frontend/common/components/resourcelist/pod/template.html +++ b/src/app/frontend/common/components/resourcelist/pod/template.html @@ -14,6 +14,9 @@ limitations under the License. --> + +
', + template: '', }) export class CronJobListComponent {} diff --git a/src/app/frontend/resource/workloads/job/list/component.ts b/src/app/frontend/resource/workloads/job/list/component.ts index ae7c792d87f0..13a836ad7500 100644 --- a/src/app/frontend/resource/workloads/job/list/component.ts +++ b/src/app/frontend/resource/workloads/job/list/component.ts @@ -16,6 +16,6 @@ import {Component} from '@angular/core'; @Component({ selector: 'kd-job-list-state', - template: '', + template: '', }) export class JobListComponent {} diff --git a/src/app/frontend/resource/workloads/pod/list/component.ts b/src/app/frontend/resource/workloads/pod/list/component.ts index 04078c2d95e1..aedac2bf9fb7 100644 --- a/src/app/frontend/resource/workloads/pod/list/component.ts +++ b/src/app/frontend/resource/workloads/pod/list/component.ts @@ -16,6 +16,6 @@ import {Component} from '@angular/core'; @Component({ selector: 'kd-pod-list-state', - template: '', + template: '', }) export class PodListComponent {} diff --git a/src/app/frontend/typings/backendapi.d.ts b/src/app/frontend/typings/backendapi.d.ts index eb80c2d1df52..8188f25569f3 100644 --- a/src/app/frontend/typings/backendapi.d.ts +++ b/src/app/frontend/typings/backendapi.d.ts @@ -75,6 +75,7 @@ export interface ConfigMapList extends ResourceList { } export interface CronJobList extends ResourceList { + cumulativeMetrics: Metric[] | null; items: CronJob[]; status: Status; } @@ -117,6 +118,7 @@ export interface IngressList extends ResourceList { } export interface JobList extends ResourceList { + cumulativeMetrics: Metric[] | null; jobs: Job[]; status: Status; }