Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Pull request update/240829 #383

Merged
merged 3 commits into from
Aug 29, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1,697 changes: 731 additions & 966 deletions herald/modules/email_generator/templates/pool_exceed_resources_report.html

Large diffs are not rendered by default.

1,538 changes: 747 additions & 791 deletions herald/modules/email_generator/templates/weekly_expense_report.html

Large diffs are not rendered by default.

171 changes: 144 additions & 27 deletions herald/send_templates.py
Original file line number Diff line number Diff line change
Expand Up @@ -190,20 +190,149 @@
},
'pool_exceed_resources_report': {
'email': ['[email protected]'],
'subject': 'Action Required: Hystax OptScale Pool Exceed Alert',
'subject': 'Action Required: Hystax OptScale Pool Limit Exceed Alert',
'template_type': 'pool_exceed_resources_report',
'template_params': {
'texts': {
'exceeded_pools_count': 1,
'exceeded_pool_forecasts': [],
'exceeded_pool_forecasts_count': 0,
'title': 'Pool Exceed Alert',
'exceeded_pools_count': 2,
'exceeded_pool_forecasts_count': 2,
"exceeded_pool_forecasts": [
{
'forecast': 448.72,
'limit': 100,
'pool_id': '6e4c3ef9-37a9-47ec-87f7-0a864af86016',
'pool_name': 'Dalek Industry pool',
'pool_purpose': 'business_unit',
'total_expenses': 448.72,
"resources": [
{
'active': True,
'cloud_account_id': '5c1ed35a-bf6b-4c7d-897a-8388b220fff3',
'cloud_account_name': 'AWS linked',
'cloud_console_link': 'https://console.aws.amazon.com/ec2/v2/home?region=us-west-2'
'#InstanceDetails:instanceId=i-082b1a163698b8ede',
'cloud_created_at': 1607326764,
'cloud_resource_id': 'i-082b1a163698b8ede',
'flavor': 't2.large',
'image_id': 'ami-09d7e4ccf2c68700d',
'last_seen': 1617152478,
'last_seen_not_stopped': 1617152478,
'organization_id': '955f3783-ad70-4ad8-9682-b64890ef95c6',
'owner_id': '0b2287ea-c543-4b47-a8aa-a2953fad9eb4',
'owner_name': 'Tester',
'name': 'HystaxWebSite. It is very very very very very very very very very very very '
'very very very very very long name',
'pool_id': '6e4c3ef9-37a9-47ec-87f7-0a864af86016',
'pool_name': 'Dalek Industry',
'pool_purpose': 'business_unit',
'region': 'us-west-2',
'resource_id': 'd3809841-eb70-4568-bb02-e962e401fdca',
'spotted': False,
'stopped_allocated': False,
'type': 'instance',
'security_groups': [
{
'GroupId': 'sg-0d99e8ecd70254ebe',
'GroupName': 'websites'}],
'tags': {
'aws:createdBy': 'IAMUser:AIDA4YBYU3OICYSASYZ2E:pkozlov'
}
}
]
},
{
'forecast': 448.72,
'limit': 100,
'pool_id': '6e4c3ef9-37a9-47ec-87f7-0a864af86016',
'pool_name': 'My Pool',
'pool_purpose': 'business_unit',
'total_expenses': 448.72,
"resources": [
{
'active': True,
'cloud_account_id': '5c1ed35a-bf6b-4c7d-897a-8388b220fff3',
'cloud_account_name': 'AWS linked',
'cloud_console_link': 'https://console.aws.amazon.com/ec2/v2/home?region=us-west-2'
'#InstanceDetails:instanceId=i-082b1a163698b8ede',
'cloud_created_at': 1607326764,
'cloud_resource_id': 'i-082b1a163698b8ede',
'flavor': 't2.large',
'image_id': 'ami-09d7e4ccf2c68700d',
'last_seen': 1617152478,
'last_seen_not_stopped': 1617152478,
'organization_id': '955f3783-ad70-4ad8-9682-b64890ef95c6',
'owner_id': '0b2287ea-c543-4b47-a8aa-a2953fad9eb4',
'owner_name': 'Tester',
'name': 'HystaxWebSite. It is very very very very very very very very very very very '
'very very very very very long name',
'pool_id': '6e4c3ef9-37a9-47ec-87f7-0a864af86016',
'pool_name': 'Dalek Industry',
'pool_purpose': 'business_unit',
'region': 'us-west-2',
'resource_id': 'd3809841-eb70-4568-bb02-e962e401fdca',
'spotted': False,
'stopped_allocated': False,
'type': 'instance',
'security_groups': [
{
'GroupId': 'sg-0d99e8ecd70254ebe',
'GroupName': 'websites'}],
'tags': {
'aws:createdBy': 'IAMUser:AIDA4YBYU3OICYSASYZ2E:pkozlov'
}
}
]
}
],
'exceeded_pools': [
{
'forecast': 448.72,
'limit': 100,
'pool_id': '6e4c3ef9-37a9-47ec-87f7-0a864af86016',
'pool_name': 'Dalek Industry',
'pool_name': 'My pool',
'pool_purpose': 'business_unit',
'total_expenses': 448.72,
"resources": [
{
'active': True,
'cloud_account_id': '5c1ed35a-bf6b-4c7d-897a-8388b220fff3',
'cloud_account_name': 'AWS linked',
'cloud_console_link': 'https://console.aws.amazon.com/ec2/v2/home?region=us-west-2'
'#InstanceDetails:instanceId=i-082b1a163698b8ede',
'cloud_created_at': 1607326764,
'cloud_resource_id': 'i-082b1a163698b8ede',
'flavor': 't2.large',
'image_id': 'ami-09d7e4ccf2c68700d',
'last_seen': 1617152478,
'last_seen_not_stopped': 1617152478,
'organization_id': '955f3783-ad70-4ad8-9682-b64890ef95c6',
'owner_id': '0b2287ea-c543-4b47-a8aa-a2953fad9eb4',
'owner_name': 'Tester',
'name': 'HystaxWebSite. It is very very very very very very very very very very very '
'very very very very very long name',
'pool_id': '6e4c3ef9-37a9-47ec-87f7-0a864af86016',
'pool_name': 'Dalek Industry',
'pool_purpose': 'business_unit',
'region': 'us-west-2',
'resource_id': 'd3809841-eb70-4568-bb02-e962e401fdca',
'spotted': False,
'stopped_allocated': False,
'type': 'instance',
'security_groups': [
{
'GroupId': 'sg-0d99e8ecd70254ebe',
'GroupName': 'websites'}],
'tags': {
'aws:createdBy': 'IAMUser:AIDA4YBYU3OICYSASYZ2E:pkozlov'
}
}
]
},
{
'forecast': 448.72,
'limit': 100,
'pool_id': '6e4c3ef9-37a9-47ec-87f7-0a864af86016',
'pool_name': 'Dalek Industry pool',
'pool_purpose': 'business_unit',
'total_expenses': 448.72,
'resources': [
Expand Down Expand Up @@ -628,23 +757,19 @@
'resource_id': '0fee4514-7b48-4616-9cd1-1b88cdbf5eef',
'type': 'bucket',
'tags': {
'aws:createdBy': 'IAMUser:AIDAIPPYCHRYQONGDLRJS:pk-full'}}]}],
'aws:createdBy': 'IAMUser:AIDAIPPYCHRYQONGDLRJS:pk-full'}
}
]
}
],
'organization': {
'id': 'c2272558-912f-4571-8dc5-99bd5d30f7d1',
'name': 'Dalek Industry',
'currency_code': '$'
},
'user': {
'assignment_id': '1fb37f03-1750-4b37-a98d-432bbddbcc1d',
'assignment_resource_id': '955f3783-ad70-4ad8-9682-b64890ef95c6',
'assignment_type_id': 2,
'role_id': 4,
'role_name': 'Engineer',
'role_purpose': 'optscale_engineer',
'role_scope_id': None,
'user_display_name': 'Tester',
'user_email': '[email protected]',
'user_id': 'cd7c7a35-572a-42bb-aefb-7479ffaf5f41'}}}},
}
}
},
'pool_owner_violation_report': {
'email': ['[email protected]'],
'subject': 'Action required: Hystax OptScale Resource Constraints Report',
Expand Down Expand Up @@ -806,9 +931,6 @@
"subject": "OptScale weekly expense report",
"template_params": {
"texts": {
"end_date": "29/3/2021",
"start_date": "1/3/2021",
"title": "Weekly expense report",
"organization": {
"forecast": 482.32,
"id": "ed74eb3b-1c4d-477e-b431-28f697d62233",
Expand Down Expand Up @@ -853,7 +975,7 @@
},
{
"cost": 93.56,
"forecast": 100.01,
"forecast": 122222312300.01,
"id": "278c5876-43bb-4f33-9dff-55ae518d65db",
"limit": 50,
"name": "testo",
Expand All @@ -864,11 +986,6 @@
"forecast": 224.81,
"total_cost": 210.3,
"resources_tracked": 540
},
"user": {
"user_display_name": "Mr Smith",
"user_email": "[email protected]",
"user_id": "8aa14efd-d111-4934-9c19-92b6f0da18fe"
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,19 +52,13 @@ def generate(self):
self.organization_id, start, end,
{'pool_id': self.get_nil_uuid()})

st_dt_string = f'{start_date.day}/{start_date.month}/{start_date.year}'
e_dt_string = f'{today.day}/{today.month}/{today.year}'
return {
'email': [self.report_data['user_email']],
'template_type': 'weekly_expense_report',
'subject': 'OptScale weekly expense report',
'template_params': {
'texts': {
'user': self.report_data,
'title': 'Weekly expense report',
'pools': pools,
'start_date': st_dt_string,
'end_date': e_dt_string,
'unassigned': {
'total_cost': round(
unassigned_expenses['total_cost'], 2),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,10 +61,8 @@ def generate(self):
'currency_code': self.get_currency_code(
organization['currency'])
},
'user': self.report_data,
'exceeded_pools': exceeded_pools,
'exceeded_pool_forecasts': exceeded_pool_forecasts,
'title': 'Pool Limit Exceed Alert',
"exceeded_pool_forecasts_count": len(
exceeded_pool_forecasts),
"exceeded_pools_count": len(exceeded_pools)
Expand Down
31 changes: 0 additions & 31 deletions ngui/ui/src/components/Events/Events.styles.ts

This file was deleted.

Loading
Loading