From 872d34dd659d3df99270eab8726fc035e26a5c2d Mon Sep 17 00:00:00 2001 From: Richard Cox Date: Tue, 5 May 2020 14:18:03 +0100 Subject: [PATCH 01/15] Fixes following merge --- .../backup-endpoints/backup-endpoints.component.html | 2 +- src/jetstream/plugins/monocular/sync.go | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) 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 bfbec70bda..f11198e59d 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,7 +14,7 @@

Backup Endpoints

- +

There are no endpoints to backup

diff --git a/src/jetstream/plugins/monocular/sync.go b/src/jetstream/plugins/monocular/sync.go index 1c4d5969ce..ab1e6c3460 100644 --- a/src/jetstream/plugins/monocular/sync.go +++ b/src/jetstream/plugins/monocular/sync.go @@ -68,7 +68,7 @@ func (m *Monocular) Sync(action interfaces.EndpointAction, endpoint *interfaces. Status: "Pending", Busy: true, } - m.portalProxy.UpdateEndointMetadata(endpoint.GUID, marshalSyncMetadata(metadata)) + m.portalProxy.UpdateEndpointMetadata(endpoint.GUID, marshalSyncMetadata(metadata)) // Add the job to the queue to be processed job := SyncJob{ @@ -127,7 +127,7 @@ func (m *Monocular) processSyncRequests() { Status: "Synchronizing", Busy: true, } - m.portalProxy.UpdateEndointMetadata(job.Endpoint.GUID, marshalSyncMetadata(metadata)) + m.portalProxy.UpdateEndpointMetadata(job.Endpoint.GUID, marshalSyncMetadata(metadata)) syncURL := fmt.Sprintf("%s%s/sync/%s", m.SyncServiceURL, chartRepoPathPrefix, job.Endpoint.Name) //Hit the sync server container endpoint to trigger a sync for given repo @@ -228,7 +228,7 @@ func marshalSyncMetadata(metadata SyncMetadata) string { } func (m *Monocular) updateMetadata(endpoint string, metadata SyncMetadata) { - err := m.portalProxy.UpdateEndointMetadata(endpoint, marshalSyncMetadata(metadata)) + err := m.portalProxy.UpdateEndpointMetadata(endpoint, marshalSyncMetadata(metadata)) if err != nil { log.Errorf("Failed to update endpoint metadata: %v+", err) } From 5651d91fdfe6c395a829bd18cf9db1c78b14199e Mon Sep 17 00:00:00 2001 From: Richard Cox Date: Thu, 7 May 2020 11:20:49 +0100 Subject: [PATCH 02/15] Fix entity-catalog.service --> entity-catalog file change --- .../helm/create-release/create-release.component.ts | 2 +- .../frontend/app/custom/helm/helm-testing.module.ts | 3 ++- .../monocular-repository-list-config.service.ts | 2 +- custom-src/frontend/app/custom/helm/store/helm.effects.ts | 8 ++++---- .../app/custom/kubernetes/kubernetes.testing.module.ts | 2 +- .../kubernetes-pod-containers.component.ts | 2 +- .../app/custom/kubernetes/store/kubernetes.effects.ts | 2 +- .../kubernetes-summary.component.ts | 4 ++-- .../helm-release-tab-base.component.ts | 2 +- .../workloads/release/tabs/helm-release-helper.service.ts | 2 +- .../kubernetes/workloads/store/workloads.effects.ts | 2 +- 11 files changed, 16 insertions(+), 15 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 87e87edc6b..60dd7f0190 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 @@ -10,7 +10,7 @@ import { BehaviorSubject, combineLatest, Observable, of, Subscription } from 'rx import { distinctUntilChanged, filter, first, map, pairwise, startWith, switchMap } from 'rxjs/operators'; import { AppState } from '../../../../../store/src/app-state'; -import { entityCatalog } from '../../../../../store/src/entity-catalog/entity-catalog.service'; +import { entityCatalog } from '../../../../../store/src/entity-catalog/entity-catalog'; import { EndpointsService } from '../../../core/endpoints.service'; import { safeUnsubscribe } from '../../../core/utils.service'; import { ConfirmationDialogConfig } from '../../../shared/components/confirmation-dialog.config'; diff --git a/custom-src/frontend/app/custom/helm/helm-testing.module.ts b/custom-src/frontend/app/custom/helm/helm-testing.module.ts index 62765f8b0d..be42355419 100644 --- a/custom-src/frontend/app/custom/helm/helm-testing.module.ts +++ b/custom-src/frontend/app/custom/helm/helm-testing.module.ts @@ -5,7 +5,7 @@ import { ActivatedRoute } from '@angular/router'; import { RouterTestingModule } from '@angular/router/testing'; import { CATALOGUE_ENTITIES, EntityCatalogFeatureModule } from '../../../../store/src/entity-catalog.module'; -import { entityCatalog, TestEntityCatalog } from '../../../../store/src/entity-catalog/entity-catalog.service'; +import { entityCatalog, TestEntityCatalog } from '../../../../store/src/entity-catalog/entity-catalog'; import { createBasicStoreModule } from '../../../../store/testing/public-api'; import { generateStratosEntities } from '../../base-entity-types'; import { CoreModule } from '../../core/core.module'; @@ -13,6 +13,7 @@ import { SharedModule } from '../../shared/shared.module'; import { HelmReleaseGuid } from '../kubernetes/workloads/workload.types'; import { generateHelmEntities } from './helm-entity-generator'; + @NgModule({ imports: [{ ngModule: EntityCatalogFeatureModule, diff --git a/custom-src/frontend/app/custom/helm/list-types/monocular-repository-list-config.service.ts b/custom-src/frontend/app/custom/helm/list-types/monocular-repository-list-config.service.ts index b3d343ef8c..de28838e2b 100644 --- a/custom-src/frontend/app/custom/helm/list-types/monocular-repository-list-config.service.ts +++ b/custom-src/frontend/app/custom/helm/list-types/monocular-repository-list-config.service.ts @@ -4,7 +4,7 @@ import { MatSnackBar } from '@angular/material'; import { ActivatedRoute } from '@angular/router'; import { Store } from '@ngrx/store'; import { UnregisterEndpoint } from 'frontend/packages/store/src/actions/endpoint.actions'; -import { entityCatalog } from 'frontend/packages/store/src/entity-catalog/entity-catalog.service'; +import { entityCatalog } from 'frontend/packages/store/src/entity-catalog/entity-catalog'; import { endpointSchemaKey } from 'frontend/packages/store/src/helpers/entity-factory'; import { selectDeletionInfo } from 'frontend/packages/store/src/selectors/api.selectors'; import { of as observableOf } from 'rxjs'; diff --git a/custom-src/frontend/app/custom/helm/store/helm.effects.ts b/custom-src/frontend/app/custom/helm/store/helm.effects.ts index 4d3d1534dd..e79232c5d9 100644 --- a/custom-src/frontend/app/custom/helm/store/helm.effects.ts +++ b/custom-src/frontend/app/custom/helm/store/helm.effects.ts @@ -2,9 +2,10 @@ import { HttpClient } from '@angular/common/http'; import { Injectable } from '@angular/core'; import { Actions, Effect, ofType } from '@ngrx/effects'; import { Action, Store } from '@ngrx/store'; +import { GET_ENDPOINTS_SUCCESS, GetAllEndpointsSuccess } from 'frontend/packages/store/src/actions/endpoint.actions'; import { ClearPaginationOfType } from 'frontend/packages/store/src/actions/pagination.actions'; import { AppState } from 'frontend/packages/store/src/app-state'; -import { entityCatalog } from 'frontend/packages/store/src/entity-catalog/entity-catalog.service'; +import { entityCatalog } from 'frontend/packages/store/src/entity-catalog/entity-catalog'; import { ApiRequestTypes } from 'frontend/packages/store/src/reducers/api-request-reducer/request-helpers'; import { NormalizedResponse } from 'frontend/packages/store/src/types/api.types'; import { @@ -13,11 +14,12 @@ import { WrapperRequestActionFailed, WrapperRequestActionSuccess, } from 'frontend/packages/store/src/types/request.types'; -import { Observable, of } from 'rxjs'; +import { Observable } from 'rxjs'; import { catchError, flatMap, mergeMap } from 'rxjs/operators'; import { environment } from '../../../environments/environment'; import { isJetstreamError } from '../../../jetstream.helpers'; +import { HELM_ENDPOINT_TYPE } from '../helm-entity-factory'; import { GET_HELM_VERSIONS, GET_MONOCULAR_CHARTS, @@ -27,8 +29,6 @@ import { HelmInstall, } from './helm.actions'; import { HelmVersion } from './helm.types'; -import { GetAllEndpointsSuccess, GET_ENDPOINTS_SUCCESS } from 'frontend/packages/store/src/actions/endpoint.actions'; -import { HELM_ENDPOINT_TYPE } from '../helm-entity-factory'; @Injectable() export class HelmEffects { diff --git a/custom-src/frontend/app/custom/kubernetes/kubernetes.testing.module.ts b/custom-src/frontend/app/custom/kubernetes/kubernetes.testing.module.ts index 9aa2016dfd..05ecca6666 100644 --- a/custom-src/frontend/app/custom/kubernetes/kubernetes.testing.module.ts +++ b/custom-src/frontend/app/custom/kubernetes/kubernetes.testing.module.ts @@ -4,7 +4,7 @@ import { NoopAnimationsModule } from '@angular/platform-browser/animations'; import { RouterTestingModule } from '@angular/router/testing'; import { CATALOGUE_ENTITIES, EntityCatalogFeatureModule } from '../../../../store/src/entity-catalog.module'; -import { entityCatalog, TestEntityCatalog } from '../../../../store/src/entity-catalog/entity-catalog.service'; +import { entityCatalog, TestEntityCatalog } from '../../../../store/src/entity-catalog/entity-catalog'; import { createBasicStoreModule } from '../../../../store/testing/public-api'; import { generateStratosEntities } from '../../base-entity-types'; import { CoreModule } from '../../core/core.module'; diff --git a/custom-src/frontend/app/custom/kubernetes/list-types/kubernetes-pods/kubernetes-pod-containers/kubernetes-pod-containers.component.ts b/custom-src/frontend/app/custom/kubernetes/list-types/kubernetes-pods/kubernetes-pod-containers/kubernetes-pod-containers.component.ts index ecc31b5654..f83718f337 100644 --- a/custom-src/frontend/app/custom/kubernetes/list-types/kubernetes-pods/kubernetes-pod-containers/kubernetes-pod-containers.component.ts +++ b/custom-src/frontend/app/custom/kubernetes/list-types/kubernetes-pods/kubernetes-pod-containers/kubernetes-pod-containers.component.ts @@ -6,7 +6,7 @@ import { of } from 'rxjs'; import { filter, map } from 'rxjs/operators'; import { AppState } from '../../../../../../../store/src/app-state'; -import { entityCatalog } from '../../../../../../../store/src/entity-catalog/entity-catalog.service'; +import { entityCatalog } from '../../../../../../../store/src/entity-catalog/entity-catalog'; import { selectEntity } from '../../../../../../../store/src/selectors/api.selectors'; import { BooleanIndicatorType } from '../../../../../shared/components/boolean-indicator/boolean-indicator.component'; import { ITableListDataSource } from '../../../../../shared/components/list/data-sources-controllers/list-data-source-types'; diff --git a/custom-src/frontend/app/custom/kubernetes/store/kubernetes.effects.ts b/custom-src/frontend/app/custom/kubernetes/store/kubernetes.effects.ts index d5d36df44d..c55b3cca8a 100644 --- a/custom-src/frontend/app/custom/kubernetes/store/kubernetes.effects.ts +++ b/custom-src/frontend/app/custom/kubernetes/store/kubernetes.effects.ts @@ -9,7 +9,7 @@ import { of } from 'rxjs'; import { catchError, first, flatMap, map, mergeMap, switchMap } from 'rxjs/operators'; import { AppState } from '../../../../../store/src/app-state'; -import { entityCatalog } from '../../../../../store/src/entity-catalog/entity-catalog.service'; +import { entityCatalog } from '../../../../../store/src/entity-catalog/entity-catalog'; import { NormalizedResponse } from '../../../../../store/src/types/api.types'; import { StartRequestAction, diff --git a/custom-src/frontend/app/custom/kubernetes/tabs/kubernetes-summary-tab/kubernetes-summary.component.ts b/custom-src/frontend/app/custom/kubernetes/tabs/kubernetes-summary-tab/kubernetes-summary.component.ts index a7c14df6ce..5f7d4cdd5d 100644 --- a/custom-src/frontend/app/custom/kubernetes/tabs/kubernetes-summary-tab/kubernetes-summary.component.ts +++ b/custom-src/frontend/app/custom/kubernetes/tabs/kubernetes-summary-tab/kubernetes-summary.component.ts @@ -1,12 +1,13 @@ import { HttpClient } from '@angular/common/http'; import { Component, NgZone, OnDestroy, OnInit } from '@angular/core'; import { SafeResourceUrl } from '@angular/platform-browser'; +import { Router } from '@angular/router'; import { Store } from '@ngrx/store'; import { combineLatest, interval, Observable, Subscription } from 'rxjs'; import { map, startWith } from 'rxjs/operators'; import { AppState } from '../../../../../../store/src/app-state'; -import { entityCatalog } from '../../../../../../store/src/entity-catalog/entity-catalog.service'; +import { entityCatalog } from '../../../../../../store/src/entity-catalog/entity-catalog'; import { PaginationMonitorFactory } from '../../../../../../store/src/monitors/pagination-monitor.factory'; import { getPaginationObservables } from '../../../../../../store/src/reducers/pagination-reducer/pagination-reducer.helper'; import { PaginatedAction } from '../../../../../../store/src/types/pagination.types'; @@ -17,7 +18,6 @@ import { } from '../../../../shared/components/simple-usage-chart/simple-usage-chart.types'; import { KubernetesEndpointService } from '../../services/kubernetes-endpoint.service'; import { GetKubernetesNamespaces, GetKubernetesNodes, GetKubernetesPods } from '../../store/kubernetes.actions'; -import { Router } from '@angular/router'; interface IValueLabels { usedLabel?: string; 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 0787289ab5..f3d8d9927a 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 @@ -4,7 +4,7 @@ import { Store } from '@ngrx/store'; import { LoggerService } from 'frontend/packages/core/src/core/logger.service'; import { IPageSideNavTab } from 'frontend/packages/core/src/features/dashboard/page-side-nav/page-side-nav.component'; import { AppState } from 'frontend/packages/store/src/app-state'; -import { entityCatalog } from 'frontend/packages/store/src/entity-catalog/entity-catalog.service'; +import { entityCatalog } from 'frontend/packages/store/src/entity-catalog/entity-catalog'; import { PaginatedAction } from 'frontend/packages/store/src/types/pagination.types'; import { EntityRequestAction, WrapperRequestActionSuccess } from 'frontend/packages/store/src/types/request.types'; import { Observable, Subject, Subscription } from 'rxjs'; 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 723a77bd33..aa8a7b73c9 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 @@ -1,7 +1,7 @@ import { Injectable } from '@angular/core'; import { Store } from '@ngrx/store'; import { AppState } from 'frontend/packages/store/src/app-state'; -import { entityCatalog } from 'frontend/packages/store/src/entity-catalog/entity-catalog.service'; +import { entityCatalog } from 'frontend/packages/store/src/entity-catalog/entity-catalog'; import { EntityServiceFactory } from 'frontend/packages/store/src/entity-service-factory.service'; import { PaginationMonitorFactory } from 'frontend/packages/store/src/monitors/pagination-monitor.factory'; import { selectEntity } from 'frontend/packages/store/src/selectors/api.selectors'; diff --git a/custom-src/frontend/app/custom/kubernetes/workloads/store/workloads.effects.ts b/custom-src/frontend/app/custom/kubernetes/workloads/store/workloads.effects.ts index 10656a97fc..086bc29fd8 100644 --- a/custom-src/frontend/app/custom/kubernetes/workloads/store/workloads.effects.ts +++ b/custom-src/frontend/app/custom/kubernetes/workloads/store/workloads.effects.ts @@ -7,7 +7,7 @@ import { Observable } from 'rxjs'; import { catchError, flatMap, mergeMap } from 'rxjs/operators'; import { AppState } from '../../../../../../store/src/app-state'; -import { entityCatalog } from '../../../../../../store/src/entity-catalog/entity-catalog.service'; +import { entityCatalog } from '../../../../../../store/src/entity-catalog/entity-catalog'; import { NormalizedResponse } from '../../../../../../store/src/types/api.types'; import { EntityRequestAction, From cca5f7b4f3d02ac57c37d852b0b67aa254436dc8 Mon Sep 17 00:00:00 2001 From: Richard Cox Date: Thu, 7 May 2020 14:16:46 +0100 Subject: [PATCH 03/15] WIP --- .../app/custom/helm/helm-entity-generator.ts | 2 +- .../kubernetes/kubernetes-entity-catalog.ts | 7 ++ .../kubernetes/kubernetes-entity-generator.ts | 79 ++++++++++++++----- .../action-builders/kube.action-builders.ts | 76 ++++++++++++++++++ .../kubernetes/store/kubernetes.actions.ts | 30 ++++--- .../kubernetes/store/kubernetes.effects.ts | 19 ++--- .../store/workloads-entity-generator.ts | 2 +- .../card-autoscaler-default.component.spec.ts | 4 +- ...p-autoscaler-events-config.service.spec.ts | 4 +- ...scaler-metric-chart-card.component.spec.ts | 2 +- ...r-metric-chart-list-config.service.spec.ts | 4 +- .../metrics/metrics/metrics.component.html | 19 +++-- .../core/test-framework/core-test.helper.ts | 4 +- 13 files changed, 196 insertions(+), 56 deletions(-) create mode 100644 custom-src/frontend/app/custom/kubernetes/kubernetes-entity-catalog.ts create mode 100644 custom-src/frontend/app/custom/kubernetes/store/action-builders/kube.action-builders.ts diff --git a/custom-src/frontend/app/custom/helm/helm-entity-generator.ts b/custom-src/frontend/app/custom/helm/helm-entity-generator.ts index aef2cffc53..0fb65457a6 100644 --- a/custom-src/frontend/app/custom/helm/helm-entity-generator.ts +++ b/custom-src/frontend/app/custom/helm/helm-entity-generator.ts @@ -2,7 +2,7 @@ import { StratosBaseCatalogEntity, StratosCatalogEndpointEntity, StratosCatalogEntity, -} from '../../../../store/src/entity-catalog/entity-catalog-entity'; +} from '../../../../store/src/entity-catalog/entity-catalog-entity/entity-catalog-entity'; import { StratosEndpointExtensionDefinition } from '../../../../store/src/entity-catalog/entity-catalog.types'; import { IFavoriteMetadata } from '../../../../store/src/types/user-favorites.types'; import { diff --git a/custom-src/frontend/app/custom/kubernetes/kubernetes-entity-catalog.ts b/custom-src/frontend/app/custom/kubernetes/kubernetes-entity-catalog.ts new file mode 100644 index 0000000000..dbadecc336 --- /dev/null +++ b/custom-src/frontend/app/custom/kubernetes/kubernetes-entity-catalog.ts @@ -0,0 +1,7 @@ +/** + * A strongly typed collection of Kube Catalog Entities. + * This can be used to access functionality exposed by each specific type, such as get, update, delete, etc + */ +export class KubeEntityCatalog { + +} \ No newline at end of file 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 cd4b43f25a..7beff79804 100644 --- a/custom-src/frontend/app/custom/kubernetes/kubernetes-entity-generator.ts +++ b/custom-src/frontend/app/custom/kubernetes/kubernetes-entity-generator.ts @@ -5,8 +5,11 @@ import { StratosBaseCatalogEntity, StratosCatalogEndpointEntity, StratosCatalogEntity, -} from '../../../../store/src/entity-catalog/entity-catalog-entity'; -import { StratosEndpointExtensionDefinition } from '../../../../store/src/entity-catalog/entity-catalog.types'; +} from '../../../../store/src/entity-catalog/entity-catalog-entity/entity-catalog-entity'; +import { + IStratosEntityDefinition, + StratosEndpointExtensionDefinition, +} from '../../../../store/src/entity-catalog/entity-catalog.types'; import { IFavoriteMetadata } from '../../../../store/src/types/user-favorites.types'; import { EndpointAuthTypeConfig, EndpointType } from '../../core/extension/extension-types'; import { KubernetesAWSAuthFormComponent } from './auth-forms/kubernetes-aws-auth-form/kubernetes-aws-auth-form.component'; @@ -29,6 +32,24 @@ import { kubernetesServicesEntityType, kubernetesStatefulSetsEntityType, } from './kubernetes-entity-factory'; +import { + KubeAppActionBuilders, + kubeAppActionBuilders, + KubeDashboardActionBuilders, + kubeDashboardActionBuilders, + KubeDeploymentActionBuilders, + kubeDeploymentActionBuilders, + KubeNamespaceActionBuilders, + kubeNamespaceActionBuilders, + KubeNodeActionBuilders, + kubeNodeActionBuilders, + KubePodActionBuilders, + kubePodActionBuilders, + KubeServiceActionBuilders, + kubeServiceActionBuilders, + KubeStatefulSetsActionBuilders, + kubeStatefulSetsActionBuilders, +} from './store/action-builders/kube.action-builders'; import { KubernetesApp, KubernetesDeployment, @@ -160,79 +181,97 @@ function generateEndpointEntity(endpointDefinition: StratosEndpointExtensionDefi } function generateAppEntity(endpointDefinition: StratosEndpointExtensionDefinition) { - const definition = { + const definition: IStratosEntityDefinition = { type: kubernetesAppsEntityType, schema: kubernetesEntityFactory(kubernetesAppsEntityType), - endpoint: endpointDefinition + endpoint: endpointDefinition, + }; - return new StratosCatalogEntity(definition); + return new StratosCatalogEntity(definition, { + actionBuilders: kubeAppActionBuilders + }); } function generateStatefulSetsEntity(endpointDefinition: StratosEndpointExtensionDefinition) { - const definition = { + const definition: IStratosEntityDefinition = { type: kubernetesStatefulSetsEntityType, schema: kubernetesEntityFactory(kubernetesStatefulSetsEntityType), endpoint: endpointDefinition }; - return new StratosCatalogEntity(definition); + return new StratosCatalogEntity(definition, { + actionBuilders: kubeStatefulSetsActionBuilders + }); } function generatePodsEntity(endpointDefinition: StratosEndpointExtensionDefinition) { - const definition = { + const definition: IStratosEntityDefinition = { type: kubernetesPodsEntityType, schema: kubernetesEntityFactory(kubernetesPodsEntityType), endpoint: endpointDefinition }; - return new StratosCatalogEntity(definition); + return new StratosCatalogEntity(definition, { + actionBuilders: kubePodActionBuilders + }); } function generateDeploymentsEntity(endpointDefinition: StratosEndpointExtensionDefinition) { - const definition = { + const definition: IStratosEntityDefinition = { type: kubernetesDeploymentsEntityType, schema: kubernetesEntityFactory(kubernetesDeploymentsEntityType), endpoint: endpointDefinition }; - return new StratosCatalogEntity(definition); + return new StratosCatalogEntity(definition, { + actionBuilders: kubeDeploymentActionBuilders + }); } function generateNodesEntity(endpointDefinition: StratosEndpointExtensionDefinition) { - const definition = { + const definition: IStratosEntityDefinition = { type: kubernetesNodesEntityType, schema: kubernetesEntityFactory(kubernetesNodesEntityType), endpoint: endpointDefinition }; - return new StratosCatalogEntity(definition); + return new StratosCatalogEntity(definition, { + actionBuilders: kubeNodeActionBuilders + }); } function generateNamespacesEntity(endpointDefinition: StratosEndpointExtensionDefinition) { - const definition = { + const definition: IStratosEntityDefinition = { type: kubernetesNamespacesEntityType, schema: kubernetesEntityFactory(kubernetesNamespacesEntityType), endpoint: endpointDefinition }; - return new StratosCatalogEntity(definition); + return new StratosCatalogEntity(definition, { + actionBuilders: kubeNamespaceActionBuilders + }); } function generateServicesEntity(endpointDefinition: StratosEndpointExtensionDefinition) { - const definition = { + const definition: IStratosEntityDefinition = { type: kubernetesServicesEntityType, schema: kubernetesEntityFactory(kubernetesServicesEntityType), endpoint: endpointDefinition }; - return new StratosCatalogEntity(definition); + return new StratosCatalogEntity(definition, { + actionBuilders: kubeServiceActionBuilders + }); } function generateDashboardEntity(endpointDefinition: StratosEndpointExtensionDefinition) { - const definition = { + const definition: IStratosEntityDefinition = { type: kubernetesDashboardEntityType, schema: kubernetesEntityFactory(kubernetesDashboardEntityType), endpoint: endpointDefinition }; - return new StratosCatalogEntity(definition); + // TODO: RC any + return new StratosCatalogEntity(definition, { + actionBuilders: kubeDashboardActionBuilders + }); } function generateMetricEntity(endpointDefinition: StratosEndpointExtensionDefinition) { - const definition = { + const definition: IStratosEntityDefinition = { type: metricEntityType, schema: kubernetesEntityFactory(metricEntityType), label: 'Kubernetes Metric', 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 new file mode 100644 index 0000000000..0ca8312580 --- /dev/null +++ b/custom-src/frontend/app/custom/kubernetes/store/action-builders/kube.action-builders.ts @@ -0,0 +1,76 @@ +import { + OrchestratedActionBuilders, +} from '../../../../../../store/src/entity-catalog/action-orchestrator/action-orchestrator'; +import { GetKubernetesNode, GetKubernetesNodes } from '../kubernetes.actions'; + +export interface KubeAppActionBuilders extends OrchestratedActionBuilders { + +} + +export const kubeAppActionBuilders: KubeAppActionBuilders = { +} + +export interface KubeStatefulSetsActionBuilders extends OrchestratedActionBuilders { + +} + +export const kubeStatefulSetsActionBuilders: KubeStatefulSetsActionBuilders = { +} + +export interface KubePodActionBuilders extends OrchestratedActionBuilders { + +} + +export const kubePodActionBuilders: KubePodActionBuilders = { +} + +export interface KubeDeploymentActionBuilders extends OrchestratedActionBuilders { + +} + +export const kubeDeploymentActionBuilders: KubeDeploymentActionBuilders = { +} + +export interface KubeNodeActionBuilders extends OrchestratedActionBuilders { + get: ( + nodeName: string, + kubeGuid: string + ) => GetKubernetesNode + getMultiple: ( + kubeGuid: string, + paginationKey: string, + ) => GetKubernetesNodes +} + +export const kubeNodeActionBuilders: KubeNodeActionBuilders = { + get: (nodeName: string, endpointGuid: string) => new GetKubernetesNode() + getMultiple: (kubeGuid: string, paginationKey: string) => new GetKubernetesNodes(kubeGuid) +} + +export interface KubeNamespaceActionBuilders extends OrchestratedActionBuilders { + +} + +export const kubeNamespaceActionBuilders: KubeNamespaceActionBuilders = { +} + +export interface KubeServiceActionBuilders extends OrchestratedActionBuilders { + +} + +export const kubeServiceActionBuilders: KubeServiceActionBuilders = { +} + +export interface KubeDashboardActionBuilders extends OrchestratedActionBuilders { + +} + +export const kubeDashboardActionBuilders: KubeDashboardActionBuilders = { +} + +// export interface A extends OrchestratedActionBuilders { + +// } + +// export const a: A = { +// } \ No newline at end of file diff --git a/custom-src/frontend/app/custom/kubernetes/store/kubernetes.actions.ts b/custom-src/frontend/app/custom/kubernetes/store/kubernetes.actions.ts index 6d1d44c4ef..ac98e0735f 100644 --- a/custom-src/frontend/app/custom/kubernetes/store/kubernetes.actions.ts +++ b/custom-src/frontend/app/custom/kubernetes/store/kubernetes.actions.ts @@ -17,6 +17,7 @@ import { kubernetesServicesEntityType, kubernetesStatefulSetsEntityType, } from '../kubernetes-entity-factory'; +import { getKubeAPIResourceGuid } from './kube.selectors'; export const GET_RELEASE_POD_INFO = '[KUBERNETES Endpoint] Get Release Pods Info'; export const GET_RELEASE_POD_INFO_SUCCESS = '[KUBERNETES Endpoint] Get Release Pods Info Success'; @@ -89,7 +90,12 @@ const sortPodsByName = { export interface KubeAction extends EntityRequestAction { kubeGuid: string; } -export interface KubePaginationAction extends PaginatedAction, KubeAction { } +export interface KubePaginationAction extends PaginatedAction, KubeAction { + getId: (r: any) => string; +} +export interface KubeSingleEntityAction extends KubeAction { + guid: string; +} export class KubeHealthCheck implements KubePaginationAction { constructor(public kubeGuid) { @@ -128,10 +134,12 @@ export class GetKubernetesNodes implements KubePaginationAction { 'order-direction': 'desc' as SortDirection, 'order-direction-field': 'name' }; + getId = getKubeAPIResourceGuid; } -export class GetKubernetesNode implements KubeAction { +export class GetKubernetesNode implements KubeSingleEntityAction { constructor(public nodeName: string, public kubeGuid: string) { + this.guid = this.nodeName; } type = GET_NODE_INFO; entityType = kubernetesNodesEntityType; @@ -143,9 +151,10 @@ export class GetKubernetesNode implements KubeAction { GET_NODE_INFO_SUCCESS, GET_NODE_INFO_FAILURE ]; + guid: string; } -export class GetKubernetesNamespace implements KubeAction { +export class GetKubernetesNamespace implements KubeSingleEntityAction { constructor(public namespaceName: string, public kubeGuid: string) { } type = GET_NAMESPACE_INFO; @@ -160,7 +169,7 @@ export class GetKubernetesNamespace implements KubeAction { ]; } -export class CreateKubernetesNamespace implements KubeAction { +export class CreateKubernetesNamespace implements KubeSingleEntityAction { public guid: string; constructor(public namespaceName: string, public kubeGuid: string) { this.guid = `Creating-${namespaceName}-${kubeGuid}`; @@ -193,7 +202,7 @@ export class GetKubernetesPods implements KubePaginationAction { }; } -export class GetKubernetesPodsOnNode implements PaginatedAction, KubeAction { +export class GetKubernetesPodsOnNode implements KubePaginationAction { constructor(public kubeGuid: string, public nodeName: string) { this.paginationKey = getPaginationKey(kubernetesPodsEntityType, `node-${nodeName}`, kubeGuid); this.initialParams = { @@ -214,7 +223,7 @@ export class GetKubernetesPodsOnNode implements PaginatedAction, KubeAction { initialParams: PaginationParam; } -export class GetKubernetesServicesInNamespace implements PaginatedAction, KubeAction { +export class GetKubernetesServicesInNamespace implements KubePaginationAction { constructor(public kubeGuid: string, public namespaceName: string) { this.paginationKey = getPaginationKey(kubernetesPodsEntityType, `ns-${namespaceName}`, kubeGuid); } @@ -233,7 +242,7 @@ export class GetKubernetesServicesInNamespace implements PaginatedAction, KubeAc }; } -export class GetKubernetesPodsInNamespace implements PaginatedAction, KubeAction { +export class GetKubernetesPodsInNamespace implements KubePaginationAction { constructor(public kubeGuid: string, public namespaceName: string) { this.paginationKey = getPaginationKey(kubernetesPodsEntityType, `ns-${namespaceName}`, kubeGuid); } @@ -292,7 +301,7 @@ export class GetKubernetesServices implements KubePaginationAction { }; } -export class GetKubernetesPod implements KubeAction { +export class GetKubernetesPod implements KubeSingleEntityAction { constructor(public podName, public namespaceName, public kubeGuid) { } type = GET_KUBE_POD; @@ -338,8 +347,9 @@ export class GeKubernetesDeployments implements KubePaginationAction { paginationKey: string; } -export class GetKubernetesDashboard implements KubeAction { +export class GetKubernetesDashboard implements KubeSingleEntityAction { constructor(public kubeGuid: string) { + this.guid = this.getId(); } type = GET_KUBE_DASHBOARD; entityType = kubernetesDashboardEntityType; @@ -351,6 +361,8 @@ export class GetKubernetesDashboard implements KubeAction { GET_KUBE_DASHBOARD_SUCCESS, GET_KUBE_DASHBOARD_FAILURE ]; + getId = () => this.kubeGuid; + guid: string; } function getKubeMetricsAction(guid: string) { diff --git a/custom-src/frontend/app/custom/kubernetes/store/kubernetes.effects.ts b/custom-src/frontend/app/custom/kubernetes/store/kubernetes.effects.ts index c55b3cca8a..55d6ccc0f8 100644 --- a/custom-src/frontend/app/custom/kubernetes/store/kubernetes.effects.ts +++ b/custom-src/frontend/app/custom/kubernetes/store/kubernetes.effects.ts @@ -124,9 +124,8 @@ export class KubernetesEffects { result: [] } as NormalizedResponse; const status = response as KubeDashboardStatus; - const id = status.guid; - result.entities[dashboardEntityConfig.entityKey][id] = status; - result.result.push(id); + result.entities[dashboardEntityConfig.entityKey][action.guid] = status; + result.result.push(action.guid); return [ new WrapperRequestActionSuccess(result, action) ]; @@ -155,8 +154,7 @@ export class KubernetesEffects { const nodeEntityConfig = entityCatalog.getEntity(KUBERNETES_ENDPOINT_TYPE, kubernetesNodesEntityType); return this.processSingleItemAction(action, `/pp/${this.proxyAPIVersion}/proxy/api/v1/nodes/${action.nodeName}`, - nodeEntityConfig.entityKey, - (node) => node.metadata.name); + nodeEntityConfig.entityKey); }) ); @@ -168,7 +166,7 @@ export class KubernetesEffects { return this.processSingleItemAction(action, `/pp/${this.proxyAPIVersion}/proxy/api/v1/namespaces/${action.namespaceName}`, namespaceEntityConfig.entityKey, - getKubeAPIResourceGuid); + getKubeAPIResourceGuid); // TODO: RC HERE }) ); @@ -314,10 +312,9 @@ export class KubernetesEffects { } private processListAction( - action: KubePaginationAction | KubeAction, + action: KubePaginationAction, url: string, entityKey: string, - getId: GetID, filterResults?: Filter) { this.store.dispatch(new StartRequestAction(action)); @@ -397,7 +394,6 @@ export class KubernetesEffects { action: KubeAction, url: string, schemaKey: string, - getId: GetID, body?: any) { const requestType: ApiRequestTypes = body ? 'create' : 'fetch'; this.store.dispatch(new StartRequestAction(action, requestType)); @@ -418,12 +414,11 @@ export class KubernetesEffects { entities: { [schemaKey]: {} }, result: [] } as NormalizedResponse; - const id = getId(response); const data = action.entityType === kubernetesPodsEntityType ? KubernetesPodExpandedStatusHelper.updatePodWithExpandedStatus(response as unknown as KubernetesPod) : response; - res.entities[schemaKey][id] = data; - res.result.push(id); + res.entities[schemaKey][action.guid] = data; + res.result.push(action.guid); const actions: Action[] = [ new WrapperRequestActionSuccess(res, action) ]; diff --git a/custom-src/frontend/app/custom/kubernetes/workloads/store/workloads-entity-generator.ts b/custom-src/frontend/app/custom/kubernetes/workloads/store/workloads-entity-generator.ts index cddd1778f4..8ba379a06c 100644 --- a/custom-src/frontend/app/custom/kubernetes/workloads/store/workloads-entity-generator.ts +++ b/custom-src/frontend/app/custom/kubernetes/workloads/store/workloads-entity-generator.ts @@ -1,7 +1,7 @@ import { StratosBaseCatalogEntity, StratosCatalogEntity, -} from 'frontend/packages/store/src/entity-catalog/entity-catalog-entity'; +} from 'frontend/packages/store/src/entity-catalog/entity-catalog-entity/entity-catalog-entity'; import { StratosEndpointExtensionDefinition } from 'frontend/packages/store/src/entity-catalog/entity-catalog.types'; import { IFavoriteMetadata } from 'frontend/packages/store/src/types/user-favorites.types'; diff --git a/src/frontend/packages/cf-autoscaler/src/shared/card-autoscaler-default/card-autoscaler-default.component.spec.ts b/src/frontend/packages/cf-autoscaler/src/shared/card-autoscaler-default/card-autoscaler-default.component.spec.ts index 347c2a3c40..77c25d66d0 100644 --- a/src/frontend/packages/cf-autoscaler/src/shared/card-autoscaler-default/card-autoscaler-default.component.spec.ts +++ b/src/frontend/packages/cf-autoscaler/src/shared/card-autoscaler-default/card-autoscaler-default.component.spec.ts @@ -15,7 +15,9 @@ import { import { MetadataItemComponent } from '../../../../core/src/shared/components/metadata-item/metadata-item.component'; import { ApplicationServiceMock } from '../../../../core/test-framework/application-service-helper'; import { AppTestModule } from '../../../../core/test-framework/core-test.helper'; -import { EntityCatalogHelper } from '../../../../store/src/entity-catalog/entity-catalog-entity/entity-catalog.service'; +import { + EntityCatalogHelper, +} from '../../../../store/src/entity-catalog/entity-catalog-entity/entity-catalog-entity/entity-catalog.service'; import { EntityMonitorFactory } from '../../../../store/src/monitors/entity-monitor.factory.service'; import { PaginationMonitorFactory } from '../../../../store/src/monitors/pagination-monitor.factory'; import { CfAutoscalerTestingModule } from '../../cf-autoscaler-testing.module'; diff --git a/src/frontend/packages/cf-autoscaler/src/shared/list-types/app-autoscaler-event/cf-app-autoscaler-events-config.service.spec.ts b/src/frontend/packages/cf-autoscaler/src/shared/list-types/app-autoscaler-event/cf-app-autoscaler-events-config.service.spec.ts index 4f00ffdaef..8412c69ad4 100644 --- a/src/frontend/packages/cf-autoscaler/src/shared/list-types/app-autoscaler-event/cf-app-autoscaler-events-config.service.spec.ts +++ b/src/frontend/packages/cf-autoscaler/src/shared/list-types/app-autoscaler-event/cf-app-autoscaler-events-config.service.spec.ts @@ -14,7 +14,9 @@ import { SharedModule } from '../../../../../core/src/shared/shared.module'; import { generateTestApplicationServiceProvider } from '../../../../../core/test-framework/application-service-helper'; import { AppTestModule } from '../../../../../core/test-framework/core-test.helper'; import { generateTestEntityServiceProvider } from '../../../../../core/test-framework/entity-service.helper'; -import { EntityCatalogHelper } from '../../../../../store/src/entity-catalog/entity-catalog-entity/entity-catalog.service'; +import { + EntityCatalogHelper, +} from '../../../../../store/src/entity-catalog/entity-catalog-entity/entity-catalog-entity/entity-catalog.service'; import { EntityServiceFactory } from '../../../../../store/src/entity-service-factory.service'; import { EntityMonitorFactory } from '../../../../../store/src/monitors/entity-monitor.factory.service'; import { CfAutoscalerTestingModule } from '../../../cf-autoscaler-testing.module'; diff --git a/src/frontend/packages/cf-autoscaler/src/shared/list-types/app-autoscaler-metric-chart/app-autoscaler-metric-chart-card/app-autoscaler-metric-chart-card.component.spec.ts b/src/frontend/packages/cf-autoscaler/src/shared/list-types/app-autoscaler-metric-chart/app-autoscaler-metric-chart-card/app-autoscaler-metric-chart-card.component.spec.ts index bc8e376f85..95bab21784 100644 --- a/src/frontend/packages/cf-autoscaler/src/shared/list-types/app-autoscaler-metric-chart/app-autoscaler-metric-chart-card/app-autoscaler-metric-chart-card.component.spec.ts +++ b/src/frontend/packages/cf-autoscaler/src/shared/list-types/app-autoscaler-metric-chart/app-autoscaler-metric-chart-card/app-autoscaler-metric-chart-card.component.spec.ts @@ -18,7 +18,7 @@ import { generateTestApplicationServiceProvider } from '../../../../../../core/t import { AppTestModule } from '../../../../../../core/test-framework/core-test.helper'; import { EntityCatalogHelper, -} from '../../../../../../store/src/entity-catalog/entity-catalog-entity/entity-catalog.service'; +} from '../../../../../../store/src/entity-catalog/entity-catalog-entity/entity-catalog-entity/entity-catalog.service'; import { EntityMonitorFactory } from '../../../../../../store/src/monitors/entity-monitor.factory.service'; import { PaginationMonitorFactory } from '../../../../../../store/src/monitors/pagination-monitor.factory'; import { CfAutoscalerTestingModule } from '../../../../cf-autoscaler-testing.module'; diff --git a/src/frontend/packages/cf-autoscaler/src/shared/list-types/app-autoscaler-metric-chart/app-autoscaler-metric-chart-list-config.service.spec.ts b/src/frontend/packages/cf-autoscaler/src/shared/list-types/app-autoscaler-metric-chart/app-autoscaler-metric-chart-list-config.service.spec.ts index 08e9f627eb..3c16b6b43a 100644 --- a/src/frontend/packages/cf-autoscaler/src/shared/list-types/app-autoscaler-metric-chart/app-autoscaler-metric-chart-list-config.service.spec.ts +++ b/src/frontend/packages/cf-autoscaler/src/shared/list-types/app-autoscaler-metric-chart/app-autoscaler-metric-chart-list-config.service.spec.ts @@ -11,7 +11,9 @@ import { import { MetricsRangeSelectorService } from '../../../../../core/src/shared/services/metrics-range-selector.service'; import { generateTestApplicationServiceProvider } from '../../../../../core/test-framework/application-service-helper'; import { AppTestModule } from '../../../../../core/test-framework/core-test.helper'; -import { EntityCatalogHelper } from '../../../../../store/src/entity-catalog/entity-catalog-entity/entity-catalog.service'; +import { + EntityCatalogHelper, +} from '../../../../../store/src/entity-catalog/entity-catalog-entity/entity-catalog-entity/entity-catalog.service'; import { EntityServiceFactory } from '../../../../../store/src/entity-service-factory.service'; import { EntityMonitorFactory } from '../../../../../store/src/monitors/entity-monitor.factory.service'; import { PaginationMonitorFactory } from '../../../../../store/src/monitors/pagination-monitor.factory'; diff --git a/src/frontend/packages/core/src/features/metrics/metrics/metrics.component.html b/src/frontend/packages/core/src/features/metrics/metrics/metrics.component.html index 3d5b4dfaf9..544d07696e 100644 --- a/src/frontend/packages/core/src/features/metrics/metrics/metrics.component.html +++ b/src/frontend/packages/core/src/features/metrics/metrics/metrics.component.html @@ -1,4 +1,5 @@ -{{ (metricsEndpoint$ | async)?.entity.provider.name }} +{{ (metricsEndpoint$ | async)?.entity.provider.name }} +
@@ -8,7 +9,8 @@
@@ -35,11 +37,14 @@

+