1
0
mirror of https://github.com/Unleash/unleash.git synced 2025-04-24 01:18:01 +02:00

feat: health rating color in email (#8943)

This commit is contained in:
Mateusz Kwasniewski 2024-12-09 15:44:16 +01:00 committed by GitHub
parent 3a0cddc345
commit 23bdf0356a
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 12 additions and 1 deletions

View File

@ -174,6 +174,7 @@ test('Can send productivity report email', async () => {
expect(content.html.includes(`Productivity Report`)).toBe(true); expect(content.html.includes(`Productivity Report`)).toBe(true);
expect(content.html.includes(`localhost/insights`)).toBe(true); expect(content.html.includes(`localhost/insights`)).toBe(true);
expect(content.html.includes(`localhost/profile`)).toBe(true); expect(content.html.includes(`localhost/profile`)).toBe(true);
expect(content.html.includes(`#b0d182`)).toBe(true);
expect(content.text.includes(`localhost/insights`)).toBe(true); expect(content.text.includes(`localhost/insights`)).toBe(true);
expect(content.text.includes(`localhost/profile`)).toBe(true); expect(content.text.includes(`localhost/profile`)).toBe(true);
}); });

View File

@ -542,6 +542,16 @@ export class EmailService {
userEmail, userEmail,
...metrics, ...metrics,
unleashUrl: this.config.server.unleashUrl, unleashUrl: this.config.server.unleashUrl,
healthColor() {
const healthRating = this.health;
const healthColor =
healthRating >= 0 && healthRating <= 24
? '#d93644'
: healthRating >= 25 && healthRating <= 74
? '#ffc46f'
: '#b0d182';
return healthColor;
},
}; };
const template = 'productivity-report'; const template = 'productivity-report';

View File

@ -27,7 +27,7 @@
<div class="shaded" <div class="shaded"
style="margin: 0;padding: 36px 8px;background: #f0f0f5;border-width: 3px;border-color: #ffffff;border-style: solid;"> style="margin: 0;padding: 36px 8px;background: #f0f0f5;border-width: 3px;border-color: #ffffff;border-style: solid;">
<div style="padding-top: 12px;"> <div style="padding-top: 12px;">
<span style="color: #1a4049;">{{health}}%</span><br> <span style="color: {{healthColor}};">{{health}}%</span><br>
<span style="font-size: 16px; color: #888;">your instance health</span> <span style="font-size: 16px; color: #888;">your instance health</span>
</div> </div>
</div> </div>