public/javascripts/matrix.js in pact_broker-2.51.0 vs public/javascripts/matrix.js in pact_broker-2.52.0
- old
+ new
@@ -51,27 +51,27 @@
function disableFieldsThatShouldNotBeSubmitted() {
$('.version-selectorizor').prop('disabled', 'disabled');
}
-function highlightPactPublicationsWithSameContent(td) {
- const pactVersionSha = $(td).data('pact-version-sha');
- $('*[data-pact-version-sha="' + pactVersionSha +'"]').addClass('bg-info');
+function highlightPactPublicationsWithSameData(td, field) {
+ const value = $(td).data(field);
+ $('*[data-' + field + '="' + value +'"]').addClass('bg-info');
}
-function unHighlightPactPublicationsWithSameContent(td, event) {
+function unHighlightPactPublicationsWithSameData(td, event, field) {
var destinationElement = $(event.toElement || event.relatedTarget);
// Have to use mouseout instead of mouseleave, because the tooltip is a child
// of the td, and the mouseleave will consider that hovering over the tooltip
// does not count as leaving. Unfortunately, if you then leave the tooltip,
// the div gets removed without firing the mouseleave event, so the cells remain
// highlighted.
// The tooltip needs to be a child of the td so that we can style the one showing
// the SHA so that it's wide enough to fit the SHA in.
if (!$(td).find('a').is(destinationElement)) {
- const pactVersionSha = $(td).data('pact-version-sha');
- $('*[data-pact-version-sha="' + pactVersionSha +'"]').removeClass('bg-info');
+ const value = $(td).data(field);
+ $('*[data-' + field + '="' + value +'"]').removeClass('bg-info');
}
}
$(document).ready(function(){
$('.version-selectorizor').change(handleSelectorizorChanged);
@@ -88,8 +88,20 @@
$(el).tooltip({container: $(el)})
});
initializeClipper('.clippable');
- $('td.pact-published').mouseover(function(event) { highlightPactPublicationsWithSameContent(this) });
- $('td.pact-published').mouseout(function(event) { unHighlightPactPublicationsWithSameContent(this, event)});
+ $('td.consumer').mouseover(function(event) { highlightPactPublicationsWithSameData(this, 'consumer-name') });
+ $('td.consumer').mouseout(function(event) { unHighlightPactPublicationsWithSameData(this, event, 'consumer-name') });
+
+ $('td.consumer-version').mouseover(function(event) { highlightPactPublicationsWithSameData(this, 'consumer-version-id') });
+ $('td.consumer-version').mouseout(function(event) { unHighlightPactPublicationsWithSameData(this, event, 'consumer-version-id') });
+
+ $('td.pact-published').mouseover(function(event) { highlightPactPublicationsWithSameData(this, 'pact-version-sha') });
+ $('td.pact-published').mouseout(function(event) { unHighlightPactPublicationsWithSameData(this, event, 'pact-version-sha') });
+
+ $('td.provider').mouseover(function(event) { highlightPactPublicationsWithSameData(this, 'provider-name') });
+ $('td.provider').mouseout(function(event) { unHighlightPactPublicationsWithSameData(this, event, 'provider-name') });
+
+ $('td.provider-version').mouseover(function(event) { highlightPactPublicationsWithSameData(this, 'provider-version-id') });
+ $('td.provider-version').mouseout(function(event) { unHighlightPactPublicationsWithSameData(this, event, 'provider-version-id') });
});