From cc96d9877b2fdbea2a3eb3bd7f4cda42975ca5ce Mon Sep 17 00:00:00 2001
From: Lance Edgar
Date: Mon, 6 Apr 2020 13:12:38 -0500
Subject: [PATCH] Defer fetching price, cost history when viewing product
details
user can ask for that history if they need it, but it's too expensive to always
fetch by default for initial page load
---
tailbone/templates/page.mako | 3 +-
tailbone/templates/products/view.mako | 123 ++++++++++++++++++++++++--
tailbone/views/products.py | 105 ++++++++++++++++++++--
3 files changed, 213 insertions(+), 18 deletions(-)
diff --git a/tailbone/templates/page.mako b/tailbone/templates/page.mako
index 1dbd333b..2d8227d4 100644
--- a/tailbone/templates/page.mako
+++ b/tailbone/templates/page.mako
@@ -32,7 +32,8 @@
let ThisPage = {
template: '#this-page-template',
- methods: {}
+ computed: {},
+ methods: {},
}
let ThisPageData = {
diff --git a/tailbone/templates/products/view.mako b/tailbone/templates/products/view.mako
index 99f555ae..c8f2a5ec 100644
--- a/tailbone/templates/products/view.mako
+++ b/tailbone/templates/products/view.mako
@@ -305,7 +305,7 @@
Vendor Sources
% if request.rattail_config.versioning_enabled() and master.has_perm('versions'):
-
+
(view cost history)
% endif
@@ -380,7 +380,7 @@
- ${regular_price_history_grid.render_buefy_table_element(data_prop='regularPriceHistoryData')|n}
+ ${regular_price_history_grid.render_buefy_table_element(data_prop='regularPriceHistoryData', loading='regularPriceHistoryLoading')|n}
- ${current_price_history_grid.render_buefy_table_element(data_prop='currentPriceHistoryData')|n}
+ ${current_price_history_grid.render_buefy_table_element(data_prop='currentPriceHistoryData', loading='currentPriceHistoryLoading')|n}