[MediaWiki-commits] [Gerrit] wikidata...gui[master]: Use Promise.then() instead of non-standard done()

2017-11-03 Thread Yurik (Code Review)
Yurik has uploaded a new change for review. ( 
https://gerrit.wikimedia.org/r/388677 )

Change subject: Use Promise.then() instead of non-standard done()
..

Use Promise.then() instead of non-standard done()

jquery already supports standard .then() / .catch(),
so lets use those instead of .done().

This change allows implementers to use proper ES6+ things
like async functions, which return standard promise.

Change-Id: If692d7f13d406bbcc75b22735f78749c6460def4
---
M embed.html
M wikibase/queryService/ui/App.js
2 files changed, 8 insertions(+), 4 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/wikidata/query/gui 
refs/changes/77/388677/1

diff --git a/embed.html b/embed.html
index 5b98e78..2d48ca0 100644
--- a/embed.html
+++ b/embed.html
@@ -275,7 +275,7 @@
$( 'body' ).i18n();
$( 'html' ).attr( { lang: lang, dir: 
$.uls.data.getDir( lang ) } );
 
-   resultView.draw( query ).done( function() {
+   resultView.draw( query ).then( function() {
$( '.logo' ).hide();
} );
renderEdit( query, function( q ){
diff --git a/wikibase/queryService/ui/App.js b/wikibase/queryService/ui/App.js
index d6ee0b7..f8a27c7 100644
--- a/wikibase/queryService/ui/App.js
+++ b/wikibase/queryService/ui/App.js
@@ -672,9 +672,13 @@
this._updateQueryUrl();
 
$( '#execute-button' ).prop( 'disabled', true );
-   this._resultView.draw( this._editor.getValue() ).fail( function 
( error ) {
-   self._editor.highlightError( error );
-   } ).always( function () {
+   this._resultView.draw( this._editor.getValue() ).catch( 
function ( error ) {
+   try {
+   self._editor.highlightError(error);
+   } catch ( err ) {
+   // ignore
+   }
+   } ).then( function () {
$( '#execute-button' ).prop( 'disabled', false );
} );
 

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: If692d7f13d406bbcc75b22735f78749c6460def4
Gerrit-PatchSet: 1
Gerrit-Project: wikidata/query/gui
Gerrit-Branch: master
Gerrit-Owner: Yurik 

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


[MediaWiki-commits] [Gerrit] wikidata...gui[master]: Add original query str to the queryApi object

2017-10-13 Thread Yurik (Code Review)
Yurik has uploaded a new change for review. ( 
https://gerrit.wikimedia.org/r/384202 )

Change subject: Add original query str to the queryApi object
..

Add original query str to the queryApi object

In order to gain access to the original query string
inside the resultBrowsers, we need to preserve the query
string inside the queryApi object.  This is not ideal,
because the api object is both the API wrapper, with
the information HOW to get the data, as well as the
storage for the RESULT data itself.  I think the API
object should return an object with the request,
server's response, and any additional metrics,
thus allowing everyone to share in on it.  But such
change should probably happen after we migrate to Babel,
and start using proper Promises.

Change-Id: I4da3dd36ccec5ae5d91e210d8f344b8228008f9b
---
M wikibase/queryService/api/Sparql.js
1 file changed, 2 insertions(+), 0 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/wikidata/query/gui 
refs/changes/02/384202/1

diff --git a/wikibase/queryService/api/Sparql.js 
b/wikibase/queryService/api/Sparql.js
index bd55824..2446876 100644
--- a/wikibase/queryService/api/Sparql.js
+++ b/wikibase/queryService/api/Sparql.js
@@ -156,12 +156,14 @@
self._resultLength = 
data.results.bindings.length || 0;
}
self._rawData = data;
+   self._originalQuery = query;
 
deferred.resolve( data );
}
function fail( request, options, exception ) {
self._executionTime = null;
self._rawData = null;
+   self._originalQuery = null;
self._resultLength = null;
self._generateErrorMessage( request, options, exception 
);
 

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I4da3dd36ccec5ae5d91e210d8f344b8228008f9b
Gerrit-PatchSet: 1
Gerrit-Project: wikidata/query/gui
Gerrit-Branch: master
Gerrit-Owner: Yurik 

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


[MediaWiki-commits] [Gerrit] wikidata...gui[master]: Moved CSS to LESS, added grunt support

2017-10-11 Thread Yurik (Code Review)
Yurik has uploaded a new change for review. ( 
https://gerrit.wikimedia.org/r/383774 )

Change subject: Moved CSS to LESS, added grunt support
..

Moved CSS to LESS, added grunt support

Change-Id: Ie4720ac9f212ced0d36ce54bc1a6c7ab294daada
---
M Gruntfile.js
M package.json
R style.less
3 files changed, 10 insertions(+), 2 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/wikidata/query/gui 
refs/changes/74/383774/1

diff --git a/Gruntfile.js b/Gruntfile.js
index 06983bc..d6b1374 100644
--- a/Gruntfile.js
+++ b/Gruntfile.js
@@ -28,9 +28,16 @@
'wikibase/tests/*.html'
]
},
+   less: {
+   all: {
+   files: {
+   'style.css': 'style.less'
+   }
+   }
+   },
stylelint: {
all: [
-   'style.css'
+   'style.less'
]
},
banana: {
@@ -227,7 +234,7 @@
'clean', 'create_build'
] );
grunt.registerTask( 'create_build', [
-   'auto_install', 'test', 'copy', 'useminPrepare', 'concat', 
'cssmin', 'uglify', 'filerev', 'usemin', 'htmlmin', 'merge-i18n'
+   'auto_install', 'test', 'less', 'copy', 'useminPrepare', 
'concat', 'cssmin', 'uglify', 'filerev', 'usemin', 'htmlmin', 'merge-i18n'
] );
grunt.registerTask( 'deploy', [
'clean', 'shell:updateRepo', 'shell:cloneDeploy', 
'clean:deploy', 'create_build', 'shell:commitDeploy', 'configDeploy', 
'shell:review'
diff --git a/package.json b/package.json
index a196ec4..e2f2613 100644
--- a/package.json
+++ b/package.json
@@ -55,6 +55,7 @@
 "grunt-contrib-cssmin": "^2.2.0",
 "grunt-contrib-htmlmin": "^2.4.0",
 "grunt-contrib-jshint": "^1.1.0",
+"grunt-contrib-less": "^1.4.1",
 "grunt-contrib-qunit": "^2.0.0",
 "grunt-contrib-uglify": "^3.0.1",
 "grunt-filerev": "^2.3.1",
diff --git a/style.css b/style.less
similarity index 100%
rename from style.css
rename to style.less

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: Ie4720ac9f212ced0d36ce54bc1a6c7ab294daada
Gerrit-PatchSet: 1
Gerrit-Project: wikidata/query/gui
Gerrit-Branch: master
Gerrit-Owner: Yurik 

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


[MediaWiki-commits] [Gerrit] wikidata...gui[master]: gitignore npm-debug.log

2017-10-09 Thread Yurik (Code Review)
Yurik has uploaded a new change for review. ( 
https://gerrit.wikimedia.org/r/383298 )

Change subject: gitignore npm-debug.log
..

gitignore npm-debug.log

Change-Id: I53b08564575f76106b4e43334d0ab0cdd3e8f0d8
---
M .gitignore
1 file changed, 1 insertion(+), 0 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/wikidata/query/gui 
refs/changes/98/383298/1

diff --git a/.gitignore b/.gitignore
index 3433e74..709d14c 100644
--- a/.gitignore
+++ b/.gitignore
@@ -6,3 +6,4 @@
 .idea
 package-lock.json
 *.iml
+npm-debug.log

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I53b08564575f76106b4e43334d0ab0cdd3e8f0d8
Gerrit-PatchSet: 1
Gerrit-Project: wikidata/query/gui
Gerrit-Branch: master
Gerrit-Owner: Yurik 

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


[MediaWiki-commits] [Gerrit] wikidata...gui[master]: Handle missing error.debug

2017-10-08 Thread Yurik (Code Review)
Yurik has uploaded a new change for review. ( 
https://gerrit.wikimedia.org/r/383050 )

Change subject: Handle missing error.debug
..

Handle missing error.debug

In some cases, server may fail without specifying an error,
in which case the error.debug will be undefined, which causes
an error in the later regex parsing.

Change-Id: I2fefdc063c1bf8376c062e7126601ff573ae0400
---
M wikibase/queryService/ui/ResultView.js
1 file changed, 1 insertion(+), 1 deletion(-)


  git pull ssh://gerrit.wikimedia.org:29418/wikidata/query/gui 
refs/changes/50/383050/1

diff --git a/wikibase/queryService/ui/ResultView.js 
b/wikibase/queryService/ui/ResultView.js
index f54a3de..a643abe 100644
--- a/wikibase/queryService/ui/ResultView.js
+++ b/wikibase/queryService/ui/ResultView.js
@@ -311,7 +311,7 @@
this._actionBar.show( errorMessageKey || '', error.message || 
'', 'danger' );
this._track( 'result.error.' + ( errorMessageKey || 'unknown' ) 
);
 
-   return error.debug;
+   return error.debug === undefined ? '' : error.debug;
};
 
/**

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I2fefdc063c1bf8376c062e7126601ff573ae0400
Gerrit-PatchSet: 1
Gerrit-Project: wikidata/query/gui
Gerrit-Branch: master
Gerrit-Owner: Yurik 

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


[MediaWiki-commits] [Gerrit] wikidata...gui[master]: Use global config everywhere

2017-10-08 Thread Yurik (Code Review)
Yurik has uploaded a new change for review. ( 
https://gerrit.wikimedia.org/r/383049 )

Change subject: Use global config everywhere
..

Use global config everywhere

* Ensure config is loaded before all other code
* Do not use any hardcoded URL values outside of config
* Minor optimization for localhost debugging

Change-Id: I933162c48aaddb121062a1e39e484ed2f4c9ece8
---
M embed.html
M examples/dialog.html
M examples/editor.html
M examples/result.html
M examples/sparql.html
M index.html
M wikibase/config.js
M wikibase/init.js
M wikibase/queryService/api/Sparql.js
M wikibase/tests/QueryHelper.html
M wikibase/tests/index.html
11 files changed, 58 insertions(+), 47 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/wikidata/query/gui 
refs/changes/49/383049/1

diff --git a/embed.html b/embed.html
index 553a14b..840738d 100644
--- a/embed.html
+++ b/embed.html
@@ -192,6 +192,7 @@

 

+   



@@ -221,7 +222,6 @@



-   

 

diff --git a/examples/dialog.html b/examples/dialog.html
index 577a34a..155f192 100644
--- a/examples/dialog.html
+++ b/examples/dialog.html
@@ -20,6 +20,7 @@