Skip to content

Conversation

@yuda110
Copy link
Member

@yuda110 yuda110 commented May 27, 2025

Skip Review (optional)

  • Minor changes that don't affect the functionality (e.g. style, chore, ci, test, docs)
  • Previously reviewed in feature branch, further review is not mandatory
  • Self-merge allowed for solo developers or urgent changes

Description (optional)

스원123-05-27-2025_05_54_PM

Things to Talk About (optional)

Signed-off-by: yuda <yuda@megazone.com>
@vercel
Copy link

vercel bot commented May 27, 2025

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
cost-report ✅ Ready (Inspect) Visit Preview 💬 Add feedback May 27, 2025 9:02am
2 Skipped Deployments
Name Status Preview Comments Updated (UTC)
console ⬜️ Ignored (Inspect) Visit Preview May 27, 2025 9:02am
web-storybook ⬜️ Ignored (Inspect) Visit Preview May 27, 2025 9:02am

@vercel
Copy link

vercel bot commented May 27, 2025

@yuda110 is attempting to deploy a commit to the cloudforet Team on Vercel.

A member of the Team first needs to authorize it.

@github-actions
Copy link
Contributor

🎉 @seungyeoneeee has been randomly selected as the reviewer! Please review. 🙏

Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR refactors the cost report detail page to compute and display adjustment data alongside existing provider/project breakdowns and updates the UI/styling accordingly.

  • Refactored tableState to store raw data and derive provider, project, and product tables via computed properties
  • Introduced adjustment logic (adjustedProviderData, adjustedProjectData) and updated templates to render adjusted entries
  • Simplified sections (removed service account table), tweaked styling for adjusted rows
Comments suppressed due to low confidence (1)

apps/web/src/common/pages/CostReportDetailPage.vue:66

  • [nitpick] The name CostReportAdjustedDataAnalyzeResultByProvider is verbose and misaligned with its values (arrays of {product, value}). Consider renaming to something like ProviderAdjustmentData and updating the type definition to reflect the actual data shape.
type CostReportAdjustedDataAnalyzeResultByProvider = {

const costByProductTableData = computed<CostReportDataAnalyzeResultByProduct>(() => getConvertedProductTableData(tableState.productRawData));
const costByProviderTableData = computed<CostReportDataAnalyzeResult[]>(() => getSortedTableData(tableState.productRawData));
const costByProjectTableData = computed<CostReportDataAnalyzeResult[]>(() => tableState.projectRawData.filter((d) => !d.is_adjusted));
const adjustedProviderData = computed<CostReportAdjustedDataAnalyzeResultByProvider>(() => {
Copy link

Copilot AI May 27, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The type annotation CostReportAdjustedDataAnalyzeResultByProvider expects CostReportDataAnalyzeResult[], but the code assigns d.value_sum (an array of {product, value} objects). Adjust the type to match Array<{product: string; value: number}> or wrap the data into CostReportDataAnalyzeResult.

Copilot uses AI. Check for mistakes.
return `${startDate} ~ ${endDate}`;
}),
totalCost: computed<number>(() => sum(tableState.costByProvider.map((d) => d._total_value_sum))),
totalCost: computed<number>(() => sum(costByProviderTableData.value.map((d) => d._total_value_sum))),
Copy link

Copilot AI May 27, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since _total_value_sum is optional, consider coalescing to zero (d._total_value_sum ?? 0) before summing to avoid potential NaN results.

Suggested change
totalCost: computed<number>(() => sum(costByProviderTableData.value.map((d) => d._total_value_sum))),
totalCost: computed<number>(() => sum(costByProviderTableData.value.map((d) => d._total_value_sum ?? 0))),

Copilot uses AI. Check for mistakes.
Comment on lines +180 to +189
const adjustedProviderData = computed<CostReportAdjustedDataAnalyzeResultByProvider>(() => {
const results: CostReportAdjustedDataAnalyzeResultByProvider = {};
const adjustedData = tableState.productRawData.filter((d) => d.is_adjusted);
adjustedData.forEach((d) => {
results[d.provider] = d.value_sum;
});
return results;
});
const adjustedProjectData = computed<AdjustmentProductData>(() => {
const adjustedData = tableState.projectRawData.filter((d) => d.is_adjusted);
Copy link

Copilot AI May 27, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[nitpick] Both adjustedProviderData and adjustedProjectData filter rawData by is_adjusted. Extract this filtering into a shared helper to reduce duplication and improve readability.

Suggested change
const adjustedProviderData = computed<CostReportAdjustedDataAnalyzeResultByProvider>(() => {
const results: CostReportAdjustedDataAnalyzeResultByProvider = {};
const adjustedData = tableState.productRawData.filter((d) => d.is_adjusted);
adjustedData.forEach((d) => {
results[d.provider] = d.value_sum;
});
return results;
});
const adjustedProjectData = computed<AdjustmentProductData>(() => {
const adjustedData = tableState.projectRawData.filter((d) => d.is_adjusted);
const getAdjustedData = (data: CostReportDataAnalyzeResult[]) => data.filter((d) => d.is_adjusted);
const adjustedProviderData = computed<CostReportAdjustedDataAnalyzeResultByProvider>(() => {
const results: CostReportAdjustedDataAnalyzeResultByProvider = {};
const adjustedData = getAdjustedData(tableState.productRawData);
adjustedData.forEach((d) => {
results[d.provider] = d.value_sum;
});
return results;
});
const adjustedProjectData = computed<AdjustmentProductData>(() => {
const adjustedData = getAdjustedData(tableState.projectRawData);

Copilot uses AI. Check for mistakes.
@yuda110 yuda110 merged commit a9bcb21 into cloudforet-io:feature-cost-report May 27, 2025
8 checks passed
@yuda110 yuda110 deleted the feature/report-detail-ad branch May 27, 2025 09:06
yuda110 added a commit that referenced this pull request May 29, 2025
Signed-off-by: yuda <yuda@megazone.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant