From 3b343c4cf530e92ea3b730c320976a822caec6f8 Mon Sep 17 00:00:00 2001 From: Ayushi Rai <72227873+ayushrai206@users.noreply.github.com> Date: Tue, 14 Nov 2023 21:34:37 +0530 Subject: [PATCH 1/7] adds the service logo --- .../module/scripts/schema-alignment.js | 29 +- .../module/styles/schema-alignment.css | 6 + .../views/data-table/column-header-ui.js | 21 + .../views/data-table/column-header.html | 5 +- .../core/styles/views/data-table-view.css | 390 +++++++++--------- 5 files changed, 257 insertions(+), 194 deletions(-) diff --git a/extensions/wikibase/module/scripts/schema-alignment.js b/extensions/wikibase/module/scripts/schema-alignment.js index a39ec5da2b6c..d4a4df587905 100644 --- a/extensions/wikibase/module/scripts/schema-alignment.js +++ b/extensions/wikibase/module/scripts/schema-alignment.js @@ -246,7 +246,7 @@ SchemaAlignment.updateColumns = function() { // TODO we could potentially ignore any reconciliation to a siteIRI not // mentioned in the manifest… var cell = SchemaAlignment._createDraggableColumn(column.name, - reconConfig && column.reconStats ? reconConfig.identifierSpace : null); + reconConfig && column.reconStats ? reconConfig.identifierSpace : null, reconConfig); this._columnArea.append(cell); } @@ -433,8 +433,29 @@ SchemaAlignment._changesCleared = function() { .addClass('disabled'); }; -SchemaAlignment._createDraggableColumn = function(name, reconciledSiteIRI) { +SchemaAlignment._createDraggableColumn = function(name, reconciledSiteIRI, reconConfig) { + var serviceUrl = null; +var service = null; +var serviceLogo=null; +if (reconConfig) { +serviceUrl =reconConfig.service; +} +if (serviceUrl) { +service = ReconciliationManager.getServiceFromUrl(serviceUrl); +} +if(service){ +serviceLogo=service.logo; +} + +var img =$(""); +if(serviceLogo ){ +var imageUrl = serviceLogo; +img.attr("src", imageUrl); +img.attr("title", service.name); +img.addClass("serviceLogo-for-schema") +}; var cell = $("
").addClass('wbs-draggable-column').text(name); + cell.append(img); cell.data({ 'columnName': name, 'reconciledSiteIRI': reconciledSiteIRI @@ -1544,7 +1565,7 @@ SchemaAlignment._initField = function(inputContainer, mode, initialValue, change input.val(initialValue.label); input.addClass("wbs-validated-input"); } else if (initialValue.type == "wbentityvariable") { - var cell = SchemaAlignment._createDraggableColumn(initialValue.columnName, true); + var cell = SchemaAlignment._createDraggableColumn(initialValue.columnName, true, null); acceptDraggableColumn(cell); } else if (initialValue.type === "wbstringconstant" || initialValue.type === "wbdateconstant" || @@ -1557,7 +1578,7 @@ SchemaAlignment._initField = function(inputContainer, mode, initialValue, change initialValue.type === "wbdatevariable" || initialValue.type === "wblocationvariable" || initialValue.type === "wblanguagevariable") { - var cell = SchemaAlignment._createDraggableColumn(initialValue.columnName, false); + var cell = SchemaAlignment._createDraggableColumn(initialValue.columnName, false, null); acceptDraggableColumn(cell); } inputContainer.data("jsonValue", initialValue); diff --git a/extensions/wikibase/module/styles/schema-alignment.css b/extensions/wikibase/module/styles/schema-alignment.css index 6b8a410c9eaa..898da9790c95 100644 --- a/extensions/wikibase/module/styles/schema-alignment.css +++ b/extensions/wikibase/module/styles/schema-alignment.css @@ -21,6 +21,12 @@ max-width: 70em; } +.serviceLogo-for-schema{ + float: left !important; + width:19px; + height:21px; + } + .main-view-panel-tab-header { margin-top: 9px; margin-left: 7px; diff --git a/main/webapp/modules/core/scripts/views/data-table/column-header-ui.js b/main/webapp/modules/core/scripts/views/data-table/column-header-ui.js index 8f7ed51c6581..d03c17dcef89 100644 --- a/main/webapp/modules/core/scripts/views/data-table/column-header-ui.js +++ b/main/webapp/modules/core/scripts/views/data-table/column-header-ui.js @@ -69,6 +69,27 @@ DataTableColumnHeaderUI.prototype._render = function() { elmts.dropdownMenu.on('click',function() { self._createMenuForColumnHeader(this); }); + var serviceUrl = null; +var service = null; +var serviceLogo=null; +if (this._column.reconConfig) { +serviceUrl =this._column.reconConfig.service; +} +if (serviceUrl) { +service = ReconciliationManager.getServiceFromUrl(serviceUrl); +} +if(service){ +serviceLogo=service.logo; +} + +var img =$(""); +if(serviceLogo ){ +var imageUrl = serviceLogo; +img.attr("src", imageUrl); +img.attr("title", service.name); +img.addClass("serviceLogo") +img.appendTo(elmts.serviceLogoContainer.show()); +} if ("reconStats" in this._column) { var stats = this._column.reconStats; diff --git a/main/webapp/modules/core/scripts/views/data-table/column-header.html b/main/webapp/modules/core/scripts/views/data-table/column-header.html index 2c93453f30dc..f8d89cfe1470 100644 --- a/main/webapp/modules/core/scripts/views/data-table/column-header.html +++ b/main/webapp/modules/core/scripts/views/data-table/column-header.html @@ -1,2 +1,5 @@
-
\ No newline at end of file +
+
+
+
\ No newline at end of file diff --git a/main/webapp/modules/core/styles/views/data-table-view.css b/main/webapp/modules/core/styles/views/data-table-view.css index 0c7d5c978a32..bd8b04f7b2d2 100644 --- a/main/webapp/modules/core/styles/views/data-table-view.css +++ b/main/webapp/modules/core/styles/views/data-table-view.css @@ -1,3 +1,5 @@ + + /* Copyright 2010, Google Inc. @@ -7,13 +9,13 @@ Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: - * Redistributions of source code must retain the above copyright +* Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. - * Redistributions in binary form must reproduce the above +* Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. - * Neither the name of Google Inc. nor the names of its +* Neither the name of Google Inc. nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission. @@ -23,8 +25,8 @@ LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. @@ -32,382 +34,392 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ .viewpanel-header { - position: relative; - background: var(--fill-secondary); - font-size: 1.3em; - padding: var(--padding-normal); - overflow: hidden; +position: relative; +background: var(--fill-secondary); +font-size: 1.3em; +padding: var(--padding-normal); +overflow: hidden; } .viewpanel-rowrecord, .viewpanel-pagesize, .viewpanel-sorting { - top: var(--padding-normal); - padding: 0 10px 0 0; - float: left; +top: var(--padding-normal); +padding: 0 10px 0 0; +float: left; } .viewpanel-paging { - float: right; +float: right; } .viewpanel-pagingcount { - font-weight: bold; +font-weight: bold; } .viewpanel-rowrecord a { - background-color: var(--fill-primary); - margin: 0px 1px 0px 1px; - padding: 2px 5px 2px 5px; - border-radius: 4px; +background-color: var(--fill-primary); +margin: 0px 1px 0px 1px; +padding: 2px 5px 2px 5px; +border-radius: 4px; } .viewpanel-pagesize a { - background-color: var(--fill-primary); - margin: 0px 2px 0px 2px; - padding: 2px 3px 2px 3px; - border-radius: 4px; +background-color: var(--fill-primary); +margin: 0px 2px 0px 2px; +padding: 2px 3px 2px 3px; +border-radius: 4px; } div.viewpanel-pagesize span:first-of-type { - margin: 0px 0px 0px 20px; +margin: 0px 0px 0px 20px; } .viewpanel-paging a { - background-color: var(--fill-primary); - margin: 0px 4px 0px 4px; - padding: 2px 10px 2px 10px; - border-radius: 4px; +background-color: var(--fill-primary); +margin: 0px 4px 0px 4px; +padding: 2px 10px 2px 10px; +border-radius: 4px; } .viewpanel-paging span#viewpanel-paging-current { - margin: 0 10px 0 10px; - padding: 0px; +margin: 0 10px 0 10px; +padding: 0px; } .viewpanel-paging input#viewpanel-paging-current-input { - width: 60px; - margin: 0px; - padding: 0px; - height: 16px; - position: relative; - top: -2px; +width: 60px; +margin: 0px; +padding: 0px; +height: 16px; +position: relative; +top: -2px; } .data-table-header { - width: 1px; - position: relative; - background: var(--fill-primary); +width: 1px; +position: relative; +background: var(--fill-primary); } .data-table-container { - overflow: auto; - border-top: 1px solid var(--chrome-primary); +overflow: auto; +border-top: 1px solid var(--chrome-primary); } .data-table-header, .data-table { - margin: 0; - padding: 0; - font-size: 1.05em; - border-collapse: separate; +margin: 0; +padding: 0; +font-size: 1.05em; +border-collapse: separate; } .data-table td, .data-table-header td, .data-table-header th { - padding: 2px 5px; +padding: 2px 5px; } .data-table td { - border-bottom: 0.02rem dotted #ddd; - border-right: 0.02rem solid #ddd; +border-bottom: 0.02rem dotted #ddd; +border-right: 0.02rem solid #ddd; } .data-table-header td, .data-table-header th { - border-bottom: 0.02rem dotted var(--chrome-primary); - border-right: 0.02rem solid var(--chrome-primary); +border-bottom: 0.02rem dotted var(--chrome-primary); +border-right: 0.02rem solid var(--chrome-primary); } table { - position: relative; +position: relative; } th.column-header { - position: sticky; - top: 0; - z-index: 1; - will-change: transform; +position: sticky; +top: 0; +z-index: 1; +will-change: transform; } th { - text-align: left; +text-align: left; } table.data-header-table>tbody>tr>td { - overflow: hidden !important; +overflow: hidden !important; } table>thead>tr>th { - overflow: hidden !important; +overflow: hidden !important; } table.data-table>tbody>tr.odd>td { - background: var(--fill-secondary); +background: var(--fill-secondary); } table.data-table>tbody>tr.contextual>td>div { - opacity: 0.3; +opacity: 0.3; } table.data-table-header td.column-header, table.data-table-header th.column-header, table.data-table td.column-header, table.data-table th.column-header { - vertical-align: top; - white-space: nowrap; - padding: 4px 6px 4px 4px; - border-bottom: none; - font-weight: bold; +vertical-align: top; +white-space: nowrap; +padding: 4px 6px 4px 4px; +border-bottom: none; +font-weight: bold; } /* For the preview in the importing stage */ table.data-table td.column-header, table.data-table th.column-header { - background: var(--fill-primary); - border-bottom: 0.12rem solid var(--chrome-primary); +background: var(--fill-primary); +border-bottom: 0.12rem solid var(--chrome-primary); } .column-header-name { - margin: 0 0 0 21px; - padding: 4px 0 0 0; - display: block; +margin: 0 0 0 21px; +padding: 4px 0 0 0; +display: block; } .column-header-menu { - float: left; - display: block; - margin: 0 4px 0 0; - width: 17px; - height: 19px; - background-image: url(../../images/menu-dropdown.png); - background-repeat: no-repeat; - cursor: pointer; - border: none; +float: left; +display: block; +margin: 0 4px 0 0; +width: 17px; +height: 19px; +background-image: url(../../images/menu-dropdown.png); +background-repeat: no-repeat; +cursor: pointer; +border: none; } .column-header-menu:hover { - background-position: -17px 0px; +background-position: -17px 0px; } +.container-of-logo-and-statsbar { +display: grid; +grid-template-columns: max-content auto; +width:100%; +} .column-header-recon-stats-bar { - margin-top: 10px; - height: 4px; - background: #ddd; - border: 1px solid #ccc; - position: relative; - width: 100%; +margin-top:4px; +height: 6px; +background: #ddd; +border: 1px solid #ccc; +position: relative; +width: 100%; +} + +.serviceLogo { +width: 19px; +height: 21px; } .column-header-recon-stats-matched { - position: absolute; - height: 100%; - background: var(--green-primary); +position: absolute; +height: 100%; +background: var(--green-primary); } .column-header-recon-stats-blanks { - position: absolute; - height: 100%; - background: var(--green-secondary); +position: absolute; +height: 100%; +background: var(--green-secondary); } div.data-table-cell-content { - line-height: 1.2; - color: #222; - position: relative; - white-space: pre-wrap; +line-height: 1.2; +color: #222; +position: relative; +white-space: pre-wrap; } div.data-table-cell-content-numeric { - text-align: right; +text-align: right; } a.data-table-cell-edit { - position: absolute; - right: 0; - text-decoration: none; - visibility: hidden; - color: var(--background-primary); - background-color: #8ae; - padding: 2px 3px; - border-radius: 3px; - font-weight: bold; - line-height: normal; +position: absolute; +right: 0; +text-decoration: none; +visibility: hidden; +color: var(--background-primary); +background-color: #8ae; +padding: 2px 3px; +border-radius: 3px; +font-weight: bold; +line-height: normal; } a.data-table-cell-edit:hover { - background-color: var(--link-secondary); +background-color: var(--link-secondary); } div.data-table-cell-content-numeric>a.data-table-cell-edit { - left: 0px; - right: auto; +left: 0px; +right: auto; } .data-table-value-nonstring { - color: #282; +color: #282; } .data-table-null { - color: #aaa; - display: none; +color: #aaa; +display: none; } .data-table-error { - color: red; +color: red; } div.data-table-recon-candidates { - padding: 1px 0; - min-width: 15em; - color: var(--text-tertiary); +padding: 1px 0; +min-width: 15em; +color: var(--text-tertiary); } div.data-table-recon-candidate { - padding: 1px 35px 1px; - position: relative; +padding: 1px 35px 1px; +position: relative; } a.data-table-recon-topic { - color: var(--link-secondary); +color: var(--link-secondary); } .data-table-recon-score, .data-table-recon-new { - color: #aaa; - margin: 0 0.5em; +color: #aaa; +margin: 0 0.5em; } a.data-table-recon-action, .data-table-recon-extra>a { - text-decoration: none; - color: var(--link-secondary); +text-decoration: none; +color: var(--link-secondary); } a.data-table-recon-action, .data-table-recon-extra { - font-size: 0.8em; - display: block; - margin: 3px 0 0; +font-size: 0.8em; +display: block; +margin: 3px 0 0; } a.data-table-recon-match, a.data-table-recon-match-similar { - position: absolute; - top: 0; - left: 0; - display: block; - width: 16px; - height: 16px; - background-image: url('../../images/checks-map.png'); - background-repeat: no-repeat; - background-position: -16px 0; - text-decoration: none; +position: absolute; +top: 0; +left: 0; +display: block; +width: 16px; +height: 16px; +background-image: url('../../images/checks-map.png'); +background-repeat: no-repeat; +background-position: -16px 0; +text-decoration: none; } a.data-table-recon-match:hover { - background-position: 0 0; +background-position: 0 0; } a.data-table-recon-match-similar { - background-position: -16px -16px; - left: 16px; +background-position: -16px -16px; +left: 16px; } a.data-table-recon-match-similar:hover { - background-position: 0 -16px; +background-position: 0 -16px; } a.data-table-star-on, a.data-table-star-off, a.data-table-flag-on, a.data-table-flag-off { - display: block; - width: 16px; - height: 16px; - background-image: url('../../images/star-flag-map.png'); - background-repeat: no-repeat; - text-decoration: none; +display: block; +width: 16px; +height: 16px; +background-image: url('../../images/star-flag-map.png'); +background-repeat: no-repeat; +text-decoration: none; } a.data-table-star-on { - background-position: 0 0; +background-position: 0 0; } a.data-table-star-off { - background-position: -17px 0; +background-position: -17px 0; } a.data-table-flag-on { - background-position: 0 -17px; +background-position: 0 -17px; } a.data-table-flag-off { - background-position: -17px -17px; +background-position: -17px -17px; } .data-table-cell-editor, .data-table-topic-popup { - border: 1px solid var(--chrome-primary); - background: var(--chrome-secondary); - padding: var(--padding-tight); - border-radius: var(--rounded-corners-radius); +border: 1px solid var(--chrome-primary); +background: var(--chrome-secondary); +padding: var(--padding-tight); +border-radius: var(--rounded-corners-radius); } .data-table-topic-popup { - z-index: 1010; - position: fixed; - line-height: 1; - white-space: initial; +z-index: 1010; +position: fixed; +line-height: 1; +white-space: initial; } .data-table-topic-popup-header { - padding: 0 0 5px; +padding: 0 0 5px; } .data-table-cell-editor-editor { - display: block; - min-width: 392px; - min-height: 3em; - line-height: 1.1; - font-family: monospace; - margin: 3px 0px; +display: block; +min-width: 392px; +min-height: 3em; +line-height: 1.1; +font-family: monospace; +margin: 3px 0px; } .data-table-cell-editor { - min-width: fit-content; +min-width: fit-content; } .data-table-cell-editor-action { - float: left; - vertical-align: bottom; - text-align: center; +float: left; +vertical-align: bottom; +text-align: center; } .data-table-cell-editor-key { - font-size: 0.8em; - color: var(--light-grey); +font-size: 0.8em; +color: var(--light-grey); } .set-httpheaders-container label { - display: inline-block; - width: 15%; - text-align: left; +display: inline-block; +width: 15%; +text-align: left; } .set-httpheaders-container input { - display: inline-block; - width: 50%; +display: inline-block; +width: 50%; } ul.sorting-dialog-blank-error-positions { - margin: 0; - padding: 5px; - height: 10em; - border: 1px solid #ccc; - border-radius: 3px; +margin: 0; +padding: 5px; +height: 10em; +border: 1px solid #ccc; +border-radius: 3px; } ul.sorting-dialog-blank-error-positions>li { - display: block; - border: 1px solid #ccc; - background: #eee; - padding: 5px; - margin: 2px; - cursor: move; - border-radius: 3px; +display: block; +border: 1px solid #ccc; +background: #eee; +padding: 5px; +margin: 2px; +cursor: move; +border-radius: 3px; } From a5d76ce613d3c9808b97bc6cf8893ccf1033cabb Mon Sep 17 00:00:00 2001 From: Ayushi Rai <72227873+ayushrai206@users.noreply.github.com> Date: Wed, 15 Nov 2023 07:21:20 +0530 Subject: [PATCH 2/7] fixes the indentation changes --- .../module/scripts/schema-alignment.js | 40 +- .../views/data-table/column-header-ui.js | 38 +- .../core/styles/views/data-table-view.css | 397 +++++++++--------- 3 files changed, 237 insertions(+), 238 deletions(-) diff --git a/extensions/wikibase/module/scripts/schema-alignment.js b/extensions/wikibase/module/scripts/schema-alignment.js index d4a4df587905..957aca1c025e 100644 --- a/extensions/wikibase/module/scripts/schema-alignment.js +++ b/extensions/wikibase/module/scripts/schema-alignment.js @@ -435,25 +435,25 @@ SchemaAlignment._changesCleared = function() { SchemaAlignment._createDraggableColumn = function(name, reconciledSiteIRI, reconConfig) { var serviceUrl = null; -var service = null; -var serviceLogo=null; -if (reconConfig) { -serviceUrl =reconConfig.service; -} -if (serviceUrl) { -service = ReconciliationManager.getServiceFromUrl(serviceUrl); -} -if(service){ -serviceLogo=service.logo; -} - -var img =$(""); -if(serviceLogo ){ -var imageUrl = serviceLogo; -img.attr("src", imageUrl); -img.attr("title", service.name); -img.addClass("serviceLogo-for-schema") -}; + var service = null; + var serviceLogo=null; + if (reconConfig) { + serviceUrl =reconConfig.service; + } + if (serviceUrl) { + service = ReconciliationManager.getServiceFromUrl(serviceUrl); + } + if(service){ + serviceLogo=service.logo; + } + + var img =$(""); + if(serviceLogo ){ + var imageUrl = serviceLogo; + img.attr("src", imageUrl); + img.attr("title", service.name); + img.addClass("serviceLogo-for-schema") + }; var cell = $("
").addClass('wbs-draggable-column').text(name); cell.append(img); cell.data({ @@ -1565,7 +1565,7 @@ SchemaAlignment._initField = function(inputContainer, mode, initialValue, change input.val(initialValue.label); input.addClass("wbs-validated-input"); } else if (initialValue.type == "wbentityvariable") { - var cell = SchemaAlignment._createDraggableColumn(initialValue.columnName, true, null); + var cell = SchemaAlignment._createDraggableColumn(initialValue.columnName, true, this.column.reconConfig); acceptDraggableColumn(cell); } else if (initialValue.type === "wbstringconstant" || initialValue.type === "wbdateconstant" || diff --git a/main/webapp/modules/core/scripts/views/data-table/column-header-ui.js b/main/webapp/modules/core/scripts/views/data-table/column-header-ui.js index d03c17dcef89..eb26f4aafb68 100644 --- a/main/webapp/modules/core/scripts/views/data-table/column-header-ui.js +++ b/main/webapp/modules/core/scripts/views/data-table/column-header-ui.js @@ -70,26 +70,26 @@ DataTableColumnHeaderUI.prototype._render = function() { self._createMenuForColumnHeader(this); }); var serviceUrl = null; -var service = null; -var serviceLogo=null; -if (this._column.reconConfig) { -serviceUrl =this._column.reconConfig.service; -} -if (serviceUrl) { -service = ReconciliationManager.getServiceFromUrl(serviceUrl); -} -if(service){ -serviceLogo=service.logo; -} + var service = null; + var serviceLogo=null; + if (this._column.reconConfig) { + serviceUrl =this._column.reconConfig.service; + } + if (serviceUrl) { + service = ReconciliationManager.getServiceFromUrl(serviceUrl); + } + if(service){ + serviceLogo=service.logo; + } -var img =$(""); -if(serviceLogo ){ -var imageUrl = serviceLogo; -img.attr("src", imageUrl); -img.attr("title", service.name); -img.addClass("serviceLogo") -img.appendTo(elmts.serviceLogoContainer.show()); -} + var img =$(""); + if(serviceLogo ){ + var imageUrl = serviceLogo; + img.attr("src", imageUrl); + img.attr("title", service.name); + img.addClass("serviceLogo") + img.appendTo(elmts.serviceLogoContainer.show()); + } if ("reconStats" in this._column) { var stats = this._column.reconStats; diff --git a/main/webapp/modules/core/styles/views/data-table-view.css b/main/webapp/modules/core/styles/views/data-table-view.css index bd8b04f7b2d2..ab4e8e302460 100644 --- a/main/webapp/modules/core/styles/views/data-table-view.css +++ b/main/webapp/modules/core/styles/views/data-table-view.css @@ -1,5 +1,3 @@ - - /* Copyright 2010, Google Inc. @@ -9,13 +7,13 @@ Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: -* Redistributions of source code must retain the above copyright + * Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. -* Redistributions in binary form must reproduce the above + * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. -* Neither the name of Google Inc. nor the names of its + * Neither the name of Google Inc. nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission. @@ -25,8 +23,8 @@ LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. @@ -34,392 +32,393 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ .viewpanel-header { -position: relative; -background: var(--fill-secondary); -font-size: 1.3em; -padding: var(--padding-normal); -overflow: hidden; + position: relative; + background: var(--fill-secondary); + font-size: 1.3em; + padding: var(--padding-normal); + overflow: hidden; } .viewpanel-rowrecord, .viewpanel-pagesize, .viewpanel-sorting { -top: var(--padding-normal); -padding: 0 10px 0 0; -float: left; + top: var(--padding-normal); + padding: 0 10px 0 0; + float: left; } .viewpanel-paging { -float: right; + float: right; } .viewpanel-pagingcount { -font-weight: bold; + font-weight: bold; } .viewpanel-rowrecord a { -background-color: var(--fill-primary); -margin: 0px 1px 0px 1px; -padding: 2px 5px 2px 5px; -border-radius: 4px; + background-color: var(--fill-primary); + margin: 0px 1px 0px 1px; + padding: 2px 5px 2px 5px; + border-radius: 4px; } .viewpanel-pagesize a { -background-color: var(--fill-primary); -margin: 0px 2px 0px 2px; -padding: 2px 3px 2px 3px; -border-radius: 4px; + background-color: var(--fill-primary); + margin: 0px 2px 0px 2px; + padding: 2px 3px 2px 3px; + border-radius: 4px; } div.viewpanel-pagesize span:first-of-type { -margin: 0px 0px 0px 20px; + margin: 0px 0px 0px 20px; } .viewpanel-paging a { -background-color: var(--fill-primary); -margin: 0px 4px 0px 4px; -padding: 2px 10px 2px 10px; -border-radius: 4px; + background-color: var(--fill-primary); + margin: 0px 4px 0px 4px; + padding: 2px 10px 2px 10px; + border-radius: 4px; } .viewpanel-paging span#viewpanel-paging-current { -margin: 0 10px 0 10px; -padding: 0px; + margin: 0 10px 0 10px; + padding: 0px; } .viewpanel-paging input#viewpanel-paging-current-input { -width: 60px; -margin: 0px; -padding: 0px; -height: 16px; -position: relative; -top: -2px; + width: 60px; + margin: 0px; + padding: 0px; + height: 16px; + position: relative; + top: -2px; } .data-table-header { -width: 1px; -position: relative; -background: var(--fill-primary); + width: 1px; + position: relative; + background: var(--fill-primary); } .data-table-container { -overflow: auto; -border-top: 1px solid var(--chrome-primary); + overflow: auto; + border-top: 1px solid var(--chrome-primary); } .data-table-header, .data-table { -margin: 0; -padding: 0; -font-size: 1.05em; -border-collapse: separate; + margin: 0; + padding: 0; + font-size: 1.05em; + border-collapse: separate; } .data-table td, .data-table-header td, .data-table-header th { -padding: 2px 5px; + padding: 2px 5px; } .data-table td { -border-bottom: 0.02rem dotted #ddd; -border-right: 0.02rem solid #ddd; + border-bottom: 0.02rem dotted #ddd; + border-right: 0.02rem solid #ddd; } .data-table-header td, .data-table-header th { -border-bottom: 0.02rem dotted var(--chrome-primary); -border-right: 0.02rem solid var(--chrome-primary); + border-bottom: 0.02rem dotted var(--chrome-primary); + border-right: 0.02rem solid var(--chrome-primary); } table { -position: relative; + position: relative; } th.column-header { -position: sticky; -top: 0; -z-index: 1; -will-change: transform; + position: sticky; + top: 0; + z-index: 1; + will-change: transform; } th { -text-align: left; + text-align: left; } table.data-header-table>tbody>tr>td { -overflow: hidden !important; + overflow: hidden !important; } table>thead>tr>th { -overflow: hidden !important; + overflow: hidden !important; } table.data-table>tbody>tr.odd>td { -background: var(--fill-secondary); + background: var(--fill-secondary); } table.data-table>tbody>tr.contextual>td>div { -opacity: 0.3; + opacity: 0.3; } table.data-table-header td.column-header, table.data-table-header th.column-header, table.data-table td.column-header, table.data-table th.column-header { -vertical-align: top; -white-space: nowrap; -padding: 4px 6px 4px 4px; -border-bottom: none; -font-weight: bold; + vertical-align: top; + white-space: nowrap; + padding: 4px 6px 4px 4px; + border-bottom: none; + font-weight: bold; } /* For the preview in the importing stage */ table.data-table td.column-header, table.data-table th.column-header { -background: var(--fill-primary); -border-bottom: 0.12rem solid var(--chrome-primary); + background: var(--fill-primary); + border-bottom: 0.12rem solid var(--chrome-primary); } .column-header-name { -margin: 0 0 0 21px; -padding: 4px 0 0 0; -display: block; + margin: 0 0 0 21px; + padding: 4px 0 0 0; + display: block; } .column-header-menu { -float: left; -display: block; -margin: 0 4px 0 0; -width: 17px; -height: 19px; -background-image: url(../../images/menu-dropdown.png); -background-repeat: no-repeat; -cursor: pointer; -border: none; + float: left; + display: block; + margin: 0 4px 0 0; + width: 17px; + height: 19px; + background-image: url(../../images/menu-dropdown.png); + background-repeat: no-repeat; + cursor: pointer; + border: none; } .column-header-menu:hover { -background-position: -17px 0px; + background-position: -17px 0px; } .container-of-logo-and-statsbar { -display: grid; -grid-template-columns: max-content auto; -width:100%; -} + display: grid; + grid-template-columns: max-content auto; + width:100%; + } + .column-header-recon-stats-bar { -margin-top:4px; -height: 6px; -background: #ddd; -border: 1px solid #ccc; -position: relative; -width: 100%; -} - + margin-top:4px; + height: 6px; + background: #ddd; + border: 1px solid #ccc; + position: relative; + width: 100%; +} + .serviceLogo { -width: 19px; -height: 21px; + width: 19px; + height: 21px; } .column-header-recon-stats-matched { -position: absolute; -height: 100%; -background: var(--green-primary); + position: absolute; + height: 100%; + background: var(--green-primary); } .column-header-recon-stats-blanks { -position: absolute; -height: 100%; -background: var(--green-secondary); + position: absolute; + height: 100%; + background: var(--green-secondary); } div.data-table-cell-content { -line-height: 1.2; -color: #222; -position: relative; -white-space: pre-wrap; + line-height: 1.2; + color: #222; + position: relative; + white-space: pre-wrap; } div.data-table-cell-content-numeric { -text-align: right; + text-align: right; } a.data-table-cell-edit { -position: absolute; -right: 0; -text-decoration: none; -visibility: hidden; -color: var(--background-primary); -background-color: #8ae; -padding: 2px 3px; -border-radius: 3px; -font-weight: bold; -line-height: normal; + position: absolute; + right: 0; + text-decoration: none; + visibility: hidden; + color: var(--background-primary); + background-color: #8ae; + padding: 2px 3px; + border-radius: 3px; + font-weight: bold; + line-height: normal; } a.data-table-cell-edit:hover { -background-color: var(--link-secondary); + background-color: var(--link-secondary); } div.data-table-cell-content-numeric>a.data-table-cell-edit { -left: 0px; -right: auto; + left: 0px; + right: auto; } .data-table-value-nonstring { -color: #282; + color: #282; } .data-table-null { -color: #aaa; -display: none; + color: #aaa; + display: none; } .data-table-error { -color: red; + color: red; } div.data-table-recon-candidates { -padding: 1px 0; -min-width: 15em; -color: var(--text-tertiary); + padding: 1px 0; + min-width: 15em; + color: var(--text-tertiary); } div.data-table-recon-candidate { -padding: 1px 35px 1px; -position: relative; + padding: 1px 35px 1px; + position: relative; } a.data-table-recon-topic { -color: var(--link-secondary); + color: var(--link-secondary); } .data-table-recon-score, .data-table-recon-new { -color: #aaa; -margin: 0 0.5em; + color: #aaa; + margin: 0 0.5em; } a.data-table-recon-action, .data-table-recon-extra>a { -text-decoration: none; -color: var(--link-secondary); + text-decoration: none; + color: var(--link-secondary); } a.data-table-recon-action, .data-table-recon-extra { -font-size: 0.8em; -display: block; -margin: 3px 0 0; + font-size: 0.8em; + display: block; + margin: 3px 0 0; } a.data-table-recon-match, a.data-table-recon-match-similar { -position: absolute; -top: 0; -left: 0; -display: block; -width: 16px; -height: 16px; -background-image: url('../../images/checks-map.png'); -background-repeat: no-repeat; -background-position: -16px 0; -text-decoration: none; + position: absolute; + top: 0; + left: 0; + display: block; + width: 16px; + height: 16px; + background-image: url('../../images/checks-map.png'); + background-repeat: no-repeat; + background-position: -16px 0; + text-decoration: none; } a.data-table-recon-match:hover { -background-position: 0 0; + background-position: 0 0; } a.data-table-recon-match-similar { -background-position: -16px -16px; -left: 16px; + background-position: -16px -16px; + left: 16px; } a.data-table-recon-match-similar:hover { -background-position: 0 -16px; + background-position: 0 -16px; } a.data-table-star-on, a.data-table-star-off, a.data-table-flag-on, a.data-table-flag-off { -display: block; -width: 16px; -height: 16px; -background-image: url('../../images/star-flag-map.png'); -background-repeat: no-repeat; -text-decoration: none; + display: block; + width: 16px; + height: 16px; + background-image: url('../../images/star-flag-map.png'); + background-repeat: no-repeat; + text-decoration: none; } a.data-table-star-on { -background-position: 0 0; + background-position: 0 0; } a.data-table-star-off { -background-position: -17px 0; + background-position: -17px 0; } a.data-table-flag-on { -background-position: 0 -17px; + background-position: 0 -17px; } a.data-table-flag-off { -background-position: -17px -17px; + background-position: -17px -17px; } .data-table-cell-editor, .data-table-topic-popup { -border: 1px solid var(--chrome-primary); -background: var(--chrome-secondary); -padding: var(--padding-tight); -border-radius: var(--rounded-corners-radius); + border: 1px solid var(--chrome-primary); + background: var(--chrome-secondary); + padding: var(--padding-tight); + border-radius: var(--rounded-corners-radius); } .data-table-topic-popup { -z-index: 1010; -position: fixed; -line-height: 1; -white-space: initial; + z-index: 1010; + position: fixed; + line-height: 1; + white-space: initial; } .data-table-topic-popup-header { -padding: 0 0 5px; + padding: 0 0 5px; } .data-table-cell-editor-editor { -display: block; -min-width: 392px; -min-height: 3em; -line-height: 1.1; -font-family: monospace; -margin: 3px 0px; + display: block; + min-width: 392px; + min-height: 3em; + line-height: 1.1; + font-family: monospace; + margin: 3px 0px; } .data-table-cell-editor { -min-width: fit-content; + min-width: fit-content; } .data-table-cell-editor-action { -float: left; -vertical-align: bottom; -text-align: center; + float: left; + vertical-align: bottom; + text-align: center; } .data-table-cell-editor-key { -font-size: 0.8em; -color: var(--light-grey); + font-size: 0.8em; + color: var(--light-grey); } .set-httpheaders-container label { -display: inline-block; -width: 15%; -text-align: left; + display: inline-block; + width: 15%; + text-align: left; } .set-httpheaders-container input { -display: inline-block; -width: 50%; + display: inline-block; + width: 50%; } ul.sorting-dialog-blank-error-positions { -margin: 0; -padding: 5px; -height: 10em; -border: 1px solid #ccc; -border-radius: 3px; + margin: 0; + padding: 5px; + height: 10em; + border: 1px solid #ccc; + border-radius: 3px; } ul.sorting-dialog-blank-error-positions>li { -display: block; -border: 1px solid #ccc; -background: #eee; -padding: 5px; -margin: 2px; -cursor: move; -border-radius: 3px; + display: block; + border: 1px solid #ccc; + background: #eee; + padding: 5px; + margin: 2px; + cursor: move; + border-radius: 3px; } From c0637ed62e54344b258f45364f9dcac3f72b2341 Mon Sep 17 00:00:00 2001 From: Ayushi Rai <72227873+ayushrai206@users.noreply.github.com> Date: Wed, 15 Nov 2023 07:32:04 +0530 Subject: [PATCH 3/7] fixes a minor change --- extensions/wikibase/module/scripts/schema-alignment.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/extensions/wikibase/module/scripts/schema-alignment.js b/extensions/wikibase/module/scripts/schema-alignment.js index 957aca1c025e..0905e638974f 100644 --- a/extensions/wikibase/module/scripts/schema-alignment.js +++ b/extensions/wikibase/module/scripts/schema-alignment.js @@ -1565,7 +1565,7 @@ SchemaAlignment._initField = function(inputContainer, mode, initialValue, change input.val(initialValue.label); input.addClass("wbs-validated-input"); } else if (initialValue.type == "wbentityvariable") { - var cell = SchemaAlignment._createDraggableColumn(initialValue.columnName, true, this.column.reconConfig); + var cell = SchemaAlignment._createDraggableColumn(initialValue.columnName, true, null); acceptDraggableColumn(cell); } else if (initialValue.type === "wbstringconstant" || initialValue.type === "wbdateconstant" || From 2fbd210f843cea78bf5ddba12496a5d606457c5a Mon Sep 17 00:00:00 2001 From: Ayushi Rai <72227873+ayushrai206@users.noreply.github.com> Date: Fri, 17 Nov 2023 01:29:12 +0530 Subject: [PATCH 4/7] the column added to the schema also has a logo now --- .../module/scripts/schema-alignment.js | 38 +++++++++++++++++-- .../module/styles/schema-alignment.css | 2 +- 2 files changed, 36 insertions(+), 4 deletions(-) diff --git a/extensions/wikibase/module/scripts/schema-alignment.js b/extensions/wikibase/module/scripts/schema-alignment.js index 0905e638974f..6105e5d8e274 100644 --- a/extensions/wikibase/module/scripts/schema-alignment.js +++ b/extensions/wikibase/module/scripts/schema-alignment.js @@ -1488,13 +1488,38 @@ SchemaAlignment._initField = function(inputContainer, mode, initialValue, change } var acceptDraggableColumn = function(column) { + var serviceUrl = null; + var service = null; + var serviceLogo=null; + if (reconConfig) { + serviceUrl =reconConfig.service; + } + if (serviceUrl) { + service = ReconciliationManager.getServiceFromUrl(serviceUrl); + } + if(service){ + serviceLogo=service.logo; + } + + var img =$(""); + if(serviceLogo ){ + var imageUrl = serviceLogo; + img.attr("src", imageUrl); + img.attr("title", service.name); + img.addClass("serviceLogo-for-schema") + + }; + input.hide(); input.val(""); var columnDiv = $('
').appendTo(inputContainer); column.appendTo(columnDiv); + //columnDiv.append(img); + var origText = column.text(); column.text(""); - column.append($('
').addClass('wbs-restricted-column-name').text(origText)); + column.append($('
').addClass('wbs-restricted-column-name').text(origText).append(img)); + var deleteButton = SchemaAlignment._makeDeleteButton(true).appendTo(column); deleteButton.attr('alt', $.i18n('wikibase-schema/remove-column')); deleteButton.on('click',function (e) { @@ -1559,13 +1584,20 @@ SchemaAlignment._initField = function(inputContainer, mode, initialValue, change // Init with the provided initial value. if (initialValue) { + var columns = theProject.columnModel.columns; + var reconConfig=null; + for (var i = 0; i < columns.length; i++) { + if(columns[i].name===initialValue.columnName){ + reconConfig = columns[i].reconConfig; + } + } if (initialValue.type === "wbentityidvalueconstant" || /* item for backwards-compatibility purposes */ initialValue.type === "wbitemconstant" || initialValue.type === "wbpropconstant") { input.val(initialValue.label); input.addClass("wbs-validated-input"); } else if (initialValue.type == "wbentityvariable") { - var cell = SchemaAlignment._createDraggableColumn(initialValue.columnName, true, null); + var cell = SchemaAlignment._createDraggableColumn(initialValue.columnName, true, reconConfig); acceptDraggableColumn(cell); } else if (initialValue.type === "wbstringconstant" || initialValue.type === "wbdateconstant" || @@ -1578,7 +1610,7 @@ SchemaAlignment._initField = function(inputContainer, mode, initialValue, change initialValue.type === "wbdatevariable" || initialValue.type === "wblocationvariable" || initialValue.type === "wblanguagevariable") { - var cell = SchemaAlignment._createDraggableColumn(initialValue.columnName, false, null); + var cell = SchemaAlignment._createDraggableColumn(initialValue.columnName, false, reconConfig ); acceptDraggableColumn(cell); } inputContainer.data("jsonValue", initialValue); diff --git a/extensions/wikibase/module/styles/schema-alignment.css b/extensions/wikibase/module/styles/schema-alignment.css index 898da9790c95..c86155567646 100644 --- a/extensions/wikibase/module/styles/schema-alignment.css +++ b/extensions/wikibase/module/styles/schema-alignment.css @@ -24,7 +24,7 @@ .serviceLogo-for-schema{ float: left !important; width:19px; - height:21px; + height:20px; } .main-view-panel-tab-header { From 79c556a85b09eca664436392b4707ba3a37b9016 Mon Sep 17 00:00:00 2001 From: Ayushi Rai <72227873+ayushrai206@users.noreply.github.com> Date: Thu, 7 Dec 2023 23:27:49 +0530 Subject: [PATCH 5/7] verifies the url --- .../module/scripts/schema-alignment.js | 36 ++++++++++++------- .../views/data-table/column-header-ui.js | 33 +++++++++-------- 2 files changed, 42 insertions(+), 27 deletions(-) diff --git a/extensions/wikibase/module/scripts/schema-alignment.js b/extensions/wikibase/module/scripts/schema-alignment.js index 6105e5d8e274..c29e56172be8 100644 --- a/extensions/wikibase/module/scripts/schema-alignment.js +++ b/extensions/wikibase/module/scripts/schema-alignment.js @@ -437,25 +437,35 @@ SchemaAlignment._createDraggableColumn = function(name, reconciledSiteIRI, recon var serviceUrl = null; var service = null; var serviceLogo=null; + var urlIsValid=false; if (reconConfig) { serviceUrl =reconConfig.service; } - if (serviceUrl) { - service = ReconciliationManager.getServiceFromUrl(serviceUrl); + try { + + if (new URL(serviceUrl)) { + service = ReconciliationManager.getServiceFromUrl(serviceUrl); + } + if(service) { + serviceLogo=service.logo; + } + urlIsValid=true; } - if(service){ - serviceLogo=service.logo; + catch { + console.log("The URL is not valid"); } - - var img =$(""); - if(serviceLogo ){ - var imageUrl = serviceLogo; - img.attr("src", imageUrl); - img.attr("title", service.name); - img.addClass("serviceLogo-for-schema") - }; + var cell = $("
").addClass('wbs-draggable-column').text(name); - cell.append(img); + if(urlIsValid) { + var img =$(""); + if(serviceLogo) { + var imageUrl = serviceLogo; + img.attr("src", imageUrl); + img.attr("title", service.name); + img.addClass("serviceLogo-for-schema") + } + cell.append(img); + } cell.data({ 'columnName': name, 'reconciledSiteIRI': reconciledSiteIRI diff --git a/main/webapp/modules/core/scripts/views/data-table/column-header-ui.js b/main/webapp/modules/core/scripts/views/data-table/column-header-ui.js index eb26f4aafb68..eb2c7067aee0 100644 --- a/main/webapp/modules/core/scripts/views/data-table/column-header-ui.js +++ b/main/webapp/modules/core/scripts/views/data-table/column-header-ui.js @@ -75,22 +75,27 @@ DataTableColumnHeaderUI.prototype._render = function() { if (this._column.reconConfig) { serviceUrl =this._column.reconConfig.service; } - if (serviceUrl) { - service = ReconciliationManager.getServiceFromUrl(serviceUrl); - } - if(service){ - serviceLogo=service.logo; + try { + + if (new URL(serviceUrl)) { + service = ReconciliationManager.getServiceFromUrl(serviceUrl); + } + if(service) { + serviceLogo=service.logo; + } + + var img =$(""); + if(serviceLogo) { + var imageUrl = serviceLogo; + img.attr("src", imageUrl); + img.attr("title", service.name); + img.addClass("serviceLogo") + img.appendTo(elmts.serviceLogoContainer.show()); + } } - - var img =$(""); - if(serviceLogo ){ - var imageUrl = serviceLogo; - img.attr("src", imageUrl); - img.attr("title", service.name); - img.addClass("serviceLogo") - img.appendTo(elmts.serviceLogoContainer.show()); + catch { + console.log("The URL is not valid"); } - if ("reconStats" in this._column) { var stats = this._column.reconStats; if (stats.nonBlanks > 0) { From a0a754bf08ceb6f817e5eeb7ee46240146639b34 Mon Sep 17 00:00:00 2001 From: Ayushi Rai <72227873+ayushrai206@users.noreply.github.com> Date: Mon, 11 Dec 2023 05:56:06 +0530 Subject: [PATCH 6/7] makes a function to validate service logo --- .../module/scripts/schema-alignment.js | 76 ++++++++----------- 1 file changed, 33 insertions(+), 43 deletions(-) diff --git a/extensions/wikibase/module/scripts/schema-alignment.js b/extensions/wikibase/module/scripts/schema-alignment.js index c29e56172be8..e56fa9294849 100644 --- a/extensions/wikibase/module/scripts/schema-alignment.js +++ b/extensions/wikibase/module/scripts/schema-alignment.js @@ -30,7 +30,29 @@ THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ - +function returnServiceLogo(reconConfig){ + var serviceUrl = null; + var service = null; + var serviceLogo=null; + if (reconConfig) { + serviceUrl =reconConfig.service; + } + if (serviceUrl) { + service = ReconciliationManager.getServiceFromUrl(serviceUrl); + } + if(service) { + serviceLogo=service.logo; + } + try { + if(new URL(serviceLogo)){ + return serviceLogo; + } + } + catch { + console.warn("Invalid logo URL supplied by service "+serviceUrl) + } + +}; var SchemaAlignment = { _isSetUp: false }; @@ -434,29 +456,9 @@ SchemaAlignment._changesCleared = function() { }; SchemaAlignment._createDraggableColumn = function(name, reconciledSiteIRI, reconConfig) { - var serviceUrl = null; - var service = null; - var serviceLogo=null; - var urlIsValid=false; - if (reconConfig) { - serviceUrl =reconConfig.service; - } - try { - - if (new URL(serviceUrl)) { - service = ReconciliationManager.getServiceFromUrl(serviceUrl); - } - if(service) { - serviceLogo=service.logo; - } - urlIsValid=true; - } - catch { - console.log("The URL is not valid"); - } - + var Logo=returnServiceLogo(reconConfig); var cell = $("
").addClass('wbs-draggable-column').text(name); - if(urlIsValid) { + if(Logo) { var img =$(""); if(serviceLogo) { var imageUrl = serviceLogo; @@ -1498,27 +1500,15 @@ SchemaAlignment._initField = function(inputContainer, mode, initialValue, change } var acceptDraggableColumn = function(column) { - var serviceUrl = null; - var service = null; - var serviceLogo=null; - if (reconConfig) { - serviceUrl =reconConfig.service; - } - if (serviceUrl) { - service = ReconciliationManager.getServiceFromUrl(serviceUrl); - } - if(service){ - serviceLogo=service.logo; - } - - var img =$(""); - if(serviceLogo ){ - var imageUrl = serviceLogo; - img.attr("src", imageUrl); - img.attr("title", service.name); - img.addClass("serviceLogo-for-schema") + var Logo=returnServiceLogo(reconConfig); + var img =$(""); + if(Logo ){ + var imageUrl = serviceLogo; + img.attr("src", imageUrl); + img.attr("title", service.name); + img.addClass("serviceLogo-for-schema") - }; + }; input.hide(); input.val(""); From 28e77721c0e3f9dfa385c383404c574e1d87d9fc Mon Sep 17 00:00:00 2001 From: Ayushi Rai <72227873+ayushrai206@users.noreply.github.com> Date: Tue, 19 Dec 2023 07:40:04 +0530 Subject: [PATCH 7/7] Makes small changes like variable names etc. --- .../wikibase/module/scripts/schema-alignment.js | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/extensions/wikibase/module/scripts/schema-alignment.js b/extensions/wikibase/module/scripts/schema-alignment.js index e56fa9294849..7fd62144d8bf 100644 --- a/extensions/wikibase/module/scripts/schema-alignment.js +++ b/extensions/wikibase/module/scripts/schema-alignment.js @@ -30,7 +30,7 @@ THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -function returnServiceLogo(reconConfig){ +function serviceLogoFromReconConfig(reconConfig){ var serviceUrl = null; var service = null; var serviceLogo=null; @@ -40,13 +40,11 @@ function returnServiceLogo(reconConfig){ if (serviceUrl) { service = ReconciliationManager.getServiceFromUrl(serviceUrl); } - if(service) { + if (service) { serviceLogo=service.logo; } try { - if(new URL(serviceLogo)){ - return serviceLogo; - } + return new URL(serviceLogo); } catch { console.warn("Invalid logo URL supplied by service "+serviceUrl) @@ -456,9 +454,9 @@ SchemaAlignment._changesCleared = function() { }; SchemaAlignment._createDraggableColumn = function(name, reconciledSiteIRI, reconConfig) { - var Logo=returnServiceLogo(reconConfig); + var logo=serviceLogoFromReconConfig(reconConfig); var cell = $("
").addClass('wbs-draggable-column').text(name); - if(Logo) { + if(logo) { var img =$(""); if(serviceLogo) { var imageUrl = serviceLogo; @@ -1500,7 +1498,7 @@ SchemaAlignment._initField = function(inputContainer, mode, initialValue, change } var acceptDraggableColumn = function(column) { - var Logo=returnServiceLogo(reconConfig); + var Logo=serviceLogoFromReconConfig(reconConfig); var img =$(""); if(Logo ){ var imageUrl = serviceLogo;