Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adds support for showing warning icon in StatefulSet #5055

Merged
Show file tree
Hide file tree
Changes from 2 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 @@ -20,7 +20,7 @@ import {
ComponentFactoryResolver,
Input,
} from '@angular/core';
import {Event, Metric, StatefulSet, StatefulSetList} from '@api/backendapi';
import {Event, Metric, StatefulSet, StatefulSetList, PodInfo} from '@api/backendapi';
import {Observable} from 'rxjs/Observable';
import {ResourceListWithStatuses} from '../../../resources/list';
import {NotificationsService} from '../../../services/global/notifications';
Expand Down Expand Up @@ -78,15 +78,25 @@ export class StatefulSetListComponent extends ResourceListWithStatuses<
}

isInPendingState(resource: StatefulSet): boolean {
return resource.podInfo.warnings.length === 0 && resource.podInfo.pending > 0;
return (resource.podInfo.warnings.length === 0 && resource.podInfo.pending > 0) || (resource.podInfo.running !== resource.podInfo.desired);
Harkishen-Singh marked this conversation as resolved.
Show resolved Hide resolved
}

isInSuccessState(resource: StatefulSet): boolean {
return resource.podInfo.warnings.length === 0 && resource.podInfo.pending === 0;
return resource.podInfo.warnings.length === 0 && resource.podInfo.pending === 0 && (resource.podInfo.running === resource.podInfo.desired);
}

getDisplayStatus(podInfo: PodInfo): string {
Harkishen-Singh marked this conversation as resolved.
Show resolved Hide resolved
let msgState = 'Running';

if (podInfo.pending > 1 || (podInfo.running !== podInfo.desired)) {
msgState = 'Pending';
}

return msgState;
}

getDisplayColumns(): string[] {
return ['statusicon', 'name', 'labels', 'pods', 'age', 'images'];
return ['statusicon', 'name', 'labels', 'status', 'pods', 'age', 'images'];
}

hasErrors(statefulSet: StatefulSet): boolean {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,13 @@
</mat-cell>
</ng-container>

<ng-container matColumnDef="status">
<mat-header-cell *matHeaderCellDef
disableClear="true"
i18n>Status</mat-header-cell>
<mat-cell *matCellDef="let ss">{{getDisplayStatus(ss.podInfo)}}</mat-cell>
</ng-container>

<ng-container matColumnDef="pods">
<mat-header-cell *matHeaderCellDef
i18n>Pods</mat-header-cell>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,11 @@ export class WorkloadStatusComponent {
@Input() resourcesRatio = emptyResourcesRatio;
colors: string[] = [];

constructor() {
Harkishen-Singh marked this conversation as resolved.
Show resolved Hide resolved
console.warn('resourceratio below')
console.warn(this.resourcesRatio)
}

getCustomColor(label: string): string {
if (label.includes('Running')) {
return '#00c752';
Expand Down