]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
mgr/dashboard: Move and rename pipe
authorSebastian Krah <skrah@suse.com>
Tue, 29 Jan 2019 13:25:09 +0000 (14:25 +0100)
committerSebastian Krah <skrah@suse.com>
Tue, 29 Jan 2019 13:58:37 +0000 (14:58 +0100)
Moves file to the shared directory to make it available for every module.
Also renames the file, because it will be refactored.

Fixes: https://tracker.ceph.com/issues/37916
Signed-off-by: Sebastian Krah <skrah@suse.com>
src/pybind/mgr/dashboard/frontend/src/app/ceph/dashboard/log-color.pipe.spec.ts [deleted file]
src/pybind/mgr/dashboard/frontend/src/app/ceph/dashboard/log-color.pipe.ts [deleted file]
src/pybind/mgr/dashboard/frontend/src/app/shared/pipes/log-priority.pipe.spec.ts [new file with mode: 0644]
src/pybind/mgr/dashboard/frontend/src/app/shared/pipes/log-priority.pipe.ts [new file with mode: 0644]

diff --git a/src/pybind/mgr/dashboard/frontend/src/app/ceph/dashboard/log-color.pipe.spec.ts b/src/pybind/mgr/dashboard/frontend/src/app/ceph/dashboard/log-color.pipe.spec.ts
deleted file mode 100644 (file)
index 5851487..0000000
+++ /dev/null
@@ -1,34 +0,0 @@
-import { LogColorPipe } from './log-color.pipe';
-
-describe('LogColorPipe', () => {
-  const pipe = new LogColorPipe();
-
-  it('create an instance', () => {
-    expect(pipe).toBeTruthy();
-  });
-
-  it('transforms "INF"', () => {
-    const value = { priority: '[INF]' };
-    expect(pipe.transform(value)).toBe('');
-  });
-
-  it('transforms "WRN"', () => {
-    const value = { priority: '[WRN]' };
-    const result = {
-      color: '#ffa500',
-      'font-weight': 'bold'
-    };
-    expect(pipe.transform(value)).toEqual(result);
-  });
-
-  it('transforms "ERR"', () => {
-    const value = { priority: '[ERR]' };
-    const result = { color: '#FF2222' };
-    expect(pipe.transform(value)).toEqual(result);
-  });
-
-  it('transforms others', () => {
-    const value = { priority: '[foo]' };
-    expect(pipe.transform(value)).toBe('');
-  });
-});
diff --git a/src/pybind/mgr/dashboard/frontend/src/app/ceph/dashboard/log-color.pipe.ts b/src/pybind/mgr/dashboard/frontend/src/app/ceph/dashboard/log-color.pipe.ts
deleted file mode 100644 (file)
index eb60ddb..0000000
+++ /dev/null
@@ -1,21 +0,0 @@
-import { Pipe, PipeTransform } from '@angular/core';
-
-@Pipe({
-  name: 'logColor'
-})
-export class LogColorPipe 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' };
-    } else {
-      return '';
-    }
-  }
-}
diff --git a/src/pybind/mgr/dashboard/frontend/src/app/shared/pipes/log-priority.pipe.spec.ts b/src/pybind/mgr/dashboard/frontend/src/app/shared/pipes/log-priority.pipe.spec.ts
new file mode 100644 (file)
index 0000000..5851487
--- /dev/null
@@ -0,0 +1,34 @@
+import { LogColorPipe } from './log-color.pipe';
+
+describe('LogColorPipe', () => {
+  const pipe = new LogColorPipe();
+
+  it('create an instance', () => {
+    expect(pipe).toBeTruthy();
+  });
+
+  it('transforms "INF"', () => {
+    const value = { priority: '[INF]' };
+    expect(pipe.transform(value)).toBe('');
+  });
+
+  it('transforms "WRN"', () => {
+    const value = { priority: '[WRN]' };
+    const result = {
+      color: '#ffa500',
+      'font-weight': 'bold'
+    };
+    expect(pipe.transform(value)).toEqual(result);
+  });
+
+  it('transforms "ERR"', () => {
+    const value = { priority: '[ERR]' };
+    const result = { color: '#FF2222' };
+    expect(pipe.transform(value)).toEqual(result);
+  });
+
+  it('transforms others', () => {
+    const value = { priority: '[foo]' };
+    expect(pipe.transform(value)).toBe('');
+  });
+});
diff --git a/src/pybind/mgr/dashboard/frontend/src/app/shared/pipes/log-priority.pipe.ts b/src/pybind/mgr/dashboard/frontend/src/app/shared/pipes/log-priority.pipe.ts
new file mode 100644 (file)
index 0000000..eb60ddb
--- /dev/null
@@ -0,0 +1,21 @@
+import { Pipe, PipeTransform } from '@angular/core';
+
+@Pipe({
+  name: 'logColor'
+})
+export class LogColorPipe 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' };
+    } else {
+      return '';
+    }
+  }
+}