]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
mgr/dashboard: Introduce upperFirst pipe 26116/head
authorVolker Theile <vtheile@suse.com>
Tue, 19 Feb 2019 13:22:13 +0000 (14:22 +0100)
committerVolker Theile <vtheile@suse.com>
Tue, 26 Feb 2019 13:12:07 +0000 (14:12 +0100)
Signed-off-by: Volker Theile <vtheile@suse.com>
src/pybind/mgr/dashboard/frontend/src/app/shared/pipes/pipes.module.ts
src/pybind/mgr/dashboard/frontend/src/app/shared/pipes/upper-first.pipe.spec.ts [new file with mode: 0644]
src/pybind/mgr/dashboard/frontend/src/app/shared/pipes/upper-first.pipe.ts [new file with mode: 0644]

index ac89776424eff8be3b9e9075a7da74600255ef7c..8ca806514b7db6a8520a4359c4d728dedc4e2781 100644 (file)
@@ -18,6 +18,7 @@ import { MillisecondsPipe } from './milliseconds.pipe';
 import { OrdinalPipe } from './ordinal.pipe';
 import { RelativeDatePipe } from './relative-date.pipe';
 import { RoundPipe } from './round.pipe';
+import { UpperFirstPipe } from './upper-first.pipe';
 
 @NgModule({
   imports: [CommonModule],
@@ -38,7 +39,8 @@ import { RoundPipe } from './round.pipe';
     RoundPipe,
     OrdinalPipe,
     MillisecondsPipe,
-    IopsPipe
+    IopsPipe,
+    UpperFirstPipe
   ],
   exports: [
     DimlessBinaryPipe,
@@ -57,7 +59,8 @@ import { RoundPipe } from './round.pipe';
     RoundPipe,
     OrdinalPipe,
     MillisecondsPipe,
-    IopsPipe
+    IopsPipe,
+    UpperFirstPipe
   ],
   providers: [
     DatePipe,
@@ -74,7 +77,8 @@ import { RoundPipe } from './round.pipe';
     EncodeUriPipe,
     OrdinalPipe,
     IopsPipe,
-    MillisecondsPipe
+    MillisecondsPipe,
+    UpperFirstPipe
   ]
 })
 export class PipesModule {}
diff --git a/src/pybind/mgr/dashboard/frontend/src/app/shared/pipes/upper-first.pipe.spec.ts b/src/pybind/mgr/dashboard/frontend/src/app/shared/pipes/upper-first.pipe.spec.ts
new file mode 100644 (file)
index 0000000..072baa0
--- /dev/null
@@ -0,0 +1,17 @@
+import { UpperFirstPipe } from './upper-first.pipe';
+
+describe('UpperFirstPipe', () => {
+  const pipe = new UpperFirstPipe();
+
+  it('create an instance', () => {
+    expect(pipe).toBeTruthy();
+  });
+
+  it('transforms "foo"', () => {
+    expect(pipe.transform('foo')).toEqual('Foo');
+  });
+
+  it('transforms "BAR"', () => {
+    expect(pipe.transform('BAR')).toEqual('BAR');
+  });
+});
diff --git a/src/pybind/mgr/dashboard/frontend/src/app/shared/pipes/upper-first.pipe.ts b/src/pybind/mgr/dashboard/frontend/src/app/shared/pipes/upper-first.pipe.ts
new file mode 100644 (file)
index 0000000..11d7fc9
--- /dev/null
@@ -0,0 +1,12 @@
+import { Pipe, PipeTransform } from '@angular/core';
+
+import * as _ from 'lodash';
+
+@Pipe({
+  name: 'upperFirst'
+})
+export class UpperFirstPipe implements PipeTransform {
+  transform(value: string): string {
+    return _.upperFirst(value);
+  }
+}