浏览代码

HUE-3281 [home] Disable dynamic loading of component until it is ported out of require

Romain Rigaux 9 年之前
父节点
当前提交
f28b3c7

+ 0 - 5
desktop/core/src/desktop/static/desktop/js/ko.editor.js

@@ -14,10 +14,6 @@
 // See the License for the specific language governing permissions and
 // See the License for the specific language governing permissions and
 // limitations under the License.
 // limitations under the License.
 
 
-define([
-  'knockout'
-], function (ko) {
-
   var EditorViewModel = function () {
   var EditorViewModel = function () {
     console.log('ko editor model loaded');
     console.log('ko editor model loaded');
   };
   };
@@ -26,4 +22,3 @@ define([
     viewModel: EditorViewModel,
     viewModel: EditorViewModel,
     template: { require: 'text!/ko_editor' }
     template: { require: 'text!/ko_editor' }
   });
   });
-});

+ 0 - 5
desktop/core/src/desktop/static/desktop/js/ko.metastore.js

@@ -14,10 +14,6 @@
 // See the License for the specific language governing permissions and
 // See the License for the specific language governing permissions and
 // limitations under the License.
 // limitations under the License.
 
 
-define([
-  'knockout'
-], function (ko) {
-
   var EditorViewModel = function () {
   var EditorViewModel = function () {
     console.log('ko metastore model loaded');
     console.log('ko metastore model loaded');
   };
   };
@@ -26,4 +22,3 @@ define([
     viewModel: EditorViewModel,
     viewModel: EditorViewModel,
     template: { require: 'text!/ko_metastore' }
     template: { require: 'text!/ko_metastore' }
   });
   });
-});

+ 19 - 6
desktop/core/src/desktop/templates/responsive.mako

@@ -183,7 +183,8 @@ ${ hueIcons.symbols() }
       <a href="javascript: void(0);" title="${_('Toggle Assist')}" class="pointer show-assist" style="display:none;">
       <a href="javascript: void(0);" title="${_('Toggle Assist')}" class="pointer show-assist" style="display:none;">
         <i class="fa fa-chevron-right"></i>
         <i class="fa fa-chevron-right"></i>
       </a>
       </a>
-      <div data-bind='component: currentApp'></div>
+      ##<div data-bind='component: currentApp'></div>
+      <div data-bind='text: currentApp'></div>
     </div>
     </div>
   </div>
   </div>
 </div>
 </div>
@@ -211,6 +212,13 @@ ${ hueIcons.symbols() }
 <script src="${ static('desktop/js/assist/assistS3Entry.js') }"></script>
 <script src="${ static('desktop/js/assist/assistS3Entry.js') }"></script>
 <script src="${ static('desktop/js/document/hueFileEntry.js') }"></script>
 <script src="${ static('desktop/js/document/hueFileEntry.js') }"></script>
 
 
+
+## Dynamic loading of apps
+##<script src="${ static('desktop/ext/js/text.js') }"></script>
+##<script src="${ static('desktop/js/ko.editor.js') }"></script>
+##<script src="${ static('desktop/js/ko.metastore.js') }"></script>
+
+
 ${ assist.assistPanel() }
 ${ assist.assistPanel() }
 
 
 <a title="${_('Toggle Assist')}" class="pointer show-assist" data-bind="visible: !$root.isLeftPanelVisible() && $root.assistAvailable(), click: function() { $root.isLeftPanelVisible(true); }">
 <a title="${_('Toggle Assist')}" class="pointer show-assist" data-bind="visible: !$root.isLeftPanelVisible() && $root.assistAvailable(), click: function() { $root.isLeftPanelVisible(true); }">
@@ -247,7 +255,7 @@ ${ assist.assistPanel() }
         }
         }
       };
       };
   
   
-      //ko.applyBindings(new OnePageViewModel(), $('.page-content')[0]);
+      ko.applyBindings(new OnePageViewModel(), $('.page-content')[0]);
     
     
       //ko.applyBindings({}, $('.left-nav')[0])
       //ko.applyBindings({}, $('.left-nav')[0])
       ko.applyBindings(new AssistViewModel(options), $('#assist-container')[0])
       ko.applyBindings(new AssistViewModel(options), $('#assist-container')[0])
@@ -278,14 +286,19 @@ ${ assist.assistPanel() }
     return moment(time).format("L LT");
     return moment(time).format("L LT");
   }
   }
 
 
-  //Add CSRF Token to all XHR Requests
+  // Add CSRF Token to all XHR Requests
   var xrhsend = XMLHttpRequest.prototype.send;
   var xrhsend = XMLHttpRequest.prototype.send;
   XMLHttpRequest.prototype.send = function (data) {
   XMLHttpRequest.prototype.send = function (data) {
-    this.setRequestHeader('X-CSRFToken', $.cookie('csrftoken'));
+    % if request and request.COOKIES and request.COOKIES.get('csrftoken'):
+      this.setRequestHeader('X-CSRFToken', "${ request.COOKIES.get('csrftoken') }");
+    % else:
+      this.setRequestHeader('X-CSRFToken', "");
+    % endif
+
     return xrhsend.apply(this, arguments);
     return xrhsend.apply(this, arguments);
   }
   }
 
 
-  // sets global assistHelper TTL
+  // Set global assistHelper TTL
   $.totalStorage('hue.cacheable.ttl', ${conf.CUSTOM.CACHEABLE_TTL.get()});
   $.totalStorage('hue.cacheable.ttl', ${conf.CUSTOM.CACHEABLE_TTL.get()});
 
 
   $(document).ready(function () {
   $(document).ready(function () {
@@ -323,7 +336,7 @@ ${ assist.assistPanel() }
     %endif
     %endif
 
 
     % if 'jobbrowser' in apps:
     % if 'jobbrowser' in apps:
-var JB_CHECK_INTERVAL_IN_MILLIS = 30000;
+      var JB_CHECK_INTERVAL_IN_MILLIS = 30000;
       var checkJobBrowserStatusIdx = window.setTimeout(checkJobBrowserStatus, 10);
       var checkJobBrowserStatusIdx = window.setTimeout(checkJobBrowserStatus, 10);
 
 
       function checkJobBrowserStatus(){
       function checkJobBrowserStatus(){