jenkins-bot has submitted this change and it was merged.

Change subject: Fixed Sandbox error reporting
......................................................................


Fixed Sandbox error reporting

Change-Id: I31037c2186aba5fe736224a65f1319bfd8c0654f
---
M modules/graph.sandbox.js
1 file changed, 6 insertions(+), 5 deletions(-)

Approvals:
  Yurik: Looks good to me, approved
  jenkins-bot: Verified



diff --git a/modules/graph.sandbox.js b/modules/graph.sandbox.js
index df10a3d..092a2d2 100644
--- a/modules/graph.sandbox.js
+++ b/modules/graph.sandbox.js
@@ -20,7 +20,8 @@
 
        mw.hook( 'codeEditor.configure' ).add( function ( session ) {
                var $json = $( '#mw-graph-json' )[ 0 ],
-                       $graph = $( '.mw-graph' )[ 0 ],
+                       $graph = $( '.mw-graph' ),
+                       $graphEl = $graph[ 0 ],
                        $rightPanel = $( '#mw-graph-right' ),
                        $editor = $( '.editor' );
 
@@ -49,6 +50,7 @@
                                return;
                        }
                        oldContent = content;
+                       $graph.empty();
 
                        new mw.Api().post( {
                                formatversion: 2,
@@ -60,14 +62,13 @@
                                        return;
                                }
                                $json.textContent = JSON.stringify( data.graph, 
null, 2 );
-                               $graph.textContent = '...';
-                               mw.drawVegaGraph( $graph, data.graph, function 
( error ) {
+                               mw.drawVegaGraph( $graphEl, data.graph, 
function ( error ) {
                                        if ( error ) {
-                                               $graph.textContent = ( 
error.exception || error ).toString();
+                                               $graphEl.textContent = ( 
error.exception || error ).toString();
                                        }
                                } );
                        } ).fail( function ( errCode, error ) {
-                               $graph.textContent = errCode.toString() + ':' + 
( error.exception || error ).toString();
+                               $graphEl.textContent = errCode.toString() + ':' 
+ ( error.exception || error ).toString();
                        } );
                } ) );
        } );

-- 
To view, visit https://gerrit.wikimedia.org/r/296686
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: I31037c2186aba5fe736224a65f1319bfd8c0654f
Gerrit-PatchSet: 3
Gerrit-Project: mediawiki/extensions/Graph
Gerrit-Branch: master
Gerrit-Owner: Yurik <yu...@wikimedia.org>
Gerrit-Reviewer: Yurik <yu...@wikimedia.org>
Gerrit-Reviewer: jenkins-bot <>

_______________________________________________
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to