From fc197cd99fdd46f90fbdf3fce8ef37a8f9fe2e58 Mon Sep 17 00:00:00 2001 From: Richard Cox Date: Fri, 12 Jun 2020 17:17:52 +0100 Subject: [PATCH] Changes following review --- .../create-release/create-release.component.ts | 5 ----- .../app/custom/helm/helm-entity-catalog.ts | 4 ++-- .../kubernetes-certs-auth-form.component.scss | 2 +- .../kubernetes/kubernetes-entity-catalog.ts | 3 --- .../kubernetes/kubernetes-entity-factory.ts | 7 ------- .../kubernetes/kubernetes-entity-generator.ts | 17 ----------------- .../action-builders/kube.action-builders.ts | 7 ------- .../app/custom/kubernetes/store/kube.getIds.ts | 2 +- .../kube-namespaces-filter-config.service.ts | 3 +-- .../helm-release-tab-base.component.ts | 14 +++++--------- .../release/tabs/helm-release-helper.service.ts | 9 ++++----- .../workloads/workloads-entity-catalog.ts | 4 ++-- .../backup-endpoints.component.html | 2 ++ 13 files changed, 18 insertions(+), 61 deletions(-) diff --git a/custom-src/frontend/app/custom/helm/create-release/create-release.component.ts b/custom-src/frontend/app/custom/helm/create-release/create-release.component.ts index 42474594ff..45793d2149 100644 --- a/custom-src/frontend/app/custom/helm/create-release/create-release.component.ts +++ b/custom-src/frontend/app/custom/helm/create-release/create-release.component.ts @@ -3,12 +3,9 @@ import { Component, ElementRef, OnDestroy, OnInit, ViewChild } from '@angular/co import { FormControl, FormGroup, Validators } from '@angular/forms'; import { MatTextareaAutosize } from '@angular/material/input'; import { ActivatedRoute } from '@angular/router'; -import { Store } from '@ngrx/store'; import { BehaviorSubject, combineLatest, Observable, of, Subscription } from 'rxjs'; import { distinctUntilChanged, filter, first, map, pairwise, startWith, switchMap } from 'rxjs/operators'; -import { AppState } from '../../../../../store/src/app-state'; -import { EntityMonitorFactory } from '../../../../../store/src/monitors/entity-monitor.factory.service'; import { RequestInfoState } from '../../../../../store/src/reducers/api-request-reducer/types'; import { EndpointsService } from '../../../core/endpoints.service'; import { safeUnsubscribe } from '../../../core/utils.service'; @@ -60,10 +57,8 @@ export class CreateReleaseComponent implements OnInit, OnDestroy { constructor( private route: ActivatedRoute, public endpointsService: EndpointsService, - private store: Store, private httpClient: HttpClient, private confirmDialog: ConfirmationDialogService, - private emf: EntityMonitorFactory ) { const chart = this.route.snapshot.params; this.cancelUrl = `/monocular/charts/${chart.repo}/${chart.chartName}/${chart.version}`; diff --git a/custom-src/frontend/app/custom/helm/helm-entity-catalog.ts b/custom-src/frontend/app/custom/helm/helm-entity-catalog.ts index cb1bcde3d7..288b527982 100644 --- a/custom-src/frontend/app/custom/helm/helm-entity-catalog.ts +++ b/custom-src/frontend/app/custom/helm/helm-entity-catalog.ts @@ -1,7 +1,7 @@ import { StratosCatalogEndpointEntity, StratosCatalogEntity } from '../../../../store/src/entity-catalog/entity-catalog-entity/entity-catalog-entity'; import { IFavoriteMetadata } from '../../../../store/src/types/user-favorites.types'; import { MonocularChart, HelmVersion } from './store/helm.types'; import { HelmChartActionBuilders, HelmVersionActionBuilders } from './store/helm.action-builders'; /** - * A strongly typed collection of Kube Catalog Entities. + * A strongly typed collection of Helm Catalog Entities. * This can be used to access functionality exposed by each specific type, such as get, update, delete, etc */ export class HelmEntityCatalog { @@ -11,7 +11,7 @@ export class HelmEntityCatalog { } /** - * A strongly typed collection of Kube Catalog Entities. + * A strongly typed collection of Helm Catalog Entities. * This can be used to access functionality exposed by each specific type, such as get, update, delete, etc */ export const helmEntityCatalog: HelmEntityCatalog = new HelmEntityCatalog(); diff --git a/custom-src/frontend/app/custom/kubernetes/auth-forms/kubernetes-certs-auth-form/kubernetes-certs-auth-form.component.scss b/custom-src/frontend/app/custom/kubernetes/auth-forms/kubernetes-certs-auth-form/kubernetes-certs-auth-form.component.scss index 23498e9eca..5385ee9711 100644 --- a/custom-src/frontend/app/custom/kubernetes/auth-forms/kubernetes-certs-auth-form/kubernetes-certs-auth-form.component.scss +++ b/custom-src/frontend/app/custom/kubernetes/auth-forms/kubernetes-certs-auth-form/kubernetes-certs-auth-form.component.scss @@ -14,7 +14,7 @@ &__content { & > * { - padding-bottom: 10px; + margin-bottom: 10px; } textarea { max-height: 75px; diff --git a/custom-src/frontend/app/custom/kubernetes/kubernetes-entity-catalog.ts b/custom-src/frontend/app/custom/kubernetes/kubernetes-entity-catalog.ts index a59854a6f1..816ab0bd47 100644 --- a/custom-src/frontend/app/custom/kubernetes/kubernetes-entity-catalog.ts +++ b/custom-src/frontend/app/custom/kubernetes/kubernetes-entity-catalog.ts @@ -4,7 +4,6 @@ import { } from '../../../../store/src/entity-catalog/entity-catalog-entity/entity-catalog-entity'; import { IFavoriteMetadata } from '../../../../store/src/types/user-favorites.types'; import { - KubeAppActionBuilders, KubeDashboardActionBuilders, KubeDeploymentActionBuilders, KubeNamespaceActionBuilders, @@ -14,7 +13,6 @@ import { KubeStatefulSetsActionBuilders, } from './store/action-builders/kube.action-builders'; import { - KubernetesApp, KubernetesDeployment, KubernetesNamespace, KubernetesNode, @@ -29,7 +27,6 @@ import { */ export class KubeEntityCatalog { public endpoint: StratosCatalogEndpointEntity; - public app: StratosCatalogEntity; public statefulSet: StratosCatalogEntity; public pod: StratosCatalogEntity; public deployment: StratosCatalogEntity; diff --git a/custom-src/frontend/app/custom/kubernetes/kubernetes-entity-factory.ts b/custom-src/frontend/app/custom/kubernetes/kubernetes-entity-factory.ts index 2f2892c23a..a30402dfaa 100644 --- a/custom-src/frontend/app/custom/kubernetes/kubernetes-entity-factory.ts +++ b/custom-src/frontend/app/custom/kubernetes/kubernetes-entity-factory.ts @@ -21,7 +21,6 @@ export const kubernetesNamespacesEntityType = 'kubernetesNamespace'; export const kubernetesServicesEntityType = 'kubernetesService'; export const kubernetesStatefulSetsEntityType = 'kubernetesStatefulSet'; export const kubernetesDeploymentsEntityType = 'kubernetesDeployment'; -export const kubernetesAppsEntityType = 'kubernetesApp'; export const kubernetesDashboardEntityType = 'kubernetesDashboard'; export const getKubeAppId = (object: KubernetesApp) => object.name; @@ -57,12 +56,6 @@ entityCache[kubernetesEntityType] = new KubernetesEntitySchema( { idAttribute: getAPIResourceGuid } ); -entityCache[kubernetesAppsEntityType] = new KubernetesEntitySchema( - kubernetesAppsEntityType, - {}, - { idAttribute: getKubeAppId } -); - entityCache[kubernetesStatefulSetsEntityType] = new KubernetesEntitySchema( kubernetesStatefulSetsEntityType, {}, diff --git a/custom-src/frontend/app/custom/kubernetes/kubernetes-entity-generator.ts b/custom-src/frontend/app/custom/kubernetes/kubernetes-entity-generator.ts index 45a20854e0..eac9f993c0 100644 --- a/custom-src/frontend/app/custom/kubernetes/kubernetes-entity-generator.ts +++ b/custom-src/frontend/app/custom/kubernetes/kubernetes-entity-generator.ts @@ -23,7 +23,6 @@ import { KubernetesGKEAuthFormComponent } from './auth-forms/kubernetes-gke-auth import { kubeEntityCatalog } from './kubernetes-entity-catalog'; import { KUBERNETES_ENDPOINT_TYPE, - kubernetesAppsEntityType, kubernetesDashboardEntityType, kubernetesDeploymentsEntityType, kubernetesEntityFactory, @@ -34,8 +33,6 @@ import { kubernetesStatefulSetsEntityType, } from './kubernetes-entity-factory'; import { - KubeAppActionBuilders, - kubeAppActionBuilders, KubeDashboardActionBuilders, kubeDashboardActionBuilders, KubeDeploymentActionBuilders, @@ -52,7 +49,6 @@ import { kubeStatefulSetsActionBuilders, } from './store/action-builders/kube.action-builders'; import { - KubernetesApp, KubernetesDeployment, KubernetesNamespace, KubernetesNode, @@ -161,7 +157,6 @@ export function generateKubernetesEntities(): StratosBaseCatalogEntity[] { }; return [ generateEndpointEntity(endpointDefinition), - generateAppEntity(endpointDefinition), generateStatefulSetsEntity(endpointDefinition), generatePodsEntity(endpointDefinition), generateDeploymentsEntity(endpointDefinition), @@ -182,18 +177,6 @@ function generateEndpointEntity(endpointDefinition: StratosEndpointExtensionDefi return kubeEntityCatalog.endpoint; } -function generateAppEntity(endpointDefinition: StratosEndpointExtensionDefinition) { - const definition: IStratosEntityDefinition = { - type: kubernetesAppsEntityType, - schema: kubernetesEntityFactory(kubernetesAppsEntityType), - endpoint: endpointDefinition, - }; - kubeEntityCatalog.app = new StratosCatalogEntity(definition, { - actionBuilders: kubeAppActionBuilders - }); - return kubeEntityCatalog.app; -} - function generateStatefulSetsEntity(endpointDefinition: StratosEndpointExtensionDefinition) { const definition: IStratosEntityDefinition = { type: kubernetesStatefulSetsEntityType, diff --git a/custom-src/frontend/app/custom/kubernetes/store/action-builders/kube.action-builders.ts b/custom-src/frontend/app/custom/kubernetes/store/action-builders/kube.action-builders.ts index 51f1bc53c9..58ad75827c 100644 --- a/custom-src/frontend/app/custom/kubernetes/store/action-builders/kube.action-builders.ts +++ b/custom-src/frontend/app/custom/kubernetes/store/action-builders/kube.action-builders.ts @@ -20,13 +20,6 @@ import { KubeHealthCheck, } from '../kubernetes.actions'; -export interface KubeAppActionBuilders extends OrchestratedActionBuilders { - -} - -export const kubeAppActionBuilders: KubeAppActionBuilders = { -} - export interface KubeStatefulSetsActionBuilders extends OrchestratedActionBuilders { getMultiple: ( kubeGuid: string, diff --git a/custom-src/frontend/app/custom/kubernetes/store/kube.getIds.ts b/custom-src/frontend/app/custom/kubernetes/store/kube.getIds.ts index 6639f6f509..ef66c673df 100644 --- a/custom-src/frontend/app/custom/kubernetes/store/kube.getIds.ts +++ b/custom-src/frontend/app/custom/kubernetes/store/kube.getIds.ts @@ -1,4 +1,4 @@ -import { environment } from '../../../environments/environment.prod'; +import { environment } from '../../../environments/environment'; import { BasicKubeAPIResource, KubernetesDeployment, diff --git a/custom-src/frontend/app/custom/kubernetes/workloads/list-types/kube-namespaces-filter-config.service.ts b/custom-src/frontend/app/custom/kubernetes/workloads/list-types/kube-namespaces-filter-config.service.ts index fe9ca2f1e3..846848fc7a 100644 --- a/custom-src/frontend/app/custom/kubernetes/workloads/list-types/kube-namespaces-filter-config.service.ts +++ b/custom-src/frontend/app/custom/kubernetes/workloads/list-types/kube-namespaces-filter-config.service.ts @@ -36,7 +36,6 @@ export class KubernetesNamespacesFilterService implements OnDestroy { public kube: KubernetesNamespacesFilterItem; public namespace: KubernetesNamespacesFilterItem; - // private isLoading$: Observable; private subs: Subscription[] = []; private allNamespaces = this.getNamespacesObservable(); @@ -50,7 +49,7 @@ export class KubernetesNamespacesFilterService implements OnDestroy { this.kube = this.createKube(); this.namespace = this.createNamespace(); - // Start watching the cf/org/space plus automatically setting values only when we actually have values to auto select + // Start watching the namespace plus automatically setting values only when we actually have values to auto select this.namespace.list$.pipe(first()).subscribe(() => this.setupAutoSelectors()); } diff --git a/custom-src/frontend/app/custom/kubernetes/workloads/release/helm-release-tab-base/helm-release-tab-base.component.ts b/custom-src/frontend/app/custom/kubernetes/workloads/release/helm-release-tab-base/helm-release-tab-base.component.ts index 7f8e317b9a..3c62493c90 100644 --- a/custom-src/frontend/app/custom/kubernetes/workloads/release/helm-release-tab-base/helm-release-tab-base.component.ts +++ b/custom-src/frontend/app/custom/kubernetes/workloads/release/helm-release-tab-base/helm-release-tab-base.component.ts @@ -104,11 +104,7 @@ export class HelmReleaseTabBaseComponent implements OnDestroy { prefix = messageObj.data; } else if (messageObj.kind === 'Pods') { const pods: KubernetesPod[] = messageObj.data || []; - const podsWithInfo: KubernetesPod[] = pods.map(pod => { - const res = KubernetesPodExpandedStatusHelper.updatePodWithExpandedStatus(pod); - res.metadata.kubeId = this.helmReleaseHelper.endpointGuid; - return res; - }); + const podsWithInfo: KubernetesPod[] = pods.map(pod => KubernetesPodExpandedStatusHelper.updatePodWithExpandedStatus(pod)); const releasePodsAction = kubeEntityCatalog.pod.actions.getInWorkload( this.helmReleaseHelper.endpointGuid, this.helmReleaseHelper.releaseTitle @@ -127,7 +123,6 @@ export class HelmReleaseTabBaseComponent implements OnDestroy { // Store ALL resources for the release manifest.forEach(resource => { if (resource.kind === 'Service' && prefix) { - resource.metadata.kubeId = this.helmReleaseHelper.endpointGuid; svcs.push(resource); } }); @@ -170,7 +165,6 @@ export class HelmReleaseTabBaseComponent implements OnDestroy { private populateList(action: KubePaginationAction, resources: any) { const entity = entityCatalog.getEntity(action); - const entityKey = entity.entityKey; const newResources = {}; resources.forEach(resource => { const newResource: HelmReleasePod | HelmReleaseService = { @@ -179,12 +173,14 @@ export class HelmReleaseTabBaseComponent implements OnDestroy { ...resource }; newResource.metadata.kubeId = action.kubeGuid; - const entityId = entity.getSchema(action.schemaKey).getId(resource) + // The service entity from manifest is missing this, but apply here to ensure any others are caught + newResource.metadata.namespace = this.helmReleaseHelper.namespace; + const entityId = action.entity[0].getId(resource) newResources[entityId] = newResource; }); const releasePods = { - entities: { [entityKey]: newResources }, + entities: { [entity.entityKey]: newResources }, result: Object.keys(newResources) }; const successWrapper = new WrapperRequestActionSuccess(releasePods, action, 'fetch', releasePods.result.length, 1); diff --git a/custom-src/frontend/app/custom/kubernetes/workloads/release/tabs/helm-release-helper.service.ts b/custom-src/frontend/app/custom/kubernetes/workloads/release/tabs/helm-release-helper.service.ts index 0f193ea044..bcdef4478b 100644 --- a/custom-src/frontend/app/custom/kubernetes/workloads/release/tabs/helm-release-helper.service.ts +++ b/custom-src/frontend/app/custom/kubernetes/workloads/release/tabs/helm-release-helper.service.ts @@ -71,11 +71,10 @@ export class HelmReleaseHelperService { public fetchReleaseResources(): Observable { // Get helm release - return workloadsEntityCatalog.resource.store.getPaginationMonitor( - this.endpointGuid, - null, - { releaseTitle: this.releaseTitle } - ).currentPage$.pipe( + const action = workloadsEntityCatalog.resource.actions.get(this.releaseTitle, this.endpointGuid) + return workloadsEntityCatalog.resource.store.getEntityMonitor( + action.guid + ).entity$.pipe( filter(resources => !!resources) ); } diff --git a/custom-src/frontend/app/custom/kubernetes/workloads/workloads-entity-catalog.ts b/custom-src/frontend/app/custom/kubernetes/workloads/workloads-entity-catalog.ts index ba37ba0821..06d3a33c04 100644 --- a/custom-src/frontend/app/custom/kubernetes/workloads/workloads-entity-catalog.ts +++ b/custom-src/frontend/app/custom/kubernetes/workloads/workloads-entity-catalog.ts @@ -4,7 +4,7 @@ import { WorkloadGraphBuilders, WorkloadReleaseBuilders, WorkloadResourceBuilder import { HelmRelease, HelmReleaseGraph, HelmReleaseResource } from './workload.types'; /** - * A strongly typed collection of Kube Catalog Entities. + * A strongly typed collection of Workload Catalog Entities. * This can be used to access functionality exposed by each specific type, such as get, update, delete, etc */ export class WorkloadsEntityCatalog { @@ -14,7 +14,7 @@ export class WorkloadsEntityCatalog { } /** - * A strongly typed collection of Kube Catalog Entities. + * A strongly typed collection of Workload Catalog Entities. * This can be used to access functionality exposed by each specific type, such as get, update, delete, etc */ export const workloadsEntityCatalog: WorkloadsEntityCatalog = new WorkloadsEntityCatalog(); diff --git a/src/frontend/packages/core/src/features/endpoints/backup-restore/backup-endpoints/backup-endpoints.component.html b/src/frontend/packages/core/src/features/endpoints/backup-restore/backup-endpoints/backup-endpoints.component.html index f11198e59d..b86b52acc0 100644 --- a/src/frontend/packages/core/src/features/endpoints/backup-restore/backup-endpoints/backup-endpoints.component.html +++ b/src/frontend/packages/core/src/features/endpoints/backup-restore/backup-endpoints/backup-endpoints.component.html @@ -14,6 +14,8 @@

Backup Endpoints

+