summaryrefslogtreecommitdiffstats
path: root/src/pybind/mgr/dashboard/frontend/src/app/shared/forms/crud-form/formly-input-type
diff options
context:
space:
mode:
Diffstat (limited to 'src/pybind/mgr/dashboard/frontend/src/app/shared/forms/crud-form/formly-input-type')
-rw-r--r--src/pybind/mgr/dashboard/frontend/src/app/shared/forms/crud-form/formly-input-type/formly-input-type.component.html3
-rw-r--r--src/pybind/mgr/dashboard/frontend/src/app/shared/forms/crud-form/formly-input-type/formly-input-type.component.scss0
-rw-r--r--src/pybind/mgr/dashboard/frontend/src/app/shared/forms/crud-form/formly-input-type/formly-input-type.component.spec.ts46
-rw-r--r--src/pybind/mgr/dashboard/frontend/src/app/shared/forms/crud-form/formly-input-type/formly-input-type.component.ts9
4 files changed, 58 insertions, 0 deletions
diff --git a/src/pybind/mgr/dashboard/frontend/src/app/shared/forms/crud-form/formly-input-type/formly-input-type.component.html b/src/pybind/mgr/dashboard/frontend/src/app/shared/forms/crud-form/formly-input-type/formly-input-type.component.html
new file mode 100644
index 000000000..2d807d02b
--- /dev/null
+++ b/src/pybind/mgr/dashboard/frontend/src/app/shared/forms/crud-form/formly-input-type/formly-input-type.component.html
@@ -0,0 +1,3 @@
+<input [formControl]="formControl"
+ [formlyAttributes]="field"
+ class="form-control col-form-input"/>
diff --git a/src/pybind/mgr/dashboard/frontend/src/app/shared/forms/crud-form/formly-input-type/formly-input-type.component.scss b/src/pybind/mgr/dashboard/frontend/src/app/shared/forms/crud-form/formly-input-type/formly-input-type.component.scss
new file mode 100644
index 000000000..e69de29bb
--- /dev/null
+++ b/src/pybind/mgr/dashboard/frontend/src/app/shared/forms/crud-form/formly-input-type/formly-input-type.component.scss
diff --git a/src/pybind/mgr/dashboard/frontend/src/app/shared/forms/crud-form/formly-input-type/formly-input-type.component.spec.ts b/src/pybind/mgr/dashboard/frontend/src/app/shared/forms/crud-form/formly-input-type/formly-input-type.component.spec.ts
new file mode 100644
index 000000000..0818807d0
--- /dev/null
+++ b/src/pybind/mgr/dashboard/frontend/src/app/shared/forms/crud-form/formly-input-type/formly-input-type.component.spec.ts
@@ -0,0 +1,46 @@
+import { Component } from '@angular/core';
+import { ComponentFixture, TestBed } from '@angular/core/testing';
+import { FormGroup } from '@angular/forms';
+import { FormlyFieldConfig, FormlyModule } from '@ngx-formly/core';
+
+import { FormlyInputTypeComponent } from './formly-input-type.component';
+import { configureTestBed } from '~/testing/unit-test-helper';
+
+@Component({
+ template: ` <form [formGroup]="form">
+ <formly-form [model]="{}" [fields]="fields" [options]="{}" [form]="form"></formly-form>
+ </form>`
+})
+class MockFormComponent {
+ form = new FormGroup({});
+ fields: FormlyFieldConfig[] = [
+ {
+ wrappers: ['input'],
+ defaultValue: {}
+ }
+ ];
+}
+
+describe('FormlyInputTypeComponent', () => {
+ let component: MockFormComponent;
+ let fixture: ComponentFixture<MockFormComponent>;
+
+ configureTestBed({
+ declarations: [FormlyInputTypeComponent],
+ imports: [
+ FormlyModule.forRoot({
+ types: [{ name: 'input', component: FormlyInputTypeComponent }]
+ })
+ ]
+ });
+
+ beforeEach(() => {
+ fixture = TestBed.createComponent(MockFormComponent);
+ component = fixture.componentInstance;
+ fixture.detectChanges();
+ });
+
+ it('should create', () => {
+ expect(component).toBeTruthy();
+ });
+});
diff --git a/src/pybind/mgr/dashboard/frontend/src/app/shared/forms/crud-form/formly-input-type/formly-input-type.component.ts b/src/pybind/mgr/dashboard/frontend/src/app/shared/forms/crud-form/formly-input-type/formly-input-type.component.ts
new file mode 100644
index 000000000..d31001724
--- /dev/null
+++ b/src/pybind/mgr/dashboard/frontend/src/app/shared/forms/crud-form/formly-input-type/formly-input-type.component.ts
@@ -0,0 +1,9 @@
+import { Component } from '@angular/core';
+import { FieldType, FieldTypeConfig } from '@ngx-formly/core';
+
+@Component({
+ selector: 'cd-formly-input-type',
+ templateUrl: './formly-input-type.component.html',
+ styleUrls: ['./formly-input-type.component.scss']
+})
+export class FormlyInputTypeComponent extends FieldType<FieldTypeConfig> {}