Ver código fonte

HUE-4031 [editor] Add random parameter to web worker imports when in debug mode

Johan Ahlen 8 anos atrás
pai
commit
b07e9ca

+ 13 - 4
desktop/core/src/desktop/templates/ace_sql_location_worker.mako

@@ -14,10 +14,19 @@
 ## See the License for the specific language governing permissions and
 ## limitations under the License.
 
-var version = 20;
-importScripts('${ static('desktop/js/autocomplete/sqlParseSupport.js') }' + '?version=' + version);
-importScripts('${ static('desktop/js/autocomplete/sqlAutocompleteParser.js') }' + '?version=' + version);
-importScripts('${ static('desktop/js/sqlFunctions.js') }' + '?version=' + version);
+<%!
+  from desktop import conf
+%>
+
+% if conf.DJANGO_DEBUG_MODE.get():
+importScripts('${ static('desktop/js/autocomplete/sqlParseSupport.js') }' + '?' + Math.random());
+importScripts('${ static('desktop/js/autocomplete/sqlAutocompleteParser.js') }' + '?' + Math.random());
+importScripts('${ static('desktop/js/sqlFunctions.js') }' + '?' + Math.random());
+% else:
+importScripts('${ static('desktop/js/autocomplete/sqlParseSupport.js') }');
+importScripts('${ static('desktop/js/autocomplete/sqlAutocompleteParser.js') }');
+importScripts('${ static('desktop/js/sqlFunctions.js') }');
+% endif
 
 (function () {
 

+ 11 - 3
desktop/core/src/desktop/templates/ace_sql_syntax_worker.mako

@@ -14,9 +14,17 @@
 ## See the License for the specific language governing permissions and
 ## limitations under the License.
 
-var version = 1;
-importScripts('${ static('desktop/js/autocomplete/sqlParseSupport.js') }' + '?version=' + version);
-importScripts('${ static('desktop/js/autocomplete/sqlSyntaxParser.js') }' + '?version=' + version);
+<%!
+  from desktop import conf
+%>
+
+% if conf.DJANGO_DEBUG_MODE.get():
+importScripts('${ static('desktop/js/autocomplete/sqlParseSupport.js') }' + '?' + Math.random());
+importScripts('${ static('desktop/js/autocomplete/sqlSyntaxParser.js') }' + '?' + Math.random());
+% else:
+importScripts('${ static('desktop/js/autocomplete/sqlParseSupport.js') }');
+importScripts('${ static('desktop/js/autocomplete/sqlSyntaxParser.js') }');
+% endif
 
 (function () {