Skip to content

Commit

Permalink
Dedupe Deployment error messages in tooltip
Browse files Browse the repository at this point in the history
The PR deduplicates the same Deployment error messages, showing only 1 message for every problem reason.
Also, it limits the number of shown error messages for Deployment and Pod Containers to 3 messages each.

Signed-off-by: Victor Rubezhny <[email protected]>
  • Loading branch information
vrubezhny committed May 30, 2024
1 parent e6c4b25 commit 740d9b8
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/explorer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -324,8 +324,8 @@ export class OpenShiftExplorer implements TreeDataProvider<ExplorerItem>, Dispos
inCrashLoopBackOff = inCrashLoopBackOff || reason === 'CrashLoopBackOff';

const msg = `${reason}: ${message ? message.trim(): 'No valuable message'}`;
// Skip duplicates and show not more than 10 errors
if (messages.length <= 10 && !(messages.find((m) => m === msg))) {
// Skip duplicated messages
if (messages.length < 3 && !(messages.find((m) => m.startsWith(`${reason}:`)))) {
messages.push(msg);
}
}
Expand All @@ -344,8 +344,8 @@ export class OpenShiftExplorer implements TreeDataProvider<ExplorerItem>, Dispos
.forEach((c) => {
const message = `${c.reason}: ${c.message ? c.message.trim(): 'No valuable message'}`;

// Skip duplicates and show not more than 10 errors
if (messages.length <= 10 && !(messages.find((m) => m === message))) {
// Skip duplicated messages
if (messages.length < 3 && !(messages.find((m) => m.startsWith(`${c.reason}:`)))) {
messages.push(message);
}
});
Expand Down

0 comments on commit 740d9b8

Please sign in to comment.