From 9f14b7bddf0abea8ac3fceb25eed806599c9b781 Mon Sep 17 00:00:00 2001 From: Jordan Jensen Date: Wed, 7 Aug 2019 02:21:28 -0700 Subject: [PATCH 01/15] Expand ListConfig to get/set filters (SOC-9450) --- .../monocular-charts-list-config.service.ts | 2 + ...ocular-release-pods-list-config.service.ts | 2 + ...ar-release-services-list-config.service.ts | 2 + .../monocular-releases-list-config.service.ts | 2 + ...onocular-repository-list-config.service.ts | 2 + .../monocular-versions-list-config.service.ts | 2 + .../kubernetes-apps-list-config.service.ts | 2 + ...ubernetes-endpoints-list-config.service.ts | 2 + ...bernetes-namespaces-list-config.service.ts | 2 + .../kubernetes-nodes-data-source.ts | 79 ++++++++++++++++++- .../kubernetes-nodes-list-config.service.ts | 43 ++++++++-- .../kubernetes-pods-list-config.service.ts | 2 + .../kubernetes-service-list-config.service.ts | 3 +- .../app-event/cf-app-events-config.service.ts | 3 +- .../cf-app-instances-config.service.ts | 2 + .../cf-app-variables-list-config.service.ts | 2 + .../list-types/app/cf-app-config.service.ts | 3 +- .../list-types/base-cf/base-cf-list-config.ts | 2 + .../cf-endpoints-list-config.service.ts | 2 + .../cf-routes/cf-routes-list-config-base.ts | 2 + .../cf-routes-list-config.service.ts | 2 + .../cf-select-users-list-config.service.ts | 2 + .../cf-service-instances-list-config.base.ts | 2 + .../cf-services-list-config.service.ts | 2 + .../cf-user-service-instances-list-config.ts | 2 + .../cf-space-apps-list-config.service.ts | 2 + .../cf-spaces-list-config.service.ts | 2 + ...f-users-space-roles-list-config.service.ts | 2 + .../detach-apps-list-config.service.ts | 2 + .../endpoint/endpoints-list-config.service.ts | 2 + ...github-commits-list-config-base.service.ts | 2 + .../service-plans-list-config.service.ts | 2 + .../components/list/list.component.types.ts | 15 ++++ 33 files changed, 187 insertions(+), 13 deletions(-) diff --git a/custom-src/frontend/app/custom/helm/list-types/monocular-charts-list-config.service.ts b/custom-src/frontend/app/custom/helm/list-types/monocular-charts-list-config.service.ts index 551fff9625..30c24847b8 100644 --- a/custom-src/frontend/app/custom/helm/list-types/monocular-charts-list-config.service.ts +++ b/custom-src/frontend/app/custom/helm/list-types/monocular-charts-list-config.service.ts @@ -84,6 +84,8 @@ export class MonocularChartsListConfig implements IListConfig { getColumns = () => this.columns; getDataSource = () => this.AppsDataSource; getMultiFiltersConfigs = () => [this.createRepositoryFilterConfig()]; + getFilters = () => []; + setFilter = (id: string) => null; private createRepositoryFilterConfig(): IListMultiFilterConfig { return { diff --git a/custom-src/frontend/app/custom/helm/list-types/monocular-release-pods-list-config.service.ts b/custom-src/frontend/app/custom/helm/list-types/monocular-release-pods-list-config.service.ts index 22d21f4dc0..069659dfa7 100644 --- a/custom-src/frontend/app/custom/helm/list-types/monocular-release-pods-list-config.service.ts +++ b/custom-src/frontend/app/custom/helm/list-types/monocular-release-pods-list-config.service.ts @@ -98,5 +98,7 @@ export class HelmReleasePodsListConfig implements IListConfig { public getMultiActions = () => []; public getSingleActions = () => []; public getMultiFiltersConfigs = () => []; + public getFilters = () => []; + public setFilter = (id: string) => null; public getDataSource = () => this.dataSource; } diff --git a/custom-src/frontend/app/custom/helm/list-types/monocular-release-services-list-config.service.ts b/custom-src/frontend/app/custom/helm/list-types/monocular-release-services-list-config.service.ts index b1b46b43cb..b8309ab0b6 100644 --- a/custom-src/frontend/app/custom/helm/list-types/monocular-release-services-list-config.service.ts +++ b/custom-src/frontend/app/custom/helm/list-types/monocular-release-services-list-config.service.ts @@ -80,5 +80,7 @@ export class HelmReleaseServicesListConfig implements IListConfig []; public getSingleActions = () => []; public getMultiFiltersConfigs = () => []; + public getFilters = () => []; + public setFilter = (id: string) => null; public getDataSource = () => this.dataSource; } diff --git a/custom-src/frontend/app/custom/helm/list-types/monocular-releases-list-config.service.ts b/custom-src/frontend/app/custom/helm/list-types/monocular-releases-list-config.service.ts index 9512498e97..b6ab797c79 100644 --- a/custom-src/frontend/app/custom/helm/list-types/monocular-releases-list-config.service.ts +++ b/custom-src/frontend/app/custom/helm/list-types/monocular-releases-list-config.service.ts @@ -117,5 +117,7 @@ export class HelmReleasesListConfig implements IListConfig { public getMultiActions = () => []; public getSingleActions = () => []; public getMultiFiltersConfigs = () => []; + public getFilters = () => []; + public setFilter = (id: string) => null; public getDataSource = () => this.dataSource; } 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 0e99e7dd86..d6d38b928b 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 @@ -96,5 +96,7 @@ export class MonocularRepositoryListConfig implements IListConfig public getMultiActions = () => []; public getSingleActions = () => []; public getMultiFiltersConfigs = () => []; + public getFilters = () => []; + public setFilter = (id: string) => null; public getDataSource = () => this.dataSource; } diff --git a/custom-src/frontend/app/custom/helm/list-types/monocular-versions-list-config.service.ts b/custom-src/frontend/app/custom/helm/list-types/monocular-versions-list-config.service.ts index 4da8970655..55b487e6e7 100644 --- a/custom-src/frontend/app/custom/helm/list-types/monocular-versions-list-config.service.ts +++ b/custom-src/frontend/app/custom/helm/list-types/monocular-versions-list-config.service.ts @@ -52,5 +52,7 @@ export class HelmVersionsListConfig implements IListConfig { public getMultiActions = () => []; public getSingleActions = () => []; public getMultiFiltersConfigs = () => []; + public getFilters = () => []; + public setFilter = (id: string) => null; public getDataSource = () => this.dataSource; } diff --git a/custom-src/frontend/app/custom/kubernetes/list-types/kubernetes-apps/kubernetes-apps-list-config.service.ts b/custom-src/frontend/app/custom/kubernetes/list-types/kubernetes-apps/kubernetes-apps-list-config.service.ts index e984169e53..1e83b450bf 100644 --- a/custom-src/frontend/app/custom/kubernetes/list-types/kubernetes-apps/kubernetes-apps-list-config.service.ts +++ b/custom-src/frontend/app/custom/kubernetes/list-types/kubernetes-apps/kubernetes-apps-list-config.service.ts @@ -89,6 +89,8 @@ export class KubernetesAppsListConfigService implements IListConfig this.columns; getDataSource = () => this.AppsDataSource; getMultiFiltersConfigs = () => []; + getFilters = () => []; + setFilter = (id: string) => null; constructor( store: Store, diff --git a/custom-src/frontend/app/custom/kubernetes/list-types/kubernetes-endpoints/kubernetes-endpoints-list-config.service.ts b/custom-src/frontend/app/custom/kubernetes/list-types/kubernetes-endpoints/kubernetes-endpoints-list-config.service.ts index 73f0cdd19f..409262d03c 100644 --- a/custom-src/frontend/app/custom/kubernetes/list-types/kubernetes-endpoints/kubernetes-endpoints-list-config.service.ts +++ b/custom-src/frontend/app/custom/kubernetes/list-types/kubernetes-endpoints/kubernetes-endpoints-list-config.service.ts @@ -53,5 +53,7 @@ export class KubernetesEndpointsListConfigService implements IListConfig []; public getSingleActions = () => []; public getMultiFiltersConfigs = () => []; + public getFilters = () => []; + public setFilter = (id: string) => null; public getDataSource = () => this.dataSource; } diff --git a/custom-src/frontend/app/custom/kubernetes/list-types/kubernetes-namespaces/kubernetes-namespaces-list-config.service.ts b/custom-src/frontend/app/custom/kubernetes/list-types/kubernetes-namespaces/kubernetes-namespaces-list-config.service.ts index f4093d2b7c..fc4881c1a4 100644 --- a/custom-src/frontend/app/custom/kubernetes/list-types/kubernetes-namespaces/kubernetes-namespaces-list-config.service.ts +++ b/custom-src/frontend/app/custom/kubernetes/list-types/kubernetes-namespaces/kubernetes-namespaces-list-config.service.ts @@ -74,6 +74,8 @@ export class KubernetesNamespacesListConfigService implements IListConfig this.columns; getDataSource = () => this.podsDataSource; getMultiFiltersConfigs = () => []; + getFilters = () => []; + setFilter = (id: string) => null; getInitialised = () => this.initialised$; constructor( diff --git a/custom-src/frontend/app/custom/kubernetes/list-types/kubernetes-nodes/kubernetes-nodes-data-source.ts b/custom-src/frontend/app/custom/kubernetes/list-types/kubernetes-nodes/kubernetes-nodes-data-source.ts index a64f8b5d5a..a1ba148334 100644 --- a/custom-src/frontend/app/custom/kubernetes/list-types/kubernetes-nodes/kubernetes-nodes-data-source.ts +++ b/custom-src/frontend/app/custom/kubernetes/list-types/kubernetes-nodes/kubernetes-nodes-data-source.ts @@ -3,20 +3,26 @@ import { Store } from '@ngrx/store'; import { getPaginationKey } from '../../../../../../store/src/actions/pagination.actions'; import { AppState } from '../../../../../../store/src/app-state'; import { entityFactory } from '../../../../../../store/src/helpers/entity-factory'; -import { ListDataSource } from '../../../../shared/components/list/data-sources-controllers/list-data-source'; +import { + DataFunction, + DataFunctionDefinition, + ListDataSource +} from '../../../../shared/components/list/data-sources-controllers/list-data-source'; import { IListConfig } from '../../../../shared/components/list/list.component.types'; import { BaseKubeGuid } from '../../kubernetes-page.types'; import { getKubeAPIResourceGuid } from '../../store/kube.selectors'; import { KubernetesNode } from '../../store/kube.types'; import { GetKubernetesNodes } from '../../store/kubernetes.actions'; import { kubernetesNodesSchemaKey } from '../../store/kubernetes.entities'; +import { PaginationEntityState } from '../../../../../../store/src/types/pagination.types'; export class KubernetesNodesDataSource extends ListDataSource { constructor( store: Store, kubeGuid: BaseKubeGuid, - listConfig: IListConfig + listConfig: IListConfig, + transformEntities: (DataFunction | DataFunctionDefinition)[] ) { super({ store, @@ -26,8 +32,75 @@ export class KubernetesNodesDataSource extends ListDataSource { paginationKey: getPaginationKey(kubernetesNodesSchemaKey, kubeGuid.guid), isLocal: true, listConfig, - transformEntities: [{ type: 'filter', field: 'metadata.name' }] + transformEntities }); } +} + +export class LabelsKubernetesNodesDataSource extends KubernetesNodesDataSource { + constructor( + store: Store, + kubeGuid: BaseKubeGuid, + listConfig: IListConfig + ) { + super( + store, + kubeGuid, + listConfig, + [ + (entities: KubernetesNode[], paginationStore: PaginationEntityState) => { + const filterString = paginationStore.clientPagination.filter.string.toUpperCase(); + return entities.filter(node => { + return Object.entries(node.metadata.labels).some(([label, value]) => { + label = label.toUpperCase(); + value = value.toUpperCase(); + return label.includes(filterString) || value.includes(filterString); + }); + }); + } + ] + ); + } +} + +export class NameKubernetesNodesDataSource extends KubernetesNodesDataSource { + + constructor( + store: Store, + kubeGuid: BaseKubeGuid, + listConfig: IListConfig + ) { + super( + store, + kubeGuid, + listConfig, + [{ type: 'filter', field: 'metadata.name' }] + ); + } +} + +export class IPAddressKubernetesNodesDataSource extends KubernetesNodesDataSource { + + constructor( + store: Store, + kubeGuid: BaseKubeGuid, + listConfig: IListConfig + ) { + super( + store, + kubeGuid, + listConfig, + [ + (entities: KubernetesNode[], paginationState: PaginationEntityState) => { + return entities.filter(node => { + const internalIP: string = node.status.addresses.find(address => { + return address.type === 'InternalIP'; + }).address; + return internalIP.toUpperCase().includes(paginationState.clientPagination.filter.string.toUpperCase()); + }); + } + ] + ); + } } diff --git a/custom-src/frontend/app/custom/kubernetes/list-types/kubernetes-nodes/kubernetes-nodes-list-config.service.ts b/custom-src/frontend/app/custom/kubernetes/list-types/kubernetes-nodes/kubernetes-nodes-list-config.service.ts index 97033b1eaa..b4b496ae2c 100644 --- a/custom-src/frontend/app/custom/kubernetes/list-types/kubernetes-nodes/kubernetes-nodes-list-config.service.ts +++ b/custom-src/frontend/app/custom/kubernetes/list-types/kubernetes-nodes/kubernetes-nodes-list-config.service.ts @@ -3,7 +3,7 @@ import { Store } from '@ngrx/store'; import { AppState } from '../../../../../../store/src/app-state'; import { ITableColumn } from '../../../../shared/components/list/list-table/table.types'; -import { IListConfig, ListViewTypes } from '../../../../shared/components/list/list.component.types'; +import { IListConfig, IListFilter, ListViewTypes } from '../../../../shared/components/list/list.component.types'; import { BaseKubeGuid } from '../../kubernetes-page.types'; import { ConditionType, KubernetesNode } from '../../store/kube.types'; import { defaultHelmKubeListPageSize } from '../kube-helm-list-types'; @@ -11,13 +11,15 @@ import { getConditionSort } from '../kube-sort.helper'; import { ConditionCellComponent, SubtleConditionCellComponent } from './condition-cell/condition-cell.component'; import { KubernetesNodeCapacityComponent } from './kubernetes-node-capacity/kubernetes-node-capacity.component'; import { KubernetesNodeLinkComponent } from './kubernetes-node-link/kubernetes-node-link.component'; -import { KubernetesNodesDataSource } from './kubernetes-nodes-data-source'; +import { + LabelsKubernetesNodesDataSource, + NameKubernetesNodesDataSource, + IPAddressKubernetesNodesDataSource +} from './kubernetes-nodes-data-source'; import { NodePodCountComponent } from './node-pod-count/node-pod-count.component'; @Injectable() export class KubernetesNodesListConfigService implements IListConfig { - nodesDataSource: KubernetesNodesDataSource; - columns: Array> = [ { columnId: 'name', headerCell: () => 'Name', @@ -68,6 +70,8 @@ export class KubernetesNodesListConfigService implements IListConfig[]; + filterSelected: IListFilter; pageSizeOptions = defaultHelmKubeListPageSize; viewType = ListViewTypes.TABLE_ONLY; @@ -82,14 +86,39 @@ export class KubernetesNodesListConfigService implements IListConfig []; getSingleActions = () => []; getColumns = () => this.columns; - getDataSource = () => this.nodesDataSource; + getDataSource = () => this.filterSelected.dataSource; getMultiFiltersConfigs = () => []; + getFilters = (): IListFilter[] => this.filters; + setFilter = (id: string) => { + this.filterSelected = this.filters.find(filter => filter.id === id); + } constructor( store: Store, kubeId: BaseKubeGuid, ) { - this.nodesDataSource = new KubernetesNodesDataSource(store, kubeId, this); - } + this.filters = [ + { + dataSource: new NameKubernetesNodesDataSource(store, kubeId, this), + default: true, + id: 'name', + label: 'Name', + placeholder: 'Filter by Name' + }, + { + dataSource: new LabelsKubernetesNodesDataSource(store, kubeId, this), + id: 'labels', + label: 'Labels', + placeholder: 'Filter by Labels' + }, + { + dataSource: new IPAddressKubernetesNodesDataSource(store, kubeId, this), + id: 'ip-address', + label: 'IP Address', + placeholder: 'Filter by IP Address' + } + ]; + this.filterSelected = this.filters.find(filter => filter.default === true); + } } diff --git a/custom-src/frontend/app/custom/kubernetes/list-types/kubernetes-pods/kubernetes-pods-list-config.service.ts b/custom-src/frontend/app/custom/kubernetes/list-types/kubernetes-pods/kubernetes-pods-list-config.service.ts index 3c097b2cbd..629af156ed 100644 --- a/custom-src/frontend/app/custom/kubernetes/list-types/kubernetes-pods/kubernetes-pods-list-config.service.ts +++ b/custom-src/frontend/app/custom/kubernetes/list-types/kubernetes-pods/kubernetes-pods-list-config.service.ts @@ -103,6 +103,8 @@ export class KubernetesPodsListConfigService implements IListConfig this.columns; getDataSource = () => this.podsDataSource; getMultiFiltersConfigs = () => []; + getFilters = () => []; + setFilter = (id: string) => null; constructor( store: Store, diff --git a/custom-src/frontend/app/custom/kubernetes/list-types/kubernetes-service-list-config.service.ts b/custom-src/frontend/app/custom/kubernetes/list-types/kubernetes-service-list-config.service.ts index b2dc99e0a6..6da50d7cb7 100644 --- a/custom-src/frontend/app/custom/kubernetes/list-types/kubernetes-service-list-config.service.ts +++ b/custom-src/frontend/app/custom/kubernetes/list-types/kubernetes-service-list-config.service.ts @@ -60,5 +60,6 @@ export abstract class BaseKubernetesServicesListConfig implements IListConfig []; getColumns = () => this.columns; getMultiFiltersConfigs = () => []; - + getFilters = () => []; + setFilter = (id: string) => null; } diff --git a/src/frontend/packages/core/src/shared/components/list/list-types/app-event/cf-app-events-config.service.ts b/src/frontend/packages/core/src/shared/components/list/list-types/app-event/cf-app-events-config.service.ts index a4fc8ce123..9146ab9467 100644 --- a/src/frontend/packages/core/src/shared/components/list/list-types/app-event/cf-app-events-config.service.ts +++ b/src/frontend/packages/core/src/shared/components/list/list-types/app-event/cf-app-events-config.service.ts @@ -52,5 +52,6 @@ export class CfAppEventsConfigService extends ListConfig implements getColumns = () => this.columns; getDataSource = () => this.eventSource; getMultiFiltersConfigs = () => []; - + getFilters = () => []; + setFilter = (id: string) => null; } diff --git a/src/frontend/packages/core/src/shared/components/list/list-types/app-instance/cf-app-instances-config.service.ts b/src/frontend/packages/core/src/shared/components/list/list-types/app-instance/cf-app-instances-config.service.ts index ba3a782089..54dad54486 100644 --- a/src/frontend/packages/core/src/shared/components/list/list-types/app-instance/cf-app-instances-config.service.ts +++ b/src/frontend/packages/core/src/shared/components/list/list-types/app-instance/cf-app-instances-config.service.ts @@ -220,6 +220,8 @@ export class CfAppInstancesConfigService implements IListConfig getColumns = () => this.columns; getDataSource = () => this.instancesSource; getMultiFiltersConfigs = () => []; + getFilters = () => []; + setFilter = (id: string) => null; getInitialised = () => this.initialised$; private createMetricsResults(entityServiceFactory: EntityServiceFactory) { diff --git a/src/frontend/packages/core/src/shared/components/list/list-types/app-variables/cf-app-variables-list-config.service.ts b/src/frontend/packages/core/src/shared/components/list/list-types/app-variables/cf-app-variables-list-config.service.ts index 63c03ed470..1c288d4be0 100644 --- a/src/frontend/packages/core/src/shared/components/list/list-types/app-variables/cf-app-variables-list-config.service.ts +++ b/src/frontend/packages/core/src/shared/components/list/list-types/app-variables/cf-app-variables-list-config.service.ts @@ -131,6 +131,8 @@ export class CfAppVariablesListConfigService implements IListConfig this.columns; getDataSource = () => this.envVarsDataSource; getMultiFiltersConfigs = () => []; + getFilters = () => []; + setFilter = (id: string) => null; constructor( private store: Store, diff --git a/src/frontend/packages/core/src/shared/components/list/list-types/app/cf-app-config.service.ts b/src/frontend/packages/core/src/shared/components/list/list-types/app/cf-app-config.service.ts index d7cd8565c7..9abc1afdcf 100644 --- a/src/frontend/packages/core/src/shared/components/list/list-types/app/cf-app-config.service.ts +++ b/src/frontend/packages/core/src/shared/components/list/list-types/app/cf-app-config.service.ts @@ -144,6 +144,7 @@ export class CfAppConfigService extends ListConfig implements IList getColumns = () => this.columns; getDataSource = () => this.appsDataSource; getMultiFiltersConfigs = () => this.multiFilterConfigs; + getFilters = () => []; + setFilter = (id: string) => null; getInitialised = () => this.initialised$; - } diff --git a/src/frontend/packages/core/src/shared/components/list/list-types/base-cf/base-cf-list-config.ts b/src/frontend/packages/core/src/shared/components/list/list-types/base-cf/base-cf-list-config.ts index a2156d434d..5f0844b271 100644 --- a/src/frontend/packages/core/src/shared/components/list/list-types/base-cf/base-cf-list-config.ts +++ b/src/frontend/packages/core/src/shared/components/list/list-types/base-cf/base-cf-list-config.ts @@ -17,4 +17,6 @@ export class BaseCfListConfig implements IListConfig { getMultiActions = () => []; getSingleActions = () => []; getMultiFiltersConfigs = () => []; + getFilters = () => []; + setFilter = (id: string) => null; } diff --git a/src/frontend/packages/core/src/shared/components/list/list-types/cf-endpoints/cf-endpoints-list-config.service.ts b/src/frontend/packages/core/src/shared/components/list/list-types/cf-endpoints/cf-endpoints-list-config.service.ts index f351d6db32..cd617b7535 100644 --- a/src/frontend/packages/core/src/shared/components/list/list-types/cf-endpoints/cf-endpoints-list-config.service.ts +++ b/src/frontend/packages/core/src/shared/components/list/list-types/cf-endpoints/cf-endpoints-list-config.service.ts @@ -49,5 +49,7 @@ export class CFEndpointsListConfigService implements IListConfig public getMultiActions = () => []; public getSingleActions = () => []; public getMultiFiltersConfigs = () => []; + public getFilters = () => []; + public setFilter = (id: string) => null; public getDataSource = () => this.dataSource; } diff --git a/src/frontend/packages/core/src/shared/components/list/list-types/cf-routes/cf-routes-list-config-base.ts b/src/frontend/packages/core/src/shared/components/list/list-types/cf-routes/cf-routes-list-config-base.ts index bbc1f804df..459a476e3a 100644 --- a/src/frontend/packages/core/src/shared/components/list/list-types/cf-routes/cf-routes-list-config-base.ts +++ b/src/frontend/packages/core/src/shared/components/list/list-types/cf-routes/cf-routes-list-config-base.ts @@ -205,6 +205,8 @@ export abstract class CfRoutesListConfigBase implements IListConfig getColumns = () => this.columns; getMultiFiltersConfigs = () => []; + getFilters = () => []; + setFilter = (id: string) => null; /** * Creates an instance of CfRoutesListConfigBase. diff --git a/src/frontend/packages/core/src/shared/components/list/list-types/cf-routes/cf-routes-list-config.service.ts b/src/frontend/packages/core/src/shared/components/list/list-types/cf-routes/cf-routes-list-config.service.ts index 0a2cce34e2..9b96a62922 100644 --- a/src/frontend/packages/core/src/shared/components/list/list-types/cf-routes/cf-routes-list-config.service.ts +++ b/src/frontend/packages/core/src/shared/components/list/list-types/cf-routes/cf-routes-list-config.service.ts @@ -69,6 +69,8 @@ export class CfRoutesListConfigService extends CfRoutesListConfigBase implements createCfOrgSpaceFilterConfig('space', 'Space', cfOrgSpaceService.space), ]; this.getMultiFiltersConfigs = () => multiFilterConfigs; + this.getFilters = () => []; + this.setFilter = (id: string) => null; initCfOrgSpaceService(store, cfOrgSpaceService, this.dataSource.masterAction.entityKey, this.dataSource.masterAction.paginationKey).subscribe(); diff --git a/src/frontend/packages/core/src/shared/components/list/list-types/cf-select-users/cf-select-users-list-config.service.ts b/src/frontend/packages/core/src/shared/components/list/list-types/cf-select-users/cf-select-users-list-config.service.ts index 1717819c40..5b4173600f 100644 --- a/src/frontend/packages/core/src/shared/components/list/list-types/cf-select-users/cf-select-users-list-config.service.ts +++ b/src/frontend/packages/core/src/shared/components/list/list-types/cf-select-users/cf-select-users-list-config.service.ts @@ -132,6 +132,8 @@ export class CfSelectUsersListConfigService implements IListConfig>[] => []; getSingleActions = () => []; getMultiFiltersConfigs = () => []; + getFilters = () => []; + setFilter = (id: string) => null; getDataSource = () => this.dataSource; getInitialised = () => this.initialised; } diff --git a/src/frontend/packages/core/src/shared/components/list/list-types/cf-services/cf-service-instances-list-config.base.ts b/src/frontend/packages/core/src/shared/components/list/list-types/cf-services/cf-service-instances-list-config.base.ts index a16964b67b..1890f455ad 100644 --- a/src/frontend/packages/core/src/shared/components/list/list-types/cf-services/cf-service-instances-list-config.base.ts +++ b/src/frontend/packages/core/src/shared/components/list/list-types/cf-services/cf-service-instances-list-config.base.ts @@ -193,6 +193,8 @@ export class CfServiceInstancesListConfigBase implements IListConfig []; getSingleActions = () => [this.listActionEdit, this.listActionDetach, this.listActionDelete]; getMultiFiltersConfigs = () => []; + getFilters = () => []; + setFilter = (id: string) => null; getColumns = () => this.serviceInstanceColumns; getDataSource = () => null; diff --git a/src/frontend/packages/core/src/shared/components/list/list-types/cf-services/cf-services-list-config.service.ts b/src/frontend/packages/core/src/shared/components/list/list-types/cf-services/cf-services-list-config.service.ts index c28b53a669..8abe831628 100644 --- a/src/frontend/packages/core/src/shared/components/list/list-types/cf-services/cf-services-list-config.service.ts +++ b/src/frontend/packages/core/src/shared/components/list/list-types/cf-services/cf-services-list-config.service.ts @@ -84,5 +84,7 @@ export class CfServicesListConfigService implements IListConfig { getMultiActions = () => []; getSingleActions = () => []; getMultiFiltersConfigs = () => this.multiFilterConfigs; + getFilters = () => []; + setFilter = (id: string) => null; getDataSource = () => this.dataSource; } diff --git a/src/frontend/packages/core/src/shared/components/list/list-types/cf-services/cf-user-service-instances-list-config.ts b/src/frontend/packages/core/src/shared/components/list/list-types/cf-services/cf-user-service-instances-list-config.ts index c0053902e0..e8ef1501f2 100644 --- a/src/frontend/packages/core/src/shared/components/list/list-types/cf-services/cf-user-service-instances-list-config.ts +++ b/src/frontend/packages/core/src/shared/components/list/list-types/cf-services/cf-user-service-instances-list-config.ts @@ -197,6 +197,8 @@ export class CfUserServiceInstancesListConfigBase implements IListConfig []; getSingleActions = () => [this.listActionEdit, this.listActionDetach, this.listActionDelete]; getMultiFiltersConfigs = () => []; + getFilters = () => []; + setFilter = (id: string) => null; getColumns = () => this.serviceInstanceColumns; getDataSource = () => this.dataSource; diff --git a/src/frontend/packages/core/src/shared/components/list/list-types/cf-space-apps/cf-space-apps-list-config.service.ts b/src/frontend/packages/core/src/shared/components/list/list-types/cf-space-apps/cf-space-apps-list-config.service.ts index bbb6c860de..ed82576976 100644 --- a/src/frontend/packages/core/src/shared/components/list/list-types/cf-space-apps/cf-space-apps-list-config.service.ts +++ b/src/frontend/packages/core/src/shared/components/list/list-types/cf-space-apps/cf-space-apps-list-config.service.ts @@ -88,5 +88,7 @@ export class CfSpaceAppsListConfigService implements IListConfig { getMultiActions = () => []; getSingleActions = () => []; getMultiFiltersConfigs = () => []; + getFilters = () => []; + setFilter = (id: string) => null; getDataSource = () => this.dataSource; } diff --git a/src/frontend/packages/core/src/shared/components/list/list-types/cf-spaces/cf-spaces-list-config.service.ts b/src/frontend/packages/core/src/shared/components/list/list-types/cf-spaces/cf-spaces-list-config.service.ts index 27ff550d79..6935a22986 100644 --- a/src/frontend/packages/core/src/shared/components/list/list-types/cf-spaces/cf-spaces-list-config.service.ts +++ b/src/frontend/packages/core/src/shared/components/list/list-types/cf-spaces/cf-spaces-list-config.service.ts @@ -55,5 +55,7 @@ export class CfSpacesListConfigService implements IListConfig []; getSingleActions = () => []; getMultiFiltersConfigs = () => []; + getFilters = () => []; + setFilter = (id: string) => null; getDataSource = () => this.dataSource; } diff --git a/src/frontend/packages/core/src/shared/components/list/list-types/cf-users-org-space-roles/cf-users-space-roles-list-config.service.ts b/src/frontend/packages/core/src/shared/components/list/list-types/cf-users-org-space-roles/cf-users-space-roles-list-config.service.ts index ca630bca18..70517de420 100644 --- a/src/frontend/packages/core/src/shared/components/list/list-types/cf-users-org-space-roles/cf-users-space-roles-list-config.service.ts +++ b/src/frontend/packages/core/src/shared/components/list/list-types/cf-users-org-space-roles/cf-users-space-roles-list-config.service.ts @@ -85,6 +85,8 @@ export class CfUsersSpaceRolesListConfigService implements IListConfig []; getSingleActions = () => []; getMultiFiltersConfigs = () => []; + getFilters = () => []; + setFilter = (id: string) => null; getDataSource = () => this.dataSource; public getInitialised = () => this.initialised; } diff --git a/src/frontend/packages/core/src/shared/components/list/list-types/detach-apps/detach-apps-list-config.service.ts b/src/frontend/packages/core/src/shared/components/list/list-types/detach-apps/detach-apps-list-config.service.ts index b37519b820..394ea1be37 100644 --- a/src/frontend/packages/core/src/shared/components/list/list-types/detach-apps/detach-apps-list-config.service.ts +++ b/src/frontend/packages/core/src/shared/components/list/list-types/detach-apps/detach-apps-list-config.service.ts @@ -57,5 +57,7 @@ export class DetachAppsListConfigService implements IListConfig { getMultiActions = () => []; getSingleActions = () => []; getMultiFiltersConfigs = () => []; + getFilters = () => []; + setFilter = (id: string) => null; getDataSource = () => this.dataSource; } diff --git a/src/frontend/packages/core/src/shared/components/list/list-types/endpoint/endpoints-list-config.service.ts b/src/frontend/packages/core/src/shared/components/list/list-types/endpoint/endpoints-list-config.service.ts index 88ea39eef8..d8d6cb9fa4 100644 --- a/src/frontend/packages/core/src/shared/components/list/list-types/endpoint/endpoints-list-config.service.ts +++ b/src/frontend/packages/core/src/shared/components/list/list-types/endpoint/endpoints-list-config.service.ts @@ -134,4 +134,6 @@ export class EndpointsListConfigService implements IListConfig { public getColumns = () => this.columns; public getDataSource = () => this.dataSource; public getMultiFiltersConfigs = () => []; + public getFilters = () => []; + public setFilter = (id: string) => null; } diff --git a/src/frontend/packages/core/src/shared/components/list/list-types/github-commits/github-commits-list-config-base.service.ts b/src/frontend/packages/core/src/shared/components/list/list-types/github-commits/github-commits-list-config-base.service.ts index c24b228713..585b8a8171 100644 --- a/src/frontend/packages/core/src/shared/components/list/list-types/github-commits/github-commits-list-config-base.service.ts +++ b/src/frontend/packages/core/src/shared/components/list/list-types/github-commits/github-commits-list-config-base.service.ts @@ -92,6 +92,8 @@ export abstract class GithubCommitsListConfigServiceBase implements IListConfig< public getMultiActions = () => []; public getSingleActions = () => []; public getMultiFiltersConfigs = () => []; + public getFilters = () => []; + public setFilter = (id: string) => null; public getDataSource = () => this.dataSource; public getInitialised = () => this.initialised; } diff --git a/src/frontend/packages/core/src/shared/components/list/list-types/service-plans/service-plans-list-config.service.ts b/src/frontend/packages/core/src/shared/components/list/list-types/service-plans/service-plans-list-config.service.ts index 5892db9199..8da99f93f3 100644 --- a/src/frontend/packages/core/src/shared/components/list/list-types/service-plans/service-plans-list-config.service.ts +++ b/src/frontend/packages/core/src/shared/components/list/list-types/service-plans/service-plans-list-config.service.ts @@ -107,6 +107,8 @@ export class ServicePlansListConfigService implements IListConfig []; getSingleActions = () => []; getMultiFiltersConfigs = () => []; + getFilters = () => []; + setFilter = (id: string) => null; getColumns = () => this.columns; getDataSource = () => this.dataSource; } diff --git a/src/frontend/packages/core/src/shared/components/list/list.component.types.ts b/src/frontend/packages/core/src/shared/components/list/list.component.types.ts index 8c0775fb64..97114515cb 100644 --- a/src/frontend/packages/core/src/shared/components/list/list.component.types.ts +++ b/src/frontend/packages/core/src/shared/components/list/list.component.types.ts @@ -47,6 +47,11 @@ export interface IListConfig { * to the data sources transformEntities collection should be used to apply these custom settings to the data. */ getMultiFiltersConfigs: () => IListMultiFilterConfig[]; + /** + * Collection of filters + */ + getFilters: () => IListFilter[]; + setFilter: (id: string) => void; /** * Fetch an observable that will emit once the underlying config components have been created. For instance if the data source requires * something from the store which requires an async call @@ -120,6 +125,14 @@ export interface IListMultiFilterConfig { select: BehaviorSubject; } +export interface IListFilter { + dataSource: ListDataSource; + default?: boolean; + id: string; + label: string; + placeholder: string; +} + export interface IListMultiFilterConfigItem { label: string; item: any; @@ -144,6 +157,8 @@ export class ListConfig implements IListConfig { getColumns = (): ITableColumn[] => null; getDataSource = (): ListDataSource => null; getMultiFiltersConfigs = (): IListMultiFilterConfig[] => []; + getFilters = (): IListFilter[] => []; + setFilter = (id: string) => null; getInitialised = () => observableOf(true); } From f9ff28fbe58123621368e606ae979a608eb5459d Mon Sep 17 00:00:00 2001 From: Jordan Jensen Date: Wed, 7 Aug 2019 02:24:56 -0700 Subject: [PATCH 02/15] Show and select filters from ListConfig (SOC-9450) --- .../components/list/list.component.html | 25 +++++++++++++++++-- .../shared/components/list/list.component.ts | 19 ++++++++++++++ 2 files changed, 42 insertions(+), 2 deletions(-) diff --git a/src/frontend/packages/core/src/shared/components/list/list.component.html b/src/frontend/packages/core/src/shared/components/list/list.component.html index 01ffbfc939..9f6d4a7f8b 100644 --- a/src/frontend/packages/core/src/shared/components/list/list.component.html +++ b/src/frontend/packages/core/src/shared/components/list/list.component.html @@ -69,12 +69,26 @@ +
+ + Filter Selection + + + {{ filter.label }} + + + +
+ placeholder="{{ filterSelected?.placeholder || config.text?.filter || 'Filter'}}">
@@ -201,4 +215,11 @@ - \ No newline at end of file + + + + + diff --git a/src/frontend/packages/core/src/shared/components/list/list.component.ts b/src/frontend/packages/core/src/shared/components/list/list.component.ts index c822bbd1ff..f56c4b241d 100644 --- a/src/frontend/packages/core/src/shared/components/list/list.component.ts +++ b/src/frontend/packages/core/src/shared/components/list/list.component.ts @@ -69,6 +69,7 @@ import { defaultPaginationPageSizeOptionsTable, IGlobalListAction, IListConfig, + IListFilter, IMultiListAction, IOptionalAction, ListConfig, @@ -176,6 +177,9 @@ export class ListComponent implements OnInit, OnChanges, OnDestroy, AfterView }; private filterString = ''; private sortColumns: ITableColumn[]; + // private filterColumns: ITableColumn[]; + private filterColumns: IListFilter[]; + private filterSelected: IListFilter; private paginationWidgetToStore: Subscription; private filterWidgetToStore: Subscription; @@ -392,6 +396,13 @@ export class ListComponent implements OnInit, OnChanges, OnDestroy, AfterView return column.sort; }); + this.filterColumns = this.config.getFilters(); + if (!this.filterSelected) { + this.filterSelected = this.filterColumns.find(filterConfig => { + return filterConfig.default === true; + }); + } + const sortStoreToWidget = this.paginationController.sort$.pipe(tap((sort: ListSort) => { this.headerSort.value = sort.field; this.headerSort.direction = sort.direction; @@ -561,6 +572,9 @@ export class ListComponent implements OnInit, OnChanges, OnDestroy, AfterView this.uberSub, this.multiFilterChangesSub ); + if (this.filterColumns) { + this.filterColumns.forEach(filterConfig => filterConfig.dataSource.destroy()); + } if (this.dataSource) { this.dataSource.destroy(); } @@ -591,6 +605,11 @@ export class ListComponent implements OnInit, OnChanges, OnDestroy, AfterView }); } + updateListFilter(filterSelected: IListFilter, filterString: string) { + this.config.setFilter(filterSelected.id); + this.initialise(); + } + executeActionMultiple(listActionConfig: IMultiListAction) { const result = listActionConfig.action(Array.from(this.dataSource.selectedRows.values())); if (isObservable(result)) { From bc111215002407168c69701a378d91ee3a8ea0f4 Mon Sep 17 00:00:00 2001 From: Jordan Jensen Date: Fri, 9 Aug 2019 17:59:38 -0700 Subject: [PATCH 03/15] Reduce filters to single data source (SOC-9450) - Use action to set the filterKey - if the filterKey is not set use the default filter --- .../monocular-charts-list-config.service.ts | 1 - ...ocular-release-pods-list-config.service.ts | 1 - ...ar-release-services-list-config.service.ts | 1 - .../monocular-releases-list-config.service.ts | 1 - ...onocular-repository-list-config.service.ts | 1 - .../monocular-versions-list-config.service.ts | 1 - .../kubernetes-apps-list-config.service.ts | 1 - ...ubernetes-endpoints-list-config.service.ts | 1 - ...bernetes-namespaces-list-config.service.ts | 1 - .../kubernetes-nodes-data-source.ts | 69 -------------- .../kubernetes-nodes-list-config.service.ts | 93 ++++++++++++------- .../kubernetes-pods-list-config.service.ts | 1 - .../kubernetes-service-list-config.service.ts | 1 - .../list-data-source.ts | 3 +- .../local-list-controller.ts | 1 + .../app-event/cf-app-events-config.service.ts | 1 - .../cf-app-instances-config.service.ts | 1 - .../cf-app-variables-list-config.service.ts | 1 - .../list-types/app/cf-app-config.service.ts | 1 - .../list-types/base-cf/base-cf-list-config.ts | 1 - .../cf-endpoints-list-config.service.ts | 1 - .../cf-routes/cf-routes-list-config-base.ts | 1 - .../cf-routes-list-config.service.ts | 1 - .../cf-select-users-list-config.service.ts | 1 - .../cf-service-instances-list-config.base.ts | 1 - .../cf-services-list-config.service.ts | 1 - .../cf-user-service-instances-list-config.ts | 1 - .../cf-space-apps-list-config.service.ts | 1 - .../cf-spaces-list-config.service.ts | 1 - ...f-users-space-roles-list-config.service.ts | 1 - .../detach-apps-list-config.service.ts | 1 - .../endpoint/endpoints-list-config.service.ts | 1 - ...github-commits-list-config-base.service.ts | 1 - .../service-plans-list-config.service.ts | 1 - .../shared/components/list/list.component.ts | 38 ++++---- .../components/list/list.component.types.ts | 11 +-- .../store/src/actions/list.actions.ts | 1 + .../store/src/actions/pagination.actions.ts | 10 ++ ...agination-reducer-set-client-filter-key.ts | 22 +++++ .../pagination-reducer/pagination.reducer.ts | 4 + .../store/src/types/pagination.types.ts | 1 + 41 files changed, 127 insertions(+), 156 deletions(-) create mode 100644 src/frontend/packages/store/src/reducers/pagination-reducer/pagination-reducer-set-client-filter-key.ts diff --git a/custom-src/frontend/app/custom/helm/list-types/monocular-charts-list-config.service.ts b/custom-src/frontend/app/custom/helm/list-types/monocular-charts-list-config.service.ts index 30c24847b8..e87a82a970 100644 --- a/custom-src/frontend/app/custom/helm/list-types/monocular-charts-list-config.service.ts +++ b/custom-src/frontend/app/custom/helm/list-types/monocular-charts-list-config.service.ts @@ -85,7 +85,6 @@ export class MonocularChartsListConfig implements IListConfig { getDataSource = () => this.AppsDataSource; getMultiFiltersConfigs = () => [this.createRepositoryFilterConfig()]; getFilters = () => []; - setFilter = (id: string) => null; private createRepositoryFilterConfig(): IListMultiFilterConfig { return { diff --git a/custom-src/frontend/app/custom/helm/list-types/monocular-release-pods-list-config.service.ts b/custom-src/frontend/app/custom/helm/list-types/monocular-release-pods-list-config.service.ts index 069659dfa7..476e89492b 100644 --- a/custom-src/frontend/app/custom/helm/list-types/monocular-release-pods-list-config.service.ts +++ b/custom-src/frontend/app/custom/helm/list-types/monocular-release-pods-list-config.service.ts @@ -99,6 +99,5 @@ export class HelmReleasePodsListConfig implements IListConfig { public getSingleActions = () => []; public getMultiFiltersConfigs = () => []; public getFilters = () => []; - public setFilter = (id: string) => null; public getDataSource = () => this.dataSource; } diff --git a/custom-src/frontend/app/custom/helm/list-types/monocular-release-services-list-config.service.ts b/custom-src/frontend/app/custom/helm/list-types/monocular-release-services-list-config.service.ts index b8309ab0b6..5e6b9e6237 100644 --- a/custom-src/frontend/app/custom/helm/list-types/monocular-release-services-list-config.service.ts +++ b/custom-src/frontend/app/custom/helm/list-types/monocular-release-services-list-config.service.ts @@ -81,6 +81,5 @@ export class HelmReleaseServicesListConfig implements IListConfig []; public getMultiFiltersConfigs = () => []; public getFilters = () => []; - public setFilter = (id: string) => null; public getDataSource = () => this.dataSource; } diff --git a/custom-src/frontend/app/custom/helm/list-types/monocular-releases-list-config.service.ts b/custom-src/frontend/app/custom/helm/list-types/monocular-releases-list-config.service.ts index b6ab797c79..7f55c74e42 100644 --- a/custom-src/frontend/app/custom/helm/list-types/monocular-releases-list-config.service.ts +++ b/custom-src/frontend/app/custom/helm/list-types/monocular-releases-list-config.service.ts @@ -118,6 +118,5 @@ export class HelmReleasesListConfig implements IListConfig { public getSingleActions = () => []; public getMultiFiltersConfigs = () => []; public getFilters = () => []; - public setFilter = (id: string) => null; public getDataSource = () => this.dataSource; } 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 d6d38b928b..ab9eeb5447 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 @@ -97,6 +97,5 @@ export class MonocularRepositoryListConfig implements IListConfig public getSingleActions = () => []; public getMultiFiltersConfigs = () => []; public getFilters = () => []; - public setFilter = (id: string) => null; public getDataSource = () => this.dataSource; } diff --git a/custom-src/frontend/app/custom/helm/list-types/monocular-versions-list-config.service.ts b/custom-src/frontend/app/custom/helm/list-types/monocular-versions-list-config.service.ts index 55b487e6e7..9084ee4b17 100644 --- a/custom-src/frontend/app/custom/helm/list-types/monocular-versions-list-config.service.ts +++ b/custom-src/frontend/app/custom/helm/list-types/monocular-versions-list-config.service.ts @@ -53,6 +53,5 @@ export class HelmVersionsListConfig implements IListConfig { public getSingleActions = () => []; public getMultiFiltersConfigs = () => []; public getFilters = () => []; - public setFilter = (id: string) => null; public getDataSource = () => this.dataSource; } diff --git a/custom-src/frontend/app/custom/kubernetes/list-types/kubernetes-apps/kubernetes-apps-list-config.service.ts b/custom-src/frontend/app/custom/kubernetes/list-types/kubernetes-apps/kubernetes-apps-list-config.service.ts index 1e83b450bf..28080d06f6 100644 --- a/custom-src/frontend/app/custom/kubernetes/list-types/kubernetes-apps/kubernetes-apps-list-config.service.ts +++ b/custom-src/frontend/app/custom/kubernetes/list-types/kubernetes-apps/kubernetes-apps-list-config.service.ts @@ -90,7 +90,6 @@ export class KubernetesAppsListConfigService implements IListConfig this.AppsDataSource; getMultiFiltersConfigs = () => []; getFilters = () => []; - setFilter = (id: string) => null; constructor( store: Store, diff --git a/custom-src/frontend/app/custom/kubernetes/list-types/kubernetes-endpoints/kubernetes-endpoints-list-config.service.ts b/custom-src/frontend/app/custom/kubernetes/list-types/kubernetes-endpoints/kubernetes-endpoints-list-config.service.ts index 409262d03c..84904843f9 100644 --- a/custom-src/frontend/app/custom/kubernetes/list-types/kubernetes-endpoints/kubernetes-endpoints-list-config.service.ts +++ b/custom-src/frontend/app/custom/kubernetes/list-types/kubernetes-endpoints/kubernetes-endpoints-list-config.service.ts @@ -54,6 +54,5 @@ export class KubernetesEndpointsListConfigService implements IListConfig []; public getMultiFiltersConfigs = () => []; public getFilters = () => []; - public setFilter = (id: string) => null; public getDataSource = () => this.dataSource; } diff --git a/custom-src/frontend/app/custom/kubernetes/list-types/kubernetes-namespaces/kubernetes-namespaces-list-config.service.ts b/custom-src/frontend/app/custom/kubernetes/list-types/kubernetes-namespaces/kubernetes-namespaces-list-config.service.ts index fc4881c1a4..84344a31c0 100644 --- a/custom-src/frontend/app/custom/kubernetes/list-types/kubernetes-namespaces/kubernetes-namespaces-list-config.service.ts +++ b/custom-src/frontend/app/custom/kubernetes/list-types/kubernetes-namespaces/kubernetes-namespaces-list-config.service.ts @@ -75,7 +75,6 @@ export class KubernetesNamespacesListConfigService implements IListConfig this.podsDataSource; getMultiFiltersConfigs = () => []; getFilters = () => []; - setFilter = (id: string) => null; getInitialised = () => this.initialised$; constructor( diff --git a/custom-src/frontend/app/custom/kubernetes/list-types/kubernetes-nodes/kubernetes-nodes-data-source.ts b/custom-src/frontend/app/custom/kubernetes/list-types/kubernetes-nodes/kubernetes-nodes-data-source.ts index a1ba148334..1c9a075977 100644 --- a/custom-src/frontend/app/custom/kubernetes/list-types/kubernetes-nodes/kubernetes-nodes-data-source.ts +++ b/custom-src/frontend/app/custom/kubernetes/list-types/kubernetes-nodes/kubernetes-nodes-data-source.ts @@ -14,7 +14,6 @@ import { getKubeAPIResourceGuid } from '../../store/kube.selectors'; import { KubernetesNode } from '../../store/kube.types'; import { GetKubernetesNodes } from '../../store/kubernetes.actions'; import { kubernetesNodesSchemaKey } from '../../store/kubernetes.entities'; -import { PaginationEntityState } from '../../../../../../store/src/types/pagination.types'; export class KubernetesNodesDataSource extends ListDataSource { @@ -36,71 +35,3 @@ export class KubernetesNodesDataSource extends ListDataSource { }); } } - -export class LabelsKubernetesNodesDataSource extends KubernetesNodesDataSource { - - constructor( - store: Store, - kubeGuid: BaseKubeGuid, - listConfig: IListConfig - ) { - super( - store, - kubeGuid, - listConfig, - [ - (entities: KubernetesNode[], paginationStore: PaginationEntityState) => { - const filterString = paginationStore.clientPagination.filter.string.toUpperCase(); - return entities.filter(node => { - return Object.entries(node.metadata.labels).some(([label, value]) => { - label = label.toUpperCase(); - value = value.toUpperCase(); - return label.includes(filterString) || value.includes(filterString); - }); - }); - } - ] - ); - } -} - -export class NameKubernetesNodesDataSource extends KubernetesNodesDataSource { - - constructor( - store: Store, - kubeGuid: BaseKubeGuid, - listConfig: IListConfig - ) { - super( - store, - kubeGuid, - listConfig, - [{ type: 'filter', field: 'metadata.name' }] - ); - } -} - -export class IPAddressKubernetesNodesDataSource extends KubernetesNodesDataSource { - - constructor( - store: Store, - kubeGuid: BaseKubeGuid, - listConfig: IListConfig - ) { - super( - store, - kubeGuid, - listConfig, - [ - (entities: KubernetesNode[], paginationState: PaginationEntityState) => { - return entities.filter(node => { - const internalIP: string = node.status.addresses.find(address => { - return address.type === 'InternalIP'; - }).address; - return internalIP.toUpperCase().includes(paginationState.clientPagination.filter.string.toUpperCase()); - }); - } - ] - ); - } -} diff --git a/custom-src/frontend/app/custom/kubernetes/list-types/kubernetes-nodes/kubernetes-nodes-list-config.service.ts b/custom-src/frontend/app/custom/kubernetes/list-types/kubernetes-nodes/kubernetes-nodes-list-config.service.ts index b4b496ae2c..fa0fb9aebc 100644 --- a/custom-src/frontend/app/custom/kubernetes/list-types/kubernetes-nodes/kubernetes-nodes-list-config.service.ts +++ b/custom-src/frontend/app/custom/kubernetes/list-types/kubernetes-nodes/kubernetes-nodes-list-config.service.ts @@ -3,6 +3,8 @@ import { Store } from '@ngrx/store'; import { AppState } from '../../../../../../store/src/app-state'; import { ITableColumn } from '../../../../shared/components/list/list-table/table.types'; +import { DataFunction } from '../../../../shared/components/list/data-sources-controllers/list-data-source'; +import { PaginationEntityState } from '../../../../../../store/src/types/pagination.types'; import { IListConfig, IListFilter, ListViewTypes } from '../../../../shared/components/list/list.component.types'; import { BaseKubeGuid } from '../../kubernetes-page.types'; import { ConditionType, KubernetesNode } from '../../store/kube.types'; @@ -11,15 +13,19 @@ import { getConditionSort } from '../kube-sort.helper'; import { ConditionCellComponent, SubtleConditionCellComponent } from './condition-cell/condition-cell.component'; import { KubernetesNodeCapacityComponent } from './kubernetes-node-capacity/kubernetes-node-capacity.component'; import { KubernetesNodeLinkComponent } from './kubernetes-node-link/kubernetes-node-link.component'; -import { - LabelsKubernetesNodesDataSource, - NameKubernetesNodesDataSource, - IPAddressKubernetesNodesDataSource -} from './kubernetes-nodes-data-source'; +import { KubernetesNodesDataSource } from './kubernetes-nodes-data-source'; import { NodePodCountComponent } from './node-pod-count/node-pod-count.component'; +export enum KubernetesNodesListFilterKeys { + NAME = 'name', + IP_ADDRESS = 'ip-address', + LABELS = 'labels' +} + @Injectable() export class KubernetesNodesListConfigService implements IListConfig { + dataSource: KubernetesNodesDataSource; + columns: Array> = [ { columnId: 'name', headerCell: () => 'Name', @@ -70,8 +76,24 @@ export class KubernetesNodesListConfigService implements IListConfig[]; - filterSelected: IListFilter; + filters: IListFilter[] = [ + { + default: true, + key: KubernetesNodesListFilterKeys.NAME, + label: 'Name', + placeholder: 'Filter by Name' + }, + { + key: KubernetesNodesListFilterKeys.LABELS, + label: 'Labels', + placeholder: 'Filter by Labels' + }, + { + key: KubernetesNodesListFilterKeys.IP_ADDRESS, + label: 'IP Address', + placeholder: 'Filter by IP Address' + } + ]; pageSizeOptions = defaultHelmKubeListPageSize; viewType = ListViewTypes.TABLE_ONLY; @@ -86,39 +108,46 @@ export class KubernetesNodesListConfigService implements IListConfig []; getSingleActions = () => []; getColumns = () => this.columns; - getDataSource = () => this.filterSelected.dataSource; + getDataSource = () => this.dataSource; getMultiFiltersConfigs = () => []; - getFilters = (): IListFilter[] => this.filters; - setFilter = (id: string) => { - this.filterSelected = this.filters.find(filter => filter.id === id); - } + getFilters = (): IListFilter[] => this.filters; constructor( store: Store, kubeId: BaseKubeGuid, ) { - this.filters = [ - { - dataSource: new NameKubernetesNodesDataSource(store, kubeId, this), - default: true, - id: 'name', - label: 'Name', - placeholder: 'Filter by Name' - }, - { - dataSource: new LabelsKubernetesNodesDataSource(store, kubeId, this), - id: 'labels', - label: 'Labels', - placeholder: 'Filter by Labels' - }, - { - dataSource: new IPAddressKubernetesNodesDataSource(store, kubeId, this), - id: 'ip-address', - label: 'IP Address', - placeholder: 'Filter by IP Address' + const transformEntities: DataFunction[] = [ + (entities: KubernetesNode[], paginationState: PaginationEntityState) => { + const filterKey = paginationState.clientPagination.filter.filterKey; + const filterString = paginationState.clientPagination.filter.string.toUpperCase(); + + switch (filterKey) { + case KubernetesNodesListFilterKeys.IP_ADDRESS: + return entities.filter(node => { + const internalIP: string = node.status.addresses.find(address => { + return address.type === 'InternalIP'; + }).address; + return internalIP.toUpperCase().includes(filterString); + }); + + case KubernetesNodesListFilterKeys.LABELS: + return entities.filter(node => { + return Object.entries(node.metadata.labels).some(([label, value]) => { + label = label.toUpperCase(); + value = value.toUpperCase(); + return label.includes(filterString) || value.includes(filterString); + }); + }); + + case KubernetesNodesListFilterKeys.NAME: + default: + return entities.filter(node => { + return node.metadata.name.toUpperCase().includes(filterString); + }); + } } ]; - this.filterSelected = this.filters.find(filter => filter.default === true); + this.dataSource = new KubernetesNodesDataSource(store, kubeId, this, transformEntities); } } diff --git a/custom-src/frontend/app/custom/kubernetes/list-types/kubernetes-pods/kubernetes-pods-list-config.service.ts b/custom-src/frontend/app/custom/kubernetes/list-types/kubernetes-pods/kubernetes-pods-list-config.service.ts index 629af156ed..a389753548 100644 --- a/custom-src/frontend/app/custom/kubernetes/list-types/kubernetes-pods/kubernetes-pods-list-config.service.ts +++ b/custom-src/frontend/app/custom/kubernetes/list-types/kubernetes-pods/kubernetes-pods-list-config.service.ts @@ -104,7 +104,6 @@ export class KubernetesPodsListConfigService implements IListConfig this.podsDataSource; getMultiFiltersConfigs = () => []; getFilters = () => []; - setFilter = (id: string) => null; constructor( store: Store, diff --git a/custom-src/frontend/app/custom/kubernetes/list-types/kubernetes-service-list-config.service.ts b/custom-src/frontend/app/custom/kubernetes/list-types/kubernetes-service-list-config.service.ts index 6da50d7cb7..2579b31e86 100644 --- a/custom-src/frontend/app/custom/kubernetes/list-types/kubernetes-service-list-config.service.ts +++ b/custom-src/frontend/app/custom/kubernetes/list-types/kubernetes-service-list-config.service.ts @@ -61,5 +61,4 @@ export abstract class BaseKubernetesServicesListConfig implements IListConfig this.columns; getMultiFiltersConfigs = () => []; getFilters = () => []; - setFilter = (id: string) => null; } diff --git a/src/frontend/packages/core/src/shared/components/list/data-sources-controllers/list-data-source.ts b/src/frontend/packages/core/src/shared/components/list/data-sources-controllers/list-data-source.ts index eda6983908..1365cf3d45 100644 --- a/src/frontend/packages/core/src/shared/components/list/data-sources-controllers/list-data-source.ts +++ b/src/frontend/packages/core/src/shared/components/list/data-sources-controllers/list-data-source.ts @@ -471,7 +471,8 @@ export abstract class ListDataSource extends DataSource implements return this.pagination$.pipe( map(pag => ({ string: this.isLocal ? pag.clientPagination.filter.string : this.getFilterFromParams(pag), - items: { ...pag.clientPagination.filter.items } + items: { ...pag.clientPagination.filter.items }, + filterKey: pag.clientPagination.filter.filterKey, })), tag('list-filter') ); diff --git a/src/frontend/packages/core/src/shared/components/list/data-sources-controllers/local-list-controller.ts b/src/frontend/packages/core/src/shared/components/list/data-sources-controllers/local-list-controller.ts index 21cb9b6085..84888c0ce9 100644 --- a/src/frontend/packages/core/src/shared/components/list/data-sources-controllers/local-list-controller.ts +++ b/src/frontend/packages/core/src/shared/components/list/data-sources-controllers/local-list-controller.ts @@ -136,6 +136,7 @@ export class LocalListController { + (paginationEntity.params['order-direction-field'] || '') + ',' + (paginationEntity.params['order-direction'] || '') + ',' + paginationEntity.clientPagination.filter.string + ',' + + paginationEntity.clientPagination.filter.filterKey + ',' + paginationEntity.forcedLocalPage + Object.values(paginationEntity.clientPagination.filter.items); // Some outlier cases actually fetch independently from this list (looking at you app variables) diff --git a/src/frontend/packages/core/src/shared/components/list/list-types/app-event/cf-app-events-config.service.ts b/src/frontend/packages/core/src/shared/components/list/list-types/app-event/cf-app-events-config.service.ts index 9146ab9467..2c23cde46c 100644 --- a/src/frontend/packages/core/src/shared/components/list/list-types/app-event/cf-app-events-config.service.ts +++ b/src/frontend/packages/core/src/shared/components/list/list-types/app-event/cf-app-events-config.service.ts @@ -53,5 +53,4 @@ export class CfAppEventsConfigService extends ListConfig implements getDataSource = () => this.eventSource; getMultiFiltersConfigs = () => []; getFilters = () => []; - setFilter = (id: string) => null; } diff --git a/src/frontend/packages/core/src/shared/components/list/list-types/app-instance/cf-app-instances-config.service.ts b/src/frontend/packages/core/src/shared/components/list/list-types/app-instance/cf-app-instances-config.service.ts index 54dad54486..82c3f8b737 100644 --- a/src/frontend/packages/core/src/shared/components/list/list-types/app-instance/cf-app-instances-config.service.ts +++ b/src/frontend/packages/core/src/shared/components/list/list-types/app-instance/cf-app-instances-config.service.ts @@ -221,7 +221,6 @@ export class CfAppInstancesConfigService implements IListConfig getDataSource = () => this.instancesSource; getMultiFiltersConfigs = () => []; getFilters = () => []; - setFilter = (id: string) => null; getInitialised = () => this.initialised$; private createMetricsResults(entityServiceFactory: EntityServiceFactory) { diff --git a/src/frontend/packages/core/src/shared/components/list/list-types/app-variables/cf-app-variables-list-config.service.ts b/src/frontend/packages/core/src/shared/components/list/list-types/app-variables/cf-app-variables-list-config.service.ts index 1c288d4be0..1e6cc952ae 100644 --- a/src/frontend/packages/core/src/shared/components/list/list-types/app-variables/cf-app-variables-list-config.service.ts +++ b/src/frontend/packages/core/src/shared/components/list/list-types/app-variables/cf-app-variables-list-config.service.ts @@ -132,7 +132,6 @@ export class CfAppVariablesListConfigService implements IListConfig this.envVarsDataSource; getMultiFiltersConfigs = () => []; getFilters = () => []; - setFilter = (id: string) => null; constructor( private store: Store, diff --git a/src/frontend/packages/core/src/shared/components/list/list-types/app/cf-app-config.service.ts b/src/frontend/packages/core/src/shared/components/list/list-types/app/cf-app-config.service.ts index 9abc1afdcf..d311bf322f 100644 --- a/src/frontend/packages/core/src/shared/components/list/list-types/app/cf-app-config.service.ts +++ b/src/frontend/packages/core/src/shared/components/list/list-types/app/cf-app-config.service.ts @@ -145,6 +145,5 @@ export class CfAppConfigService extends ListConfig implements IList getDataSource = () => this.appsDataSource; getMultiFiltersConfigs = () => this.multiFilterConfigs; getFilters = () => []; - setFilter = (id: string) => null; getInitialised = () => this.initialised$; } diff --git a/src/frontend/packages/core/src/shared/components/list/list-types/base-cf/base-cf-list-config.ts b/src/frontend/packages/core/src/shared/components/list/list-types/base-cf/base-cf-list-config.ts index 5f0844b271..97edb4b016 100644 --- a/src/frontend/packages/core/src/shared/components/list/list-types/base-cf/base-cf-list-config.ts +++ b/src/frontend/packages/core/src/shared/components/list/list-types/base-cf/base-cf-list-config.ts @@ -18,5 +18,4 @@ export class BaseCfListConfig implements IListConfig { getSingleActions = () => []; getMultiFiltersConfigs = () => []; getFilters = () => []; - setFilter = (id: string) => null; } diff --git a/src/frontend/packages/core/src/shared/components/list/list-types/cf-endpoints/cf-endpoints-list-config.service.ts b/src/frontend/packages/core/src/shared/components/list/list-types/cf-endpoints/cf-endpoints-list-config.service.ts index cd617b7535..91fd7eba14 100644 --- a/src/frontend/packages/core/src/shared/components/list/list-types/cf-endpoints/cf-endpoints-list-config.service.ts +++ b/src/frontend/packages/core/src/shared/components/list/list-types/cf-endpoints/cf-endpoints-list-config.service.ts @@ -50,6 +50,5 @@ export class CFEndpointsListConfigService implements IListConfig public getSingleActions = () => []; public getMultiFiltersConfigs = () => []; public getFilters = () => []; - public setFilter = (id: string) => null; public getDataSource = () => this.dataSource; } diff --git a/src/frontend/packages/core/src/shared/components/list/list-types/cf-routes/cf-routes-list-config-base.ts b/src/frontend/packages/core/src/shared/components/list/list-types/cf-routes/cf-routes-list-config-base.ts index 459a476e3a..40bcf2a8be 100644 --- a/src/frontend/packages/core/src/shared/components/list/list-types/cf-routes/cf-routes-list-config-base.ts +++ b/src/frontend/packages/core/src/shared/components/list/list-types/cf-routes/cf-routes-list-config-base.ts @@ -206,7 +206,6 @@ export abstract class CfRoutesListConfigBase implements IListConfig getColumns = () => this.columns; getMultiFiltersConfigs = () => []; getFilters = () => []; - setFilter = (id: string) => null; /** * Creates an instance of CfRoutesListConfigBase. diff --git a/src/frontend/packages/core/src/shared/components/list/list-types/cf-routes/cf-routes-list-config.service.ts b/src/frontend/packages/core/src/shared/components/list/list-types/cf-routes/cf-routes-list-config.service.ts index 9b96a62922..dfd9b266b0 100644 --- a/src/frontend/packages/core/src/shared/components/list/list-types/cf-routes/cf-routes-list-config.service.ts +++ b/src/frontend/packages/core/src/shared/components/list/list-types/cf-routes/cf-routes-list-config.service.ts @@ -70,7 +70,6 @@ export class CfRoutesListConfigService extends CfRoutesListConfigBase implements ]; this.getMultiFiltersConfigs = () => multiFilterConfigs; this.getFilters = () => []; - this.setFilter = (id: string) => null; initCfOrgSpaceService(store, cfOrgSpaceService, this.dataSource.masterAction.entityKey, this.dataSource.masterAction.paginationKey).subscribe(); diff --git a/src/frontend/packages/core/src/shared/components/list/list-types/cf-select-users/cf-select-users-list-config.service.ts b/src/frontend/packages/core/src/shared/components/list/list-types/cf-select-users/cf-select-users-list-config.service.ts index 5b4173600f..8c2be47670 100644 --- a/src/frontend/packages/core/src/shared/components/list/list-types/cf-select-users/cf-select-users-list-config.service.ts +++ b/src/frontend/packages/core/src/shared/components/list/list-types/cf-select-users/cf-select-users-list-config.service.ts @@ -133,7 +133,6 @@ export class CfSelectUsersListConfigService implements IListConfig []; getMultiFiltersConfigs = () => []; getFilters = () => []; - setFilter = (id: string) => null; getDataSource = () => this.dataSource; getInitialised = () => this.initialised; } diff --git a/src/frontend/packages/core/src/shared/components/list/list-types/cf-services/cf-service-instances-list-config.base.ts b/src/frontend/packages/core/src/shared/components/list/list-types/cf-services/cf-service-instances-list-config.base.ts index 1890f455ad..3d2d967356 100644 --- a/src/frontend/packages/core/src/shared/components/list/list-types/cf-services/cf-service-instances-list-config.base.ts +++ b/src/frontend/packages/core/src/shared/components/list/list-types/cf-services/cf-service-instances-list-config.base.ts @@ -194,7 +194,6 @@ export class CfServiceInstancesListConfigBase implements IListConfig [this.listActionEdit, this.listActionDetach, this.listActionDelete]; getMultiFiltersConfigs = () => []; getFilters = () => []; - setFilter = (id: string) => null; getColumns = () => this.serviceInstanceColumns; getDataSource = () => null; diff --git a/src/frontend/packages/core/src/shared/components/list/list-types/cf-services/cf-services-list-config.service.ts b/src/frontend/packages/core/src/shared/components/list/list-types/cf-services/cf-services-list-config.service.ts index 8abe831628..bc171f066d 100644 --- a/src/frontend/packages/core/src/shared/components/list/list-types/cf-services/cf-services-list-config.service.ts +++ b/src/frontend/packages/core/src/shared/components/list/list-types/cf-services/cf-services-list-config.service.ts @@ -85,6 +85,5 @@ export class CfServicesListConfigService implements IListConfig { getSingleActions = () => []; getMultiFiltersConfigs = () => this.multiFilterConfigs; getFilters = () => []; - setFilter = (id: string) => null; getDataSource = () => this.dataSource; } diff --git a/src/frontend/packages/core/src/shared/components/list/list-types/cf-services/cf-user-service-instances-list-config.ts b/src/frontend/packages/core/src/shared/components/list/list-types/cf-services/cf-user-service-instances-list-config.ts index e8ef1501f2..80e7f86a52 100644 --- a/src/frontend/packages/core/src/shared/components/list/list-types/cf-services/cf-user-service-instances-list-config.ts +++ b/src/frontend/packages/core/src/shared/components/list/list-types/cf-services/cf-user-service-instances-list-config.ts @@ -198,7 +198,6 @@ export class CfUserServiceInstancesListConfigBase implements IListConfig [this.listActionEdit, this.listActionDetach, this.listActionDelete]; getMultiFiltersConfigs = () => []; getFilters = () => []; - setFilter = (id: string) => null; getColumns = () => this.serviceInstanceColumns; getDataSource = () => this.dataSource; diff --git a/src/frontend/packages/core/src/shared/components/list/list-types/cf-space-apps/cf-space-apps-list-config.service.ts b/src/frontend/packages/core/src/shared/components/list/list-types/cf-space-apps/cf-space-apps-list-config.service.ts index ed82576976..90c7061031 100644 --- a/src/frontend/packages/core/src/shared/components/list/list-types/cf-space-apps/cf-space-apps-list-config.service.ts +++ b/src/frontend/packages/core/src/shared/components/list/list-types/cf-space-apps/cf-space-apps-list-config.service.ts @@ -89,6 +89,5 @@ export class CfSpaceAppsListConfigService implements IListConfig { getSingleActions = () => []; getMultiFiltersConfigs = () => []; getFilters = () => []; - setFilter = (id: string) => null; getDataSource = () => this.dataSource; } diff --git a/src/frontend/packages/core/src/shared/components/list/list-types/cf-spaces/cf-spaces-list-config.service.ts b/src/frontend/packages/core/src/shared/components/list/list-types/cf-spaces/cf-spaces-list-config.service.ts index 6935a22986..463195a0f5 100644 --- a/src/frontend/packages/core/src/shared/components/list/list-types/cf-spaces/cf-spaces-list-config.service.ts +++ b/src/frontend/packages/core/src/shared/components/list/list-types/cf-spaces/cf-spaces-list-config.service.ts @@ -56,6 +56,5 @@ export class CfSpacesListConfigService implements IListConfig []; getMultiFiltersConfigs = () => []; getFilters = () => []; - setFilter = (id: string) => null; getDataSource = () => this.dataSource; } diff --git a/src/frontend/packages/core/src/shared/components/list/list-types/cf-users-org-space-roles/cf-users-space-roles-list-config.service.ts b/src/frontend/packages/core/src/shared/components/list/list-types/cf-users-org-space-roles/cf-users-space-roles-list-config.service.ts index 70517de420..d0332b6954 100644 --- a/src/frontend/packages/core/src/shared/components/list/list-types/cf-users-org-space-roles/cf-users-space-roles-list-config.service.ts +++ b/src/frontend/packages/core/src/shared/components/list/list-types/cf-users-org-space-roles/cf-users-space-roles-list-config.service.ts @@ -86,7 +86,6 @@ export class CfUsersSpaceRolesListConfigService implements IListConfig []; getMultiFiltersConfigs = () => []; getFilters = () => []; - setFilter = (id: string) => null; getDataSource = () => this.dataSource; public getInitialised = () => this.initialised; } diff --git a/src/frontend/packages/core/src/shared/components/list/list-types/detach-apps/detach-apps-list-config.service.ts b/src/frontend/packages/core/src/shared/components/list/list-types/detach-apps/detach-apps-list-config.service.ts index 394ea1be37..50fc128462 100644 --- a/src/frontend/packages/core/src/shared/components/list/list-types/detach-apps/detach-apps-list-config.service.ts +++ b/src/frontend/packages/core/src/shared/components/list/list-types/detach-apps/detach-apps-list-config.service.ts @@ -58,6 +58,5 @@ export class DetachAppsListConfigService implements IListConfig { getSingleActions = () => []; getMultiFiltersConfigs = () => []; getFilters = () => []; - setFilter = (id: string) => null; getDataSource = () => this.dataSource; } diff --git a/src/frontend/packages/core/src/shared/components/list/list-types/endpoint/endpoints-list-config.service.ts b/src/frontend/packages/core/src/shared/components/list/list-types/endpoint/endpoints-list-config.service.ts index d8d6cb9fa4..e7b3158731 100644 --- a/src/frontend/packages/core/src/shared/components/list/list-types/endpoint/endpoints-list-config.service.ts +++ b/src/frontend/packages/core/src/shared/components/list/list-types/endpoint/endpoints-list-config.service.ts @@ -135,5 +135,4 @@ export class EndpointsListConfigService implements IListConfig { public getDataSource = () => this.dataSource; public getMultiFiltersConfigs = () => []; public getFilters = () => []; - public setFilter = (id: string) => null; } diff --git a/src/frontend/packages/core/src/shared/components/list/list-types/github-commits/github-commits-list-config-base.service.ts b/src/frontend/packages/core/src/shared/components/list/list-types/github-commits/github-commits-list-config-base.service.ts index 585b8a8171..8684e94c7d 100644 --- a/src/frontend/packages/core/src/shared/components/list/list-types/github-commits/github-commits-list-config-base.service.ts +++ b/src/frontend/packages/core/src/shared/components/list/list-types/github-commits/github-commits-list-config-base.service.ts @@ -93,7 +93,6 @@ export abstract class GithubCommitsListConfigServiceBase implements IListConfig< public getSingleActions = () => []; public getMultiFiltersConfigs = () => []; public getFilters = () => []; - public setFilter = (id: string) => null; public getDataSource = () => this.dataSource; public getInitialised = () => this.initialised; } diff --git a/src/frontend/packages/core/src/shared/components/list/list-types/service-plans/service-plans-list-config.service.ts b/src/frontend/packages/core/src/shared/components/list/list-types/service-plans/service-plans-list-config.service.ts index 8da99f93f3..729fb7cbd1 100644 --- a/src/frontend/packages/core/src/shared/components/list/list-types/service-plans/service-plans-list-config.service.ts +++ b/src/frontend/packages/core/src/shared/components/list/list-types/service-plans/service-plans-list-config.service.ts @@ -108,7 +108,6 @@ export class ServicePlansListConfigService implements IListConfig []; getMultiFiltersConfigs = () => []; getFilters = () => []; - setFilter = (id: string) => null; getColumns = () => this.columns; getDataSource = () => this.dataSource; } diff --git a/src/frontend/packages/core/src/shared/components/list/list.component.ts b/src/frontend/packages/core/src/shared/components/list/list.component.ts index f56c4b241d..68b48dfcc4 100644 --- a/src/frontend/packages/core/src/shared/components/list/list.component.ts +++ b/src/frontend/packages/core/src/shared/components/list/list.component.ts @@ -49,7 +49,7 @@ import { ListView, SetListViewAction, } from '../../../../../store/src/actions/list.actions'; -import { SetPage } from '../../../../../store/src/actions/pagination.actions'; +import { SetPage, SetClientFilterKey } from '../../../../../store/src/actions/pagination.actions'; import { AppState } from '../../../../../store/src/app-state'; import { entityFactory } from '../../../../../store/src/helpers/entity-factory'; import { ActionState } from '../../../../../store/src/reducers/api-request-reducer/types'; @@ -177,9 +177,8 @@ export class ListComponent implements OnInit, OnChanges, OnDestroy, AfterView }; private filterString = ''; private sortColumns: ITableColumn[]; - // private filterColumns: ITableColumn[]; - private filterColumns: IListFilter[]; - private filterSelected: IListFilter; + private filterColumns: IListFilter[]; + private filterSelected: IListFilter; private paginationWidgetToStore: Subscription; private filterWidgetToStore: Subscription; @@ -396,20 +395,25 @@ export class ListComponent implements OnInit, OnChanges, OnDestroy, AfterView return column.sort; }); - this.filterColumns = this.config.getFilters(); - if (!this.filterSelected) { - this.filterSelected = this.filterColumns.find(filterConfig => { - return filterConfig.default === true; - }); - } - const sortStoreToWidget = this.paginationController.sort$.pipe(tap((sort: ListSort) => { this.headerSort.value = sort.field; this.headerSort.direction = sort.direction; })); + this.filterColumns = this.config.getFilters(); + const filterStoreToWidget = this.paginationController.filter$.pipe(tap((paginationFilter: ListFilter) => { this.filterString = paginationFilter.string; + + const filterKey = paginationFilter.filterKey; + if (filterKey) { + this.filterSelected = this.filterColumns.find(filterConfig => { + return filterConfig.key === filterKey; + }); + } else if (this.filterColumns) { + this.filterSelected = this.filterColumns.find(filterConfig => filterConfig.default); + } + // Pipe store values to filter managers. This ensures any changes such as automatically selected orgs/spaces are shown in the drop // downs (change org to one with one space results in that space being selected) Object.values(this.multiFilterManagers).forEach((filterManager: MultiFilterManager, index: number) => { @@ -572,9 +576,6 @@ export class ListComponent implements OnInit, OnChanges, OnDestroy, AfterView this.uberSub, this.multiFilterChangesSub ); - if (this.filterColumns) { - this.filterColumns.forEach(filterConfig => filterConfig.dataSource.destroy()); - } if (this.dataSource) { this.dataSource.destroy(); } @@ -605,9 +606,12 @@ export class ListComponent implements OnInit, OnChanges, OnDestroy, AfterView }); } - updateListFilter(filterSelected: IListFilter, filterString: string) { - this.config.setFilter(filterSelected.id); - this.initialise(); + updateListFilter(filterSelected: IListFilter, filterString: string) { + this.store.dispatch(new SetClientFilterKey( + this.dataSource.entityKey, + this.dataSource.paginationKey, + filterSelected.key + )); } executeActionMultiple(listActionConfig: IMultiListAction) { diff --git a/src/frontend/packages/core/src/shared/components/list/list.component.types.ts b/src/frontend/packages/core/src/shared/components/list/list.component.types.ts index 97114515cb..b6032c5922 100644 --- a/src/frontend/packages/core/src/shared/components/list/list.component.types.ts +++ b/src/frontend/packages/core/src/shared/components/list/list.component.types.ts @@ -50,8 +50,7 @@ export interface IListConfig { /** * Collection of filters */ - getFilters: () => IListFilter[]; - setFilter: (id: string) => void; + getFilters: () => IListFilter[]; /** * Fetch an observable that will emit once the underlying config components have been created. For instance if the data source requires * something from the store which requires an async call @@ -125,10 +124,9 @@ export interface IListMultiFilterConfig { select: BehaviorSubject; } -export interface IListFilter { - dataSource: ListDataSource; +export interface IListFilter { default?: boolean; - id: string; + key: string; label: string; placeholder: string; } @@ -157,8 +155,7 @@ export class ListConfig implements IListConfig { getColumns = (): ITableColumn[] => null; getDataSource = (): ListDataSource => null; getMultiFiltersConfigs = (): IListMultiFilterConfig[] => []; - getFilters = (): IListFilter[] => []; - setFilter = (id: string) => null; + getFilters = (): IListFilter[] => []; getInitialised = () => observableOf(true); } diff --git a/src/frontend/packages/store/src/actions/list.actions.ts b/src/frontend/packages/store/src/actions/list.actions.ts index 5291cba081..adccb7c3f9 100644 --- a/src/frontend/packages/store/src/actions/list.actions.ts +++ b/src/frontend/packages/store/src/actions/list.actions.ts @@ -20,6 +20,7 @@ export class ListFilter { items: { [key: string]: any; }; + filterKey?: string; } export const ListStateActionTypes = { diff --git a/src/frontend/packages/store/src/actions/pagination.actions.ts b/src/frontend/packages/store/src/actions/pagination.actions.ts index 0d2e20c2e0..4d1d99287c 100644 --- a/src/frontend/packages/store/src/actions/pagination.actions.ts +++ b/src/frontend/packages/store/src/actions/pagination.actions.ts @@ -12,6 +12,7 @@ export const SET_RESULT_COUNT = '[Pagination] Set result count'; export const SET_CLIENT_PAGE_SIZE = '[Pagination] Set client page size'; export const SET_CLIENT_PAGE = '[Pagination] Set client page'; export const SET_CLIENT_FILTER = '[Pagination] Set client filter'; +export const SET_CLIENT_FILTER_KEY = '[Pagination] Set client filter key'; export const SET_PARAMS = '[Pagination] Set Params'; export const SET_INITIAL_PARAMS = '[Pagination] Set initial params'; export const ADD_PARAMS = '[Pagination] Add Params'; @@ -114,6 +115,15 @@ export class SetClientFilter implements BasePaginatedAction { type = SET_CLIENT_FILTER; } +export class SetClientFilterKey implements BasePaginatedAction { + constructor( + public entityKey: string, + public paginationKey: string, + public filterKey: string, + ) {} + type = SET_CLIENT_FILTER_KEY; +} + export class SetParams implements BasePaginatedAction { constructor( public entityKey: string, diff --git a/src/frontend/packages/store/src/reducers/pagination-reducer/pagination-reducer-set-client-filter-key.ts b/src/frontend/packages/store/src/reducers/pagination-reducer/pagination-reducer-set-client-filter-key.ts new file mode 100644 index 0000000000..9e88445cc7 --- /dev/null +++ b/src/frontend/packages/store/src/reducers/pagination-reducer/pagination-reducer-set-client-filter-key.ts @@ -0,0 +1,22 @@ +import { PaginationEntityState } from '../../types/pagination.types'; +import { SetClientFilterKey } from '../../actions/pagination.actions'; +import { spreadClientPagination } from './pagination-reducer.helper'; + +export function paginationSetClientFilterKey(state: PaginationEntityState, action: SetClientFilterKey) { + const clientPagination = spreadClientPagination(state.clientPagination); + + return { + ...state, + error: false, + clientPagination: { + ...clientPagination, + filter: { + ...clientPagination.filter, + items: { + ...clientPagination.filter.items, + }, + filterKey: action.filterKey, + } + } + }; +} diff --git a/src/frontend/packages/store/src/reducers/pagination-reducer/pagination.reducer.ts b/src/frontend/packages/store/src/reducers/pagination-reducer/pagination.reducer.ts index d5fffcd8fd..59d5ed5763 100644 --- a/src/frontend/packages/store/src/reducers/pagination-reducer/pagination.reducer.ts +++ b/src/frontend/packages/store/src/reducers/pagination-reducer/pagination.reducer.ts @@ -12,6 +12,7 @@ import { REMOVE_PARAMS, RESET_PAGINATION, SET_CLIENT_FILTER, + SET_CLIENT_FILTER_KEY, SET_CLIENT_PAGE, SET_CLIENT_PAGE_SIZE, SET_INITIAL_PARAMS, @@ -34,6 +35,7 @@ import { paginationMaxReached } from './pagination-reducer-max-reached'; import { paginationRemoveParams } from './pagination-reducer-remove-params'; import { getDefaultPaginationEntityState, paginationResetPagination } from './pagination-reducer-reset-pagination'; import { paginationSetClientFilter } from './pagination-reducer-set-client-filter'; +import { paginationSetClientFilterKey } from './pagination-reducer-set-client-filter-key'; import { paginationSetClientPage } from './pagination-reducer-set-client-page'; import { paginationSetClientPageSize } from './pagination-reducer-set-client-page-size'; import { paginationSetPage } from './pagination-reducer-set-page'; @@ -79,6 +81,8 @@ const getPaginationUpdater = (types: [string, string, string]) => { return paginationSetClientPage(state, action); case SET_CLIENT_FILTER: return paginationSetClientFilter(state, action); + case SET_CLIENT_FILTER_KEY: + return paginationSetClientFilterKey(state, action); case SET_PAGE_BUSY: return paginationPageBusy(state, action); default: diff --git a/src/frontend/packages/store/src/types/pagination.types.ts b/src/frontend/packages/store/src/types/pagination.types.ts index 0f3fa22b30..65d70caf42 100644 --- a/src/frontend/packages/store/src/types/pagination.types.ts +++ b/src/frontend/packages/store/src/types/pagination.types.ts @@ -24,6 +24,7 @@ export interface PaginationClientFilter { items: { [key: string]: any; }; + filterKey?: string; } export interface PaginationClientPagination { From 0c91cf5c235febe931b84820e10a44f2ca2b6eac Mon Sep 17 00:00:00 2001 From: Jordan Jensen Date: Fri, 9 Aug 2019 18:07:50 -0700 Subject: [PATCH 04/15] Expand IListConfig getFilters comment (SOC-9450) --- .../core/src/shared/components/list/list.component.types.ts | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/frontend/packages/core/src/shared/components/list/list.component.types.ts b/src/frontend/packages/core/src/shared/components/list/list.component.types.ts index b6032c5922..f7fa22a8d9 100644 --- a/src/frontend/packages/core/src/shared/components/list/list.component.types.ts +++ b/src/frontend/packages/core/src/shared/components/list/list.component.types.ts @@ -48,7 +48,9 @@ export interface IListConfig { */ getMultiFiltersConfigs: () => IListMultiFilterConfig[]; /** - * Collection of filters + * Collection of filter definitions to support filtering across multiple fields in a list. + * When the filter is selected in a dropdown the filterString filters results using the chosen field. + * Combined with a transformEntities DataFunction that consumes the filterKey. */ getFilters: () => IListFilter[]; /** From f1d83c4e722c9d5320855861f0e30c7f2b3509a3 Mon Sep 17 00:00:00 2001 From: Jordan Jensen Date: Mon, 12 Aug 2019 17:14:19 -0700 Subject: [PATCH 05/15] Update list component tests (SOC-9450) --- .../shared/components/list/list.component.spec.ts | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/src/frontend/packages/core/src/shared/components/list/list.component.spec.ts b/src/frontend/packages/core/src/shared/components/list/list.component.spec.ts index 939407b770..148e5d9ce0 100644 --- a/src/frontend/packages/core/src/shared/components/list/list.component.spec.ts +++ b/src/frontend/packages/core/src/shared/components/list/list.component.spec.ts @@ -42,6 +42,7 @@ describe('ListComponent', () => { getInitialised: () => null, getMultiActions: () => null, getMultiFiltersConfigs: () => null, + getFilters: () => null, getSingleActions: () => null, isLocal: false, pageSizeOptions: [1], @@ -149,6 +150,7 @@ describe('ListComponent', () => { describe('Header', () => { it('Nothing enabled', () => { component.config.getMultiFiltersConfigs = () => []; + component.config.getFilters = () => []; component.config.enableTextFilter = false; component.config.viewType = ListViewTypes.CARD_ONLY; component.config.defaultView = 'card' as ListView; @@ -206,6 +208,19 @@ describe('ListComponent', () => { } ]; }; + component.config.getFilters = () => ([ + { + default: true, + key: 'a', + label: 'A', + placeholder: 'Filter by A' + }, + { + key: 'b', + label: 'B', + placeholder: 'Filter by B' + } + ]); component.config.enableTextFilter = true; component.config.viewType = ListViewTypes.CARD_ONLY; component.config.defaultView = 'card' as ListView; From d0bd4f37ab8a7adc35e909b0d77b22d9625f9edb Mon Sep 17 00:00:00 2001 From: Jordan Jensen Date: Fri, 23 Aug 2019 16:36:08 -0700 Subject: [PATCH 06/15] Handle no default filter selection better (SOC-9450) - Disable filter string if no default filter is selected --- .../kubernetes-nodes/kubernetes-nodes-list-config.service.ts | 5 +++-- .../core/src/shared/components/list/list.component.html | 4 ++-- .../core/src/shared/components/list/list.component.ts | 3 ++- 3 files changed, 7 insertions(+), 5 deletions(-) diff --git a/custom-src/frontend/app/custom/kubernetes/list-types/kubernetes-nodes/kubernetes-nodes-list-config.service.ts b/custom-src/frontend/app/custom/kubernetes/list-types/kubernetes-nodes/kubernetes-nodes-list-config.service.ts index fa0fb9aebc..97a30a84e8 100644 --- a/custom-src/frontend/app/custom/kubernetes/list-types/kubernetes-nodes/kubernetes-nodes-list-config.service.ts +++ b/custom-src/frontend/app/custom/kubernetes/list-types/kubernetes-nodes/kubernetes-nodes-list-config.service.ts @@ -100,7 +100,7 @@ export class KubernetesNodesListConfigService implements IListConfig { return node.metadata.name.toUpperCase().includes(filterString); }); + default: + return entities; } } ]; diff --git a/src/frontend/packages/core/src/shared/components/list/list.component.html b/src/frontend/packages/core/src/shared/components/list/list.component.html index 9f6d4a7f8b..ea7ecb4e46 100644 --- a/src/frontend/packages/core/src/shared/components/list/list.component.html +++ b/src/frontend/packages/core/src/shared/components/list/list.component.html @@ -75,7 +75,7 @@ Filter Selection {{ filter.label }} @@ -87,7 +87,7 @@ [hidden]="!config.enableTextFilter || (!(hasRows$ | async) && !filter) || (dataSource.isAdding$ | async) || (dataSource.maxedResults$ | async)"> diff --git a/src/frontend/packages/core/src/shared/components/list/list.component.ts b/src/frontend/packages/core/src/shared/components/list/list.component.ts index 68b48dfcc4..4533e67732 100644 --- a/src/frontend/packages/core/src/shared/components/list/list.component.ts +++ b/src/frontend/packages/core/src/shared/components/list/list.component.ts @@ -412,6 +412,7 @@ export class ListComponent implements OnInit, OnChanges, OnDestroy, AfterView }); } else if (this.filterColumns) { this.filterSelected = this.filterColumns.find(filterConfig => filterConfig.default); + this.updateListFilter(this.filterSelected); } // Pipe store values to filter managers. This ensures any changes such as automatically selected orgs/spaces are shown in the drop @@ -606,7 +607,7 @@ export class ListComponent implements OnInit, OnChanges, OnDestroy, AfterView }); } - updateListFilter(filterSelected: IListFilter, filterString: string) { + updateListFilter(filterSelected: IListFilter) { this.store.dispatch(new SetClientFilterKey( this.dataSource.entityKey, this.dataSource.paginationKey, From aef717614fd7216ddbe1ce125604cc0f1dc9f600 Mon Sep 17 00:00:00 2001 From: Jordan Jensen Date: Fri, 23 Aug 2019 16:46:18 -0700 Subject: [PATCH 07/15] Only update list filter if a default is found (SOC-9450) --- .../core/src/shared/components/list/list.component.ts | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/frontend/packages/core/src/shared/components/list/list.component.ts b/src/frontend/packages/core/src/shared/components/list/list.component.ts index 4533e67732..2d1e26df65 100644 --- a/src/frontend/packages/core/src/shared/components/list/list.component.ts +++ b/src/frontend/packages/core/src/shared/components/list/list.component.ts @@ -412,7 +412,9 @@ export class ListComponent implements OnInit, OnChanges, OnDestroy, AfterView }); } else if (this.filterColumns) { this.filterSelected = this.filterColumns.find(filterConfig => filterConfig.default); - this.updateListFilter(this.filterSelected); + if (this.filterSelected) { + this.updateListFilter(this.filterSelected); + } } // Pipe store values to filter managers. This ensures any changes such as automatically selected orgs/spaces are shown in the drop From 3376e76716565fad18c6f2cc971ad4304e7e66bf Mon Sep 17 00:00:00 2001 From: Jordan Jensen Date: Fri, 30 Aug 2019 16:26:31 -0700 Subject: [PATCH 08/15] Remove unnecessary additions (SOC-9450) --- .../core/src/shared/components/list/list.component.html | 7 ------- .../pagination-reducer-set-client-filter-key.ts | 3 --- 2 files changed, 10 deletions(-) diff --git a/src/frontend/packages/core/src/shared/components/list/list.component.html b/src/frontend/packages/core/src/shared/components/list/list.component.html index ea7ecb4e46..6447c2150e 100644 --- a/src/frontend/packages/core/src/shared/components/list/list.component.html +++ b/src/frontend/packages/core/src/shared/components/list/list.component.html @@ -216,10 +216,3 @@ - - - - diff --git a/src/frontend/packages/store/src/reducers/pagination-reducer/pagination-reducer-set-client-filter-key.ts b/src/frontend/packages/store/src/reducers/pagination-reducer/pagination-reducer-set-client-filter-key.ts index 9e88445cc7..5db751052d 100644 --- a/src/frontend/packages/store/src/reducers/pagination-reducer/pagination-reducer-set-client-filter-key.ts +++ b/src/frontend/packages/store/src/reducers/pagination-reducer/pagination-reducer-set-client-filter-key.ts @@ -12,9 +12,6 @@ export function paginationSetClientFilterKey(state: PaginationEntityState, actio ...clientPagination, filter: { ...clientPagination.filter, - items: { - ...clientPagination.filter.items, - }, filterKey: action.filterKey, } } From 24727d3932a93f197bf8e2fed0c60568519ad52e Mon Sep 17 00:00:00 2001 From: Jordan Jensen Date: Fri, 30 Aug 2019 16:39:23 -0700 Subject: [PATCH 09/15] Return entities if no filter string (SOC-9450) --- .../kubernetes-nodes-list-config.service.ts | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/custom-src/frontend/app/custom/kubernetes/list-types/kubernetes-nodes/kubernetes-nodes-list-config.service.ts b/custom-src/frontend/app/custom/kubernetes/list-types/kubernetes-nodes/kubernetes-nodes-list-config.service.ts index 97a30a84e8..bb7438bbdd 100644 --- a/custom-src/frontend/app/custom/kubernetes/list-types/kubernetes-nodes/kubernetes-nodes-list-config.service.ts +++ b/custom-src/frontend/app/custom/kubernetes/list-types/kubernetes-nodes/kubernetes-nodes-list-config.service.ts @@ -118,8 +118,13 @@ export class KubernetesNodesListConfigService implements IListConfig[] = [ (entities: KubernetesNode[], paginationState: PaginationEntityState) => { + const filterString = paginationState.clientPagination.filter.string; + + if (!filterString) { + return entities; + } + const filterKey = paginationState.clientPagination.filter.filterKey; - const filterString = paginationState.clientPagination.filter.string.toUpperCase(); switch (filterKey) { case KubernetesNodesListFilterKeys.IP_ADDRESS: From 43d554f45066ae9a55e542cd94f8e7fd31576eaa Mon Sep 17 00:00:00 2001 From: Jordan Jensen Date: Tue, 3 Sep 2019 16:57:20 -0700 Subject: [PATCH 10/15] Adjust test mat-select number Adding an additional mat-select created an off-by-one issue --- src/test-e2e/applications/application-wall-e2e.spec.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/test-e2e/applications/application-wall-e2e.spec.ts b/src/test-e2e/applications/application-wall-e2e.spec.ts index 669d247931..906316e2f5 100644 --- a/src/test-e2e/applications/application-wall-e2e.spec.ts +++ b/src/test-e2e/applications/application-wall-e2e.spec.ts @@ -125,7 +125,7 @@ describe('Application Wall Tests -', () => { function createPageSizeSelectId(): string { // The ctrl is hidden inside a mat-paginator, the id will change depending on other selects on page - return hasCfFilter ? 'mat-select-4' : 'mat-select-3'; + return hasCfFilter ? 'mat-select-5' : 'mat-select-4'; } function tearDown(orgName: string) { @@ -265,7 +265,7 @@ describe('Application Wall Tests -', () => { }); - describe('Multi Page -', () => { + fdescribe('Multi Page -', () => { const orgName = E2EHelpers.createCustomName(customOrgSpacesLabel) + '-multi-page'; let appNames; From c034c67e00221e9fe131f73291c2790c69d56a1f Mon Sep 17 00:00:00 2001 From: Jordan Jensen Date: Tue, 3 Sep 2019 17:05:18 -0700 Subject: [PATCH 11/15] Remove unintended fdescribe --- src/test-e2e/applications/application-wall-e2e.spec.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/test-e2e/applications/application-wall-e2e.spec.ts b/src/test-e2e/applications/application-wall-e2e.spec.ts index 906316e2f5..e28265cf62 100644 --- a/src/test-e2e/applications/application-wall-e2e.spec.ts +++ b/src/test-e2e/applications/application-wall-e2e.spec.ts @@ -265,7 +265,7 @@ describe('Application Wall Tests -', () => { }); - fdescribe('Multi Page -', () => { + describe('Multi Page -', () => { const orgName = E2EHelpers.createCustomName(customOrgSpacesLabel) + '-multi-page'; let appNames; From 1736e7ff6960d1bb7549212e27ff0f6ff532cb8b Mon Sep 17 00:00:00 2001 From: Richard Cox Date: Wed, 4 Sep 2019 09:37:57 +0100 Subject: [PATCH 12/15] Fall back on `ExternalIP` if `InternalIP` is not found, make result null safe --- .../kubernetes-nodes-list-config.service.ts | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/custom-src/frontend/app/custom/kubernetes/list-types/kubernetes-nodes/kubernetes-nodes-list-config.service.ts b/custom-src/frontend/app/custom/kubernetes/list-types/kubernetes-nodes/kubernetes-nodes-list-config.service.ts index bb7438bbdd..f86799211d 100644 --- a/custom-src/frontend/app/custom/kubernetes/list-types/kubernetes-nodes/kubernetes-nodes-list-config.service.ts +++ b/custom-src/frontend/app/custom/kubernetes/list-types/kubernetes-nodes/kubernetes-nodes-list-config.service.ts @@ -2,9 +2,9 @@ import { Injectable } from '@angular/core'; import { Store } from '@ngrx/store'; import { AppState } from '../../../../../../store/src/app-state'; -import { ITableColumn } from '../../../../shared/components/list/list-table/table.types'; -import { DataFunction } from '../../../../shared/components/list/data-sources-controllers/list-data-source'; import { PaginationEntityState } from '../../../../../../store/src/types/pagination.types'; +import { DataFunction } from '../../../../shared/components/list/data-sources-controllers/list-data-source'; +import { ITableColumn } from '../../../../shared/components/list/list-table/table.types'; import { IListConfig, IListFilter, ListViewTypes } from '../../../../shared/components/list/list.component.types'; import { BaseKubeGuid } from '../../kubernetes-page.types'; import { ConditionType, KubernetesNode } from '../../store/kube.types'; @@ -129,10 +129,10 @@ export class KubernetesNodesListConfigService implements IListConfig { - const internalIP: string = node.status.addresses.find(address => { - return address.type === 'InternalIP'; - }).address; - return internalIP.toUpperCase().includes(filterString); + const ipAddress = + node.status.addresses.find(address => address.type === 'InternalIP') || + node.status.addresses.find(address => address.type === 'ExternalIP'); + return ipAddress ? ipAddress.address.toUpperCase().includes(filterString) : false; }); case KubernetesNodesListFilterKeys.LABELS: From b8bfeb4a929ab5dfced2bb15a10a634f072ea3a5 Mon Sep 17 00:00:00 2001 From: Richard Cox Date: Wed, 4 Sep 2019 10:29:20 +0100 Subject: [PATCH 13/15] Make getFilters optional - make optional in interface - check for optional function in list component, even though in class it's not optional - fixed unrelated typing for getMultiActions and getSingleActions --- .../monocular-charts-list-config.service.ts | 1 - .../monocular-release-pods-list-config.service.ts | 1 - ...onocular-release-services-list-config.service.ts | 1 - .../monocular-releases-list-config.service.ts | 1 - .../monocular-repository-list-config.service.ts | 1 - .../monocular-versions-list-config.service.ts | 1 - .../kubernetes-apps-list-config.service.ts | 1 - .../kubernetes-endpoints-list-config.service.ts | 1 - .../kubernetes-namespaces-list-config.service.ts | 1 - .../kubernetes-pods-list-config.service.ts | 1 - .../kubernetes-service-list-config.service.ts | 5 +---- .../app-event/cf-app-events-config.service.ts | 1 - .../app-instance/cf-app-instances-config.service.ts | 1 - .../cf-app-variables-list-config.service.ts | 1 - .../list/list-types/app/cf-app-config.service.ts | 1 - .../list/list-types/base-cf/base-cf-list-config.ts | 1 - .../cf-endpoints-list-config.service.ts | 1 - .../cf-routes/cf-routes-list-config-base.ts | 1 - .../cf-routes/cf-routes-list-config.service.ts | 1 - .../cf-select-users-list-config.service.ts | 1 - .../cf-service-instances-list-config.base.ts | 1 - .../cf-services/cf-services-list-config.service.ts | 13 ++++++------- .../cf-user-service-instances-list-config.ts | 1 - .../cf-space-apps-list-config.service.ts | 1 - .../cf-spaces/cf-spaces-list-config.service.ts | 1 - .../cf-users-space-roles-list-config.service.ts | 11 +++++------ .../detach-apps/detach-apps-list-config.service.ts | 7 +++---- .../endpoint/endpoints-list-config.service.ts | 1 - .../github-commits-list-config-base.service.ts | 7 +++---- .../service-plans-list-config.service.ts | 1 - .../src/shared/components/list/list.component.ts | 4 ++-- .../shared/components/list/list.component.types.ts | 6 +++--- 32 files changed, 23 insertions(+), 55 deletions(-) diff --git a/custom-src/frontend/app/custom/helm/list-types/monocular-charts-list-config.service.ts b/custom-src/frontend/app/custom/helm/list-types/monocular-charts-list-config.service.ts index e87a82a970..551fff9625 100644 --- a/custom-src/frontend/app/custom/helm/list-types/monocular-charts-list-config.service.ts +++ b/custom-src/frontend/app/custom/helm/list-types/monocular-charts-list-config.service.ts @@ -84,7 +84,6 @@ export class MonocularChartsListConfig implements IListConfig { getColumns = () => this.columns; getDataSource = () => this.AppsDataSource; getMultiFiltersConfigs = () => [this.createRepositoryFilterConfig()]; - getFilters = () => []; private createRepositoryFilterConfig(): IListMultiFilterConfig { return { diff --git a/custom-src/frontend/app/custom/helm/list-types/monocular-release-pods-list-config.service.ts b/custom-src/frontend/app/custom/helm/list-types/monocular-release-pods-list-config.service.ts index 476e89492b..22d21f4dc0 100644 --- a/custom-src/frontend/app/custom/helm/list-types/monocular-release-pods-list-config.service.ts +++ b/custom-src/frontend/app/custom/helm/list-types/monocular-release-pods-list-config.service.ts @@ -98,6 +98,5 @@ export class HelmReleasePodsListConfig implements IListConfig { public getMultiActions = () => []; public getSingleActions = () => []; public getMultiFiltersConfigs = () => []; - public getFilters = () => []; public getDataSource = () => this.dataSource; } diff --git a/custom-src/frontend/app/custom/helm/list-types/monocular-release-services-list-config.service.ts b/custom-src/frontend/app/custom/helm/list-types/monocular-release-services-list-config.service.ts index 5e6b9e6237..b1b46b43cb 100644 --- a/custom-src/frontend/app/custom/helm/list-types/monocular-release-services-list-config.service.ts +++ b/custom-src/frontend/app/custom/helm/list-types/monocular-release-services-list-config.service.ts @@ -80,6 +80,5 @@ export class HelmReleaseServicesListConfig implements IListConfig []; public getSingleActions = () => []; public getMultiFiltersConfigs = () => []; - public getFilters = () => []; public getDataSource = () => this.dataSource; } diff --git a/custom-src/frontend/app/custom/helm/list-types/monocular-releases-list-config.service.ts b/custom-src/frontend/app/custom/helm/list-types/monocular-releases-list-config.service.ts index 7f55c74e42..9512498e97 100644 --- a/custom-src/frontend/app/custom/helm/list-types/monocular-releases-list-config.service.ts +++ b/custom-src/frontend/app/custom/helm/list-types/monocular-releases-list-config.service.ts @@ -117,6 +117,5 @@ export class HelmReleasesListConfig implements IListConfig { public getMultiActions = () => []; public getSingleActions = () => []; public getMultiFiltersConfigs = () => []; - public getFilters = () => []; public getDataSource = () => this.dataSource; } 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 ab9eeb5447..0e99e7dd86 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 @@ -96,6 +96,5 @@ export class MonocularRepositoryListConfig implements IListConfig public getMultiActions = () => []; public getSingleActions = () => []; public getMultiFiltersConfigs = () => []; - public getFilters = () => []; public getDataSource = () => this.dataSource; } diff --git a/custom-src/frontend/app/custom/helm/list-types/monocular-versions-list-config.service.ts b/custom-src/frontend/app/custom/helm/list-types/monocular-versions-list-config.service.ts index 9084ee4b17..4da8970655 100644 --- a/custom-src/frontend/app/custom/helm/list-types/monocular-versions-list-config.service.ts +++ b/custom-src/frontend/app/custom/helm/list-types/monocular-versions-list-config.service.ts @@ -52,6 +52,5 @@ export class HelmVersionsListConfig implements IListConfig { public getMultiActions = () => []; public getSingleActions = () => []; public getMultiFiltersConfigs = () => []; - public getFilters = () => []; public getDataSource = () => this.dataSource; } diff --git a/custom-src/frontend/app/custom/kubernetes/list-types/kubernetes-apps/kubernetes-apps-list-config.service.ts b/custom-src/frontend/app/custom/kubernetes/list-types/kubernetes-apps/kubernetes-apps-list-config.service.ts index 28080d06f6..e984169e53 100644 --- a/custom-src/frontend/app/custom/kubernetes/list-types/kubernetes-apps/kubernetes-apps-list-config.service.ts +++ b/custom-src/frontend/app/custom/kubernetes/list-types/kubernetes-apps/kubernetes-apps-list-config.service.ts @@ -89,7 +89,6 @@ export class KubernetesAppsListConfigService implements IListConfig this.columns; getDataSource = () => this.AppsDataSource; getMultiFiltersConfigs = () => []; - getFilters = () => []; constructor( store: Store, diff --git a/custom-src/frontend/app/custom/kubernetes/list-types/kubernetes-endpoints/kubernetes-endpoints-list-config.service.ts b/custom-src/frontend/app/custom/kubernetes/list-types/kubernetes-endpoints/kubernetes-endpoints-list-config.service.ts index 84904843f9..73f0cdd19f 100644 --- a/custom-src/frontend/app/custom/kubernetes/list-types/kubernetes-endpoints/kubernetes-endpoints-list-config.service.ts +++ b/custom-src/frontend/app/custom/kubernetes/list-types/kubernetes-endpoints/kubernetes-endpoints-list-config.service.ts @@ -53,6 +53,5 @@ export class KubernetesEndpointsListConfigService implements IListConfig []; public getSingleActions = () => []; public getMultiFiltersConfigs = () => []; - public getFilters = () => []; public getDataSource = () => this.dataSource; } diff --git a/custom-src/frontend/app/custom/kubernetes/list-types/kubernetes-namespaces/kubernetes-namespaces-list-config.service.ts b/custom-src/frontend/app/custom/kubernetes/list-types/kubernetes-namespaces/kubernetes-namespaces-list-config.service.ts index 84344a31c0..f4093d2b7c 100644 --- a/custom-src/frontend/app/custom/kubernetes/list-types/kubernetes-namespaces/kubernetes-namespaces-list-config.service.ts +++ b/custom-src/frontend/app/custom/kubernetes/list-types/kubernetes-namespaces/kubernetes-namespaces-list-config.service.ts @@ -74,7 +74,6 @@ export class KubernetesNamespacesListConfigService implements IListConfig this.columns; getDataSource = () => this.podsDataSource; getMultiFiltersConfigs = () => []; - getFilters = () => []; getInitialised = () => this.initialised$; constructor( diff --git a/custom-src/frontend/app/custom/kubernetes/list-types/kubernetes-pods/kubernetes-pods-list-config.service.ts b/custom-src/frontend/app/custom/kubernetes/list-types/kubernetes-pods/kubernetes-pods-list-config.service.ts index a389753548..3c097b2cbd 100644 --- a/custom-src/frontend/app/custom/kubernetes/list-types/kubernetes-pods/kubernetes-pods-list-config.service.ts +++ b/custom-src/frontend/app/custom/kubernetes/list-types/kubernetes-pods/kubernetes-pods-list-config.service.ts @@ -103,7 +103,6 @@ export class KubernetesPodsListConfigService implements IListConfig this.columns; getDataSource = () => this.podsDataSource; getMultiFiltersConfigs = () => []; - getFilters = () => []; constructor( store: Store, diff --git a/custom-src/frontend/app/custom/kubernetes/list-types/kubernetes-service-list-config.service.ts b/custom-src/frontend/app/custom/kubernetes/list-types/kubernetes-service-list-config.service.ts index 2579b31e86..01ab7ecc46 100644 --- a/custom-src/frontend/app/custom/kubernetes/list-types/kubernetes-service-list-config.service.ts +++ b/custom-src/frontend/app/custom/kubernetes/list-types/kubernetes-service-list-config.service.ts @@ -1,11 +1,9 @@ import { ListDataSource } from '../../../shared/components/list/data-sources-controllers/list-data-source'; import { ITableColumn } from '../../../shared/components/list/list-table/table.types'; import { IListConfig, ListViewTypes } from '../../../shared/components/list/list.component.types'; -import { - KubernetesServicePortsComponent, -} from './kubernetes-service-ports/kubernetes-service-ports.component'; import { KubeService } from '../store/kube.types'; import { defaultHelmKubeListPageSize } from './kube-helm-list-types'; +import { KubernetesServicePortsComponent } from './kubernetes-service-ports/kubernetes-service-ports.component'; export abstract class BaseKubernetesServicesListConfig implements IListConfig { @@ -60,5 +58,4 @@ export abstract class BaseKubernetesServicesListConfig implements IListConfig []; getColumns = () => this.columns; getMultiFiltersConfigs = () => []; - getFilters = () => []; } diff --git a/src/frontend/packages/core/src/shared/components/list/list-types/app-event/cf-app-events-config.service.ts b/src/frontend/packages/core/src/shared/components/list/list-types/app-event/cf-app-events-config.service.ts index 2c23cde46c..868ebee323 100644 --- a/src/frontend/packages/core/src/shared/components/list/list-types/app-event/cf-app-events-config.service.ts +++ b/src/frontend/packages/core/src/shared/components/list/list-types/app-event/cf-app-events-config.service.ts @@ -52,5 +52,4 @@ export class CfAppEventsConfigService extends ListConfig implements getColumns = () => this.columns; getDataSource = () => this.eventSource; getMultiFiltersConfigs = () => []; - getFilters = () => []; } diff --git a/src/frontend/packages/core/src/shared/components/list/list-types/app-instance/cf-app-instances-config.service.ts b/src/frontend/packages/core/src/shared/components/list/list-types/app-instance/cf-app-instances-config.service.ts index 82c3f8b737..ba3a782089 100644 --- a/src/frontend/packages/core/src/shared/components/list/list-types/app-instance/cf-app-instances-config.service.ts +++ b/src/frontend/packages/core/src/shared/components/list/list-types/app-instance/cf-app-instances-config.service.ts @@ -220,7 +220,6 @@ export class CfAppInstancesConfigService implements IListConfig getColumns = () => this.columns; getDataSource = () => this.instancesSource; getMultiFiltersConfigs = () => []; - getFilters = () => []; getInitialised = () => this.initialised$; private createMetricsResults(entityServiceFactory: EntityServiceFactory) { diff --git a/src/frontend/packages/core/src/shared/components/list/list-types/app-variables/cf-app-variables-list-config.service.ts b/src/frontend/packages/core/src/shared/components/list/list-types/app-variables/cf-app-variables-list-config.service.ts index 1e6cc952ae..63c03ed470 100644 --- a/src/frontend/packages/core/src/shared/components/list/list-types/app-variables/cf-app-variables-list-config.service.ts +++ b/src/frontend/packages/core/src/shared/components/list/list-types/app-variables/cf-app-variables-list-config.service.ts @@ -131,7 +131,6 @@ export class CfAppVariablesListConfigService implements IListConfig this.columns; getDataSource = () => this.envVarsDataSource; getMultiFiltersConfigs = () => []; - getFilters = () => []; constructor( private store: Store, diff --git a/src/frontend/packages/core/src/shared/components/list/list-types/app/cf-app-config.service.ts b/src/frontend/packages/core/src/shared/components/list/list-types/app/cf-app-config.service.ts index d311bf322f..91ecc40e12 100644 --- a/src/frontend/packages/core/src/shared/components/list/list-types/app/cf-app-config.service.ts +++ b/src/frontend/packages/core/src/shared/components/list/list-types/app/cf-app-config.service.ts @@ -144,6 +144,5 @@ export class CfAppConfigService extends ListConfig implements IList getColumns = () => this.columns; getDataSource = () => this.appsDataSource; getMultiFiltersConfigs = () => this.multiFilterConfigs; - getFilters = () => []; getInitialised = () => this.initialised$; } diff --git a/src/frontend/packages/core/src/shared/components/list/list-types/base-cf/base-cf-list-config.ts b/src/frontend/packages/core/src/shared/components/list/list-types/base-cf/base-cf-list-config.ts index 97edb4b016..a2156d434d 100644 --- a/src/frontend/packages/core/src/shared/components/list/list-types/base-cf/base-cf-list-config.ts +++ b/src/frontend/packages/core/src/shared/components/list/list-types/base-cf/base-cf-list-config.ts @@ -17,5 +17,4 @@ export class BaseCfListConfig implements IListConfig { getMultiActions = () => []; getSingleActions = () => []; getMultiFiltersConfigs = () => []; - getFilters = () => []; } diff --git a/src/frontend/packages/core/src/shared/components/list/list-types/cf-endpoints/cf-endpoints-list-config.service.ts b/src/frontend/packages/core/src/shared/components/list/list-types/cf-endpoints/cf-endpoints-list-config.service.ts index 91fd7eba14..f351d6db32 100644 --- a/src/frontend/packages/core/src/shared/components/list/list-types/cf-endpoints/cf-endpoints-list-config.service.ts +++ b/src/frontend/packages/core/src/shared/components/list/list-types/cf-endpoints/cf-endpoints-list-config.service.ts @@ -49,6 +49,5 @@ export class CFEndpointsListConfigService implements IListConfig public getMultiActions = () => []; public getSingleActions = () => []; public getMultiFiltersConfigs = () => []; - public getFilters = () => []; public getDataSource = () => this.dataSource; } diff --git a/src/frontend/packages/core/src/shared/components/list/list-types/cf-routes/cf-routes-list-config-base.ts b/src/frontend/packages/core/src/shared/components/list/list-types/cf-routes/cf-routes-list-config-base.ts index 40bcf2a8be..bbc1f804df 100644 --- a/src/frontend/packages/core/src/shared/components/list/list-types/cf-routes/cf-routes-list-config-base.ts +++ b/src/frontend/packages/core/src/shared/components/list/list-types/cf-routes/cf-routes-list-config-base.ts @@ -205,7 +205,6 @@ export abstract class CfRoutesListConfigBase implements IListConfig getColumns = () => this.columns; getMultiFiltersConfigs = () => []; - getFilters = () => []; /** * Creates an instance of CfRoutesListConfigBase. diff --git a/src/frontend/packages/core/src/shared/components/list/list-types/cf-routes/cf-routes-list-config.service.ts b/src/frontend/packages/core/src/shared/components/list/list-types/cf-routes/cf-routes-list-config.service.ts index dfd9b266b0..0a2cce34e2 100644 --- a/src/frontend/packages/core/src/shared/components/list/list-types/cf-routes/cf-routes-list-config.service.ts +++ b/src/frontend/packages/core/src/shared/components/list/list-types/cf-routes/cf-routes-list-config.service.ts @@ -69,7 +69,6 @@ export class CfRoutesListConfigService extends CfRoutesListConfigBase implements createCfOrgSpaceFilterConfig('space', 'Space', cfOrgSpaceService.space), ]; this.getMultiFiltersConfigs = () => multiFilterConfigs; - this.getFilters = () => []; initCfOrgSpaceService(store, cfOrgSpaceService, this.dataSource.masterAction.entityKey, this.dataSource.masterAction.paginationKey).subscribe(); diff --git a/src/frontend/packages/core/src/shared/components/list/list-types/cf-select-users/cf-select-users-list-config.service.ts b/src/frontend/packages/core/src/shared/components/list/list-types/cf-select-users/cf-select-users-list-config.service.ts index 8c2be47670..1717819c40 100644 --- a/src/frontend/packages/core/src/shared/components/list/list-types/cf-select-users/cf-select-users-list-config.service.ts +++ b/src/frontend/packages/core/src/shared/components/list/list-types/cf-select-users/cf-select-users-list-config.service.ts @@ -132,7 +132,6 @@ export class CfSelectUsersListConfigService implements IListConfig>[] => []; getSingleActions = () => []; getMultiFiltersConfigs = () => []; - getFilters = () => []; getDataSource = () => this.dataSource; getInitialised = () => this.initialised; } diff --git a/src/frontend/packages/core/src/shared/components/list/list-types/cf-services/cf-service-instances-list-config.base.ts b/src/frontend/packages/core/src/shared/components/list/list-types/cf-services/cf-service-instances-list-config.base.ts index 3d2d967356..a16964b67b 100644 --- a/src/frontend/packages/core/src/shared/components/list/list-types/cf-services/cf-service-instances-list-config.base.ts +++ b/src/frontend/packages/core/src/shared/components/list/list-types/cf-services/cf-service-instances-list-config.base.ts @@ -193,7 +193,6 @@ export class CfServiceInstancesListConfigBase implements IListConfig []; getSingleActions = () => [this.listActionEdit, this.listActionDetach, this.listActionDelete]; getMultiFiltersConfigs = () => []; - getFilters = () => []; getColumns = () => this.serviceInstanceColumns; getDataSource = () => null; diff --git a/src/frontend/packages/core/src/shared/components/list/list-types/cf-services/cf-services-list-config.service.ts b/src/frontend/packages/core/src/shared/components/list/list-types/cf-services/cf-services-list-config.service.ts index bc171f066d..bbd0719651 100644 --- a/src/frontend/packages/core/src/shared/components/list/list-types/cf-services/cf-services-list-config.service.ts +++ b/src/frontend/packages/core/src/shared/components/list/list-types/cf-services/cf-services-list-config.service.ts @@ -3,18 +3,18 @@ import { Store } from '@ngrx/store'; import { BehaviorSubject, of as observableOf } from 'rxjs'; import { first, map } from 'rxjs/operators'; +import { ListView } from '../../../../../../../store/src/actions/list.actions'; +import { AppState } from '../../../../../../../store/src/app-state'; +import { endpointsRegisteredEntitiesSelector } from '../../../../../../../store/src/selectors/endpoint.selectors'; +import { APIResource } from '../../../../../../../store/src/types/api.types'; +import { EndpointModel } from '../../../../../../../store/src/types/endpoint.types'; import { EndpointsService } from '../../../../../core/endpoints.service'; import { ActiveRouteCfOrgSpace } from '../../../../../features/cloud-foundry/cf-page.types'; import { CfOrgSpaceItem, createCfOrgSpaceFilterConfig } from '../../../../data-services/cf-org-space-service.service'; +import { ITableColumn } from '../../list-table/table.types'; import { IListConfig, IListMultiFilterConfig, ListViewTypes } from '../../list.component.types'; import { CfServiceCardComponent } from './cf-service-card/cf-service-card.component'; import { CfServicesDataSource } from './cf-services-data-source'; -import { ITableColumn } from '../../list-table/table.types'; -import { APIResource } from '../../../../../../../store/src/types/api.types'; -import { ListView } from '../../../../../../../store/src/actions/list.actions'; -import { AppState } from '../../../../../../../store/src/app-state'; -import { endpointsRegisteredEntitiesSelector } from '../../../../../../../store/src/selectors/endpoint.selectors'; -import { EndpointModel } from '../../../../../../../store/src/types/endpoint.types'; @Injectable() export class CfServicesListConfigService implements IListConfig { @@ -84,6 +84,5 @@ export class CfServicesListConfigService implements IListConfig { getMultiActions = () => []; getSingleActions = () => []; getMultiFiltersConfigs = () => this.multiFilterConfigs; - getFilters = () => []; getDataSource = () => this.dataSource; } diff --git a/src/frontend/packages/core/src/shared/components/list/list-types/cf-services/cf-user-service-instances-list-config.ts b/src/frontend/packages/core/src/shared/components/list/list-types/cf-services/cf-user-service-instances-list-config.ts index 80e7f86a52..c0053902e0 100644 --- a/src/frontend/packages/core/src/shared/components/list/list-types/cf-services/cf-user-service-instances-list-config.ts +++ b/src/frontend/packages/core/src/shared/components/list/list-types/cf-services/cf-user-service-instances-list-config.ts @@ -197,7 +197,6 @@ export class CfUserServiceInstancesListConfigBase implements IListConfig []; getSingleActions = () => [this.listActionEdit, this.listActionDetach, this.listActionDelete]; getMultiFiltersConfigs = () => []; - getFilters = () => []; getColumns = () => this.serviceInstanceColumns; getDataSource = () => this.dataSource; diff --git a/src/frontend/packages/core/src/shared/components/list/list-types/cf-space-apps/cf-space-apps-list-config.service.ts b/src/frontend/packages/core/src/shared/components/list/list-types/cf-space-apps/cf-space-apps-list-config.service.ts index 90c7061031..bbb6c860de 100644 --- a/src/frontend/packages/core/src/shared/components/list/list-types/cf-space-apps/cf-space-apps-list-config.service.ts +++ b/src/frontend/packages/core/src/shared/components/list/list-types/cf-space-apps/cf-space-apps-list-config.service.ts @@ -88,6 +88,5 @@ export class CfSpaceAppsListConfigService implements IListConfig { getMultiActions = () => []; getSingleActions = () => []; getMultiFiltersConfigs = () => []; - getFilters = () => []; getDataSource = () => this.dataSource; } diff --git a/src/frontend/packages/core/src/shared/components/list/list-types/cf-spaces/cf-spaces-list-config.service.ts b/src/frontend/packages/core/src/shared/components/list/list-types/cf-spaces/cf-spaces-list-config.service.ts index 463195a0f5..27ff550d79 100644 --- a/src/frontend/packages/core/src/shared/components/list/list-types/cf-spaces/cf-spaces-list-config.service.ts +++ b/src/frontend/packages/core/src/shared/components/list/list-types/cf-spaces/cf-spaces-list-config.service.ts @@ -55,6 +55,5 @@ export class CfSpacesListConfigService implements IListConfig []; getSingleActions = () => []; getMultiFiltersConfigs = () => []; - getFilters = () => []; getDataSource = () => this.dataSource; } diff --git a/src/frontend/packages/core/src/shared/components/list/list-types/cf-users-org-space-roles/cf-users-space-roles-list-config.service.ts b/src/frontend/packages/core/src/shared/components/list/list-types/cf-users-org-space-roles/cf-users-space-roles-list-config.service.ts index d0332b6954..00a45738d6 100644 --- a/src/frontend/packages/core/src/shared/components/list/list-types/cf-users-org-space-roles/cf-users-space-roles-list-config.service.ts +++ b/src/frontend/packages/core/src/shared/components/list/list-types/cf-users-org-space-roles/cf-users-space-roles-list-config.service.ts @@ -2,17 +2,17 @@ import { Store } from '@ngrx/store'; import { BehaviorSubject } from 'rxjs'; import { first } from 'rxjs/operators'; +import { ListView } from '../../../../../../../store/src/actions/list.actions'; +import { AppState } from '../../../../../../../store/src/app-state'; +import { selectUsersRolesRoles } from '../../../../../../../store/src/selectors/users-roles.selector'; +import { APIResource } from '../../../../../../../store/src/types/api.types'; +import { SpaceUserRoleNames } from '../../../../../../../store/src/types/user.types'; import { ISpace } from '../../../../../core/cf-api.types'; import { CurrentUserPermissionsService } from '../../../../../core/current-user-permissions.service'; import { ITableColumn } from '../../list-table/table.types'; import { IListConfig, ListViewTypes } from '../../list.component.types'; import { CfUsersSpaceRolesDataSourceService } from './cf-users-space-roles-data-source.service'; import { TableCellRoleOrgSpaceComponent } from './table-cell-org-space-role/table-cell-org-space-role.component'; -import { APIResource } from '../../../../../../../store/src/types/api.types'; -import { ListView } from '../../../../../../../store/src/actions/list.actions'; -import { SpaceUserRoleNames } from '../../../../../../../store/src/types/user.types'; -import { AppState } from '../../../../../../../store/src/app-state'; -import { selectUsersRolesRoles } from '../../../../../../../store/src/selectors/users-roles.selector'; export class CfUsersSpaceRolesListConfigService implements IListConfig> { @@ -85,7 +85,6 @@ export class CfUsersSpaceRolesListConfigService implements IListConfig []; getSingleActions = () => []; getMultiFiltersConfigs = () => []; - getFilters = () => []; getDataSource = () => this.dataSource; public getInitialised = () => this.initialised; } diff --git a/src/frontend/packages/core/src/shared/components/list/list-types/detach-apps/detach-apps-list-config.service.ts b/src/frontend/packages/core/src/shared/components/list/list-types/detach-apps/detach-apps-list-config.service.ts index 50fc128462..046588991b 100644 --- a/src/frontend/packages/core/src/shared/components/list/list-types/detach-apps/detach-apps-list-config.service.ts +++ b/src/frontend/packages/core/src/shared/components/list/list-types/detach-apps/detach-apps-list-config.service.ts @@ -3,13 +3,13 @@ import { Injectable } from '@angular/core'; import { ActivatedRoute } from '@angular/router'; import { Store } from '@ngrx/store'; +import { ListView } from '../../../../../../../store/src/actions/list.actions'; +import { AppState } from '../../../../../../../store/src/app-state'; +import { APIResource } from '../../../../../../../store/src/types/api.types'; import { IServiceBinding } from '../../../../../core/cf-api-svc.types'; import { ITableColumn } from '../../list-table/table.types'; import { IListConfig, ListViewTypes } from '../../list.component.types'; import { DetachAppsDataSource } from './detach-apps-data-source'; -import { APIResource } from '../../../../../../../store/src/types/api.types'; -import { ListView } from '../../../../../../../store/src/actions/list.actions'; -import { AppState } from '../../../../../../../store/src/app-state'; @Injectable() export class DetachAppsListConfigService implements IListConfig { @@ -57,6 +57,5 @@ export class DetachAppsListConfigService implements IListConfig { getMultiActions = () => []; getSingleActions = () => []; getMultiFiltersConfigs = () => []; - getFilters = () => []; getDataSource = () => this.dataSource; } diff --git a/src/frontend/packages/core/src/shared/components/list/list-types/endpoint/endpoints-list-config.service.ts b/src/frontend/packages/core/src/shared/components/list/list-types/endpoint/endpoints-list-config.service.ts index e7b3158731..88ea39eef8 100644 --- a/src/frontend/packages/core/src/shared/components/list/list-types/endpoint/endpoints-list-config.service.ts +++ b/src/frontend/packages/core/src/shared/components/list/list-types/endpoint/endpoints-list-config.service.ts @@ -134,5 +134,4 @@ export class EndpointsListConfigService implements IListConfig { public getColumns = () => this.columns; public getDataSource = () => this.dataSource; public getMultiFiltersConfigs = () => []; - public getFilters = () => []; } diff --git a/src/frontend/packages/core/src/shared/components/list/list-types/github-commits/github-commits-list-config-base.service.ts b/src/frontend/packages/core/src/shared/components/list/list-types/github-commits/github-commits-list-config-base.service.ts index 8684e94c7d..7192124ef3 100644 --- a/src/frontend/packages/core/src/shared/components/list/list-types/github-commits/github-commits-list-config-base.service.ts +++ b/src/frontend/packages/core/src/shared/components/list/list-types/github-commits/github-commits-list-config-base.service.ts @@ -3,13 +3,13 @@ import { Injectable } from '@angular/core'; import { Store } from '@ngrx/store'; import { BehaviorSubject } from 'rxjs'; +import { AppState } from '../../../../../../../store/src/app-state'; +import { APIResource } from '../../../../../../../store/src/types/api.types'; +import { GitCommit } from '../../../../../../../store/src/types/git.types'; import { ITableColumn } from '../../list-table/table.types'; import { IListConfig, ListViewTypes } from '../../list.component.types'; import { GithubCommitsDataSource } from './github-commits-data-source'; import { TableCellCommitAuthorComponent } from './table-cell-commit-author/table-cell-commit-author.component'; -import { APIResource } from '../../../../../../../store/src/types/api.types'; -import { AppState } from '../../../../../../../store/src/app-state'; -import { GitCommit } from '../../../../../../../store/src/types/git.types'; @Injectable() export abstract class GithubCommitsListConfigServiceBase implements IListConfig> { @@ -92,7 +92,6 @@ export abstract class GithubCommitsListConfigServiceBase implements IListConfig< public getMultiActions = () => []; public getSingleActions = () => []; public getMultiFiltersConfigs = () => []; - public getFilters = () => []; public getDataSource = () => this.dataSource; public getInitialised = () => this.initialised; } diff --git a/src/frontend/packages/core/src/shared/components/list/list-types/service-plans/service-plans-list-config.service.ts b/src/frontend/packages/core/src/shared/components/list/list-types/service-plans/service-plans-list-config.service.ts index 729fb7cbd1..5892db9199 100644 --- a/src/frontend/packages/core/src/shared/components/list/list-types/service-plans/service-plans-list-config.service.ts +++ b/src/frontend/packages/core/src/shared/components/list/list-types/service-plans/service-plans-list-config.service.ts @@ -107,7 +107,6 @@ export class ServicePlansListConfigService implements IListConfig []; getSingleActions = () => []; getMultiFiltersConfigs = () => []; - getFilters = () => []; getColumns = () => this.columns; getDataSource = () => this.dataSource; } diff --git a/src/frontend/packages/core/src/shared/components/list/list.component.ts b/src/frontend/packages/core/src/shared/components/list/list.component.ts index 2d1e26df65..a06173f2a2 100644 --- a/src/frontend/packages/core/src/shared/components/list/list.component.ts +++ b/src/frontend/packages/core/src/shared/components/list/list.component.ts @@ -49,7 +49,7 @@ import { ListView, SetListViewAction, } from '../../../../../store/src/actions/list.actions'; -import { SetPage, SetClientFilterKey } from '../../../../../store/src/actions/pagination.actions'; +import { SetClientFilterKey, SetPage } from '../../../../../store/src/actions/pagination.actions'; import { AppState } from '../../../../../store/src/app-state'; import { entityFactory } from '../../../../../store/src/helpers/entity-factory'; import { ActionState } from '../../../../../store/src/reducers/api-request-reducer/types'; @@ -400,7 +400,7 @@ export class ListComponent implements OnInit, OnChanges, OnDestroy, AfterView this.headerSort.direction = sort.direction; })); - this.filterColumns = this.config.getFilters(); + this.filterColumns = this.config.getFilters ? this.config.getFilters() : []; const filterStoreToWidget = this.paginationController.filter$.pipe(tap((paginationFilter: ListFilter) => { this.filterString = paginationFilter.string; diff --git a/src/frontend/packages/core/src/shared/components/list/list.component.types.ts b/src/frontend/packages/core/src/shared/components/list/list.component.types.ts index f7fa22a8d9..f2faed44aa 100644 --- a/src/frontend/packages/core/src/shared/components/list/list.component.types.ts +++ b/src/frontend/packages/core/src/shared/components/list/list.component.types.ts @@ -28,11 +28,11 @@ export interface IListConfig { /** * List of actions that are presented as individual buttons when one or more rows are selected. For example `Delete` of selected rows. */ - getMultiActions: (schemaKey: string) => IMultiListAction[]; + getMultiActions: () => IMultiListAction[]; /** * List of actions that are presented in a mat-menu for an individual entity. For example `unmap` an application route */ - getSingleActions: (schemaKey: string) => IListAction[]; + getSingleActions: () => IListAction[]; /** * Collection of column definitions to show when the list is in table mode */ @@ -52,7 +52,7 @@ export interface IListConfig { * When the filter is selected in a dropdown the filterString filters results using the chosen field. * Combined with a transformEntities DataFunction that consumes the filterKey. */ - getFilters: () => IListFilter[]; + getFilters?: () => IListFilter[]; /** * Fetch an observable that will emit once the underlying config components have been created. For instance if the data source requires * something from the store which requires an async call From 65c983f7dcb4c5dc8f7e78fa0d912ff3e96db5e9 Mon Sep 17 00:00:00 2001 From: Richard Cox Date: Fri, 11 Oct 2019 16:15:53 +0100 Subject: [PATCH 14/15] Update following design doc - https://xd.adobe.com/spec/dcd4203c-d334-462e-7921-ea6c3ef41151-aae5/screen/a2ea0108-1ae5-418f-8153-bc2a1fe985d5/Filter/ - Include optional labels list component - Fix issue where search term was not capitalised - Improve typing --- .../custom/kubernetes/kubernetes.module.ts | 27 ++++++---- .../kubernetes-labels-cell.component.html | 1 + .../kubernetes-labels-cell.component.scss | 0 .../kubernetes-labels-cell.component.spec.ts | 45 ++++++++++++++++ .../kubernetes-labels-cell.component.ts | 26 ++++++++++ .../condition-cell.component.ts | 17 ------ .../kubernetes-node-ips.component.html | 1 + .../kubernetes-node-ips.component.scss | 5 ++ .../kubernetes-node-ips.component.spec.ts | 46 ++++++++++++++++ .../kubernetes-node-ips.component.ts | 26 ++++++++++ .../kubernetes-node-labels.component.html | 1 + .../kubernetes-node-labels.component.scss | 5 ++ .../kubernetes-node-labels.component.spec.ts | 46 ++++++++++++++++ .../kubernetes-node-labels.component.ts | 25 +++++++++ .../kubernetes-node-link.component.spec.ts | 8 +-- .../kubernetes-node-link.component.ts | 5 +- .../kubernetes-node-pressure.component.html | 9 ++++ .../kubernetes-node-pressure.component.scss | 12 +++++ ...kubernetes-node-pressure.component.spec.ts | 46 ++++++++++++++++ ...ernetes-node-pressure.component.theme.scss | 13 +++++ .../kubernetes-node-pressure.component.ts | 26 ++++++++++ .../kubernetes-node-condition.component.ts | 11 ++-- .../kubernetes-nodes-list-config.service.ts | 52 +++++++++++-------- .../app/custom/kubernetes/store/kube.types.ts | 27 +++++++--- 24 files changed, 409 insertions(+), 71 deletions(-) create mode 100644 custom-src/frontend/app/custom/kubernetes/list-types/kubernetes-labels-cell/kubernetes-labels-cell.component.html create mode 100644 custom-src/frontend/app/custom/kubernetes/list-types/kubernetes-labels-cell/kubernetes-labels-cell.component.scss create mode 100644 custom-src/frontend/app/custom/kubernetes/list-types/kubernetes-labels-cell/kubernetes-labels-cell.component.spec.ts create mode 100644 custom-src/frontend/app/custom/kubernetes/list-types/kubernetes-labels-cell/kubernetes-labels-cell.component.ts create mode 100644 custom-src/frontend/app/custom/kubernetes/list-types/kubernetes-nodes/kubernetes-node-ips/kubernetes-node-ips.component.html create mode 100644 custom-src/frontend/app/custom/kubernetes/list-types/kubernetes-nodes/kubernetes-node-ips/kubernetes-node-ips.component.scss create mode 100644 custom-src/frontend/app/custom/kubernetes/list-types/kubernetes-nodes/kubernetes-node-ips/kubernetes-node-ips.component.spec.ts create mode 100644 custom-src/frontend/app/custom/kubernetes/list-types/kubernetes-nodes/kubernetes-node-ips/kubernetes-node-ips.component.ts create mode 100644 custom-src/frontend/app/custom/kubernetes/list-types/kubernetes-nodes/kubernetes-node-labels/kubernetes-node-labels.component.html create mode 100644 custom-src/frontend/app/custom/kubernetes/list-types/kubernetes-nodes/kubernetes-node-labels/kubernetes-node-labels.component.scss create mode 100644 custom-src/frontend/app/custom/kubernetes/list-types/kubernetes-nodes/kubernetes-node-labels/kubernetes-node-labels.component.spec.ts create mode 100644 custom-src/frontend/app/custom/kubernetes/list-types/kubernetes-nodes/kubernetes-node-labels/kubernetes-node-labels.component.ts create mode 100644 custom-src/frontend/app/custom/kubernetes/list-types/kubernetes-nodes/kubernetes-node-pressure/kubernetes-node-pressure.component.html create mode 100644 custom-src/frontend/app/custom/kubernetes/list-types/kubernetes-nodes/kubernetes-node-pressure/kubernetes-node-pressure.component.scss create mode 100644 custom-src/frontend/app/custom/kubernetes/list-types/kubernetes-nodes/kubernetes-node-pressure/kubernetes-node-pressure.component.spec.ts create mode 100644 custom-src/frontend/app/custom/kubernetes/list-types/kubernetes-nodes/kubernetes-node-pressure/kubernetes-node-pressure.component.theme.scss create mode 100644 custom-src/frontend/app/custom/kubernetes/list-types/kubernetes-nodes/kubernetes-node-pressure/kubernetes-node-pressure.component.ts diff --git a/custom-src/frontend/app/custom/kubernetes/kubernetes.module.ts b/custom-src/frontend/app/custom/kubernetes/kubernetes.module.ts index 6cf7f688ec..e9f7dbfad8 100644 --- a/custom-src/frontend/app/custom/kubernetes/kubernetes.module.ts +++ b/custom-src/frontend/app/custom/kubernetes/kubernetes.module.ts @@ -40,23 +40,27 @@ import { AppLinkComponent } from './list-types/kubernetes-apps/app-link/app-link import { KubeAppcreatedDateComponent, } from './list-types/kubernetes-apps/kube-appcreated-date/kube-appcreated-date.component'; +import { KubernetesLabelsCellComponent } from './list-types/kubernetes-labels-cell/kubernetes-labels-cell.component'; import { KubeNamespacePodCountComponent, } from './list-types/kubernetes-namespaces/kube-namespace-pod-count/kube-namespace-pod-count.component'; import { KubernetesNamespaceLinkComponent, } from './list-types/kubernetes-namespaces/kubernetes-namespace-link/kubernetes-namespace-link.component'; -import { - ConditionCellComponent, - InverseConditionCellComponent, - SubtleConditionCellComponent, -} from './list-types/kubernetes-nodes/condition-cell/condition-cell.component'; +import { ConditionCellComponent } from './list-types/kubernetes-nodes/condition-cell/condition-cell.component'; import { KubernetesNodeCapacityComponent, } from './list-types/kubernetes-nodes/kubernetes-node-capacity/kubernetes-node-capacity.component'; +import { KubernetesNodeIpsComponent } from './list-types/kubernetes-nodes/kubernetes-node-ips/kubernetes-node-ips.component'; +import { + KubernetesNodeLabelsComponent, +} from './list-types/kubernetes-nodes/kubernetes-node-labels/kubernetes-node-labels.component'; import { KubernetesNodeLinkComponent, } from './list-types/kubernetes-nodes/kubernetes-node-link/kubernetes-node-link.component'; +import { + KubernetesNodePressureComponent, +} from './list-types/kubernetes-nodes/kubernetes-node-pressure/kubernetes-node-pressure.component'; import { KubernetesNodeConditionCardComponent, } from './list-types/kubernetes-nodes/kubernetes-node-summary/kubernetes-node-condition-card/kubernetes-node-condition-card.component'; @@ -91,6 +95,7 @@ import { KubernetesPodsTabComponent } from './tabs/kubernetes-pods-tab/kubernete import { KubernetesSummaryTabComponent } from './tabs/kubernetes-summary-tab/kubernetes-summary.component'; + /* tslint:enable */ @NgModule({ @@ -120,6 +125,10 @@ import { KubernetesSummaryTabComponent } from './tabs/kubernetes-summary-tab/kub HelmReleaseSummaryCardComponent, PodMetricsComponent, KubernetesNodeLinkComponent, + KubernetesNodeIpsComponent, + KubernetesNodeLabelsComponent, + KubernetesNodePressureComponent, + KubernetesLabelsCellComponent, KubernetesNodeComponent, KubernetesNodeSummaryComponent, KubernetesNodePodsComponent, @@ -134,8 +143,6 @@ import { KubernetesSummaryTabComponent } from './tabs/kubernetes-summary-tab/kub KubernetesNodeMetricStatsCardComponent, KubernetesNodeSimpleMetricComponent, ConditionCellComponent, - InverseConditionCellComponent, - SubtleConditionCellComponent, KubernetesNamespaceLinkComponent, KubernetesNamespaceComponent, KubernetesNamespacePodsComponent, @@ -161,9 +168,11 @@ import { KubernetesSummaryTabComponent } from './tabs/kubernetes-summary-tab/kub KubernetesPodTagsComponent, AppLinkComponent, KubernetesNodeLinkComponent, + KubernetesNodeIpsComponent, + KubernetesNodeLabelsComponent, + KubernetesNodePressureComponent, + KubernetesLabelsCellComponent, ConditionCellComponent, - InverseConditionCellComponent, - SubtleConditionCellComponent, KubernetesNamespaceLinkComponent, KubeAppcreatedDateComponent, KubeNamespacePodCountComponent, diff --git a/custom-src/frontend/app/custom/kubernetes/list-types/kubernetes-labels-cell/kubernetes-labels-cell.component.html b/custom-src/frontend/app/custom/kubernetes/list-types/kubernetes-labels-cell/kubernetes-labels-cell.component.html new file mode 100644 index 0000000000..ba47496e44 --- /dev/null +++ b/custom-src/frontend/app/custom/kubernetes/list-types/kubernetes-labels-cell/kubernetes-labels-cell.component.html @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/custom-src/frontend/app/custom/kubernetes/list-types/kubernetes-labels-cell/kubernetes-labels-cell.component.scss b/custom-src/frontend/app/custom/kubernetes/list-types/kubernetes-labels-cell/kubernetes-labels-cell.component.scss new file mode 100644 index 0000000000..e69de29bb2 diff --git a/custom-src/frontend/app/custom/kubernetes/list-types/kubernetes-labels-cell/kubernetes-labels-cell.component.spec.ts b/custom-src/frontend/app/custom/kubernetes/list-types/kubernetes-labels-cell/kubernetes-labels-cell.component.spec.ts new file mode 100644 index 0000000000..4c332d1f29 --- /dev/null +++ b/custom-src/frontend/app/custom/kubernetes/list-types/kubernetes-labels-cell/kubernetes-labels-cell.component.spec.ts @@ -0,0 +1,45 @@ +import { async, ComponentFixture, TestBed } from '@angular/core/testing'; + +import { KubernetesStatus } from '../../../../../../../../../custom-src/frontend/app/custom/kubernetes/store/kube.types'; +import { BaseTestModules } from '../../../../../test-framework/core-test.helper'; +import { KubernetesLabelsCellComponent } from './kubernetes-labels-cell.component'; + +describe('KubernetesLabelsCellComponent', () => { + let component: KubernetesLabelsCellComponent; + let fixture: ComponentFixture; + + beforeEach(async(() => { + TestBed.configureTestingModule({ + declarations: [KubernetesLabelsCellComponent], + imports: BaseTestModules + }) + .compileComponents(); + })); + + beforeEach(() => { + fixture = TestBed.createComponent(KubernetesLabelsCellComponent); + component = fixture.componentInstance; + component.row = { + metadata: { + labels: {}, + namespace: 'test', + name: 'test', + uid: 'test' + }, + status: { + phase: KubernetesStatus.ACTIVE + }, + spec: { + containers: [], + nodeName: 'test', + schedulerName: 'test', + initContainers: [] + } + }; + fixture.detectChanges(); + }); + + it('should create', () => { + expect(component).toBeTruthy(); + }); +}); diff --git a/custom-src/frontend/app/custom/kubernetes/list-types/kubernetes-labels-cell/kubernetes-labels-cell.component.ts b/custom-src/frontend/app/custom/kubernetes/list-types/kubernetes-labels-cell/kubernetes-labels-cell.component.ts new file mode 100644 index 0000000000..46a6891b28 --- /dev/null +++ b/custom-src/frontend/app/custom/kubernetes/list-types/kubernetes-labels-cell/kubernetes-labels-cell.component.ts @@ -0,0 +1,26 @@ +import { Component, OnInit } from '@angular/core'; + +import { AppChip } from '../../../../shared/components/chips/chips.component'; +import { TableCellCustom } from '../../../../shared/components/list/list.types'; +import { KubeAPIResource } from '../../store/kube.types'; + + +@Component({ + selector: 'app-kubernetes-labels-cell', + templateUrl: './kubernetes-labels-cell.component.html', + styleUrls: ['./kubernetes-labels-cell.component.scss'] +}) +export class KubernetesLabelsCellComponent extends TableCellCustom implements OnInit { + + chipsConfig: AppChip[]; + + constructor() { + super(); + } + + ngOnInit() { + this.chipsConfig = Object.entries(this.row.metadata.labels).map(([key, value]) => ({ + value: `${key}:${value}` + })); + } +} diff --git a/custom-src/frontend/app/custom/kubernetes/list-types/kubernetes-nodes/condition-cell/condition-cell.component.ts b/custom-src/frontend/app/custom/kubernetes/list-types/kubernetes-nodes/condition-cell/condition-cell.component.ts index 4e90794278..55bb13dee8 100644 --- a/custom-src/frontend/app/custom/kubernetes/list-types/kubernetes-nodes/condition-cell/condition-cell.component.ts +++ b/custom-src/frontend/app/custom/kubernetes/list-types/kubernetes-nodes/condition-cell/condition-cell.component.ts @@ -35,20 +35,3 @@ export class ConditionCellComponent extends TableCellCustom impl } } - -export class SubtleConditionCellComponent extends ConditionCellComponent { - - constructor() { - super(); - this.subtle = true; - } -} - - -export class InverseConditionCellComponent extends ConditionCellComponent { - - constructor() { - super(); - this.inverse = true; - } -} diff --git a/custom-src/frontend/app/custom/kubernetes/list-types/kubernetes-nodes/kubernetes-node-ips/kubernetes-node-ips.component.html b/custom-src/frontend/app/custom/kubernetes/list-types/kubernetes-nodes/kubernetes-node-ips/kubernetes-node-ips.component.html new file mode 100644 index 0000000000..fb1c936c0a --- /dev/null +++ b/custom-src/frontend/app/custom/kubernetes/list-types/kubernetes-nodes/kubernetes-node-ips/kubernetes-node-ips.component.html @@ -0,0 +1 @@ +language \ No newline at end of file diff --git a/custom-src/frontend/app/custom/kubernetes/list-types/kubernetes-nodes/kubernetes-node-ips/kubernetes-node-ips.component.scss b/custom-src/frontend/app/custom/kubernetes/list-types/kubernetes-nodes/kubernetes-node-ips/kubernetes-node-ips.component.scss new file mode 100644 index 0000000000..03d64068f2 --- /dev/null +++ b/custom-src/frontend/app/custom/kubernetes/list-types/kubernetes-nodes/kubernetes-node-ips/kubernetes-node-ips.component.scss @@ -0,0 +1,5 @@ +mat-icon { + font-size: 20px; + height: 20px; + width: 20px; +} diff --git a/custom-src/frontend/app/custom/kubernetes/list-types/kubernetes-nodes/kubernetes-node-ips/kubernetes-node-ips.component.spec.ts b/custom-src/frontend/app/custom/kubernetes/list-types/kubernetes-nodes/kubernetes-node-ips/kubernetes-node-ips.component.spec.ts new file mode 100644 index 0000000000..807f5cb307 --- /dev/null +++ b/custom-src/frontend/app/custom/kubernetes/list-types/kubernetes-nodes/kubernetes-node-ips/kubernetes-node-ips.component.spec.ts @@ -0,0 +1,46 @@ +import { async, ComponentFixture, TestBed } from '@angular/core/testing'; + +import { BaseTestModules } from '../../../../../../test-framework/core-test.helper'; +import { KubernetesNodeIpsComponent } from './kubernetes-node-ips.component'; + +describe('KubernetesNodeIpsComponent', () => { + let component: KubernetesNodeIpsComponent; + let fixture: ComponentFixture; + + beforeEach(async(() => { + TestBed.configureTestingModule({ + declarations: [KubernetesNodeIpsComponent], + imports: BaseTestModules + }) + .compileComponents(); + })); + + beforeEach(() => { + fixture = TestBed.createComponent(KubernetesNodeIpsComponent); + component = fixture.componentInstance; + component.row = { + metadata: { + labels: {}, + namespace: 'test', + name: 'test', + uid: 'test' + }, + status: { + conditions: [], + addresses: [], + images: [] + }, + spec: { + containers: [], + nodeName: 'test', + schedulerName: 'test', + initContainers: [] + } + }; + fixture.detectChanges(); + }); + + it('should create', () => { + expect(component).toBeTruthy(); + }); +}); diff --git a/custom-src/frontend/app/custom/kubernetes/list-types/kubernetes-nodes/kubernetes-node-ips/kubernetes-node-ips.component.ts b/custom-src/frontend/app/custom/kubernetes/list-types/kubernetes-nodes/kubernetes-node-ips/kubernetes-node-ips.component.ts new file mode 100644 index 0000000000..456cb420cc --- /dev/null +++ b/custom-src/frontend/app/custom/kubernetes/list-types/kubernetes-nodes/kubernetes-node-ips/kubernetes-node-ips.component.ts @@ -0,0 +1,26 @@ +import { Component, OnInit } from '@angular/core'; + +import { TableCellCustom } from '../../../../../shared/components/list/list.types'; +import { KubernetesAddressExternal, KubernetesAddressInternal, KubernetesNode } from '../../../store/kube.types'; + +@Component({ + selector: 'app-kubernetes-node-ips', + templateUrl: './kubernetes-node-ips.component.html', + styleUrls: ['./kubernetes-node-ips.component.scss'] +}) +export class KubernetesNodeIpsComponent extends TableCellCustom implements OnInit { + + tooltip: string; + + constructor() { + super(); + } + + ngOnInit() { + this.tooltip = this.row.status.addresses + .filter(address => address.type === KubernetesAddressInternal || address.type === KubernetesAddressExternal) + .map(address => address.address) + .join(', '); + } + +} diff --git a/custom-src/frontend/app/custom/kubernetes/list-types/kubernetes-nodes/kubernetes-node-labels/kubernetes-node-labels.component.html b/custom-src/frontend/app/custom/kubernetes/list-types/kubernetes-nodes/kubernetes-node-labels/kubernetes-node-labels.component.html new file mode 100644 index 0000000000..e50abec150 --- /dev/null +++ b/custom-src/frontend/app/custom/kubernetes/list-types/kubernetes-nodes/kubernetes-node-labels/kubernetes-node-labels.component.html @@ -0,0 +1 @@ +info \ No newline at end of file diff --git a/custom-src/frontend/app/custom/kubernetes/list-types/kubernetes-nodes/kubernetes-node-labels/kubernetes-node-labels.component.scss b/custom-src/frontend/app/custom/kubernetes/list-types/kubernetes-nodes/kubernetes-node-labels/kubernetes-node-labels.component.scss new file mode 100644 index 0000000000..03d64068f2 --- /dev/null +++ b/custom-src/frontend/app/custom/kubernetes/list-types/kubernetes-nodes/kubernetes-node-labels/kubernetes-node-labels.component.scss @@ -0,0 +1,5 @@ +mat-icon { + font-size: 20px; + height: 20px; + width: 20px; +} diff --git a/custom-src/frontend/app/custom/kubernetes/list-types/kubernetes-nodes/kubernetes-node-labels/kubernetes-node-labels.component.spec.ts b/custom-src/frontend/app/custom/kubernetes/list-types/kubernetes-nodes/kubernetes-node-labels/kubernetes-node-labels.component.spec.ts new file mode 100644 index 0000000000..3ca174e16f --- /dev/null +++ b/custom-src/frontend/app/custom/kubernetes/list-types/kubernetes-nodes/kubernetes-node-labels/kubernetes-node-labels.component.spec.ts @@ -0,0 +1,46 @@ +import { async, ComponentFixture, TestBed } from '@angular/core/testing'; + +import { BaseTestModules } from '../../../../../../test-framework/core-test.helper'; +import { KubernetesNodeLabelsComponent } from './kubernetes-node-labels.component'; + +describe('KubernetesNodeLabelsComponent', () => { + let component: KubernetesNodeLabelsComponent; + let fixture: ComponentFixture; + + beforeEach(async(() => { + TestBed.configureTestingModule({ + declarations: [KubernetesNodeLabelsComponent], + imports: BaseTestModules + }) + .compileComponents(); + })); + + beforeEach(() => { + fixture = TestBed.createComponent(KubernetesNodeLabelsComponent); + component = fixture.componentInstance; + component.row = { + metadata: { + labels: {}, + namespace: 'test', + name: 'test', + uid: 'test' + }, + status: { + conditions: [], + addresses: [], + images: [] + }, + spec: { + containers: [], + nodeName: 'test', + schedulerName: 'test', + initContainers: [] + } + }; + fixture.detectChanges(); + }); + + it('should create', () => { + expect(component).toBeTruthy(); + }); +}); diff --git a/custom-src/frontend/app/custom/kubernetes/list-types/kubernetes-nodes/kubernetes-node-labels/kubernetes-node-labels.component.ts b/custom-src/frontend/app/custom/kubernetes/list-types/kubernetes-nodes/kubernetes-node-labels/kubernetes-node-labels.component.ts new file mode 100644 index 0000000000..2ee563db06 --- /dev/null +++ b/custom-src/frontend/app/custom/kubernetes/list-types/kubernetes-nodes/kubernetes-node-labels/kubernetes-node-labels.component.ts @@ -0,0 +1,25 @@ +import { Component, OnInit } from '@angular/core'; + +import { TableCellCustom } from '../../../../../shared/components/list/list.types'; +import { KubernetesNode } from '../../../store/kube.types'; + +@Component({ + selector: 'app-kubernetes-node-labels', + templateUrl: './kubernetes-node-labels.component.html', + styleUrls: ['./kubernetes-node-labels.component.scss'] +}) +export class KubernetesNodeLabelsComponent extends TableCellCustom implements OnInit { + + labels: string; + + constructor() { + super(); + } + + ngOnInit() { + this.labels = Object.entries(this.row.metadata.labels) + .map(([key, value]) => `${key}:${value}`) + .join(', '); + } + +} diff --git a/custom-src/frontend/app/custom/kubernetes/list-types/kubernetes-nodes/kubernetes-node-link/kubernetes-node-link.component.spec.ts b/custom-src/frontend/app/custom/kubernetes/list-types/kubernetes-nodes/kubernetes-node-link/kubernetes-node-link.component.spec.ts index d84951cb45..4a6acb5d3e 100644 --- a/custom-src/frontend/app/custom/kubernetes/list-types/kubernetes-nodes/kubernetes-node-link/kubernetes-node-link.component.spec.ts +++ b/custom-src/frontend/app/custom/kubernetes/list-types/kubernetes-nodes/kubernetes-node-link/kubernetes-node-link.component.spec.ts @@ -1,13 +1,13 @@ import { async, ComponentFixture, TestBed } from '@angular/core/testing'; -import { KubernetesNodeLinkComponent } from './kubernetes-node-link.component'; import { BaseKubeGuid } from '../../../kubernetes-page.types'; -import { KubernetesEndpointService } from '../../../services/kubernetes-endpoint.service'; import { KubernetesBaseTestModules } from '../../../kubernetes.testing.module'; +import { KubernetesEndpointService } from '../../../services/kubernetes-endpoint.service'; +import { KubernetesNodeLinkComponent } from './kubernetes-node-link.component'; describe('KubernetesNodeLinkComponent', () => { - let component: KubernetesNodeLinkComponent; - let fixture: ComponentFixture>; + let component: KubernetesNodeLinkComponent; + let fixture: ComponentFixture; beforeEach(async(() => { TestBed.configureTestingModule({ diff --git a/custom-src/frontend/app/custom/kubernetes/list-types/kubernetes-nodes/kubernetes-node-link/kubernetes-node-link.component.ts b/custom-src/frontend/app/custom/kubernetes/list-types/kubernetes-nodes/kubernetes-node-link/kubernetes-node-link.component.ts index 2d6f5059ca..21d7d00432 100644 --- a/custom-src/frontend/app/custom/kubernetes/list-types/kubernetes-nodes/kubernetes-node-link/kubernetes-node-link.component.ts +++ b/custom-src/frontend/app/custom/kubernetes/list-types/kubernetes-nodes/kubernetes-node-link/kubernetes-node-link.component.ts @@ -1,6 +1,7 @@ import { Component, OnInit } from '@angular/core'; -import { KubernetesEndpointService } from '../../../services/kubernetes-endpoint.service'; + import { TableCellCustom } from '../../../../../shared/components/list/list.types'; +import { KubernetesEndpointService } from '../../../services/kubernetes-endpoint.service'; import { KubernetesNode } from '../../../store/kube.types'; @Component({ @@ -8,7 +9,7 @@ import { KubernetesNode } from '../../../store/kube.types'; templateUrl: './kubernetes-node-link.component.html', styleUrls: ['./kubernetes-node-link.component.scss'] }) -export class KubernetesNodeLinkComponent extends TableCellCustom implements OnInit { +export class KubernetesNodeLinkComponent extends TableCellCustom implements OnInit { public nodeLink; constructor( diff --git a/custom-src/frontend/app/custom/kubernetes/list-types/kubernetes-nodes/kubernetes-node-pressure/kubernetes-node-pressure.component.html b/custom-src/frontend/app/custom/kubernetes/list-types/kubernetes-nodes/kubernetes-node-pressure/kubernetes-node-pressure.component.html new file mode 100644 index 0000000000..aeafa64566 --- /dev/null +++ b/custom-src/frontend/app/custom/kubernetes/list-types/kubernetes-nodes/kubernetes-node-pressure/kubernetes-node-pressure.component.html @@ -0,0 +1,9 @@ + +
+ info + {{ error }} +
+
+ + None + \ No newline at end of file diff --git a/custom-src/frontend/app/custom/kubernetes/list-types/kubernetes-nodes/kubernetes-node-pressure/kubernetes-node-pressure.component.scss b/custom-src/frontend/app/custom/kubernetes/list-types/kubernetes-nodes/kubernetes-node-pressure/kubernetes-node-pressure.component.scss new file mode 100644 index 0000000000..38738ff61b --- /dev/null +++ b/custom-src/frontend/app/custom/kubernetes/list-types/kubernetes-nodes/kubernetes-node-pressure/kubernetes-node-pressure.component.scss @@ -0,0 +1,12 @@ +.pressure { + align-items: center; + display: flex; + + &__icon { + color: red; + font-size: 20px; + height: 20px; + margin-right: 4px; + width: 20px; + } +} diff --git a/custom-src/frontend/app/custom/kubernetes/list-types/kubernetes-nodes/kubernetes-node-pressure/kubernetes-node-pressure.component.spec.ts b/custom-src/frontend/app/custom/kubernetes/list-types/kubernetes-nodes/kubernetes-node-pressure/kubernetes-node-pressure.component.spec.ts new file mode 100644 index 0000000000..4f543f9596 --- /dev/null +++ b/custom-src/frontend/app/custom/kubernetes/list-types/kubernetes-nodes/kubernetes-node-pressure/kubernetes-node-pressure.component.spec.ts @@ -0,0 +1,46 @@ +import { async, ComponentFixture, TestBed } from '@angular/core/testing'; + +import { BaseTestModules } from '../../../../../../test-framework/core-test.helper'; +import { KubernetesNodePressureComponent } from './kubernetes-node-pressure.component'; + +describe('KubernetesNodePressureComponent', () => { + let component: KubernetesNodePressureComponent; + let fixture: ComponentFixture; + + beforeEach(async(() => { + TestBed.configureTestingModule({ + declarations: [KubernetesNodePressureComponent], + imports: BaseTestModules + }) + .compileComponents(); + })); + + beforeEach(() => { + fixture = TestBed.createComponent(KubernetesNodePressureComponent); + component = fixture.componentInstance; + component.row = { + metadata: { + labels: {}, + namespace: 'test', + name: 'test', + uid: 'test' + }, + status: { + conditions: [], + addresses: [], + images: [] + }, + spec: { + containers: [], + nodeName: 'test', + schedulerName: 'test', + initContainers: [] + } + }; + fixture.detectChanges(); + }); + + it('should create', () => { + expect(component).toBeTruthy(); + }); +}); diff --git a/custom-src/frontend/app/custom/kubernetes/list-types/kubernetes-nodes/kubernetes-node-pressure/kubernetes-node-pressure.component.theme.scss b/custom-src/frontend/app/custom/kubernetes/list-types/kubernetes-nodes/kubernetes-node-pressure/kubernetes-node-pressure.component.theme.scss new file mode 100644 index 0000000000..5508403ef1 --- /dev/null +++ b/custom-src/frontend/app/custom/kubernetes/list-types/kubernetes-nodes/kubernetes-node-pressure/kubernetes-node-pressure.component.theme.scss @@ -0,0 +1,13 @@ + + +// Not currently used but should be - NJ +@import '~@angular/material/theming'; +@mixin app-kubernetes-node-pressure($theme, $app-theme) { + $status: map-get($app-theme, status); + .pressure { + // color: map-get($status, danger); + &__icon { + color: map-get($status, danger); + } + } +} diff --git a/custom-src/frontend/app/custom/kubernetes/list-types/kubernetes-nodes/kubernetes-node-pressure/kubernetes-node-pressure.component.ts b/custom-src/frontend/app/custom/kubernetes/list-types/kubernetes-nodes/kubernetes-node-pressure/kubernetes-node-pressure.component.ts new file mode 100644 index 0000000000..09d1b10b64 --- /dev/null +++ b/custom-src/frontend/app/custom/kubernetes/list-types/kubernetes-nodes/kubernetes-node-pressure/kubernetes-node-pressure.component.ts @@ -0,0 +1,26 @@ +import { Component, OnInit } from '@angular/core'; + +import { TableCellCustom } from '../../../../../shared/components/list/list.types'; +import { ConditionType, ConditionTypeLabels, KubernetesNode } from '../../../store/kube.types'; + +@Component({ + selector: 'app-kubernetes-node-pressure', + templateUrl: './kubernetes-node-pressure.component.html', + styleUrls: ['./kubernetes-node-pressure.component.scss'] +}) +export class KubernetesNodePressureComponent extends TableCellCustom implements OnInit { + + errors: string[] = []; + + constructor() { + super(); + } + + ngOnInit() { + const conditions = this.row.status.conditions; + this.errors = conditions + .filter(c => c.type !== ConditionType.Ready) + .filter(c => c.status === 'True') + .map(condition => ConditionTypeLabels[condition.type] || condition.type); + } +} diff --git a/custom-src/frontend/app/custom/kubernetes/list-types/kubernetes-nodes/kubernetes-node-summary/kubernetes-node-condition-card/kubernetes-node-condition/kubernetes-node-condition.component.ts b/custom-src/frontend/app/custom/kubernetes/list-types/kubernetes-nodes/kubernetes-node-summary/kubernetes-node-condition-card/kubernetes-node-condition/kubernetes-node-condition.component.ts index 5f7baf1d35..6f2e961180 100644 --- a/custom-src/frontend/app/custom/kubernetes/list-types/kubernetes-nodes/kubernetes-node-summary/kubernetes-node-condition-card/kubernetes-node-condition/kubernetes-node-condition.component.ts +++ b/custom-src/frontend/app/custom/kubernetes/list-types/kubernetes-nodes/kubernetes-node-summary/kubernetes-node-condition-card/kubernetes-node-condition/kubernetes-node-condition.component.ts @@ -3,7 +3,7 @@ import { Observable } from 'rxjs'; import { filter, map } from 'rxjs/operators'; import { KubernetesNodeService } from '../../../../../services/kubernetes-node.service'; -import { Condition, ConditionType } from '../../../../../store/kube.types'; +import { ConditionType, ConditionTypeLabels, KubernetesCondition } from '../../../../../store/kube.types'; @Component({ selector: 'app-kubernetes-node-condition', @@ -23,12 +23,7 @@ export class KubernetesNodeConditionComponent implements OnInit { @Input() subtle = false; - public titles = { - Ready: 'Ready', - OutOfDisk: 'Out of Disk', - MemoryPressure: 'Memory Pressure', - DiskPressure: 'Disk Pressure' - }; + public titles = ConditionTypeLabels; public icons = { Ready: ['done_outline', 'material-icons'], @@ -51,7 +46,7 @@ export class KubernetesNodeConditionComponent implements OnInit { ); } - shouldBeGreen(condition: Condition) { + shouldBeGreen(condition: KubernetesCondition) { if (condition.status === 'True') { if (condition.type === ConditionType.Ready) { return true; diff --git a/custom-src/frontend/app/custom/kubernetes/list-types/kubernetes-nodes/kubernetes-nodes-list-config.service.ts b/custom-src/frontend/app/custom/kubernetes/list-types/kubernetes-nodes/kubernetes-nodes-list-config.service.ts index f86799211d..5d10ab5b48 100644 --- a/custom-src/frontend/app/custom/kubernetes/list-types/kubernetes-nodes/kubernetes-nodes-list-config.service.ts +++ b/custom-src/frontend/app/custom/kubernetes/list-types/kubernetes-nodes/kubernetes-nodes-list-config.service.ts @@ -7,12 +7,15 @@ import { DataFunction } from '../../../../shared/components/list/data-sources-co import { ITableColumn } from '../../../../shared/components/list/list-table/table.types'; import { IListConfig, IListFilter, ListViewTypes } from '../../../../shared/components/list/list.component.types'; import { BaseKubeGuid } from '../../kubernetes-page.types'; -import { ConditionType, KubernetesNode } from '../../store/kube.types'; +import { ConditionType, KubernetesAddressExternal, KubernetesAddressInternal, KubernetesNode } from '../../store/kube.types'; import { defaultHelmKubeListPageSize } from '../kube-helm-list-types'; import { getConditionSort } from '../kube-sort.helper'; -import { ConditionCellComponent, SubtleConditionCellComponent } from './condition-cell/condition-cell.component'; +import { ConditionCellComponent } from './condition-cell/condition-cell.component'; import { KubernetesNodeCapacityComponent } from './kubernetes-node-capacity/kubernetes-node-capacity.component'; +import { KubernetesNodeIpsComponent } from './kubernetes-node-ips/kubernetes-node-ips.component'; +import { KubernetesNodeLabelsComponent } from './kubernetes-node-labels/kubernetes-node-labels.component'; import { KubernetesNodeLinkComponent } from './kubernetes-node-link/kubernetes-node-link.component'; +import { KubernetesNodePressureComponent } from './kubernetes-node-pressure/kubernetes-node-pressure.component'; import { KubernetesNodesDataSource } from './kubernetes-nodes-data-source'; import { NodePodCountComponent } from './node-pod-count/node-pod-count.component'; @@ -37,6 +40,16 @@ export class KubernetesNodesListConfigService implements IListConfig 'IPs', + cellComponent: KubernetesNodeIpsComponent, + cellFlex: '1', + }, + { + columnId: 'labels', headerCell: () => 'Labels', + cellComponent: KubernetesNodeLabelsComponent, + cellFlex: '1', + }, { columnId: 'ready', headerCell: () => 'Ready', cellConfig: { @@ -48,21 +61,8 @@ export class KubernetesNodesListConfigService implements IListConfig 'Disk Pressure', - cellComponent: SubtleConditionCellComponent, - cellConfig: { - conditionType: ConditionType.DiskPressure - }, - sort: getConditionSort(ConditionType.DiskPressure), - cellFlex: '2', - }, - { - columnId: 'memPressure', headerCell: () => 'Memory Pressure', - cellComponent: SubtleConditionCellComponent, - cellConfig: { - conditionType: ConditionType.MemoryPressure - }, - sort: getConditionSort(ConditionType.MemoryPressure), + columnId: 'condition', headerCell: () => 'Condition', + cellComponent: KubernetesNodePressureComponent, cellFlex: '2', }, { @@ -73,8 +73,14 @@ export class KubernetesNodesListConfigService implements IListConfig 'Capacity', cellComponent: KubernetesNodeCapacityComponent, - cellFlex: '5', + cellFlex: '4', }, + // Display labels as the usual chip list + // { + // columnId: 'labels', headerCell: () => 'Labels', + // cellComponent: KubernetesLabelsCellComponent, + // cellFlex: '6', + // }, ]; filters: IListFilter[] = [ { @@ -118,20 +124,20 @@ export class KubernetesNodesListConfigService implements IListConfig[] = [ (entities: KubernetesNode[], paginationState: PaginationEntityState) => { - const filterString = paginationState.clientPagination.filter.string; - - if (!filterString) { + if (!paginationState.clientPagination.filter.string) { return entities; } + const filterString = paginationState.clientPagination.filter.string.toUpperCase(); + const filterKey = paginationState.clientPagination.filter.filterKey; switch (filterKey) { case KubernetesNodesListFilterKeys.IP_ADDRESS: return entities.filter(node => { const ipAddress = - node.status.addresses.find(address => address.type === 'InternalIP') || - node.status.addresses.find(address => address.type === 'ExternalIP'); + node.status.addresses.find(address => address.type === KubernetesAddressInternal) || + node.status.addresses.find(address => address.type === KubernetesAddressExternal); return ipAddress ? ipAddress.address.toUpperCase().includes(filterString) : false; }); diff --git a/custom-src/frontend/app/custom/kubernetes/store/kube.types.ts b/custom-src/frontend/app/custom/kubernetes/store/kube.types.ts index bf5a26ed0a..db04efe87c 100644 --- a/custom-src/frontend/app/custom/kubernetes/store/kube.types.ts +++ b/custom-src/frontend/app/custom/kubernetes/store/kube.types.ts @@ -98,8 +98,8 @@ export interface KubernetesApp { export interface NodeStatus { capacity?: Capacity; allocatable?: Allocatable; - conditions: Condition[]; - addresses: Address[]; + conditions: KubernetesCondition[]; + addresses: KubernetesAddress[]; daemonEndpoints?: DaemonEndpoints; nodeInfo?: NodeInfo; images: Image[]; @@ -133,8 +133,16 @@ export enum ConditionType { OutOfDisk = 'OutOfDisk', MemoryPressure = 'MemoryPressure', DiskPressure = 'DiskPressure', - Ready = 'Ready' -} + Ready = 'Ready', + PIDPressure = 'PIDPressure' +} +export const ConditionTypeLabels = { + [ConditionType.Ready]: 'Ready', + [ConditionType.OutOfDisk]: 'Out of Disk', + [ConditionType.MemoryPressure]: 'Memory Pressure', + [ConditionType.DiskPressure]: 'Disk Pressure', + [ConditionType.PIDPressure]: 'PID Pressure' +}; export enum ConditionStatus { False = 'False', @@ -142,7 +150,7 @@ export enum ConditionStatus { Unknown = 'Unknown' } -export interface Condition { +export interface KubernetesCondition { type: ConditionType; status: ConditionStatus; lastHeartbeatTime: Date; @@ -151,11 +159,14 @@ export interface Condition { message: string; } -export interface Address { +export interface KubernetesAddress { type: string; address: string; } +export const KubernetesAddressInternal = 'InternalIP'; +export const KubernetesAddressExternal = 'ExternalIP'; + export interface KubeletEndpoint { Port: number; } @@ -208,7 +219,7 @@ export interface BaseStatus { export interface PodStatus { phase: KubernetesStatus; - conditions?: Condition[]; + conditions?: KubernetesCondition[]; message?: string; reason?: string; hostIP?: string; @@ -218,7 +229,7 @@ export interface PodStatus { qosClass?: string; initContainerStatuses?: ContainerStatus[]; } -export interface Condition { +export interface KubernetesCondition { type: ConditionType; status: ConditionStatus; lastProbeTime?: any; From f10860083a40a0a1ddfefddda511d68d3c459632 Mon Sep 17 00:00:00 2001 From: Richard Cox Date: Mon, 14 Oct 2019 17:36:16 +0100 Subject: [PATCH 15/15] E2E Fix --- .../cloud-foundry/cf-level/manage-quota-e2e.spec.ts | 2 +- src/test-e2e/po/list.po.ts | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/test-e2e/cloud-foundry/cf-level/manage-quota-e2e.spec.ts b/src/test-e2e/cloud-foundry/cf-level/manage-quota-e2e.spec.ts index f9c62f5ce0..e09574299c 100644 --- a/src/test-e2e/cloud-foundry/cf-level/manage-quota-e2e.spec.ts +++ b/src/test-e2e/cloud-foundry/cf-level/manage-quota-e2e.spec.ts @@ -4,9 +4,9 @@ import { e2e } from '../../e2e'; import { CFHelpers } from '../../helpers/cf-helpers'; import { ConsoleUserType, E2EHelpers } from '../../helpers/e2e-helpers'; import { extendE2ETestTime } from '../../helpers/extend-test-helpers'; +import { TableComponent } from '../../po/table.po'; import { CfTopLevelPage } from './cf-top-level-page.po'; import { QuotaFormPage } from './quota-form-page.po'; -import { TableComponent } from '../../po/table.po'; describe('Manage Quota', () => { let e2eSetup; diff --git a/src/test-e2e/po/list.po.ts b/src/test-e2e/po/list.po.ts index 27a10e1470..4ef50b5227 100644 --- a/src/test-e2e/po/list.po.ts +++ b/src/test-e2e/po/list.po.ts @@ -39,7 +39,7 @@ export class ListTableComponent extends Component { ).first(); browser.wait(until.presenceOf(cell)); - return cell.element(by.xpath('ancestor::app-table-row'));; + return cell.element(by.xpath('ancestor::app-table-row')); } // Get the data in the table @@ -385,11 +385,11 @@ export class ListPaginationComponent extends Component { } getPageSize(customCtrlName?: string): promise.Promise { - return this.getPageSizeForm().getText(customCtrlName || 'mat-select-1'); + return this.getPageSizeForm().getText(customCtrlName || 'mat-select-2'); } setPageSize(pageSize, customCtrlName?: string): promise.Promise { - const name = customCtrlName || 'mat-select-1'; + const name = customCtrlName || 'mat-select-2'; return this.getPageSizeForm().fill({ [name]: pageSize }); }