Support from Acquia helps fund testing for Drupal Acquia logo

Comments

Xiaohua Guan created an issue. See original summary.

Xiaohua Guan’s picture

FileSize
71.66 KB
Xiaohua Guan’s picture

@yas

Although I am still implementing the feature, could you test pages finished?

The following things are what I have done.

  • Add Budget menu
  • Add view view.cloud_budget.list
  • Add Entity cloud_credit
  • Add CRUD for entity cloud_credit
  • Add view view.cloud_credit.list
  • Add hook_calculate_user_cost
  • Add cost calculation for aws_cloud_instance in hourly rate of the instance type
yas’s picture

@xiaohua-guan

Thank you for adding the superb and exiting feature.

screenshot-2019-12-03a.png
screenshot-2019-12-03b.png
screenshot-2019-12-03c.png
screenshot-2019-12-03d.png
screenshot-2019-12-03e.png
screenshot-2019-12-03f.png
screenshot-2019-12-03g.png
screenshot-2019-12-03h.png
screenshot-2019-12-03i.png

It looks good to me. I have a couple of comments:

  1. The following code should be implemented as a Plugin as more OOP way? I think this is fine to keep the implementation at this point, though (refactor later).
    diff --git a/modules/cloud_budget/cloud_budget.api.php b/modules/cloud_budget/cloud_budget.api.php
    
    +function hook_calculate_user_cost($uid, $cloud_context, $from_time, $to_time) {
    
    diff --git a/modules/cloud_budget/cloud_budget.module b/modules/cloud_budget/cloud_budget.module
    new file mode 100644
    
    +    $results = \Drupal::moduleHandler()->invokeAll('calculate_user_cost', [
    
  2. The menu structure - Budget menu can be under Design | <Cloud Service Provider> menu (as the same level as Server Templates)? ... because we literally design the Cloud Budgets. On the other hand, Cloud Credit (current status) can be placed under each <Cloud Service Provider> menu (as the same level as Instances, Pods, and etc)? It is fine to proceed to keep the current implementation, though (refactor later).
  3. It would be nice to have if we can customize (setup) the initial Amount of Cloud Credit in some Cloud Budget admin settings.

What do you think?

yas’s picture

Title: Assign a budget (Credits) to launch and run instances on each user (2) » Assign a budget (Credits) to launch and run instances on each user
Related issues: +#3095569: Composer could not parse version constraint / could not load package (2)
Xiaohua Guan’s picture

Xiaohua Guan’s picture

Xiaohua Guan’s picture

FileSize
136.55 KB

@yas

> It would be nice to have if we can customize (setup) the initial Amount of Cloud Credit in some Cloud Budget admin settings.
I add initial amount of cloud credit to admin settings.

And I also added test cases for cloud credit entity.

Please review the patch file. Thanks.

Xiaohua Guan’s picture

Status: Active » Needs review
Xiaohua Guan’s picture

FileSize
136.51 KB
Xiaohua Guan’s picture

@yas

I refactored some test codes. Could you review the patch file. Thanks.

yas’s picture

FileSize
2.01 KB

@xiaohua-guan

Looks good, thanks!

yas’s picture

Status: Needs review » Reviewed & tested by the community

@xiaohua-guan

Now the patch looks good to me.. I'll merge the patch to 8.x-2.x and close this issue as Fixed.

  • yas committed 1c2a115 on 8.x-2.x authored by Xiaohua Guan
    Issue #3098289 by Xiaohua Guan, yas: Assign a budget (Credits) to launch...
yas’s picture

Status: Reviewed & tested by the community » Fixed
yas’s picture

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.