Changeset View
Changeset View
Standalone View
Standalone View
src/resources/vue/Admin/Stats.vue
<template> | <template> | ||||
<div id="stats-container" class="container"> | <div id="stats-container" class="container"></div> | ||||
</div> | |||||
</template> | </template> | ||||
<script> | <script> | ||||
import { Chart } from 'frappe-charts/dist/frappe-charts.esm.js' | import { Chart } from 'frappe-charts/dist/frappe-charts.esm.js' | ||||
export default { | export default { | ||||
data() { | data() { | ||||
return { | return { | ||||
Show All 22 Lines | export default { | ||||
axios.get('/api/v4/stats/chart/' + name) | axios.get('/api/v4/stats/chart/' + name) | ||||
.then(response => { | .then(response => { | ||||
this.$root.removeLoader(chart) | this.$root.removeLoader(chart) | ||||
this.drawChart(name, response.data) | this.drawChart(name, response.data) | ||||
}) | }) | ||||
.catch(error => { | .catch(error => { | ||||
console.error(error) | console.error(error) | ||||
this.$root.removeLoader(chart) | this.$root.removeLoader(chart) | ||||
chart.append($('<span>').text('Failed to load data.')) | chart.append($('<span>').text(this.$t('msg.loading-failed'))) | ||||
}) | }) | ||||
} | } | ||||
} | } | ||||
} | } | ||||
</script> | </script> |