Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added default values to Advanced Settings UI form and updated value change check #2282

Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 8 additions & 6 deletions ui/src/app/modules/settings/settings.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,11 @@ export class SettingsComponent implements OnInit {

public originalUiSettingsForm = {
port: 0,
// Default values
auth: 'form',
theme: 'auto',
tempUnits: 'c',
lang: 'auto',
}

public originalLoginWallpaper = ''
Expand Down Expand Up @@ -112,14 +117,11 @@ export class SettingsComponent implements OnInit {
port: this.$settings.env.port,
})
this.uiSettingsForm.valueChanges.pipe(debounceTime(500)).subscribe((data) => {
let hasChangedUiSettings = false
Object.keys(data).forEach((key) => {
if (this.originalUiSettingsForm[key] !== data[key]) {
this.saveUiSettingChange(key, data[key])
hasChangedUiSettings = true
}
const newValue = (data[key] === undefined || data[key] === '') ? this.originalUiSettingsForm[key] : data[key];
this.saveUiSettingChange(key, data[key])
})
this.hasChangedUiSettings = hasChangedUiSettings
this.hasChangedUiSettings = true
})
}

Expand Down
Loading