@@ -52,6 +52,7 @@ class __SQLCell_GLOBAL_VARS__(object): |
52 | 52 | INITIAL_QUERY = True |
53 | 53 | PATH = False |
54 | 54 | RAW = False |
| 55 | + NOTIFY = True |
55 | 56 |
|
56 | 57 | logger = logging.getLogger() |
57 | 58 | handler = logging.StreamHandler() |
@@ -860,30 +861,37 @@ def _SQL(path, cell, __KERNEL_VARS__): |
860 | 861 | +'Rows: %s | ' |
861 | 862 | +'DB: %s | Host: %s' |
862 | 863 | ) |
863 | | - |
864 | | - if ($.notify){ |
865 | | - $.notify({},{ |
866 | | - delay: 5000, |
867 | | - animate: { |
868 | | - enter: 'animated fadeInRight', |
869 | | - exit: 'animated fadeOutRight' |
870 | | - }, |
871 | | - allow_dismiss: true, |
872 | | - mouse_over: "pause", |
873 | | - template: '<div data-notify="container" class="col-xs-11 col-sm-3 alert alert-info" role="alert">' + |
874 | | - '<button type="button" aria-hidden="true" class="close" data-notify="dismiss">x</button>' + |
875 | | - '<div style="cursor:pointer;" data-notify="container" onclick="document.getElementById(`table%s`).scrollIntoView();">' + |
876 | | - '<span data-notify="title"><strong>Query Finished</strong></span>' + |
877 | | - `</br><span data-notify="message"><pre style=\"max-height:150px;overflow-y:scroll;\">%s</pre>To Execute: %s | Rows: %s | DB: %s | Host: %s</span>` + |
878 | | - '</div>' + |
879 | | - '</div>' |
880 | | - }); |
881 | | - } else { |
882 | | - console.log('$.notify is not a function. trouble loading bootstrap-notify.') |
883 | | - } |
884 | | - """ % (str(round(t1, 3)), len(df.index), engine.url.database, engine.url.host, unique_id, cell, str(round(t1, 3)), len(df.index), engine.url.database, engine.url.host) |
| 864 | + """ % (str(round(t1, 3)), len(df.index), engine.url.database, engine.url.host) |
885 | 865 | ) |
886 | 866 | ) |
| 867 | + |
| 868 | + if __SQLCell_GLOBAL_VARS__.NOTIFY: |
| 869 | + display( |
| 870 | + Javascript( |
| 871 | + """ |
| 872 | + if ($.notify){ |
| 873 | + $.notify({},{ |
| 874 | + delay: 5000, |
| 875 | + animate: { |
| 876 | + enter: 'animated fadeInRight', |
| 877 | + exit: 'animated fadeOutRight' |
| 878 | + }, |
| 879 | + allow_dismiss: true, |
| 880 | + mouse_over: "pause", |
| 881 | + template: '<div data-notify="container" class="col-xs-11 col-sm-3 alert alert-info" role="alert">' + |
| 882 | + '<button type="button" aria-hidden="true" class="close" data-notify="dismiss">x</button>' + |
| 883 | + '<div style="cursor:pointer;" data-notify="container" onclick="document.getElementById(`table%s`).scrollIntoView();">' + |
| 884 | + '<span data-notify="title"><strong>Query Finished</strong></span>' + |
| 885 | + `</br><span data-notify="message"><pre style=\"max-height:150px;overflow-y:scroll;\">%s</pre>To Execute: %s | Rows: %s | DB: %s | Host: %s</span>` + |
| 886 | + '</div>' + |
| 887 | + '</div>' |
| 888 | + }); |
| 889 | + } else { |
| 890 | + console.log('$.notify is not a function. trouble loading bootstrap-notify.') |
| 891 | + } |
| 892 | + """ % (unique_id, cell, str(round(t1, 3)), len(df.index), engine.url.database, engine.url.host) |
| 893 | + ) |
| 894 | + ) |
887 | 895 |
|
888 | 896 | table_name = re.search('from\s*([a-z_][a-z\-_0-9]{,})', cell, re.IGNORECASE) |
889 | 897 | table_name = None if not table_name else table_name.group(1).strip() |
|