Skip to content
This repository has been archived by the owner on Jan 24, 2023. It is now read-only.

Commit

Permalink
Changes following review
Browse files Browse the repository at this point in the history
  • Loading branch information
richard-cox committed Dec 4, 2020
1 parent 90e4af2 commit 33e675c
Show file tree
Hide file tree
Showing 7 changed files with 6 additions and 89 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -226,8 +226,6 @@ export class KubeEntityCatalog {
public role: StratosCatalogEntity<IFavoriteMetadata, KubeAPIResource, KubeResourceActionBuilders>;
public job: StratosCatalogEntity<IFavoriteMetadata, KubeAPIResource, KubeResourceActionBuilders>;

private workloadEntities: StratosBaseCatalogEntity[];

constructor() {
const endpointDef: StratosEndpointExtensionDefinition = {
type: KUBERNETES_ENDPOINT_TYPE,
Expand Down Expand Up @@ -328,7 +326,6 @@ export class KubeEntityCatalog {
apiVersion: '/api/v1',
apiName: 'namespaces',
apiNamespaced: false,
hidden: true,
getKubeCatalogEntity: (definition) => new StratosCatalogEntity<IFavoriteMetadata, KubernetesNamespace, KubeNamespaceActionBuilders>(
definition, { actionBuilders: kubeNamespaceActionBuilders }
),
Expand Down Expand Up @@ -487,32 +484,12 @@ export class KubeEntityCatalog {
apiName: 'jobs',
});

this.workloadEntities = generateWorkloadsEntities(endpointDef);
}

public allKubeEntities(): StratosBaseCatalogEntity[] {
return [
this.endpoint,
this.statefulSet,
this.pod,
this.deployment,
this.node,
this.namespace,
this.service,
this.dashboard,
this.analysisReport,
this.configMap,
this.metrics,
this.secrets,
this.pvc,
this.storage,
this.pv,
this.replicaSet,
this.clusterRole,
this.serviceAccount,
this.role,
this.job,
...this.workloadEntities
...Object.getOwnPropertyNames(this).map(s => this[s]),
...generateWorkloadsEntities(this.endpoint.definition)
];
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,6 @@ export class KubernetesResourceListComponent implements OnDestroy {
this.createProvider(catalogEntity);

// Watch for namespace changes
// TODO: RC k8sCurrentNamespace should go into dashboard state... so it's sticky
this.sub = this.store.select<KubernetesCurrentNamespace>(state => state.k8sCurrentNamespace).pipe(
map(data => data[this.kubeId.guid]),
filter(data => !!data)
Expand All @@ -105,7 +104,6 @@ export class KubernetesResourceListComponent implements OnDestroy {
this.isNamespacedView = !!catalogEntity.definition.apiNamespaced;
let action;
if (this.selectedNamespace && this.isNamespacedView) {
// TODO: RC There should be a nicer way of accessing these
action = catalogEntity.actions.getInNamespace(this.kubeId.guid, this.selectedNamespace);
} else {
action = catalogEntity.actions.getMultiple(this.kubeId.guid);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ export class KubernetesTabBaseComponent implements OnInit {
kubeEntityCatalog.allKubeEntities().forEach(catalogEntity => {
if (catalogEntity) {
const defn = catalogEntity.definition as unknown as KubeResourceEntityDefinition;
if (defn.apiNamespaced === namespaced) {
if (defn.apiNamespaced === namespaced && !defn.hidden) {
tabsFromRouterConfig.push({
link: `resource/${catalogEntity.type}`,
label: defn.labelTab || defn.labelPlural,
Expand All @@ -81,35 +81,6 @@ export class KubernetesTabBaseComponent implements OnInit {
return tabsFromRouterConfig;
}

// TODO: RC Q This is unused
// private getTabsFromRouterConfig(namespaced: boolean = true) {
// const childRoutes = this.route.snapshot.routeConfig.children;
// const tabsFromRouterConfig = [];

// // Get the tabs from the router configuration
// childRoutes.forEach(r => {
// if (r.path.length > 0) {
// // See if we can find an entity for the key
// const key = r.data ? (r.data.entityCatalogKey ? r.data.entityCatalogKey : r.path) : r.path;
// const catalogEntity = kubeEntityCatalog[key];
// if (catalogEntity) {
// const defn = catalogEntity.definition as KubeResourceEntityDefinition;
// if (defn.apiNamespaced === namespaced) {
// tabsFromRouterConfig.push({
// link: defn.route ? defn.route : `resource/${r.path}`,
// label: defn.labelTab || defn.labelPlural,
// icon: defn.icon,
// iconFont: defn.iconFont,
// });
// }
// }
// }
// });

// tabsFromRouterConfig.sort((a, b) => a.label.localeCompare(b.label));
// return tabsFromRouterConfig;
// }

ngOnInit() {
this.isFetching$ = this.kubeEndpointService.endpoint$.pipe(
map(endpoint => !endpoint),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ const kubernetes: Routes = [{
// TODO: RC these can be removed?
{
path: ':endpointId/namespaces/:namespaceName',
component: KubernetesNamespaceComponent,
component: KubernetesNamespaceComponent, // TODO: RC This component, and others in here, should be removed if route goes
children: [
{
path: '',
Expand Down
Original file line number Diff line number Diff line change
@@ -1,19 +1,11 @@
import { Injectable } from '@angular/core';
import { Store } from '@ngrx/store';
import { of } from 'rxjs';

import {
TableCellSidePanelComponent,
TableCellSidePanelConfig,
} from '../../../../../core/src/shared/components/list/list-table/table-cell-side-panel/table-cell-side-panel.component';
import { ITableColumn } from '../../../../../core/src/shared/components/list/list-table/table.types';
import {
IListConfig,
ISimpleListConfig,
ListViewTypes,
} from '../../../../../core/src/shared/components/list/list.component.types';
import { AppState } from '../../../../../store/src/public-api';
import { BaseKubeGuid } from '../../kubernetes-page.types';
import { ISimpleListConfig, ListViewTypes } from '../../../../../core/src/shared/components/list/list.component.types';
import {
KubernetesResourceViewerComponent,
KubernetesResourceViewerConfig,
Expand All @@ -23,7 +15,6 @@ import { defaultHelmKubeListPageSize } from '../kube-helm-list-types';
import { createKubeAgeColumn } from '../kube-list.helper';
import { KubernetesPodContainersComponent } from './kubernetes-pod-containers/kubernetes-pod-containers.component';
import { KubernetesPodStatusComponent } from './kubernetes-pod-status/kubernetes-pod-status.component';
import { KubernetesPodsDataSource } from './kubernetes-pods-data-source';

export abstract class BaseKubernetesPodsListConfigService implements ISimpleListConfig<KubernetesPod> {

Expand Down Expand Up @@ -140,23 +131,6 @@ export abstract class BaseKubernetesPodsListConfigService implements ISimpleList
getMultiFiltersConfigs = () => [];
}

// TODO: RC this isn't used now?
@Injectable()
export class KubernetesPodsListConfigService extends BaseKubernetesPodsListConfigService implements IListConfig<KubernetesPod> {
private podsDataSource: KubernetesPodsDataSource;

getDataSource = () => this.podsDataSource;

constructor(
store: Store<AppState>,
kubeId: BaseKubeGuid,
) {
super([]);
this.podsDataSource = new KubernetesPodsDataSource(store, kubeId, this);
}

}

export class KubernetesPodsListConfig extends BaseKubernetesPodsListConfigService {
constructor() {
super([]);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ export interface KubeResourceActionBuilders extends OrchestratedActionBuilders {
get: (
resourceName: string,
kubeGuid: string,
extraArgs: { namespace: string; }
extraArgs: { namespace: string, }
) => GetKubernetesResource;
getMultiple: (
kubeGuid: string,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -86,10 +86,7 @@ export interface IStratosBaseEntityDefinition<T = EntitySchema | EntityCatalogSc
readonly schema: T;
readonly label?: string;
readonly labelShort?: string;
readonly labelTab?: string;
readonly labelPlural?: string;
readonly icon?: string;
readonly iconFont?: string;
readonly renderPriority?: number;
/**
* Show custom content in the endpoints list. Should be Type<EndpointListDetailsComponent>
Expand Down

0 comments on commit 33e675c

Please sign in to comment.