Skip to content

Commit

Permalink
Update following design doc
Browse files Browse the repository at this point in the history
- 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
  • Loading branch information
richard-cox committed Oct 11, 2019
1 parent cc927da commit d9bc3f7
Show file tree
Hide file tree
Showing 24 changed files with 426 additions and 71 deletions.
27 changes: 18 additions & 9 deletions custom-src/frontend/app/custom/kubernetes/kubernetes.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand Down Expand Up @@ -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({
Expand Down Expand Up @@ -120,6 +125,10 @@ import { KubernetesSummaryTabComponent } from './tabs/kubernetes-summary-tab/kub
HelmReleaseSummaryCardComponent,
PodMetricsComponent,
KubernetesNodeLinkComponent,
KubernetesNodeIpsComponent,
KubernetesNodeLabelsComponent,
KubernetesNodePressureComponent,
KubernetesLabelsCellComponent,
KubernetesNodeComponent,
KubernetesNodeSummaryComponent,
KubernetesNodePodsComponent,
Expand All @@ -134,8 +143,6 @@ import { KubernetesSummaryTabComponent } from './tabs/kubernetes-summary-tab/kub
KubernetesNodeMetricStatsCardComponent,
KubernetesNodeSimpleMetricComponent,
ConditionCellComponent,
InverseConditionCellComponent,
SubtleConditionCellComponent,
KubernetesNamespaceLinkComponent,
KubernetesNamespaceComponent,
KubernetesNamespacePodsComponent,
Expand All @@ -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,
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
<app-chips [chips]="chipsConfig"></app-chips>
Original file line number Diff line number Diff line change
@@ -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<KubernetesLabelsCellComponent>;

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();
});
});
Original file line number Diff line number Diff line change
@@ -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<KubeAPIResource> implements OnInit {

chipsConfig: AppChip<KubeAPIResource>[];

constructor() {
super();
}

ngOnInit() {
this.chipsConfig = Object.entries(this.row.metadata.labels).map(([key, value]) => ({
value: `${key}:${value}`
}));
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -35,20 +35,3 @@ export class ConditionCellComponent extends TableCellCustom<KubernetesNode> impl
}

}

export class SubtleConditionCellComponent extends ConditionCellComponent {

constructor() {
super();
this.subtle = true;
}
}


export class InverseConditionCellComponent extends ConditionCellComponent {

constructor() {
super();
this.inverse = true;
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
<mat-icon matTooltip="{{tooltip}}">language</mat-icon>
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
mat-icon {
font-size: 20px;
height: 20px;
width: 20px;
}
Original file line number Diff line number Diff line change
@@ -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<KubernetesNodeIpsComponent>;

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();
});
});
Original file line number Diff line number Diff line change
@@ -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<KubernetesNode> 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(', ');
}

}
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
<mat-icon matTooltip="{{labels}}">info</mat-icon>
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
mat-icon {
font-size: 20px;
height: 20px;
width: 20px;
}
Original file line number Diff line number Diff line change
@@ -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<KubernetesNodeLabelsComponent>;

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();
});
});
Original file line number Diff line number Diff line change
@@ -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<KubernetesNode> implements OnInit {

labels: string;

constructor() {
super();
}

ngOnInit() {
this.labels = Object.entries(this.row.metadata.labels)
.map(([key, value]) => `${key}:${value}`)
.join(', ');
}

}
Original file line number Diff line number Diff line change
@@ -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<any>;
let fixture: ComponentFixture<KubernetesNodeLinkComponent<any>>;
let component: KubernetesNodeLinkComponent;
let fixture: ComponentFixture<KubernetesNodeLinkComponent>;

beforeEach(async(() => {
TestBed.configureTestingModule({
Expand Down
Original file line number Diff line number Diff line change
@@ -1,14 +1,15 @@
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({
selector: 'app-kubernetes-node-link',
templateUrl: './kubernetes-node-link.component.html',
styleUrls: ['./kubernetes-node-link.component.scss']
})
export class KubernetesNodeLinkComponent<T> extends TableCellCustom<KubernetesNode> implements OnInit {
export class KubernetesNodeLinkComponent extends TableCellCustom<KubernetesNode> implements OnInit {

public nodeLink;
constructor(
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
<ng-container *ngIf="errors.length; else noErrors">
<div *ngFor="let error of errors" class="pressure">
<mat-icon class="pressure__icon">info</mat-icon>
{{ error }}
</div>
</ng-container>
<ng-template #noErrors>
None
</ng-template>
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
.pressure {
align-items: center;
display: flex;

&__icon {
color: red;
font-size: 20px;
height: 20px;
margin-right: 4px;
width: 20px;
}
}
Loading

0 comments on commit d9bc3f7

Please sign in to comment.