jenkins-bot has submitted this change and it was merged.
Change subject: [WIP] Refactor gui.js
......................................................................
[WIP] Refactor gui.js
Refactor gui.js to be oo and split up into several classes.
Bug: T116464
Change-Id: Ic9f9c128d51a0220f461ea5174284e013e4529bf
---
A gui/js/wikibase/queryService/Api.js
A gui/js/wikibase/queryService/ui/App.js
A gui/js/wikibase/queryService/ui/Editor.js
3 files changed, 126 insertions(+), 0 deletions(-)
Approvals:
Smalyshev: Looks good to me, approved
Thiemo Mättig (WMDE): Looks good to me, but someone else must approve
jenkins-bot: Verified
diff --git a/gui/js/wikibase/queryService/Api.js
b/gui/js/wikibase/queryService/Api.js
new file mode 100644
index 0000000..7462900
--- /dev/null
+++ b/gui/js/wikibase/queryService/Api.js
@@ -0,0 +1,44 @@
+var wikibase = wikibase || { queryService: { ui: {}} };
+
+wikibase.queryService.Api = ( function( $ ) {
+ "use strict";
+
+ /**
+ * API for the Wikibase query service
+ *
+ * @class wikibase.queryService.Api
+ * @licence GNU GPL v2+
+ * @author Jonas Kress
+ * @constructor
+ */
+ function SELF() {
+ }
+
+ /**
+ * Submit a query to the API
+ *
+ * @param {string[]} data
+ * @return {jQuery.Promise}
+ **/
+ SELF.prototype.submitQuery = function( data ){
+ };
+
+ /**
+ * Get the result of the submitted query
+ *
+ * @return {string}
+ **/
+ SELF.prototype.getResult = function(){
+ };
+
+ /**
+ * Get the result of the submitted query as CSV
+ *
+ * @return {string}
+ **/
+ SELF.prototype.getResultAsCSV = function(){
+ };
+
+ return SELF;
+
+}( jQuery ) );
diff --git a/gui/js/wikibase/queryService/ui/App.js
b/gui/js/wikibase/queryService/ui/App.js
new file mode 100644
index 0000000..705d559
--- /dev/null
+++ b/gui/js/wikibase/queryService/ui/App.js
@@ -0,0 +1,53 @@
+var wikibase = wikibase || { queryService: { ui: {}} };
+
+wikibase.queryService.ui.App = ( function( $ ) {
+ "use strict";
+
+ /**
+ * A ui application for the Wikibase query service
+ *
+ * @class wikibase.queryService.ui.App
+ * @licence GNU GPL v2+
+ * @author Jonas Kress
+ * @constructor
+ *
+ * @param {jQuery} $element
+ * @param {wikibase.queryService.ui.Editor}
+ * @param {wikibase.queryService.API}
+ */
+ function SELF( $element, editor, api ) {
+ this.$element = $element;
+ this.editor = editor;
+ this.api = api;
+
+ if( !this.api ){
+ this.api = new wikibase.queryService.Api();
+ }
+
+ if( !this.editor ){
+ this.editor = new wikibase.queryService.ui.Editor();
+ }
+ }
+
+ /**
+ * @property {string}
+ * @private
+ **/
+ this.$element = null;
+
+ /**
+ * @property {wikibase.queryService.API}
+ * @private
+ **/
+ this.api = null;
+
+ /**
+ * @property {wikibase.queryService.ui.Editor}
+ * @type wikibase.queryService.ui.Editor
+ * @private
+ **/
+ this.editor = null;
+
+
+ return SELF;
+}( jQuery ) );
diff --git a/gui/js/wikibase/queryService/ui/Editor.js
b/gui/js/wikibase/queryService/ui/Editor.js
new file mode 100644
index 0000000..30bae83
--- /dev/null
+++ b/gui/js/wikibase/queryService/ui/Editor.js
@@ -0,0 +1,29 @@
+var wikibase = wikibase || { queryService: { ui: {}} };
+
+wikibase.queryService.ui.Editor = ( function( $ ) {
+ "use strict";
+
+ /**
+ * An ui editor for the Wikibase query service
+ *
+ * @class wikibase.queryService.ui.Editor
+ * @licence GNU GPL v2+
+ * @author Jonas Kress
+ * @constructor
+ */
+ function SELF() {
+ }
+
+ /**
+ * Construct an editor on the given textarea DOM element
+ *
+ * @param {jQuery} $element
+ * @throws {Error} If given element is not a valid jQuery textarea
+ **/
+ SELF.prototype.fromTextArea = function( $element ){
+ };
+
+
+ return SELF;
+
+}( jQuery ) );
--
To view, visit https://gerrit.wikimedia.org/r/248689
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: merged
Gerrit-Change-Id: Ic9f9c128d51a0220f461ea5174284e013e4529bf
Gerrit-PatchSet: 2
Gerrit-Project: wikidata/query/rdf
Gerrit-Branch: master
Gerrit-Owner: Jonas Kress (WMDE) <[email protected]>
Gerrit-Reviewer: Adrian Lang <[email protected]>
Gerrit-Reviewer: Jonas Kress (WMDE) <[email protected]>
Gerrit-Reviewer: Smalyshev <[email protected]>
Gerrit-Reviewer: Thiemo Mättig (WMDE) <[email protected]>
Gerrit-Reviewer: jenkins-bot <>
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits