Эх сурвалжийг харах

HUE-5496 [responsive] Changing editor type should affect the currently selected editor snippet

Enrico Berti 9 жил өмнө
parent
commit
8db223b

+ 2 - 2
apps/filebrowser/src/filebrowser/templates/display.mako

@@ -36,7 +36,7 @@ ${ commonheader(_('%(filename)s - File Viewer') % dict(filename=truncate(filenam
 
 ${ fb_components.menubar() }
 
-<div id="fileviewer" class="container-fluid">
+<div id="fileviewerComponents" class="container-fluid">
   <link href="${ static('filebrowser/css/display.css') }" rel="stylesheet" type="text/css">
   <div class="row-fluid">
     <div class="span2">
@@ -475,7 +475,7 @@ ${ fb_components.menubar() }
   }
 
   $(document).ready(function () {
-    ko.applyBindings(viewModel, $('#fileviewer')[0]);
+    ko.applyBindings(viewModel, $('#fileviewerComponents')[0]);
 
     $(document).ajaxError(function () {
       $.jHueNotify.error("${_('There was an unexpected server error.')}");

+ 5 - 5
apps/filebrowser/src/filebrowser/templates/listdir.mako

@@ -20,6 +20,7 @@ from desktop.views import commonheader, commonfooter
 from django.utils.translation import ugettext as _
 
 from filebrowser.conf import ENABLE_EXTRACT_UPLOADED_ARCHIVE
+
 %>
 
 <%namespace name="actionbar" file="actionbar.mako" />
@@ -37,14 +38,13 @@ ${ fb_components.menubar() }
   }
 
   %if is_embeddable:
-  #filebrowser .pagination {
-    position: inherit;
-  }
+    .filebrowser .pagination {
+      position: inherit;
+    }
   %endif
 </style>
 
-<div id="filebrowser" class="container-fluid">
-
+<div id="${ path.startswith('S3A://') and 'filebrowser_s3Components' or 'filebrowserComponents' }" class="container-fluid filebrowser">
   <div class="card card-small">
     <div class="actionbar">
     <%actionbar:render>

+ 1 - 1
apps/filebrowser/src/filebrowser/templates/listdir_components.mako

@@ -1852,7 +1852,7 @@ from django.utils.translation import ugettext as _
     };
 
     var viewModel = new FileBrowserModel([], null, [], "/");
-    ko.applyBindings(viewModel, $('#filebrowser')[0]);
+    ko.applyBindings(viewModel, $('.filebrowser')[0]);
 
     $(document).ready(function () {
       $('.historyLink').on('click', function (e) {

+ 2 - 2
apps/jobbrowser/src/jobbrowser/templates/apps.mako

@@ -84,7 +84,7 @@ ${ assist.assistPanel() }
       </div>
     </div>
 </div>
-<div id="jobbrowser">
+<div id="jobbrowserComponents">
 <div class="main-content">
   <div class="vertical-full container-fluid" data-bind="style: { 'padding-left' : $root.isLeftPanelVisible() ? '0' : '20px' }">
     <div class="vertical-full">
@@ -441,7 +441,7 @@ ${ assist.assistPanel() }
       };
 
       viewModel = new JobBrowserViewModel(options, RunningCoordinatorModel);
-      ko.applyBindings(viewModel, $('#jobbrowser')[0]);
+      ko.applyBindings(viewModel, $('#jobbrowserComponents')[0]);
 
       var loadHash = function () {
         var h = window.location.hash;

+ 2 - 2
apps/oozie/src/oozie/templates/editor2/workflow_editor.mako

@@ -31,7 +31,7 @@ from oozie.conf import ENABLE_DOCUMENT_ACTION
 ${ commonheader(_("Workflow Editor"), "Oozie", user, request, "40px") | n,unicode }
 % endif
 
-<div id="wfEditor">
+<div id="oozie_workflowComponents">
 
 <%def name="buttons()">
   <div class="pull-right" style="padding-right: 10px">
@@ -541,7 +541,7 @@ ${ dashboard.import_bindings() }
   ${ utils.slaGlobal() }
 
   var viewModel = new WorkflowEditorViewModel(${ layout_json | n,unicode }, ${ workflow_json | n,unicode }, ${ credentials_json | n,unicode }, ${ workflow_properties_json | n,unicode }, ${ subworkflows_json | n,unicode }, ${ can_edit_json | n,unicode }, ${ history_json | n,unicode });
-  ko.applyBindings(viewModel, $("#wfEditor")[0]);
+  ko.applyBindings(viewModel, $("#oozie_workflowComponents")[0]);
 
   var shareViewModel = initSharing("#documentShareModal");
   shareViewModel.setDocUuid('${ doc_uuid }');

+ 1 - 1
desktop/core/src/desktop/static/desktop/css/responsive.css

@@ -1030,6 +1030,6 @@ h6 {
 }
 
 /* oozie workflow */
-#wfEditor .card-toolbar {
+#oozie_workflowComponents .card-toolbar {
   position: static;
 }

+ 1 - 1
desktop/core/src/desktop/templates/common_home.mako

@@ -124,7 +124,7 @@
       });
       %endif
 
-      ko.applyBindings(viewModel, $('#documentList')[0]);
+      ko.applyBindings(viewModel, $('#homeComponents')[0]);
 
       huePubSub.publish('init.tour');
 

+ 2 - 2
desktop/core/src/desktop/templates/home.mako

@@ -112,7 +112,7 @@ ${ commonheader(_('Welcome Home'), "home", user, request) | n,unicode }
   </div>
 </div>
 
-<div id='documentList' class="container-fluid">
+<div id="homeComponents" class="container-fluid">
   <div class="row-fluid">
     <div class="span2">
       <div class="sidebar-nav">
@@ -347,7 +347,7 @@ ${ commonshare() | n,unicode }
 
   $(document).ready(function () {
     viewModel = new HomeViewModel(JSON_TAGS, JSON_DOCS);
-    ko.applyBindings(viewModel, $('#documentList')[0]);
+    ko.applyBindings(viewModel, $('#homeComponents')[0]);
 
     shareViewModel = initSharing("#documentShareModal", viewModel.updateDoc);
 

+ 1 - 1
desktop/core/src/desktop/templates/home2.mako

@@ -163,7 +163,7 @@ ${ assist.assistPanel() }
 
 ${ common_home.navbar() }
 
-<div id="documentList" class="main-content">
+<div id="homeComponents" class="main-content">
 ##   Uncomment to enable the assist panel
 ##   <a title="${_('Toggle Assist')}" class="pointer show-assist" data-bind="visible: !$root.isLeftPanelVisible(), click: function() { $root.isLeftPanelVisible(true); }" style="display:none;">
 ##     <i class="fa fa-chevron-right"></i>

+ 1 - 1
desktop/core/src/desktop/templates/home_embeddable.mako

@@ -43,7 +43,7 @@ ${ common_home.homeJSModels() }
 </style>
 
 
-<div id="documentList" class="main-content">
+<div id="homeComponents" class="main-content">
   <div class="vertical-full container-fluid" data-bind="style: { 'padding-left' : $root.isLeftPanelVisible() ? '0' : '20px' }">
     <div class="vertical-full row-fluid panel-container">
       <div class="content-panel home-container" data-bind="style: { 'padding-left' : $root.isLeftPanelVisible() ? '8px' : '0' }">

+ 16 - 3
desktop/core/src/desktop/templates/responsive.mako

@@ -491,6 +491,14 @@ ${ assist.assistPanel() }
 
         self.embeddable_cache = {};
 
+        self.getActiveAppViewmodel = function () {
+          var koElementID = '#' + self.currentApp() + 'Components';
+          if ($(koElementID).length > 0 && ko.dataFor($(koElementID)[0])) {
+            return ko.dataFor($(koElementID)[0]);
+          }
+          return null;
+        }
+
         self.currentApp = ko.observable();
         self.isLoadingEmbeddable = ko.observable(false);
 
@@ -499,6 +507,11 @@ ${ assist.assistPanel() }
         self.changeEditorType = function (type) {
           self.extraEmbeddableURLParams('?type=' + type);
           hueUtils.changeURLParameter('type', type);
+          if (self.getActiveAppViewmodel()) {
+            self.getActiveAppViewmodel().selectedNotebook().selectedSnippet(type);
+            self.getActiveAppViewmodel().editorType(type);
+            self.getActiveAppViewmodel().newNotebook();
+          }
         }
 
         huePubSub.subscribe('open.fb.file', function(path){
@@ -556,11 +569,11 @@ ${ assist.assistPanel() }
         });
 
         if (window.location.getParameter('app') !== '' && self.EMBEDDABLE_PAGE_URLS[window.location.getParameter('app')]){
+          if (window.location.getParameter('type') !== '') {
+            self.changeEditorType(window.location.getParameter('type'));
+          }
           self.currentApp(window.location.getParameter('app'));
         }
-        else if (window.location.getParameter('editor') !== '' || window.location.getParameter('type') !== ''){
-          self.currentApp('editor');
-        }
         else {
           self.currentApp('home');
         }