Skip to content

armgit / dashy

Public Imported from GitHub
0

πŸš€ A self-hostable personal dashboard built for you. Includes status-checking, widgets, themes, icon packs, a UI editor and tons more!

:zap: Refactors NetData widget data requeest

Alicia Sykeseb1bc69155a3
diff --git a/src/components/Widgets/NdCpuHistory.vue b/src/components/Widgets/NdCpuHistory.vue
index 52ce8ca1..49e74ffe 100644
--- a/src/components/Widgets/NdCpuHistory.vue
+++ b/src/components/Widgets/NdCpuHistory.vue
@@ -33,9 +33,7 @@ export default {
methods: {
/* Make GET request to NetData */
fetchData() {
- this.makeRequest(this.endpoint).then(
- (response) => { this.processData(response); },
- );
+ this.makeRequest(this.endpoint).then(this.processData);
},
/* Assign data variables to the returned data */
processData(inputData) {
diff --git a/src/components/Widgets/NdLoadHistory.vue b/src/components/Widgets/NdLoadHistory.vue
index 2d10bb05..3be50f64 100644
--- a/src/components/Widgets/NdLoadHistory.vue
+++ b/src/components/Widgets/NdLoadHistory.vue
@@ -3,7 +3,6 @@
</template>
<script>
-import axios from 'axios';
import WidgetMixin from '@/mixins/WidgetMixin';
import ChartingMixin from '@/mixins/ChartingMixin';
@@ -34,16 +33,7 @@ export default {
methods: {
/* Make GET request to NetData */
fetchData() {
- axios.get(this.endpoint)
- .then((response) => {
- this.processData(response.data);
- })
- .catch((dataFetchError) => {
- this.error('Unable to fetch data', dataFetchError);
- })
- .finally(() => {
- this.finishLoading();
- });
+ this.makeRequest(this.endpoint).then(this.processData);
},
/* Assign data variables to the returned data */
processData(data) {
diff --git a/src/components/Widgets/NdRamHistory.vue b/src/components/Widgets/NdRamHistory.vue
index b65024c1..69be2932 100644
--- a/src/components/Widgets/NdRamHistory.vue
+++ b/src/components/Widgets/NdRamHistory.vue
@@ -36,9 +36,7 @@ export default {
methods: {
/* Make GET request to NetData */
fetchData() {
- this.makeRequest(this.endpoint).then(
- (response) => { this.processData(response); },
- );
+ this.makeRequest(this.endpoint).then(this.processData);
},
/* Assign data variables to the returned data */
processData(inputData) {
diff --git a/src/components/Widgets/WidgetBase.vue b/src/components/Widgets/WidgetBase.vue
index 07f98c81..b03967f4 100644
--- a/src/components/Widgets/WidgetBase.vue
+++ b/src/components/Widgets/WidgetBase.vue
@@ -196,7 +196,7 @@
:ref="widgetRef"
/>
<GlNetworkTraffic
- v-else-if="widgetType === 'gl-network-activity'"
+ v-else-if="widgetType === 'gl-network-traffic'"
:options="widgetOptions"
@loading="setLoaderState"
@error="handleError"