+
diff --git a/client/src/app/site/config/components/config-field/config-field.component.scss b/client/src/app/site/config/components/config-field/config-field.component.scss
index 4ebea5d50..0552f594b 100644
--- a/client/src/app/site/config/components/config-field/config-field.component.scss
+++ b/client/src/app/site/config/components/config-field/config-field.component.scss
@@ -24,3 +24,17 @@ input[type='color'] {
.error {
color: #f44336;
}
+
+.config-field-wrapper {
+ width: 100%;
+ display: flex;
+
+ .form-item {
+ flex: 2;
+ }
+ .reset-button {
+ max-width: 30px;
+ width: 30px;
+ flex: 1;
+ }
+}
diff --git a/client/src/app/site/config/components/config-field/config-field.component.ts b/client/src/app/site/config/components/config-field/config-field.component.ts
index d9f99f604..69ed29782 100644
--- a/client/src/app/site/config/components/config-field/config-field.component.ts
+++ b/client/src/app/site/config/components/config-field/config-field.component.ts
@@ -133,6 +133,15 @@ export class ConfigFieldComponent extends BaseComponent implements OnInit {
this.cdRef.detectChanges();
}
+ /**
+ * Triggers a reset to the default value (if a default value is present)
+ */
+ public onResetButton(): void {
+ if (this.configItem.hasDefault) {
+ this.onChange(this.configItem.defaultValue);
+ }
+ }
+
/**
* Updates the config field.
* @param value The new value to set.
diff --git a/client/src/app/site/config/models/view-config.ts b/client/src/app/site/config/models/view-config.ts
index 0b863a99e..e98fad628 100644
--- a/client/src/app/site/config/models/view-config.ts
+++ b/client/src/app/site/config/models/view-config.ts
@@ -46,6 +46,7 @@ export class ViewConfig extends BaseViewModel {
private _inputType: ConfigInputType;
private _label: string;
private _choices: ConfigChoice[];
+ private _defaultValue: any;
/**
* Saves, if this config already got constants information.
@@ -88,6 +89,18 @@ export class ViewConfig extends BaseViewModel {
return this._choices;
}
+ /**
+ * @returns true if a default value exists
+ */
+ public get hasDefault(): boolean {
+ return this._defaultValue !== undefined;
+ }
+
+ public get defaultValue(): any {
+ // TODO type is ugly
+ return this._defaultValue;
+ }
+
public constructor(config: Config) {
super();
this._config = config;
@@ -123,6 +136,9 @@ export class ViewConfig extends BaseViewModel {
this._helpText = constant.help_text;
this._inputType = constant.input_type;
this._choices = constant.choices;
+ if (constant.default_value !== undefined) {
+ this._defaultValue = constant.default_value;
+ }
this._hasConstantsInfo = true;
}