import { HealthComponent } from './health/health.component';
import { InfoCardComponent } from './info-card/info-card.component';
import { InfoGroupComponent } from './info-group/info-group.component';
-import { LogColorPipe } from './log-color.pipe';
import { MdsSummaryPipe } from './mds-summary.pipe';
import { MgrSummaryPipe } from './mgr-summary.pipe';
import { MonSummaryPipe } from './mon-summary.pipe';
DashboardComponent,
MonSummaryPipe,
OsdSummaryPipe,
- LogColorPipe,
MgrSummaryPipe,
MdsSummaryPipe,
HealthPieComponent,
-import { LogColorPipe } from './log-color.pipe';
+import { LogPriorityPipe } from './log-priority.pipe';
-describe('LogColorPipe', () => {
- const pipe = new LogColorPipe();
+describe('LogPriorityPipe', () => {
+ const pipe = new LogPriorityPipe();
it('create an instance', () => {
expect(pipe).toBeTruthy();
});
it('transforms "INF"', () => {
- const value = { priority: '[INF]' };
- expect(pipe.transform(value)).toBe('');
+ const value = '[INF]';
+ const result = 'info';
+ expect(pipe.transform(value)).toEqual(result);
});
it('transforms "WRN"', () => {
- const value = { priority: '[WRN]' };
- const result = {
- color: '#ffa500',
- 'font-weight': 'bold'
- };
+ const value = '[WRN]';
+ const result = 'warn';
expect(pipe.transform(value)).toEqual(result);
});
it('transforms "ERR"', () => {
- const value = { priority: '[ERR]' };
- const result = { color: '#FF2222' };
+ const value = '[ERR]';
+ const result = 'err';
expect(pipe.transform(value)).toEqual(result);
});
it('transforms others', () => {
- const value = { priority: '[foo]' };
+ const value = '[foo]';
expect(pipe.transform(value)).toBe('');
});
});
import { Pipe, PipeTransform } from '@angular/core';
@Pipe({
- name: 'logColor'
+ name: 'logPriority'
})
-export class LogColorPipe implements PipeTransform {
+export class LogPriorityPipe implements PipeTransform {
transform(value: any, args?: any): any {
- if (value.priority === '[INF]') {
- return ''; // Inherit
- } else if (value.priority === '[WRN]') {
- return {
- color: '#ffa500',
- 'font-weight': 'bold'
- };
- } else if (value.priority === '[ERR]') {
- return { color: '#FF2222' };
+ if (value === '[INF]') {
+ return 'info';
+ } else if (value === '[WRN]') {
+ return 'warn';
+ } else if (value === '[ERR]') {
+ return 'err';
} else {
- return '';
+ return ''; // Inherit
}
}
}
import { FilterPipe } from './filter.pipe';
import { HealthColorPipe } from './health-color.pipe';
import { ListPipe } from './list.pipe';
+import { LogPriorityPipe } from './log-priority.pipe';
import { RelativeDatePipe } from './relative-date.pipe';
import { RoundPipe } from './round.pipe';
CephReleaseNamePipe,
RelativeDatePipe,
ListPipe,
+ LogPriorityPipe,
FilterPipe,
CdDatePipe,
EmptyPipe,
CephReleaseNamePipe,
RelativeDatePipe,
ListPipe,
+ LogPriorityPipe,
FilterPipe,
CdDatePipe,
EmptyPipe,
DimlessPipe,
RelativeDatePipe,
ListPipe,
+ LogPriorityPipe,
CdDatePipe,
EmptyPipe,
EncodeUriPipe