Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
mgr/dashboard: Add config option component
This commit adds an initial config option component in order to move the HTML template and the config option types related code to an own centralized place to be re-usable by other components Signed-off-by: Tatjana Dehler <tdehler@suse.com> (cherry picked from commit 1834c68)
- Loading branch information
Tatjana Dehler
committed
Jun 14, 2019
1 parent
7dde7c2
commit 0c6cc0d
Showing
12 changed files
with
612 additions
and
91 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
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
72 changes: 72 additions & 0 deletions
72
...r/dashboard/frontend/src/app/shared/components/config-option/config-option.component.html
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,72 @@ | ||
<div [formGroup]="optionsFormGroup"> | ||
<div *ngFor="let option of options; let last = last"> | ||
<div class="form-group" | ||
[ngClass]="{'has-error': optionsForm.showError(option.name, optionsFormDir)}" | ||
*ngIf="option.type === 'bool'"> | ||
<label class="col-sm-6 control-label" | ||
[for]="option.name"> | ||
{{ option.text }} | ||
<br> | ||
<span class="text-muted"> | ||
{{ option.desc }} | ||
<cd-helper *ngIf="option.long_desc"> | ||
{{ option.long_desc }}</cd-helper> | ||
</span> | ||
</label> | ||
<div class="col-sm-6 checkbox-primary checkbox"> | ||
<input type="checkbox" | ||
[id]="option.name" | ||
[formControlName]="option.name"> | ||
<label></label> | ||
</div> | ||
</div> | ||
<div class="form-group" | ||
[ngClass]="{'has-error': optionsForm.showError(option.name, optionsFormDir)}" | ||
*ngIf="option.type !== 'bool'"> | ||
<label class="col-sm-6 control-label" | ||
[for]="option.name">{{ option.text }} | ||
<br> | ||
<span class="text-muted"> | ||
{{ option.desc }} | ||
<cd-helper *ngIf="option.long_desc"> | ||
{{ option.long_desc }}</cd-helper> | ||
</span> | ||
</label> | ||
<div class="col-sm-6"> | ||
<div class="input-group"> | ||
<input class="form-control" | ||
[type]="option.additionalTypeInfo.inputType" | ||
[id]="option.name" | ||
[placeholder]="option.additionalTypeInfo.humanReadable" | ||
[formControlName]="option.name" | ||
[step]="getStep(option.type, optionsForm.getValue(option.name))"> | ||
<span class="input-group-btn" | ||
*ngIf="optionsFormShowReset"> | ||
<button class="btn btn-default" | ||
type="button" | ||
data-toggle="button" | ||
title="Remove the custom configuration value. The default configuration will be inherited and used instead." | ||
(click)="resetValue(option.name)" | ||
i18n-title> | ||
<i class="fa fa-eraser" | ||
aria-hidden="true"></i> | ||
</button> | ||
</span> | ||
</div> | ||
<span class="help-block" | ||
*ngIf="optionsForm.showError(option.name, optionsFormDir, 'pattern')"> | ||
{{ option.additionalTypeInfo.patternHelpText }}</span> | ||
<span class="help-block" | ||
*ngIf="optionsForm.showError(option.name, optionsFormDir, 'invalidUuid')"> | ||
{{ option.additionalTypeInfo.patternHelpText }}</span> | ||
<span class="help-block" | ||
*ngIf="optionsForm.showError(option.name, optionsFormDir, 'max')" | ||
i18n>The entered value is too high! It must not be greater than {{ option.maxValue }}.</span> | ||
<span class="help-block" | ||
*ngIf="optionsForm.showError(option.name, optionsFormDir, 'min')" | ||
i18n>The entered value is too low! It must not be lower than {{ option.minValue }}.</span> | ||
</div> | ||
</div> | ||
<hr *ngIf="!last"> | ||
</div> | ||
</div> |
30 changes: 30 additions & 0 deletions
30
...r/dashboard/frontend/src/app/shared/components/config-option/config-option.component.scss
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,30 @@ | ||
hr { | ||
margin-top: 5px; | ||
margin-bottom: 5px; | ||
} | ||
|
||
.control-label { | ||
text-align: left; | ||
} | ||
|
||
.checkbox-primary { | ||
input { | ||
width: 23px; | ||
height: 15px; | ||
margin-left: 0; | ||
cursor: pointer; | ||
} | ||
label { | ||
&:before, | ||
&:after { | ||
margin-left: 0; | ||
} | ||
cursor: auto; | ||
} | ||
} | ||
|
||
.form-group { | ||
.col-sm-6 { | ||
padding-top: 7px; | ||
} | ||
} |
Oops, something went wrong.