This is an automated email from the ASF dual-hosted git repository.

ppawar pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/atlas.git


The following commit(s) were added to refs/heads/master by this push:
     new b92063b3d Atlas UI: Normalize Bootstrap button loading text handling 
(#501)
b92063b3d is described below

commit b92063b3d33947301ff2f5facf56d5a6ddceb6d9
Author: Prasad Pawar <[email protected]>
AuthorDate: Thu Jan 22 16:26:02 2026 +0530

    Atlas UI: Normalize Bootstrap button loading text handling (#501)
---
 dashboardv2/public/js/main.js      | 28 ++++++++++++++++++++++++++++
 dashboardv2/public/js/migration.js | 28 ++++++++++++++++++++++++++++
 dashboardv3/public/js/main.js      | 28 ++++++++++++++++++++++++++++
 dashboardv3/public/js/migration.js | 28 ++++++++++++++++++++++++++++
 4 files changed, 112 insertions(+)

diff --git a/dashboardv2/public/js/main.js b/dashboardv2/public/js/main.js
index c31e69242..2e9da95d5 100644
--- a/dashboardv2/public/js/main.js
+++ b/dashboardv2/public/js/main.js
@@ -212,6 +212,34 @@ require(['App',
     'select2'
 ], function(App, Router, Helper, CommonViewFunction, Globals, UrlLinks, 
VEntityList, VTagList, VRelationshipSearchList, Enums, Utils) {
     var that = this;
+       var sanitizeBootstrapButtonLoadingText = function() {
+               if (!window.jQuery || !$.fn || !$.fn.button ||
+                       !$.fn.button.Constructor) {
+                       return
+               }
+
+               var Button = $.fn.button.Constructor
+               if (Button.prototype._safeSetState) {
+                       return
+               }
+
+               var originalSetState = Button.prototype.setState
+               if (!originalSetState) {
+                       return
+               }
+
+               Button.prototype.setState = function(state) {
+                       var data = this.$element ? this.$element.data() : null
+                       var key = state + 'Text'
+                       if (data && data[key]) {
+                               data[key] = $('<div/>').text(data[key]).text()
+                       }
+                       return originalSetState.call(this, state)
+               }
+               Button.prototype._safeSetState = true
+       }
+
+       sanitizeBootstrapButtonLoadingText()
     this.asyncFetchCounter = 5 + (Enums.addOnEntities.length + 1);
     // entity
     this.entityDefCollection = new VEntityList();
diff --git a/dashboardv2/public/js/migration.js 
b/dashboardv2/public/js/migration.js
index 32d4a2b53..451113105 100644
--- a/dashboardv2/public/js/migration.js
+++ b/dashboardv2/public/js/migration.js
@@ -200,6 +200,34 @@ require([
     'bootstrap'
 ], function(Marionette, Helper) {
     var that = this;
+       var sanitizeBootstrapButtonLoadingText = function() {
+               if (!window.jQuery || !$.fn || !$.fn.button ||
+                       !$.fn.button.Constructor) {
+                       return
+               }
+
+               var Button = $.fn.button.Constructor
+               if (Button.prototype._safeSetState) {
+                       return
+               }
+
+               var originalSetState = Button.prototype.setState
+               if (!originalSetState) {
+                       return
+               }
+
+               Button.prototype.setState = function(state) {
+                       var data = this.$element ? this.$element.data() : null
+                       var key = state + 'Text'
+                       if (data && data[key]) {
+                               data[key] = $('<div/>').text(data[key]).text()
+                       }
+                       return originalSetState.call(this, state)
+               }
+               Button.prototype._safeSetState = true
+       }
+
+       sanitizeBootstrapButtonLoadingText()
     var App = new Marionette.Application();
 
     App.addRegions({
diff --git a/dashboardv3/public/js/main.js b/dashboardv3/public/js/main.js
index 16717fb48..6653facda 100644
--- a/dashboardv3/public/js/main.js
+++ b/dashboardv3/public/js/main.js
@@ -241,6 +241,34 @@ require(['App',
     'select2'
 ], function(App, Router, Helper, CommonViewFunction, Globals, UrlLinks, 
VEntityList, VTagList, VRelationshipSearchList, Enums, Utils) {
     var that = this;
+       var sanitizeBootstrapButtonLoadingText = function() {
+               if (!window.jQuery || !$.fn || !$.fn.button ||
+                       !$.fn.button.Constructor) {
+                       return
+               }
+
+               var Button = $.fn.button.Constructor
+               if (Button.prototype._safeSetState) {
+                       return
+               }
+
+               var originalSetState = Button.prototype.setState
+               if (!originalSetState) {
+                       return
+               }
+
+               Button.prototype.setState = function(state) {
+                       var data = this.$element ? this.$element.data() : null
+                       var key = state + 'Text'
+                       if (data && data[key]) {
+                               data[key] = $('<div/>').text(data[key]).text()
+                       }
+                       return originalSetState.call(this, state)
+               }
+               Button.prototype._safeSetState = true
+       }
+
+       sanitizeBootstrapButtonLoadingText()
     this.asyncFetchCounter = 5 + (Enums.addOnEntities.length + 1);
     // entity
     this.entityDefCollection = new VEntityList();
diff --git a/dashboardv3/public/js/migration.js 
b/dashboardv3/public/js/migration.js
index f989b8788..717c0c7de 100644
--- a/dashboardv3/public/js/migration.js
+++ b/dashboardv3/public/js/migration.js
@@ -201,6 +201,34 @@ require([
     'select2'
 ], function(Marionette, Helper) {
     var that = this;
+       var sanitizeBootstrapButtonLoadingText = function() {
+               if (!window.jQuery || !$.fn || !$.fn.button ||
+                       !$.fn.button.Constructor) {
+                       return
+               }
+
+               var Button = $.fn.button.Constructor
+               if (Button.prototype._safeSetState) {
+                       return
+               }
+
+               var originalSetState = Button.prototype.setState
+               if (!originalSetState) {
+                       return
+               }
+
+               Button.prototype.setState = function(state) {
+                       var data = this.$element ? this.$element.data() : null
+                       var key = state + 'Text'
+                       if (data && data[key]) {
+                               data[key] = $('<div/>').text(data[key]).text()
+                       }
+                       return originalSetState.call(this, state)
+               }
+               Button.prototype._safeSetState = true
+       }
+
+       sanitizeBootstrapButtonLoadingText()
     var App = new Marionette.Application();
 
     App.addRegions({

Reply via email to