// Copyright (c) 2024, JINGROW
// For license information, please see license.txt

jingrow.query_reports['AWS Rightsizing Recommendation'] = {
	onload: function (report) {
		report.page.add_button(__('Rightsize'), () => {
			jingrow
				.call(
					'jcloud.jcloud.report.aws_rightsizing_recommendation.aws_rightsizing_recommendation.rightsize',
					{
						filters: {
							resource_type:
								jingrow.query_report.get_filter_value('resource_type'),
							action_type: jingrow.query_report.get_filter_value('action_type'),
						},
					},
				)
				.then((r) => {
					jingrow.query_report.refresh();
				});
		});
	},
};
