misc: use mtime of schema as last update time (#41836)
This commit is contained in:
parent
eaa10963ef
commit
d1cddf2117
|
@ -415,7 +415,7 @@ class Cube(Base):
|
|||
|
||||
|
||||
class Warehouse(Base):
|
||||
__slots__ = ['name', 'slug', 'label', 'pg_dsn', 'search_path', 'cubes', 'path']
|
||||
__slots__ = ['name', 'slug', 'label', 'pg_dsn', 'search_path', 'cubes', 'path', 'timestamp']
|
||||
__types__ = {
|
||||
'name': str,
|
||||
'slug': str,
|
||||
|
@ -429,6 +429,7 @@ class Warehouse(Base):
|
|||
def __init__(self, **kwargs):
|
||||
self.path = None
|
||||
self.slug = None
|
||||
self.timestamp = None
|
||||
super(Warehouse, self).__init__(**kwargs)
|
||||
|
||||
def check(self):
|
||||
|
|
|
@ -71,6 +71,7 @@
|
|||
<a rel="popup" href="{% url "create-visualization" warehouse=warehouse.name cube=cube.name %}?{% firstof view.request.POST.urlencode view.request.GET.urlencode %}"
|
||||
title="{{ visualization.title }}" class="button">{% trans "Save" %}</a>
|
||||
{% endblock %}
|
||||
<p>{% trans "Last update" %} {{ warehouse.timestamp }}</p>
|
||||
{% else %}
|
||||
<div class="big-msg-info">{% trans "Please choose some measures and groupings." %}</div>
|
||||
{% endif %}
|
||||
|
|
|
@ -28,7 +28,9 @@
|
|||
<ul class="objects-list single-links bijoe-warehouses">
|
||||
{% for warehouse in warehouses %}
|
||||
{% url 'warehouse' warehouse=warehouse.name as warehouse_url %}
|
||||
<li><a href="{{ warehouse_url }}">{{ warehouse.label }}</a></li>
|
||||
<li>
|
||||
<a href="{{ warehouse_url }}">{{ warehouse.label }} ({% trans "last update" %} {{ warehouse.timestamp}})</a>
|
||||
</li>
|
||||
{% endfor %}
|
||||
</ul>
|
||||
{% endif %}
|
||||
|
|
|
@ -12,6 +12,7 @@
|
|||
{% endblock %}
|
||||
|
||||
{% block content %}
|
||||
<p>{% trans "Last update " %} {{ warehouse.timestamp }}</p>
|
||||
<table class="bijoe-table bijoe-form-table main">
|
||||
<thead>
|
||||
<tr>
|
||||
|
|
|
@ -14,6 +14,7 @@
|
|||
# You should have received a copy of the GNU Affero General Public License
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
import datetime
|
||||
import os
|
||||
import glob
|
||||
import json
|
||||
|
@ -21,6 +22,8 @@ import json
|
|||
from django.conf import settings
|
||||
from django.db import connection, transaction
|
||||
from django.utils.translation import ugettext as _
|
||||
from django.utils.timezone import utc
|
||||
|
||||
try:
|
||||
from functools import lru_cache
|
||||
except ImportError:
|
||||
|
@ -41,8 +44,10 @@ def get_warehouses_paths():
|
|||
|
||||
@lru_cache()
|
||||
def get_warehouse_by_path_and_mtime(path, mtime):
|
||||
warehouse = json.load(open(path))
|
||||
with open(path) as fd:
|
||||
warehouse = json.load(fd)
|
||||
warehouse['path'] = path
|
||||
warehouse['timestamp'] = mtime
|
||||
return Warehouse.from_json(warehouse)
|
||||
|
||||
|
||||
|
|
Loading…
Reference in New Issue