⚡ Refactors all Glances widgets to inherit from parent mixin
This commit is contained in:
@@ -6,31 +6,25 @@
|
||||
|
||||
<script>
|
||||
import WidgetMixin from '@/mixins/WidgetMixin';
|
||||
import GlancesMixin from '@/mixins/GlancesMixin';
|
||||
import ChartingMixin from '@/mixins/ChartingMixin';
|
||||
import { timestampToTime, getTimeAgo } from '@/utils/MiscHelpers';
|
||||
|
||||
export default {
|
||||
mixins: [WidgetMixin, ChartingMixin],
|
||||
mixins: [WidgetMixin, GlancesMixin, ChartingMixin],
|
||||
components: {},
|
||||
data() {
|
||||
return {};
|
||||
},
|
||||
computed: {
|
||||
hostname() {
|
||||
if (!this.options.hostname) this.error('You must specify a \'hostname\' for Glaces');
|
||||
return this.options.hostname;
|
||||
},
|
||||
limit() {
|
||||
return this.options.limit || 500;
|
||||
},
|
||||
endpoint() {
|
||||
return `${this.hostname}/api/3/load/history/${this.limit}`;
|
||||
return this.makeGlancesUrl(`load/history/${this.limit}`);
|
||||
},
|
||||
},
|
||||
methods: {
|
||||
fetchData() {
|
||||
this.makeRequest(this.endpoint).then(this.processData);
|
||||
},
|
||||
processData(loadData) {
|
||||
const labels = [];
|
||||
const min1 = [];
|
||||
|
||||
Reference in New Issue
Block a user