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

Minor Kube Fixes #4829

Merged
merged 4 commits into from
Dec 8, 2020
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -2,18 +2,21 @@
<app-panel *ngIf="!chart && !initing" class="app-panel--container">
<h2>Sorry, we couldn't find the chart</h2>
</app-panel>
<app-panel *ngIf="chart && !currentVersion && !initing" class="app-panel--container">
<h2>Sorry, we couldn't find the version information for this chart</h2>
</app-panel>
<app-loader [loading]="loading">
<div class="chart-details__wrapper">
<app-entity-summary-title class="summary-title" *ngIf="chart" [title]="chart.attributes.name"
[subTitle]="chartSubTitle" [subText]="chart.attributes.description" [imagePath]="iconUrl">
<div class="chart-details__wrapper" *ngIf="chart && currentVersion">
<app-entity-summary-title class="summary-title" [title]="chart.attributes.name" [subTitle]="chartSubTitle"
[subText]="chart.attributes.description" [imagePath]="iconUrl">
<div class="chart-details__content">
<article class="chart-details__content__docs">
<app-chart-details-readme [currentVersion]=currentVersion></app-chart-details-readme>
<app-chart-details-readme [currentVersion]="currentVersion"></app-chart-details-readme>
</article>
</div>
</app-entity-summary-title>
<aside *ngIf="chart" class="chart-details__content__info">
<app-chart-details-info [chart]=chart [currentVersion]=currentVersion></app-chart-details-info>
<aside class="chart-details__content__info">
<app-chart-details-info [chart]="chart" [currentVersion]="currentVersion"></app-chart-details-info>
</aside>
</div>
</app-loader>
Expand Down
Original file line number Diff line number Diff line change
@@ -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';
Expand Down Expand Up @@ -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();
}
});
}
Expand Down
Original file line number Diff line number Diff line change
@@ -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';
Expand All @@ -24,7 +24,7 @@ const REPO_FILTER_NAME = 'repository';
}]

})
export class CatalogTabComponent {
export class CatalogTabComponent implements OnDestroy {

public repos$: Observable<{
artifactHubRepos: string[],
Expand All @@ -39,6 +39,9 @@ export class CatalogTabComponent {
public collapsed = true;
public hide = true;

private initStateSet = false;
private sub: Subscription;

constructor(private store: Store<AppState>, private activatedRoute: ActivatedRoute) {
// Determine the starting state of the filter by repo section
stratosEntityCatalog.endpoint.store.getAll.getPaginationService().entities$.pipe(
Expand Down Expand Up @@ -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;
});
}

Expand All @@ -123,4 +131,10 @@ export class CatalogTabComponent {
public searchRepos(repoName: string) {
this.searchReposSub.next(repoName);
}

ngOnDestroy(): void {
if (this.sub) {
this.sub.unsubscribe();
}
}
}
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
<app-tile-grid fit="true">
<app-tile-group class="k8s-home-card__plain-tiles">
<app-tile>
<app-card-number-metric mode="plain" link="/kubernetes/{{endpoint.guid}}/nodes"
icon="apps" label="Nodes" labelSingular="Node" value="{{ nodeCount$ | async }}">
<app-card-number-metric mode="plain" link="/kubernetes/{{endpoint.guid}}/nodes" icon="apps" label="Nodes"
labelSingular="Node" value="{{ nodeCount$ | async }}">
</app-card-number-metric>
</app-tile>
<app-tile>
<app-card-number-metric mode="plain" link="/kubernetes/{{endpoint.guid}}/namespaces"
icon="language" label="Namespaces" labelSingular="Node" value="{{ namespaceCount$ | async }}">
<app-card-number-metric mode="plain" link="/kubernetes/{{endpoint.guid}}/namespaces" icon="language"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should be /resources/namespace

label="Namespaces" labelSingular="Node" value="{{ namespaceCount$ | async }}">
</app-card-number-metric>
</app-tile>
<app-tile>
<app-card-number-metric mode="plain" link="/kubernetes/{{endpoint.guid}}/pods"
icon="apps" label="Pods" labelSingular="Pod" value="{{ podCount$ | async }}">
<app-card-number-metric mode="plain" link="/kubernetes/{{endpoint.guid}}/resource/pod" icon="apps" label="Pods"
labelSingular="Pod" value="{{ podCount$ | async }}">
</app-card-number-metric>
</app-tile>
</app-tile-group>
Expand All @@ -23,4 +23,4 @@
</div>
</app-tile>
</app-tile-group>
</app-tile-grid>
</app-tile-grid>