From 45c6acce58939a4667d40733167e14ffc24b7a6a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jes=C3=BAs=20Garc=C3=ADa=20Crespo?= Date: Fri, 21 Jun 2024 08:12:45 +0000 Subject: [PATCH] Use text dateType to avoid use of JSON.stringify --- src/dashboard/src/media/js/jobs.js | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/src/dashboard/src/media/js/jobs.js b/src/dashboard/src/media/js/jobs.js index b0afff2f9c..562adc2023 100644 --- a/src/dashboard/src/media/js/jobs.js +++ b/src/dashboard/src/media/js/jobs.js @@ -864,9 +864,9 @@ BaseAppView = Backbone.View.extend({ // Check if the response from the API has changed since the last poll. hasResponseChanged: function(response) { - var next = JSON.stringify(response); - var changed = this.firstPoll || this.previousVersion !== next; - this.previousVersion = next; + var changed = this.firstPoll || this.previousVersion !== response; + + this.previousVersion = response; return changed; }, @@ -877,7 +877,7 @@ BaseAppView = Backbone.View.extend({ $.ajax({ context: this, - dataType: 'json', + dataType: 'text', type: 'GET', url: this.statusUrl + '?' + new Date().getTime(), beforeSend: function() @@ -894,7 +894,9 @@ BaseAppView = Backbone.View.extend({ return; } - var objects = response.objects; + var data = JSON.parse(response); + var objects = data.objects; + if (getURLParameter('paged')) { this.updateSips(objects); @@ -933,7 +935,7 @@ BaseAppView = Backbone.View.extend({ } // MCP status - if (response.mcp) + if (data.mcp) { window.statusWidget.connect(); }