Brijesh619 commented on code in PR #708:
URL: https://github.com/apache/atlas/pull/708#discussion_r3749631845


##########
dashboardv2/public/js/views/audit/AdminAuditTableLayoutView.js:
##########
@@ -349,25 +392,95 @@ define(['require',
                     };
                 this.showModal(modalData);
             },
-            displayPurgeAndImportAudits: function(obj) {
+            displayPurgeAndImportAudits: function (obj) {
+                var adminTypDetails = Enums.category[obj.operation];
+
+                // If it's a new JSON string (from new API changes), parse it.
+                var isJson = false;
+                var summaryData = {};
+                try {
+                    summaryData = typeof obj.results === 'string' ? 
JSON.parse(obj.results) : obj.results;
+                    if (summaryData && typeof summaryData === 'object' && 
!Array.isArray(summaryData)) {
+                        isJson = true;
+                    }
+                } catch (e) {
+                    isJson = false;
+                }
+
+                if (isJson) {
+                    // It's the new Summary format
+                    var runId = summaryData.runId || obj.model.get('runId') || 
'';
+                    var paramsArr = obj.model.get('params') ? 
obj.model.get('params').split(',') : [];
+
+                    var reqCount = summaryData.requestedCount !== undefined ? 
summaryData.requestedCount : paramsArr.length;
+                    var purgedCount = summaryData.purgedCount !== undefined ? 
summaryData.purgedCount : 0;
+                    var purgedDependenciesCount = 
summaryData.purgedDependenciesCount || 0;
+                    var totalPurgedCount = purgedCount + 
purgedDependenciesCount;
+                    var failedCount = summaryData.failedCount || 0;
+                    var failedDependenciesCount = 
summaryData.failedDependenciesCount || 0;
+                    var totalFailedCount = failedCount + 
failedDependenciesCount;
+                    var skippedCount = summaryData.skippedCount || 0;
+
+                    var html = '<div class="row"><div class="attr-details">';
+
+                    html += '<div class="purge-summary-wrapper">';
+                    if (runId) {
+                        html += '<div class="purge-run-id-row"><strong>Run 
Id:</strong> <span data-id="runIdValue">' + _.escape(runId) + '</span> <i 
class="fa fa-copy purge-run-id-copy" data-id="copyRunIdMain" title="Copy to 
clipboard"></i></div>';
+                    }
+
+                    html += '<div class="purge-summary-container">';
+
+                    // Requested
+                    html += '<div class="purge-summary-card card-blue 
clickable" data-id="drawerSummaryTrigger" data-type="requested" data-runid="' + 
_.escape(runId) + '" data-guid="' + _.escape(obj.model.get('guid')) + '" 
data-params="' + _.escape(obj.model.get('params')) + '">';
+                    html += '<div class="card-label">REQUESTED</div><div 
class="card-value">' + reqCount + '</div></div>';
+
+                    // Total Purged
+                    var rawResults = obj.originalResults ? obj.originalResults 
: (typeof obj.results === 'string' ? obj.results : JSON.stringify(obj.results));
+                    html += '<div class="purge-summary-card card-green ' + 
(totalPurgedCount > 0 ? 'clickable' : '') + '" ' + (totalPurgedCount > 0 ? 
'data-id="drawerSummaryTrigger" data-type="purged" data-runid="' + 
_.escape(runId) + '" data-guid="' + _.escape(obj.model.get('guid')) + '" 
data-results="' + _.escape(rawResults) + '"' : '') + '>';
+                    html += '<div class="card-label">PURGED</div><div 
class="card-value">' + totalPurgedCount + '</div></div>';
+
+                    // Failed
+                    html += '<div class="purge-summary-card card-red ' + 
(totalFailedCount > 0 ? 'has-count' : '') + '" title="Some entities failed to 
purge. Please check purgefailure.log for details.">';
+                    html += '<div class="card-label">FAILED</div><div 
class="card-value">' + totalFailedCount + '</div></div>';
+
+                    // Skipped
+                    html += '<div class="purge-summary-card card-amber ' + 
(skippedCount > 0 ? 'has-count' : '') + '" title="Some entities were skipped 
during purge. Please check purgefailure.log for details.">';

Review Comment:
   Fixed! I have updated the Classic UI logic to perfectly match React. The 
Failed and Skipped tooltips now dynamically render a neutral message when the 
count is 0, and only show the failure/skipped logs instruction when the count 
is > 0 or executionFailed is true.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to