Explorar o código

HUE-9066 [gist] Open SQL gist in presentation mode by default

Romain %!s(int64=6) %!d(string=hai) anos
pai
achega
20e94a0d33

+ 5 - 2
desktop/core/src/desktop/js/apps/notebook2/components/ko.snippetEditorActions.js

@@ -14,6 +14,7 @@
 // See the License for the specific language governing permissions and
 // limitations under the License.
 
+import $ from 'jquery';
 import ko from 'knockout';
 
 import 'ko/bindings/ko.publish';
@@ -162,13 +163,15 @@ class SnippetEditorActions {
 
     const gistLink = await apiHelper.createGistAsync({
       statement:
-        this.snippet.ace().getSelectedText() != '' ? this.snippet.ace().getSelectedText() : this.snippet.statement_raw(),
+        this.snippet.ace().getSelectedText() != ''
+          ? this.snippet.ace().getSelectedText()
+          : this.snippet.statement_raw(),
       doc_type: this.snippet.type(),
       name: this.snippet.name(),
       description: ''
     });
 
-    new window.Clipboard(".gist-link-btn");
+    new window.Clipboard('.gist-link-btn');
 
     $(document).trigger('showGistModal', {
       link: gistLink

+ 1 - 0
desktop/libs/notebook/src/notebook/api.py

@@ -71,6 +71,7 @@ def create_notebook(request):
       description='',
       editor_type=editor_type,
       statement=statement,
+      is_presentation_mode=True
     )
   else:
     editor = Notebook()

+ 2 - 1
desktop/libs/notebook/src/notebook/models.py

@@ -81,7 +81,7 @@ def make_notebook(
     name='Browse', description='', editor_type='hive', statement='', status='ready',
     files=None, functions=None, settings=None, is_saved=False, database='default', snippet_properties=None, batch_submit=False,
     on_success_url=None, skip_historify=False, is_task=False, last_executed=-1, is_notebook=False, pub_sub_url=None, result_properties={},
-    namespace=None, compute=None):
+    namespace=None, compute=None, is_presentation_mode=False):
   '''
   skip_historify: do not add the task to the query history. e.g. SQL Dashboard
   is_task / isManaged: true when being a managed by Hue operation (include_managed=True in document), e.g. exporting query result, dropping some tables
@@ -136,6 +136,7 @@ def make_notebook(
     'onSuccessUrl': urllib_quote(on_success_url.encode('utf-8'), safe=SAFE_CHARACTERS_URI) if on_success_url else None,
     'pubSubUrl': pub_sub_url,
     'skipHistorify': skip_historify,
+    'isPresentationModeDefault': is_presentation_mode,
     'isManaged': is_task,
     'snippets': [
       {