2020-06-12 17:40:18 +00:00
|
|
|
<template>
|
2021-08-29 12:39:52 +00:00
|
|
|
<div class="d-flex flex-align-center">
|
|
|
|
<b-button class="m-1 mr-3" variant="secondary" size="sm" @click="refreshAll(true)">
|
|
|
|
<RefreshIcon :size="16" />
|
|
|
|
</b-button>
|
|
|
|
|
|
|
|
<b-form-checkbox
|
|
|
|
v-model="autoRefreshLoc"
|
|
|
|
class="ml-auto float-right mr-2 my-auto"
|
|
|
|
title="AutoRefresh"
|
|
|
|
variant="secondary"
|
|
|
|
>AutoRefresh</b-form-checkbox
|
|
|
|
>
|
2020-06-12 17:40:18 +00:00
|
|
|
</div>
|
|
|
|
</template>
|
|
|
|
|
2020-07-19 13:30:34 +00:00
|
|
|
<script lang="ts">
|
2021-08-29 13:40:54 +00:00
|
|
|
import { Component, Vue } from 'vue-property-decorator';
|
|
|
|
import { Getter, namespace } from 'vuex-class';
|
2020-11-13 19:19:16 +00:00
|
|
|
import RefreshIcon from 'vue-material-design-icons/Refresh.vue';
|
2020-07-19 13:30:34 +00:00
|
|
|
|
2021-08-29 12:39:52 +00:00
|
|
|
const ftbot = namespace('ftbot');
|
|
|
|
|
2020-11-13 19:19:16 +00:00
|
|
|
@Component({ components: { RefreshIcon } })
|
2020-07-19 13:30:34 +00:00
|
|
|
export default class ReloadControl extends Vue {
|
2020-09-07 18:44:57 +00:00
|
|
|
refreshInterval: number | null = null;
|
2020-07-19 13:30:34 +00:00
|
|
|
|
2020-09-07 18:44:57 +00:00
|
|
|
refreshIntervalSlow: number | null = null;
|
2020-07-19 13:30:34 +00:00
|
|
|
|
2020-06-12 17:40:18 +00:00
|
|
|
created() {
|
2020-07-19 13:35:10 +00:00
|
|
|
if (this.loggedIn) {
|
|
|
|
this.refreshOnce();
|
2020-11-10 19:24:00 +00:00
|
|
|
this.refreshAll(true);
|
2020-07-19 13:35:10 +00:00
|
|
|
}
|
2020-07-19 13:30:34 +00:00
|
|
|
}
|
|
|
|
|
2020-06-12 17:40:18 +00:00
|
|
|
mounted() {
|
2021-04-18 17:41:19 +00:00
|
|
|
this.startRefresh(false);
|
2020-07-19 13:30:34 +00:00
|
|
|
}
|
|
|
|
|
2020-06-12 17:40:18 +00:00
|
|
|
beforeDestroy() {
|
|
|
|
this.stopRefresh();
|
2020-07-19 13:30:34 +00:00
|
|
|
}
|
|
|
|
|
2021-08-29 07:42:00 +00:00
|
|
|
// TODO-multi: This should be per bot!
|
2021-08-28 18:23:20 +00:00
|
|
|
@Getter loggedIn;
|
2020-07-19 13:35:10 +00:00
|
|
|
|
2021-08-29 12:39:52 +00:00
|
|
|
@ftbot.Getter autoRefresh!: boolean;
|
2020-07-23 17:58:25 +00:00
|
|
|
|
2020-09-08 13:45:01 +00:00
|
|
|
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
2021-08-29 12:39:52 +00:00
|
|
|
@ftbot.Action setAutoRefresh!: (newValue: boolean) => void;
|
2020-07-23 17:58:25 +00:00
|
|
|
|
2021-08-29 12:39:52 +00:00
|
|
|
@ftbot.Action refreshAll;
|
2020-07-19 13:30:34 +00:00
|
|
|
|
2021-08-29 12:39:52 +00:00
|
|
|
@ftbot.Action refreshOnce;
|
2020-07-19 13:30:34 +00:00
|
|
|
|
2021-08-29 13:40:54 +00:00
|
|
|
@ftbot.Action startRefresh;
|
|
|
|
|
|
|
|
@ftbot.Action stopRefresh;
|
|
|
|
|
2020-07-23 17:58:25 +00:00
|
|
|
get autoRefreshLoc() {
|
|
|
|
return this.autoRefresh;
|
|
|
|
}
|
|
|
|
|
|
|
|
set autoRefreshLoc(newValue: boolean) {
|
|
|
|
this.setAutoRefresh(newValue);
|
|
|
|
}
|
2020-07-19 13:30:34 +00:00
|
|
|
}
|
2020-06-12 17:40:18 +00:00
|
|
|
</script>
|
|
|
|
|
2020-07-26 08:48:07 +00:00
|
|
|
<style scoped></style>
|