浏览代码

[spark] Moved and restyled errors

Enrico Berti 10 年之前
父节点
当前提交
916ac54

+ 12 - 1
apps/spark/src/spark/static/spark/css/spark.css

@@ -500,4 +500,15 @@ table.airy tr td {
   display: inline-block;
   display: inline-block;
   margin: 0 5px;
   margin: 0 5px;
   position: relative;
   position: relative;
-}
+}
+
+.results.alert-error {
+  border: none;
+  margin-top: -3px;
+  background: -moz-linear-gradient(left, rgba(242, 222, 222, 1) 0%, rgba(255, 255, 255, 0) 100%);
+  background: -webkit-linear-gradient(left, rgba(242, 222, 222, 1) 0%, rgba(255, 255, 255, 0) 100%);
+  background: -o-linear-gradient(left, rgba(242, 222, 222, 1) 0%, rgba(255, 255, 255, 0) 100%);
+  background: -ms-linear-gradient(left, rgba(242, 222, 222, 1) 0%, rgba(255, 255, 255, 0) 100%);
+  background: linear-gradient(to right, rgba(242, 222, 222, 1) 0%, rgba(255, 255, 255, 0) 100%);
+  filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#f2dede', endColorstr='#00ffffff', GradientType=1)
+}

+ 3 - 4
apps/spark/src/spark/templates/editor_components.mako

@@ -368,10 +368,6 @@ from django.utils.translation import ugettext as _
         <pre data-bind="visible: result.logs().length > 0, text: result.logs, logScroller: result.logs" class="logs logs-bigger"></pre>
         <pre data-bind="visible: result.logs().length > 0, text: result.logs, logScroller: result.logs" class="logs logs-bigger"></pre>
       </div>
       </div>
 
 
-      <div data-bind="visible: result.errors().length > 0, css: errorsKlass" style="margin-top: 5px">
-        <span data-bind="text: result.errors"></span>
-      </div>
-
       <div data-bind="visible: ! result.hasResultset() && status() == 'available', css: resultsKlass">
       <div data-bind="visible: ! result.hasResultset() && status() == 'available', css: resultsKlass">
         ${ _('Success.') }
         ${ _('Success.') }
       </div>
       </div>
@@ -659,6 +655,9 @@ from django.utils.translation import ugettext as _
       <div class="bar" data-bind="style: {'width': (result.errors().length > 0 ? 100 : progress()) + '%'}"></div>
       <div class="bar" data-bind="style: {'width': (result.errors().length > 0 ? 100 : progress()) + '%'}"></div>
     </div>
     </div>
   </div>
   </div>
+  <div data-bind="visible: result.errors().length > 0, css: errorsKlass" style="margin-left: 3px">
+    <span data-bind="text: result.errors"></span>
+  </div>
 
 
   <div class="snippet-footer-actions-bar">
   <div class="snippet-footer-actions-bar">
     <a data-bind="visible: status() == 'loading'" class="btn btn-primary spark-btn" style="cursor: default;" title="${ _('Creating session') }">
     <a data-bind="visible: status() == 'loading'" class="btn btn-primary spark-btn" style="cursor: default;" title="${ _('Creating session') }">

+ 21 - 16
desktop/core/src/desktop/static/desktop/js/ko.hue-bindings.js

@@ -1780,23 +1780,28 @@ ko.bindingHandlers.aceEditor = {
 
 
           var token = editor.session.getTokenAt(docPos.row, docPos.column);
           var token = editor.session.getTokenAt(docPos.row, docPos.column);
 
 
-          var isMetastoreLink = Object.keys(valueAccessor().autocompleter.getCurrentTables()).indexOf(token.value) > -1;
-
-          if (token.value.indexOf("'/") == 0 && token.value.lastIndexOf("'") == token.value.length - 1 ||
-              token.value.indexOf("\"/") == 0 && token.value.lastIndexOf("\"") == token.value.length - 1 ||
-              isMetastoreLink) {
-            // add highlight for the clicked token
-            var range = new AceRange(docPos.row, token.start, docPos.row, token.start + token.value.length);
-            editor.session.removeMarker(this.marker);
-            this.marker = editor.session.addMarker(range, 'ace_bracket red');
-            editor.renderer.setCursorStyle("pointer");
-            this.setText(options.openIt);
-            if ($.totalStorage("hue.ace.showLinkTooltips") == null || $.totalStorage("hue.ace.showLinkTooltips")) {
-              $(".ace_tooltip").show();
-              this.show(null, this.x + 10, this.y + 10);
+          if (token) {
+            var isMetastoreLink = Object.keys(valueAccessor().autocompleter.getCurrentTables()).indexOf(token.value) > -1;
+
+            if (token.value.indexOf("'/") == 0 && token.value.lastIndexOf("'") == token.value.length - 1 ||
+                token.value.indexOf("\"/") == 0 && token.value.lastIndexOf("\"") == token.value.length - 1 ||
+                isMetastoreLink) {
+              // add highlight for the clicked token
+              var range = new AceRange(docPos.row, token.start, docPos.row, token.start + token.value.length);
+              editor.session.removeMarker(this.marker);
+              this.marker = editor.session.addMarker(range, 'ace_bracket red');
+              editor.renderer.setCursorStyle("pointer");
+              this.setText(options.openIt);
+              if ($.totalStorage("hue.ace.showLinkTooltips") == null || $.totalStorage("hue.ace.showLinkTooltips")) {
+                $(".ace_tooltip").show();
+                this.show(null, this.x + 10, this.y + 10);
+              }
+              this.link = token;
+              this.isClearable = true
+            }
+            else {
+              this.clear();
             }
             }
-            this.link = token;
-            this.isClearable = true
           }
           }
           else {
           else {
             this.clear();
             this.clear();