-
Notifications
You must be signed in to change notification settings - Fork 14
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #303 from Vafilor/feat/full.node.resources
feat: move capture node checkbox next to node pool
- Loading branch information
Showing
11 changed files
with
145 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
<mat-checkbox [formControl]="inputControl">{{data.displayName}}</mat-checkbox> |
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
import { async, ComponentFixture, TestBed } from '@angular/core/testing'; | ||
|
||
import { CheckboxComponent } from './checkbox.component'; | ||
|
||
describe('CheckboxComponent', () => { | ||
let component: CheckboxComponent; | ||
let fixture: ComponentFixture<CheckboxComponent>; | ||
|
||
beforeEach(async(() => { | ||
TestBed.configureTestingModule({ | ||
declarations: [ CheckboxComponent ] | ||
}) | ||
.compileComponents(); | ||
})); | ||
|
||
beforeEach(() => { | ||
fixture = TestBed.createComponent(CheckboxComponent); | ||
component = fixture.componentInstance; | ||
fixture.detectChanges(); | ||
}); | ||
|
||
it('should create', () => { | ||
expect(component).toBeTruthy(); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,69 @@ | ||
import { Component, Input, OnInit } from '@angular/core'; | ||
import { Parameter } from '../../../api'; | ||
import { FormControl, FormGroup, Validators } from '@angular/forms'; | ||
|
||
@Component({ | ||
selector: 'app-checkbox', | ||
templateUrl: './checkbox.component.html', | ||
styleUrls: ['./checkbox.component.scss'] | ||
}) | ||
export class CheckboxComponent implements OnInit { | ||
// tslint:disable-next-line:variable-name | ||
private _data: Parameter; | ||
|
||
@Input() set errors(errors: any) { | ||
if (!this._data || !this.inputControl) { | ||
return; | ||
} | ||
|
||
const hasError = errors[this.data.name] && errors[this.data.name] === 'conflict'; | ||
if (hasError) { | ||
this.inputControl.setErrors({ | ||
conflict: true, | ||
}); | ||
|
||
this.inputControl.markAllAsTouched(); | ||
} | ||
} | ||
|
||
@Input() set data(value: Parameter) { | ||
this._data = value; | ||
this.inputControl.setValue(value.value === 'true'); | ||
} | ||
|
||
get data(): Parameter { | ||
return this._data; | ||
} | ||
|
||
@Input() form: FormGroup; | ||
inputControl: FormControl; | ||
|
||
constructor() { | ||
this.inputControl = new FormControl(); | ||
this.inputControl.valueChanges.subscribe(newValue => { | ||
if (this._data) { | ||
this._data.value = newValue; | ||
} | ||
}); | ||
} | ||
|
||
ngOnInit() { | ||
this.setupForm(); | ||
} | ||
|
||
setupForm() { | ||
if (this.data.required) { | ||
this.inputControl.setValidators([ | ||
Validators.required | ||
]); | ||
} | ||
|
||
this.form.addControl(this.data.name, this.inputControl); | ||
} | ||
|
||
setDataValue(value: string) { | ||
setTimeout(() => { | ||
this._data.value = value; | ||
}); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -74,6 +74,10 @@ $spacer: 0.25rem; | |
} | ||
} | ||
|
||
.mt-0 { | ||
margin-top: 0 !important; | ||
} | ||
|
||
.mb-0 { | ||
margin-bottom: 0 !important; | ||
} | ||
|