Enable AbstractViewSettings

This commit is contained in:
the-djmaze 2022-02-28 10:38:47 +01:00
parent 92cec80b73
commit 97bc3ef585
20 changed files with 149 additions and 212 deletions

View file

@ -1,40 +1,10 @@
import { SaveSettingsStep } from 'Common/Enums';
import { SettingsGet } from 'Common/Globals';
import { settingsSaveHelperSimpleFunction } from 'Common/Utils';
import { addObservablesTo, addSubscribablesTo } from 'External/ko';
import { AbstractViewSettings } from 'Knoin/AbstractViews';
import Remote from 'Remote/Admin/Fetch';
export class BrandingAdminSettings /*extends AbstractViewSettings*/ {
export class BrandingAdminSettings extends AbstractViewSettings {
constructor() {
addObservablesTo(this, {
title: SettingsGet('Title'),
loadingDesc: SettingsGet('LoadingDescription'),
faviconUrl: SettingsGet('FaviconUrl'),
titleTrigger: SaveSettingsStep.Idle,
loadingDescTrigger: SaveSettingsStep.Idle,
faviconUrlTrigger: SaveSettingsStep.Idle
});
addSubscribablesTo(this, {
title: (value =>
Remote.saveConfig({
Title: value.trim()
}, settingsSaveHelperSimpleFunction(this.titleTrigger, this))
).debounce(999),
loadingDesc: (value =>
Remote.saveConfig({
LoadingDescription: value.trim()
}, settingsSaveHelperSimpleFunction(this.loadingDescTrigger, this))
).debounce(999),
faviconUrl: (value =>
Remote.saveConfig({
FaviconUrl: value.trim()
}, settingsSaveHelperSimpleFunction(this.faviconUrlTrigger, this))
).debounce(999)
});
super();
this.addSetting('Title');
this.addSetting('LoadingDescription');
this.addSetting('FaviconUrl');
}
}