mirror of
https://github.com/freqtrade/frequi.git
synced 2024-11-23 19:45:15 +00:00
Add backgroundsync Setting
This commit is contained in:
parent
0ce64a17ea
commit
3718ba007a
|
@ -11,21 +11,25 @@ export enum OpenTradeVizOptions {
|
||||||
export enum SettingsGetters {
|
export enum SettingsGetters {
|
||||||
openTradesInTitle = 'openTradesInTitle',
|
openTradesInTitle = 'openTradesInTitle',
|
||||||
timezone = 'timezone',
|
timezone = 'timezone',
|
||||||
|
backgroundSync = 'backgroundSync',
|
||||||
}
|
}
|
||||||
|
|
||||||
export enum SettingsActions {
|
export enum SettingsActions {
|
||||||
setOpenTradesInTitle = 'setOpenTradesInTitle',
|
setOpenTradesInTitle = 'setOpenTradesInTitle',
|
||||||
setTimeZone = 'setTimeZone',
|
setTimeZone = 'setTimeZone',
|
||||||
|
setBackgroundSync = 'setBackgroundSync',
|
||||||
}
|
}
|
||||||
|
|
||||||
export enum SettingsMutations {
|
export enum SettingsMutations {
|
||||||
setOpenTrades = 'setOpenTrades',
|
setOpenTrades = 'setOpenTrades',
|
||||||
setTimeZone = 'setTimeZone',
|
setTimeZone = 'setTimeZone',
|
||||||
|
setBackgroundSync = 'setBackgroundSync',
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface SettingsType {
|
export interface SettingsType {
|
||||||
openTradesInTitle: string;
|
openTradesInTitle: string;
|
||||||
timezone: string;
|
timezone: string;
|
||||||
|
backgroundSync: boolean;
|
||||||
}
|
}
|
||||||
|
|
||||||
function getSettings() {
|
function getSettings() {
|
||||||
|
@ -37,7 +41,7 @@ function getSettings() {
|
||||||
}
|
}
|
||||||
const storedSettings = getSettings();
|
const storedSettings = getSettings();
|
||||||
|
|
||||||
function updateSetting(key: string, value: string) {
|
function updateSetting(key: string, value: string | boolean) {
|
||||||
const settings = getSettings() || {};
|
const settings = getSettings() || {};
|
||||||
settings[key] = value;
|
settings[key] = value;
|
||||||
localStorage.setItem(STORE_UI_SETTINGS, JSON.stringify(settings));
|
localStorage.setItem(STORE_UI_SETTINGS, JSON.stringify(settings));
|
||||||
|
@ -46,18 +50,22 @@ function updateSetting(key: string, value: string) {
|
||||||
const state: SettingsType = {
|
const state: SettingsType = {
|
||||||
openTradesInTitle: storedSettings?.openTradesInTitle || OpenTradeVizOptions.showPill,
|
openTradesInTitle: storedSettings?.openTradesInTitle || OpenTradeVizOptions.showPill,
|
||||||
timezone: storedSettings.timezone || 'UTC',
|
timezone: storedSettings.timezone || 'UTC',
|
||||||
|
backgroundSync: storedSettings.backgroundSync || true,
|
||||||
};
|
};
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
namespaced: true,
|
namespaced: true,
|
||||||
state,
|
state,
|
||||||
getters: {
|
getters: {
|
||||||
[SettingsGetters.openTradesInTitle](state) {
|
[SettingsGetters.openTradesInTitle](state): string {
|
||||||
return state.openTradesInTitle;
|
return state.openTradesInTitle;
|
||||||
},
|
},
|
||||||
[SettingsGetters.timezone](state) {
|
[SettingsGetters.timezone](state): string {
|
||||||
return state.timezone;
|
return state.timezone;
|
||||||
},
|
},
|
||||||
|
[SettingsGetters.backgroundSync](state): boolean {
|
||||||
|
return state.backgroundSync;
|
||||||
|
},
|
||||||
},
|
},
|
||||||
mutations: {
|
mutations: {
|
||||||
[SettingsMutations.setOpenTrades](state, value: string) {
|
[SettingsMutations.setOpenTrades](state, value: string) {
|
||||||
|
@ -68,6 +76,10 @@ export default {
|
||||||
state.timezone = timezone;
|
state.timezone = timezone;
|
||||||
updateSetting('timezone', timezone);
|
updateSetting('timezone', timezone);
|
||||||
},
|
},
|
||||||
|
[SettingsMutations.setBackgroundSync](state, backgroundSync: boolean) {
|
||||||
|
state.backgroundSync = backgroundSync;
|
||||||
|
updateSetting('backgroundSync', backgroundSync);
|
||||||
|
},
|
||||||
},
|
},
|
||||||
actions: {
|
actions: {
|
||||||
[SettingsActions.setOpenTradesInTitle]({ commit }, locked: boolean) {
|
[SettingsActions.setOpenTradesInTitle]({ commit }, locked: boolean) {
|
||||||
|
@ -77,5 +89,8 @@ export default {
|
||||||
setTimezone(timezone);
|
setTimezone(timezone);
|
||||||
commit(SettingsMutations.setTimeZone, timezone);
|
commit(SettingsMutations.setTimeZone, timezone);
|
||||||
},
|
},
|
||||||
|
[SettingsActions.setBackgroundSync]({ commit }, timezone: string) {
|
||||||
|
commit(SettingsMutations.setBackgroundSync, timezone);
|
||||||
|
},
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
|
@ -22,6 +22,9 @@
|
||||||
>
|
>
|
||||||
<b-form-select v-model="timezoneLoc" :options="timezoneOptions"></b-form-select>
|
<b-form-select v-model="timezoneLoc" :options="timezoneOptions"></b-form-select>
|
||||||
</b-form-group>
|
</b-form-group>
|
||||||
|
<b-form-group description="Keep background sync running while other bots are selected.">
|
||||||
|
<b-checkbox v-model="backgroundSyncLocal">Background sync</b-checkbox>
|
||||||
|
</b-form-group>
|
||||||
</div>
|
</div>
|
||||||
</b-card>
|
</b-card>
|
||||||
</div>
|
</div>
|
||||||
|
@ -46,10 +49,14 @@ export default class Template extends Vue {
|
||||||
|
|
||||||
@uiSettingsNs.Getter [SettingsGetters.timezone]: string;
|
@uiSettingsNs.Getter [SettingsGetters.timezone]: string;
|
||||||
|
|
||||||
|
@uiSettingsNs.Getter [SettingsGetters.backgroundSync]: boolean;
|
||||||
|
|
||||||
@uiSettingsNs.Action [SettingsActions.setOpenTradesInTitle];
|
@uiSettingsNs.Action [SettingsActions.setOpenTradesInTitle];
|
||||||
|
|
||||||
@uiSettingsNs.Action [SettingsActions.setTimeZone];
|
@uiSettingsNs.Action [SettingsActions.setTimeZone];
|
||||||
|
|
||||||
|
@uiSettingsNs.Action [SettingsActions.setBackgroundSync];
|
||||||
|
|
||||||
openTradesOptions = [
|
openTradesOptions = [
|
||||||
{ value: OpenTradeVizOptions.showPill, text: 'Show pill in icon' },
|
{ value: OpenTradeVizOptions.showPill, text: 'Show pill in icon' },
|
||||||
{ value: OpenTradeVizOptions.asTitle, text: 'Show in title' },
|
{ value: OpenTradeVizOptions.asTitle, text: 'Show in title' },
|
||||||
|
@ -82,6 +89,14 @@ export default class Template extends Vue {
|
||||||
set layoutLockedLocal(value: boolean) {
|
set layoutLockedLocal(value: boolean) {
|
||||||
this.setLayoutLocked(value);
|
this.setLayoutLocked(value);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
get backgroundSyncLocal(): boolean {
|
||||||
|
return this.backgroundSync;
|
||||||
|
}
|
||||||
|
|
||||||
|
set backgroundSyncLocal(value: boolean) {
|
||||||
|
this.setBackgroundSync(value);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user