jenkins-bot has submitted this change and it was merged.
Change subject: Remove right pannel split, hide graph on error
......................................................................
Remove right pannel split, hide graph on error
Now graphs specs have more space,
and error message and result graph share space
Change-Id: I42d7ec4a84b7dbd5c816d1abd5955db35345534f
---
M extension.json
M includes/Sandbox.php
M modules/graph.sandbox.js
M styles/common.less
M styles/sandbox.css
5 files changed, 13 insertions(+), 27 deletions(-)
Approvals:
Yurik: Looks good to me, approved
jenkins-bot: Verified
diff --git a/extension.json b/extension.json
index a0327f9..960aa3a 100644
--- a/extension.json
+++ b/extension.json
@@ -97,7 +97,7 @@
"ext.codeEditor",
"ext.graph.vega2"
],
- "messages": [ "ok", "editwarning-warning" ],
+ "messages": [ "editwarning-warning" ],
"targets": [ "desktop" ]
},
"ext.graph.visualEditor": {
diff --git a/includes/Sandbox.php b/includes/Sandbox.php
index 057728e..4d91d4b 100644
--- a/includes/Sandbox.php
+++ b/includes/Sandbox.php
@@ -35,12 +35,11 @@
$graphHtml = Html::rawElement( 'div', $attr, '' );
// FIXME: make this textarea readonly (but text should be
selectable)
- $logHtml = '<div><pre id="mw-graph-log" dir="ltr"></pre></div>';
$specHtml = '<div><textarea tabindex="1" accesskey=","
id="wpTextbox1" cols="80" rows="40" style="" lang="en" dir="ltr"
name="wpTextbox1" class="webfonts-changed"></textarea></div>';
$jsonHtml = '<div><pre id="mw-graph-json"></pre></div>';
$out->addHTML( Html::rawElement( 'div', array( 'id' =>
'mw-graph-sandbox' ),
- Html::rawElement( 'div', array( 'id' => 'mw-graph-left'
), $graphHtml . $logHtml ) .
- Html::rawElement( 'div', array( 'id' =>
'mw-graph-right' ), $specHtml . $jsonHtml ) ) );
+ Html::rawElement( 'div', array( 'id' => 'mw-graph-left'
), $graphHtml . $jsonHtml ) .
+ Html::rawElement( 'div', array( 'id' =>
'mw-graph-right' ), $specHtml ) ) );
}
}
diff --git a/modules/graph.sandbox.js b/modules/graph.sandbox.js
index 766ee4c..df10a3d 100644
--- a/modules/graph.sandbox.js
+++ b/modules/graph.sandbox.js
@@ -1,5 +1,5 @@
( function ( $, mw ) {
- var oldContent, ccw, $rightSplitTop,
+ var oldContent, ccw,
resizeCodeEditor = $.noop;
$( function () {
@@ -16,20 +16,12 @@
limit: 100,
position: initialPosition
} );
- $( '#mw-graph-right' ).split( {
- orientation: 'horizontal',
- limit: 100,
- position: initialPosition,
- onDrag: function () {
- resizeCodeEditor( $rightSplitTop.height() );
- }
- } );
} );
mw.hook( 'codeEditor.configure' ).add( function ( session ) {
- var $errorLog = $( '#mw-graph-log' )[ 0 ],
- $json = $( '#mw-graph-json' )[ 0 ],
+ var $json = $( '#mw-graph-json' )[ 0 ],
$graph = $( '.mw-graph' )[ 0 ],
+ $rightPanel = $( '#mw-graph-right' ),
$editor = $( '.editor' );
if ( ccw ) {
@@ -42,13 +34,13 @@
message: mw.msg( 'editwarning-warning' )
} );
- resizeCodeEditor = function ( height ) {
- $editor.parent().height( height - 57 );
+ resizeCodeEditor = function () {
+ $editor.parent().height( $rightPanel.height() - 57 );
$.wikiEditor.instances[ 0 ].data( 'wikiEditor-context'
).codeEditor.resize();
};
- $rightSplitTop = $( '#mw-graph-right .top_panel' );
- resizeCodeEditor( $rightSplitTop.height() );
+ // I tried to resize on $( window ).resize(), but that didn't
work right
+ resizeCodeEditor();
session.on( 'change', $.debounce( 300, function () {
var content = session.getValue();
@@ -68,16 +60,14 @@
return;
}
$json.textContent = JSON.stringify( data.graph,
null, 2 );
- $errorLog.textContent = '...';
+ $graph.textContent = '...';
mw.drawVegaGraph( $graph, data.graph, function
( error ) {
if ( error ) {
- $errorLog.textContent = (
error.exception || error ).toString();
- } else {
- $errorLog.textContent = mw.msg(
'ok' );
+ $graph.textContent = (
error.exception || error ).toString();
}
} );
} ).fail( function ( errCode, error ) {
- $errorLog.textContent = errCode.toString() +
':' + ( error.exception || error ).toString();
+ $graph.textContent = errCode.toString() + ':' +
( error.exception || error ).toString();
} );
} ) );
} );
diff --git a/styles/common.less b/styles/common.less
index 70f87e1..d90748a 100644
--- a/styles/common.less
+++ b/styles/common.less
@@ -158,7 +158,6 @@
/* stylelint-disable selector-no-id */
/* Set graph width */
- #mw-graph-log,
#mw-graph-json {
width: 100%;
}
diff --git a/styles/sandbox.css b/styles/sandbox.css
index 32e5353..a629594 100644
--- a/styles/sandbox.css
+++ b/styles/sandbox.css
@@ -4,10 +4,8 @@
overflow: hidden;
}
-#mw-graph-log,
#mw-graph-json {
margin: 0;
- position: absolute;
top: 0;
left: 0;
right: 0;
--
To view, visit https://gerrit.wikimedia.org/r/296358
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: merged
Gerrit-Change-Id: I42d7ec4a84b7dbd5c816d1abd5955db35345534f
Gerrit-PatchSet: 3
Gerrit-Project: mediawiki/extensions/Graph
Gerrit-Branch: master
Gerrit-Owner: Yurik <[email protected]>
Gerrit-Reviewer: Yurik <[email protected]>
Gerrit-Reviewer: jenkins-bot <>
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits