From 98f98dcd797aa01ce184ad58074adc3f1eb4df95 Mon Sep 17 00:00:00 2001 From: Richard Cox Date: Mon, 7 Dec 2020 13:58:55 +0000 Subject: [PATCH 1/4] Fix home screen kube card pod link --- .../home/kubernetes-home-card.component.html | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/src/frontend/packages/kubernetes/src/kubernetes/home/kubernetes-home-card.component.html b/src/frontend/packages/kubernetes/src/kubernetes/home/kubernetes-home-card.component.html index bebe8b03a3..297b385126 100644 --- a/src/frontend/packages/kubernetes/src/kubernetes/home/kubernetes-home-card.component.html +++ b/src/frontend/packages/kubernetes/src/kubernetes/home/kubernetes-home-card.component.html @@ -1,18 +1,18 @@ - + - + - + @@ -23,4 +23,4 @@ - + \ No newline at end of file From b27741f222c13addc13b7f24510334dea4343157 Mon Sep 17 00:00:00 2001 From: Richard Cox Date: Mon, 7 Dec 2020 14:08:33 +0000 Subject: [PATCH 2/4] Ensure reset list filter button also resets helm chart repo filter --- .../tabs/catalog-tab/catalog-tab.component.ts | 36 +++++++++++++------ 1 file changed, 25 insertions(+), 11 deletions(-) diff --git a/src/frontend/packages/kubernetes/src/helm/tabs/catalog-tab/catalog-tab.component.ts b/src/frontend/packages/kubernetes/src/helm/tabs/catalog-tab/catalog-tab.component.ts index a2b313fe11..654b23bf00 100644 --- a/src/frontend/packages/kubernetes/src/helm/tabs/catalog-tab/catalog-tab.component.ts +++ b/src/frontend/packages/kubernetes/src/helm/tabs/catalog-tab/catalog-tab.component.ts @@ -1,7 +1,7 @@ -import { Component } from '@angular/core'; +import { Component, OnDestroy } from '@angular/core'; import { ActivatedRoute } from '@angular/router'; import { Store } from '@ngrx/store'; -import { BehaviorSubject, combineLatest, Observable } from 'rxjs'; +import { BehaviorSubject, combineLatest, Observable, Subscription } from 'rxjs'; import { distinctUntilChanged, filter, first, map, startWith } from 'rxjs/operators'; import { ListConfig } from '../../../../../core/src/shared/components/list/list.component.types'; @@ -24,7 +24,7 @@ const REPO_FILTER_NAME = 'repository'; }] }) -export class CatalogTabComponent { +export class CatalogTabComponent implements OnDestroy { public repos$: Observable<{ artifactHubRepos: string[], @@ -39,6 +39,9 @@ export class CatalogTabComponent { public collapsed = true; public hide = true; + private initStateSet = false; + private sub: Subscription; + constructor(private store: Store, private activatedRoute: ActivatedRoute) { // Determine the starting state of the filter by repo section stratosEntityCatalog.endpoint.store.getAll.getPaginationService().entities$.pipe( @@ -89,15 +92,20 @@ export class CatalogTabComponent { startWith(null) ); - helmEntityCatalog.chart.store.getPaginationMonitor().pagination$.pipe( - first() - ).subscribe(pagination => { - const { repo } = this.activatedRoute.snapshot.params; - if (repo && repo.length > 0) { - this.filterCharts(repo); - } else { - this.filteredRepo = pagination.clientPagination?.filter?.items?.[REPO_FILTER_NAME]; + const { repo: repoFromRoute } = this.activatedRoute.snapshot.params; + const repoFromStore$ = helmEntityCatalog.chart.store.getPaginationMonitor().pagination$.pipe( + map(pagination => pagination.clientPagination?.filter?.items?.[REPO_FILTER_NAME]) + ); + + // Set the initial state... and watch for changes (aka reset filters button) + this.sub = repoFromStore$.subscribe(repoFromStore => { + // Only apply repo from url on first load (and if we have one) + if (!this.initStateSet && repoFromRoute && repoFromRoute.length > 0) { + this.filterCharts(repoFromRoute); + } else if (this.filteredRepo !== repoFromStore) { + this.filteredRepo = repoFromStore; } + this.initStateSet = true; }); } @@ -123,4 +131,10 @@ export class CatalogTabComponent { public searchRepos(repoName: string) { this.searchReposSub.next(repoName); } + + ngOnDestroy(): void { + if (this.sub) { + this.sub.unsubscribe(); + } + } } From 765014c47883858adc3236b50a8a1284ee2edf21 Mon Sep 17 00:00:00 2001 From: Richard Cox Date: Mon, 7 Dec 2020 15:21:18 +0000 Subject: [PATCH 3/4] Ensure we handle the case where the versions info is unable --- .../chart-details.component.html | 15 ++++--- .../chart-details/chart-details.component.ts | 44 +++++++++++-------- 2 files changed, 34 insertions(+), 25 deletions(-) diff --git a/src/frontend/packages/kubernetes/src/helm/monocular/chart-details/chart-details.component.html b/src/frontend/packages/kubernetes/src/helm/monocular/chart-details/chart-details.component.html index f89ef9ce0a..0843429c5c 100644 --- a/src/frontend/packages/kubernetes/src/helm/monocular/chart-details/chart-details.component.html +++ b/src/frontend/packages/kubernetes/src/helm/monocular/chart-details/chart-details.component.html @@ -2,18 +2,21 @@

Sorry, we couldn't find the chart

+ +

Sorry, we couldn't find the version information for this chart

+
-
- +
+
- +
-
diff --git a/src/frontend/packages/kubernetes/src/helm/monocular/chart-details/chart-details.component.ts b/src/frontend/packages/kubernetes/src/helm/monocular/chart-details/chart-details.component.ts index 9ca80fd5d9..125f9ac710 100644 --- a/src/frontend/packages/kubernetes/src/helm/monocular/chart-details/chart-details.component.ts +++ b/src/frontend/packages/kubernetes/src/helm/monocular/chart-details/chart-details.component.ts @@ -1,6 +1,6 @@ import { Component, OnInit } from '@angular/core'; import { ActivatedRoute, Params } from '@angular/router'; -import { first } from 'rxjs/operators'; +import { finalize, first, switchMap, tap } from 'rxjs/operators'; import { Chart } from '../shared/models/chart'; import { ChartVersion } from '../shared/models/chart-version'; @@ -39,24 +39,30 @@ export class ChartDetailsComponent implements OnInit { const chartName = params.chartName; if (!!chartName) { - this.chartsService.getChart(repo, chartName).pipe(first()).subscribe(chart => { - clearTimeout(this.loadingDelay); - this.loading = false; - this.initing = false; - this.chart = chart; - this.chartSubTitle = chart.attributes.repo.name; - if (getMonocularEndpoint(this.route, chart) !== stratosMonocularEndpointGuid) { - this.chartSubTitle = 'Artifact Hub - ' + this.chartSubTitle; - } - const version = params.version || this.chart.relationships.latestChartVersion.data.version; - this.chartsService.getVersion(repo, chartName, version).pipe(first()) - .subscribe(chartVersion => { - this.currentVersion = chartVersion; - this.titleVersion = this.currentVersion.attributes.app_version || ''; - this.updateMetaTags(); - this.iconUrl = this.chartsService.getChartIconURL(this.chart, chartVersion); - }); - }); + this.chartsService.getChart(repo, chartName).pipe( + first(), + switchMap(chart => { + clearTimeout(this.loadingDelay); + this.chart = chart; + this.chartSubTitle = chart.attributes.repo.name; + if (getMonocularEndpoint(this.route, chart) !== stratosMonocularEndpointGuid) { + this.chartSubTitle = 'Artifact Hub - ' + this.chartSubTitle; + } + const version = params.version || this.chart.relationships.latestChartVersion.data.version; + return this.chartsService.getVersion(repo, chartName, version).pipe(first()); + }), + tap(chartVersion => { + this.currentVersion = chartVersion; + this.titleVersion = this.currentVersion.attributes.app_version || ''; + this.updateMetaTags(); + this.iconUrl = this.chartsService.getChartIconURL(this.chart, chartVersion); + }), + finalize(() => { + clearTimeout(this.loadingDelay); + this.loading = false; + this.initing = false; + }) + ).subscribe(); } }); } From f33e73a7a7ae2ebef0429528db9bc78eb9824f86 Mon Sep 17 00:00:00 2001 From: Neil MacDougall Date: Tue, 8 Dec 2020 11:55:55 +0000 Subject: [PATCH 4/4] Fix link for namespaces --- .../src/kubernetes/home/kubernetes-home-card.component.html | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/frontend/packages/kubernetes/src/kubernetes/home/kubernetes-home-card.component.html b/src/frontend/packages/kubernetes/src/kubernetes/home/kubernetes-home-card.component.html index 297b385126..60e90d0c4c 100644 --- a/src/frontend/packages/kubernetes/src/kubernetes/home/kubernetes-home-card.component.html +++ b/src/frontend/packages/kubernetes/src/kubernetes/home/kubernetes-home-card.component.html @@ -6,7 +6,7 @@ - @@ -23,4 +23,4 @@
- \ No newline at end of file +