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):
|
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__ = {
|
__types__ = {
|
||||||
'name': str,
|
'name': str,
|
||||||
'slug': str,
|
'slug': str,
|
||||||
|
@ -429,6 +429,7 @@ class Warehouse(Base):
|
||||||
def __init__(self, **kwargs):
|
def __init__(self, **kwargs):
|
||||||
self.path = None
|
self.path = None
|
||||||
self.slug = None
|
self.slug = None
|
||||||
|
self.timestamp = None
|
||||||
super(Warehouse, self).__init__(**kwargs)
|
super(Warehouse, self).__init__(**kwargs)
|
||||||
|
|
||||||
def check(self):
|
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 %}"
|
<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>
|
title="{{ visualization.title }}" class="button">{% trans "Save" %}</a>
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
<p>{% trans "Last update" %} {{ warehouse.timestamp }}</p>
|
||||||
{% else %}
|
{% else %}
|
||||||
<div class="big-msg-info">{% trans "Please choose some measures and groupings." %}</div>
|
<div class="big-msg-info">{% trans "Please choose some measures and groupings." %}</div>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
|
@ -28,7 +28,9 @@
|
||||||
<ul class="objects-list single-links bijoe-warehouses">
|
<ul class="objects-list single-links bijoe-warehouses">
|
||||||
{% for warehouse in warehouses %}
|
{% for warehouse in warehouses %}
|
||||||
{% url 'warehouse' warehouse=warehouse.name as warehouse_url %}
|
{% 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 %}
|
{% endfor %}
|
||||||
</ul>
|
</ul>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
|
@ -12,6 +12,7 @@
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
|
||||||
{% block content %}
|
{% block content %}
|
||||||
|
<p>{% trans "Last update " %} {{ warehouse.timestamp }}</p>
|
||||||
<table class="bijoe-table bijoe-form-table main">
|
<table class="bijoe-table bijoe-form-table main">
|
||||||
<thead>
|
<thead>
|
||||||
<tr>
|
<tr>
|
||||||
|
|
|
@ -14,6 +14,7 @@
|
||||||
# You should have received a copy of the GNU Affero General Public License
|
# 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/>.
|
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
import datetime
|
||||||
import os
|
import os
|
||||||
import glob
|
import glob
|
||||||
import json
|
import json
|
||||||
|
@ -21,6 +22,8 @@ import json
|
||||||
from django.conf import settings
|
from django.conf import settings
|
||||||
from django.db import connection, transaction
|
from django.db import connection, transaction
|
||||||
from django.utils.translation import ugettext as _
|
from django.utils.translation import ugettext as _
|
||||||
|
from django.utils.timezone import utc
|
||||||
|
|
||||||
try:
|
try:
|
||||||
from functools import lru_cache
|
from functools import lru_cache
|
||||||
except ImportError:
|
except ImportError:
|
||||||
|
@ -41,8 +44,10 @@ def get_warehouses_paths():
|
||||||
|
|
||||||
@lru_cache()
|
@lru_cache()
|
||||||
def get_warehouse_by_path_and_mtime(path, mtime):
|
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['path'] = path
|
||||||
|
warehouse['timestamp'] = mtime
|
||||||
return Warehouse.from_json(warehouse)
|
return Warehouse.from_json(warehouse)
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue