Nschaaf has uploaded a new change for review.
https://gerrit.wikimedia.org/r/313005
Change subject: Move bower components to configurable directory
......................................................................
Move bower components to configurable directory
Change-Id: I11823c44422d64c5e5f592eb0e14bfa9df1de227
---
M recommendation/api/test/test_recommendation.ini
M recommendation/data/recommendation.ini
M recommendation/web/gapfinder.py
M recommendation/web/static/gf-input.tag
M recommendation/web/templates/index.html
M setup.py
6 files changed, 37 insertions(+), 26 deletions(-)
git pull ssh://gerrit.wikimedia.org:29418/research/recommendation-api
refs/changes/05/313005/1
diff --git a/recommendation/api/test/test_recommendation.ini
b/recommendation/api/test/test_recommendation.ini
index f2af6f4..878efbb 100644
--- a/recommendation/api/test/test_recommendation.ini
+++ b/recommendation/api/test/test_recommendation.ini
@@ -44,6 +44,9 @@
count_default = 12
count_max = 24
+[gapfinder]
+resource_path = /srv/recommendation/resources
+
[logging]
format = %(asctime)s %(name)s %(funcName)s():%(lineno)d %(levelname)s --
%(message)s
level = DEBUG
diff --git a/recommendation/data/recommendation.ini
b/recommendation/data/recommendation.ini
index f771652..d38470c 100644
--- a/recommendation/data/recommendation.ini
+++ b/recommendation/data/recommendation.ini
@@ -44,6 +44,9 @@
count_default = 12
count_max = 24
+[gapfinder]
+resource_path = /srv/recommendation/resources
+
[logging]
format = %(asctime)s %(name)s %(funcName)s():%(lineno)d %(levelname)s --
%(message)s
level = INFO
diff --git a/recommendation/web/gapfinder.py b/recommendation/web/gapfinder.py
index 0e12bee..02f4a85 100644
--- a/recommendation/web/gapfinder.py
+++ b/recommendation/web/gapfinder.py
@@ -1,5 +1,5 @@
import json
-from flask import Blueprint, render_template, request
+from flask import Blueprint, render_template, request, send_from_directory
from recommendation.utils import configuration
from recommendation.utils import language_pairs
@@ -23,3 +23,8 @@
seed=seed,
event_logger_url=configuration.get_config_value('endpoints',
'event_logger')
)
+
+
[email protected]('/static/resource/<path:filename>')
+def resource(filename):
+ return send_from_directory(configuration.get_config_value('gapfinder',
'resource_path'), filename=filename)
diff --git a/recommendation/web/static/gf-input.tag
b/recommendation/web/static/gf-input.tag
index ea4d102..64b9f74 100644
--- a/recommendation/web/static/gf-input.tag
+++ b/recommendation/web/static/gf-input.tag
@@ -78,9 +78,6 @@
$.ajax({
url: url
- }).complete(function () {
- self.fetching = false;
- self.update();
}).done(function (data) {
if (data.error) {
self.error = true;
@@ -100,6 +97,9 @@
target: mappedTarget
});
}
+ }).always(function () {
+ self.fetching = false;
+ self.update();
});
};
diff --git a/recommendation/web/templates/index.html
b/recommendation/web/templates/index.html
index 1cf7b1d..1fb3cf0 100644
--- a/recommendation/web/templates/index.html
+++ b/recommendation/web/templates/index.html
@@ -6,10 +6,10 @@
<meta name="viewport" content="width=device-width, initial-scale=1,
shrink-to-fit=no">
<meta http-equiv="x-ua-compatible" content="ie=edge">
- <link rel="stylesheet" href="{{ url_for('.static',
filename='bower_components/bootstrap/dist/css/bootstrap.min.css') }}">
- <link rel="stylesheet" href="{{ url_for('.static',
filename='bower_components/uls/css/jquery.uls.css') }}">
- <link rel="stylesheet" href="{{ url_for('.static',
filename='bower_components/uls/css/jquery.uls.grid.css') }}">
- <link rel="stylesheet" href="{{ url_for('.static',
filename='bower_components/uls/css/jquery.uls.lcd.css') }}">
+ <link rel="stylesheet" href="{{ url_for('.resource',
filename='bower_components/bootstrap/dist/css/bootstrap.min.css') }}">
+ <link rel="stylesheet" href="{{ url_for('.resource',
filename='bower_components/uls/css/jquery.uls.css') }}">
+ <link rel="stylesheet" href="{{ url_for('.resource',
filename='bower_components/uls/css/jquery.uls.grid.css') }}">
+ <link rel="stylesheet" href="{{ url_for('.resource',
filename='bower_components/uls/css/jquery.uls.lcd.css') }}">
<link rel="stylesheet" href="{{ url_for('.static',
filename='style.css') }}">
<link rel="stylesheet" href="{{ url_for('.static',
filename='suggest-searches/wm-typeahead.css') }}">
</head>
@@ -28,24 +28,24 @@
<script src="{{ url_for('.static', filename='event_logger.js')
}}"></script>
- <script src="{{ url_for('.static',
filename='bower_components/riot/riot+compiler.min.js') }}"></script>
- <script src="{{ url_for('.static',
filename='bower_components/jquery/dist/jquery.min.js') }}"></script>
- <script src="{{ url_for('.static',
filename='bower_components/tether/dist/js/tether.min.js') }}"></script>
- <script src="{{ url_for('.static',
filename='bower_components/bootstrap/dist/js/bootstrap.min.js') }}"></script>
- <script src="{{ url_for('.static',
filename='bower_components/store2/dist/store2.min.js') }}"></script>
+ <script src="{{ url_for('.resource',
filename='bower_components/riot/riot+compiler.min.js') }}"></script>
+ <script src="{{ url_for('.resource',
filename='bower_components/jquery/dist/jquery.min.js') }}"></script>
+ <script src="{{ url_for('.resource',
filename='bower_components/tether/dist/js/tether.min.js') }}"></script>
+ <script src="{{ url_for('.resource',
filename='bower_components/bootstrap/dist/js/bootstrap.min.js') }}"></script>
+ <script src="{{ url_for('.resource',
filename='bower_components/store2/dist/store2.min.js') }}"></script>
- <script src="{{ url_for('.static',
filename='bower_components/i18n/src/jquery.i18n.js') }}"></script>
- <script src="{{ url_for('.static',
filename='bower_components/i18n/src/jquery.i18n.messagestore.js') }}"></script>
- <script src="{{ url_for('.static',
filename='bower_components/i18n/src/jquery.i18n.fallbacks.js') }}"></script>
- <script src="{{ url_for('.static',
filename='bower_components/i18n/src/jquery.i18n.parser.js') }}"></script>
- <script src="{{ url_for('.static',
filename='bower_components/i18n/src/jquery.i18n.emitter.js') }}"></script>
- <script src="{{ url_for('.static',
filename='bower_components/i18n/src/jquery.i18n.language.js') }}"></script>
+ <script src="{{ url_for('.resource',
filename='bower_components/i18n/src/jquery.i18n.js') }}"></script>
+ <script src="{{ url_for('.resource',
filename='bower_components/i18n/src/jquery.i18n.messagestore.js') }}"></script>
+ <script src="{{ url_for('.resource',
filename='bower_components/i18n/src/jquery.i18n.fallbacks.js') }}"></script>
+ <script src="{{ url_for('.resource',
filename='bower_components/i18n/src/jquery.i18n.parser.js') }}"></script>
+ <script src="{{ url_for('.resource',
filename='bower_components/i18n/src/jquery.i18n.emitter.js') }}"></script>
+ <script src="{{ url_for('.resource',
filename='bower_components/i18n/src/jquery.i18n.language.js') }}"></script>
- <script src="{{ url_for('.static',
filename='bower_components/uls/src/jquery.uls.data.js') }}"></script>
- <script src="{{ url_for('.static',
filename='bower_components/uls/src/jquery.uls.data.utils.js') }}"></script>
- <script src="{{ url_for('.static',
filename='bower_components/uls/src/jquery.uls.lcd.js') }}"></script>
- <script src="{{ url_for('.static',
filename='bower_components/uls/src/jquery.uls.languagefilter.js') }}"></script>
- <script src="{{ url_for('.static',
filename='bower_components/uls/src/jquery.uls.core.js') }}"></script>
+ <script src="{{ url_for('.resource',
filename='bower_components/uls/src/jquery.uls.data.js') }}"></script>
+ <script src="{{ url_for('.resource',
filename='bower_components/uls/src/jquery.uls.data.utils.js') }}"></script>
+ <script src="{{ url_for('.resource',
filename='bower_components/uls/src/jquery.uls.lcd.js') }}"></script>
+ <script src="{{ url_for('.resource',
filename='bower_components/uls/src/jquery.uls.languagefilter.js') }}"></script>
+ <script src="{{ url_for('.resource',
filename='bower_components/uls/src/jquery.uls.core.js') }}"></script>
<script src="{{ url_for('.static',
filename='suggest-searches/mediawiki.lite.js') }}"></script>
<script src="{{ url_for('.static',
filename='suggest-searches/polyfills.js') }}"></script>
@@ -67,7 +67,7 @@
eventLoggerUrl: '{{ event_logger_url }}',
i18nGapFinderPath: '{{ url_for('.static', filename='i18n/')
}}',
- i18nUlsPath: '{{ url_for('.static',
filename='bower_components/uls/i18n/') }}'
+ i18nUlsPath: '{{ url_for('.resource',
filename='bower_components/uls/i18n/') }}'
};
riot.mount('gf-disclaimer, gf-title, gf-input');
diff --git a/setup.py b/setup.py
index d35a5ff..68a5edc 100644
--- a/setup.py
+++ b/setup.py
@@ -16,7 +16,7 @@
'PyYAML',
'requests',
'numpy'],
- package_data={'recommendation.web': ['static/*',
+ package_data={'recommendation.web': ['static/*.*',
'static/i18n/*',
'static/images/*',
'static/suggest-searches/*',
--
To view, visit https://gerrit.wikimedia.org/r/313005
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I11823c44422d64c5e5f592eb0e14bfa9df1de227
Gerrit-PatchSet: 1
Gerrit-Project: research/recommendation-api
Gerrit-Branch: master
Gerrit-Owner: Nschaaf <[email protected]>
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits