This commit is contained in:
2020-11-03 00:08:10 +00:00
parent 259aa1be7b
commit bdfeabe03f
5 changed files with 51 additions and 13 deletions

View File

@@ -532,7 +532,21 @@ export default {
r = await that.extractBodyEx(r);
return r;
} catch (error) {
handleError("UPSERT", error, route);
handleError("PUT", error, route);
}
},
///////////////////////////////////
// POST DATA TO API SERVER
// (used for post only routes not needing upserts)
async post(route, data) {
try {
let that = this;
let r = await fetch(that.APIUrl(route), that.fetchPostOptions(data));
that.statusEx(r);
r = await that.extractBodyEx(r);
return r;
} catch (error) {
handleError("POST", error, route);
}
},
///////////////////////////////////

View File

@@ -125,6 +125,7 @@ export default {
moreUrl: String,
count: { type: Number, default: 0 },
updateFrequency: { type: Number, default: 60000 },
maxListItems: { type: Number, default: 10 },
icon: { type: String, default: "$ayiTachometer" }
},
created() {

View File

@@ -2,34 +2,54 @@
<gz-dash
icon="$ayiSplotch"
:updateFrequency="60000"
v-on:dash-refresh="loadData"
v-on:dash-refresh="getDataFromApi()"
v-on="$listeners"
v-bind="$attrs"
>
<template slot="main">
<div class="ml-4 mt-1 d-flex align-center">
<div>
<span class="green--text">LIST PRICIEST WIDGETS CONTENT HERE</span>
max list items:{{ maxListItems }}
<span class="green--text">{{ obj }}</span>
</div>
</div>
</template>
</gz-dash>
</template>
<script>
/*
*/
import GzDash from "../components/dash-base.vue";
const LIST_VIEW = {
offset: 0,
limit: 10,
dataListKey: "TestWidgetDataList",
listView: '[{"fld":"widgetname"},{"fld":"widgetdollaramount","sort":"-"}]'
};
export default {
components: {
GzDash
},
data() {
return {};
return { obj: [] };
},
props: {
maxListItems: { type: Number, default: 10 }
},
props: {},
created() {},
computed: {},
methods: {
loadData: function() {
console.log("dash-test-widgets-priciest::loadData");
async getDataFromApi() {
let lv = LIST_VIEW;
lv.limit = this.maxListItems;
let res = await window.$gz.api.post("data-list", lv);
if (!res.error) {
this.obj = res.data;
} else {
this.obj = [];
}
}
}
};

View File

@@ -67,6 +67,7 @@
<component
:is="item.type"
v-bind="item"
:maxListItems="10"
v-on:dash-remove="dashRemove"
v-on:dash-move-start="dashMoveStart"
v-on:dash-move-back="dashMoveBack"
@@ -81,7 +82,7 @@
<script>
const FORM_KEY = "home-dashboard";
import DashRegistry from "../api/dash-registry";
import GzDashBase from "../components/dash-base.vue";
//---------- DASH ITEMS ----------
import GzDashTestListWidgetsPriciest from "../components/dash-test-list-widgets-priciest.vue";
import GzDashTestBarWidgetCountByUserType from "../components/dash-test-bar-widget-count-by-usertype.vue";
@@ -90,7 +91,6 @@ import GzDashTestDayCalendarWidget from "../components/dash-test-day-calendar-wi
export default {
components: {
GzDashBase,
GzDashTestListWidgetsPriciest,
GzDashTestBarWidgetCountByUserType,
GzDashTestLineWidgetMonthlyTotalPrice,