sealos icon indicating copy to clipboard operation
sealos copied to clipboard

feat: Anticipated Price

Open c121914yu opened this issue 1 year ago • 2 comments

🤖 Generated by Copilot at 0517b2a

Summary

:moneybag::globe_with_meridians::bug:

This pull request adds a new feature to the application launchpad frontend and backend that allows users to see the estimated cost of the app resources based on their subscription plan and the source price. It also fixes some bugs and improves the UI and localization of some components. The main files involved are resourcePrice.ts, PriceBox.tsx, Form.tsx, and static.ts.

Sing, O Muse, of the skillful pull request That brought to the launchpad a wondrous feature To show the mortal users the price of their apps And the resources they consume in the cloud.

Walkthrough

  • Implement the feature of displaying the estimated cost of the application resources in the frontend and backend (link, link, link, link, link, link, link, link)
  • Add the resourcePrice API in the platform.ts and resourcePrice.ts files to calculate the price of the application resources based on the user's price query CRD and the source price CRD (link, link)
  • Add the getUserPrice function in the static.ts and _app.tsx files to fetch the user's price from the backend when the application is loaded and retry in case of failure (link, link)
  • Add the PriceBox component in the PriceBox.tsx and Form.tsx files to display the estimated cost of the application resources based on the user's price and the source price (link, link, link)
  • Add the type declaration for the resourcePriceResponse and the initial value for the SOURCE_PRICE variable in the static.ts file to store and access the user's price and the source price (link)
  • Fix the localization issues in the frontend labels and texts (link, link, link, link, link, link, link, link, link, link)
    • Change the labels for the deployment mode, network configuration, basic configuration, CPU value, and memory value fields to match the backend terminology, make them shorter and consistent with other labels, and remove the redundant ones (link, link, link, link, link)
    • Add the labels for the total price, day, and anticipated price fields to the common.json files in English and Chinese to support the new feature of displaying the estimated cost of the application resources (link, link)
    • Change the text for the "未开启" label in the AppMainInfo component from Chinese to English ("Not Enabled") to fix a localization issue (link)
    • Change the text for the title of the ConfigmapModal component from "添加ConfigMap" and "修改ConfigMap" to "Add" and "Update" to make it shorter and consistent with other modals (link)
    • Wrap the text for the title of the ConfigmapModal component with the t function to enable localization based on the user's language preference (link)
  • Fix the logic and linting errors in the ConfigmapModal component (link, link)
    • Remove the import statement for the FormErrorMessage component as it was unused and caused a linting error (link)
    • Fix the logic for the type variable to correctly determine whether the modal is for creating or editing a configmap based on the defaultValue prop (link)
  • Change the order of the getServiceEnv and getUserPrice functions in the useEffect hook of the App component to ensure that the user's price is fetched before the service environment is set (link)

c121914yu avatar Jun 14 '23 09:06 c121914yu

🤖 Generated by lychee action

Summary

Status Count
🔍 Total 637
✅ Successful 302
⏳ Timeouts 0
🔀 Redirected 0
👻 Excluded 334
❓ Unknown 0
🚫 Errors 0

Full action output

Full Github Actions output

sealos-ci-robot avatar Jun 14 '23 09:06 sealos-ci-robot

Codecov Report

Patch and project coverage have no change.

Comparison is base (b8efed9) 72.97% compared to head (fcac3ea) 72.97%.

:exclamation: Current head fcac3ea differs from pull request most recent head 2930e00. Consider uploading reports for the commit 2930e00 to get more accurate results

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #3357   +/-   ##
=======================================
  Coverage   72.97%   72.97%           
=======================================
  Files           8        8           
  Lines         618      618           
=======================================
  Hits          451      451           
  Misses        132      132           
  Partials       35       35           

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Do you have feedback about the report comment? Let us know in this issue.

codecov[bot] avatar Jun 14 '23 09:06 codecov[bot]