{"version":3,"sources":["webpack:///./src/components/Apis/ApiUsage.vue","webpack:///src/components/Apis/ApiUsage.vue","webpack:///./src/components/Apis/ApiUsage.vue?6f92","webpack:///./src/components/Apis/ApiUsage.vue?57b9"],"names":["render","_vm","this","_c","_self","staticClass","showChart","staticStyle","attrs","chartData","options","_e","staticRenderFns","components","BarChart","props","apiId","type","Number","default","data","date","Date","startDate","setDate","getDate","endDate","dataLoaded","labels","datasets","scales","yAxes","ticks","beginAtZero","gridLines","display","xAxes","legend","responsive","maintainAspectRatio","computed","created","getApiUsage","mounted","methods","_this","self","statsProvider","format","then","response","status","dataset","i","length","d","push","NrOfCalls","label","fill","borderColor","backgroundColor","borderWidth","finally","component"],"mappings":"yHAAA,IAAIA,EAAS,WAAkB,IAAIC,EAAIC,KAAKC,EAAGF,EAAIG,MAAMD,GAAG,OAAOA,EAAG,MAAM,CAACE,YAAY,YAAY,CAAEJ,EAAIK,UAAWH,EAAG,WAAW,CAACI,YAAY,CAAC,aAAa,SAASC,MAAM,CAAC,UAAYP,EAAIQ,UAAU,QAAUR,EAAIS,WAAWT,EAAIU,MAAM,IAExOC,EAAkB,G,4ECaP,GACfC,WAAA,CACAC,SAAA,yGAGAC,MAAA,CACAC,MAAA,CACAC,KAAAC,OACAC,QAAA,IAIAC,KAAA,WACA,IAAAC,EAAA,IAAAC,KAEA,OACAC,UAAA,IAAAD,KAAAD,EAAAG,QAAAH,EAAAI,UAAA,KACAC,QAAA,IAAAJ,KACAF,KAAA,KACAO,YAAA,EACArB,WAAA,EAEAG,UAAA,CACAmB,OAAA,GACAC,SAAA,IAGAnB,QAAA,CACAoB,OAAA,CACAC,MAAA,CACA,CACAC,MAAA,CACAC,aAAA,GAEAC,UAAA,CACAC,SAAA,KAIAC,MAAA,CACA,CACAF,UAAA,CACAC,SAAA,MAKAE,OAAA,CACAF,SAAA,GAEAG,YAAA,EACAC,qBAAA,KAKAC,SAAA,GAEAC,QAAA,WACA,KAAAC,eAGAC,QAAA,aAEAC,QAAA,CACAF,YAAA,eAAAG,EAAA,KACAC,EAAA,KAEAC,OAAAH,QACAF,YACAM,eAAAF,EAAAvB,UAAA,cACAyB,eAAAF,EAAApB,QAAA,cACAoB,EAAA9B,OAEAiC,MAAA,SAAAC,GACA,SAAAA,EAAAC,OAAA,CACAL,EAAA1B,KAAA8B,EAAA9B,KAKA,IAHA,IAAAQ,EAAA,GACAwB,EAAA,GAEAC,EAAA,EAAAA,EAAAP,EAAA1B,KAAAkC,OAAAD,IAAA,CACA,IAAAE,EAAAT,EAAA1B,KAAAiC,GAEAzB,EAAA4B,KAAAR,eAAAO,EAAAjC,KAAA,eACA8B,EAAAI,KAAAD,EAAAE,WAGAX,EAAArC,UAAAmB,SACAkB,EAAArC,UAAAoB,SAAA2B,KAAA,CACAE,MAAA,cACAtC,KAAAgC,EACAO,MAAA,EACAC,YAAA,UACAC,gBAAA,UACAC,YAAA,IAIAjB,EAAAvC,WAAA,MAGAyD,SAAA,WACAlB,EAAAlB,YAAA,QCtHgW,I,YCO5VqC,EAAY,eACd,EACAhE,EACAY,GACA,EACA,KACA,KACA,MAIa,aAAAoD,E","file":"js/chunk-2d0abe0e.js?id=40a067e41ed413f7ca7f","sourcesContent":["var render = function render(){var _vm=this,_c=_vm._self._c;return _c('div',{staticClass:\"bar-Char\"},[(_vm.showChart)?_c('BarChart',{staticStyle:{\"min-height\":\"250px\"},attrs:{\"chartdata\":_vm.chartData,\"options\":_vm.options}}):_vm._e()],1)\n}\nvar staticRenderFns = []\n\nexport { render, staticRenderFns }","<template>\n  <div class=\"bar-Char\">\n    <BarChart\n      v-if=\"showChart\"\n      :chartdata=\"chartData\"\n      :options=\"options\"\n      style=\"min-height: 250px;\"\n    />\n  </div>\n</template>\n\n<script>\nimport statsProvider from '@/providers/stats'\nimport { format } from 'date-fns'\n\nexport default {\n  components: {\n    BarChart: () => import('@/components/UI/Charts/BarChart'),\n  },\n\n  props: {\n    apiId: {\n      type: Number,\n      default: 0,\n    },\n  },\n\n  data() {\n    let date = new Date()\n\n    return {\n      startDate: new Date(date.setDate(date.getDate() - 30)),\n      endDate: new Date(),\n      data: null,\n      dataLoaded: false,\n      showChart: false,\n\n      chartData: {\n        labels: [],\n        datasets: [],\n      },\n\n      options: {\n        scales: {\n          yAxes: [\n            {\n              ticks: {\n                beginAtZero: true,\n              },\n              gridLines: {\n                display: true,\n              },\n            },\n          ],\n          xAxes: [\n            {\n              gridLines: {\n                display: false,\n              },\n            },\n          ],\n        },\n        legend: {\n          display: true,\n        },\n        responsive: true,\n        maintainAspectRatio: false,\n      },\n    }\n  },\n\n  computed: {},\n\n  created() {\n    this.getApiUsage()\n  },\n\n  mounted() {},\n\n  methods: {\n    getApiUsage() {\n      let self = this\n\n      statsProvider.methods\n        .getApiUsage(\n          format(self.startDate, 'yyyy-MM-dd'),\n          format(self.endDate, 'yyyy-MM-dd'),\n          self.apiId\n        )\n        .then((response) => {\n          if (response.status === 200) {\n            self.data = response.data\n\n            let labels = []\n            let dataset = []\n\n            for (let i = 0; i < self.data.length; i++) {\n              let d = self.data[i]\n\n              labels.push(format(d.Date, 'yyyy-MM-dd'))\n              dataset.push(d.NrOfCalls)\n            }\n\n            self.chartData.labels = labels\n            self.chartData.datasets.push({\n              label: 'Nr of calls',\n              data: dataset,\n              fill: false,\n              borderColor: '#209CEE',\n              backgroundColor: '#209CEE',\n              borderWidth: 1,\n            })\n\n            //self.renderChart(self.chartData, self.options)\n            this.showChart = true\n          }\n        })\n        .finally(() => {\n          this.dataLoaded = true\n        })\n    },\n  },\n}\n</script>\n\n<style></style>\n","import mod from \"-!../../../node_modules/cache-loader/dist/cjs.js??ref--13-0!../../../node_modules/thread-loader/dist/cjs.js!../../../node_modules/babel-loader/lib/index.js!../../../node_modules/cache-loader/dist/cjs.js??ref--1-0!../../../node_modules/vue-loader/lib/index.js??vue-loader-options!./ApiUsage.vue?vue&type=script&lang=js\"; export default mod; export * from \"-!../../../node_modules/cache-loader/dist/cjs.js??ref--13-0!../../../node_modules/thread-loader/dist/cjs.js!../../../node_modules/babel-loader/lib/index.js!../../../node_modules/cache-loader/dist/cjs.js??ref--1-0!../../../node_modules/vue-loader/lib/index.js??vue-loader-options!./ApiUsage.vue?vue&type=script&lang=js\"","import { render, staticRenderFns } from \"./ApiUsage.vue?vue&type=template&id=53446746\"\nimport script from \"./ApiUsage.vue?vue&type=script&lang=js\"\nexport * from \"./ApiUsage.vue?vue&type=script&lang=js\"\n\n\n/* normalize component */\nimport normalizer from \"!../../../node_modules/vue-loader/lib/runtime/componentNormalizer.js\"\nvar component = normalizer(\n  script,\n  render,\n  staticRenderFns,\n  false,\n  null,\n  null,\n  null\n  \n)\n\nexport default component.exports"],"sourceRoot":""}