You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@dlab.apache.org by bh...@apache.org on 2019/04/03 09:21:53 UTC

[incubator-dlab] 02/07: DLAB-23 dictionary updated

This is an automated email from the ASF dual-hosted git repository.

bhliva pushed a commit to branch demo_gcp_billing
in repository https://gitbox.apache.org/repos/asf/incubator-dlab.git

commit ccfa823ece76c214e2b87b3fc161ef4b5ce3b363
Author: bhliva <bo...@epam.com>
AuthorDate: Wed Mar 13 17:47:06 2019 +0200

    DLAB-23 dictionary updated
---
 .../src/main/java/com/epam/dlab/backendapi/dao/BaseBillingDAO.java | 6 +++++-
 .../java/com/epam/dlab/backendapi/dao/azure/AzureBillingDAO.java   | 7 +++++++
 .../src/main/resources/webapp/src/dictionary/azure.dictionary.ts   | 2 +-
 .../src/main/resources/webapp/src/dictionary/gcp.dictionary.ts     | 2 +-
 4 files changed, 14 insertions(+), 3 deletions(-)

diff --git a/services/self-service/src/main/java/com/epam/dlab/backendapi/dao/BaseBillingDAO.java b/services/self-service/src/main/java/com/epam/dlab/backendapi/dao/BaseBillingDAO.java
index 25e9a8b..41235b6 100644
--- a/services/self-service/src/main/java/com/epam/dlab/backendapi/dao/BaseBillingDAO.java
+++ b/services/self-service/src/main/java/com/epam/dlab/backendapi/dao/BaseBillingDAO.java
@@ -141,7 +141,7 @@ public abstract class BaseBillingDAO<T extends BillingFilter> extends BaseDAO im
                     .append(shapeFieldName(), generateShapeName(shape))
                     .append("dlab_resource_type", DlabResourceType.getResourceTypeName(id.getString("dlab_resource_type"))) //todo check on azure!!!
                     .append(STATUS, statusString)
-                    .append(FIELD_RESOURCE_TYPE, id.getString(FIELD_RESOURCE_TYPE))
+                    .append(FIELD_RESOURCE_TYPE, resourceType(id))
                     .append(productFieldName(), id.getString(productFieldName()))
                     .append(MongoKeyWords.COST, d.getDouble(MongoKeyWords.COST))
                     .append(costFieldName(), BillingCalculationUtils.formatDouble(d.getDouble(MongoKeyWords
@@ -167,6 +167,10 @@ public abstract class BaseBillingDAO<T extends BillingFilter> extends BaseDAO im
 
     }
 
+    protected String resourceType(Document id) {
+        return id.getString(FIELD_RESOURCE_TYPE);
+    }
+
     protected String currencyCodeFieldName() {
         return "currency_code";
     }
diff --git a/services/self-service/src/main/java/com/epam/dlab/backendapi/dao/azure/AzureBillingDAO.java b/services/self-service/src/main/java/com/epam/dlab/backendapi/dao/azure/AzureBillingDAO.java
index c241b06..cc02774 100644
--- a/services/self-service/src/main/java/com/epam/dlab/backendapi/dao/azure/AzureBillingDAO.java
+++ b/services/self-service/src/main/java/com/epam/dlab/backendapi/dao/azure/AzureBillingDAO.java
@@ -19,6 +19,7 @@ package com.epam.dlab.backendapi.dao.azure;
 import com.epam.dlab.MongoKeyWords;
 import com.epam.dlab.backendapi.dao.BaseBillingDAO;
 import com.epam.dlab.backendapi.resources.dto.azure.AzureBillingFilter;
+import com.epam.dlab.billing.DlabResourceType;
 import com.google.inject.Singleton;
 import com.mongodb.client.model.Accumulators;
 import com.mongodb.client.model.Aggregates;
@@ -122,4 +123,10 @@ public class AzureBillingDAO extends BaseBillingDAO<AzureBillingFilter> {
     protected String currencyCodeFieldName() {
         return MongoKeyWords.CURRENCY_CODE;
     }
+
+    @Override
+    protected String resourceType(Document id) {
+        return DlabResourceType.getResourceTypeName(id.getString(MongoKeyWords.RESOURCE_TYPE));
+    }
+
 }
diff --git a/services/self-service/src/main/resources/webapp/src/dictionary/azure.dictionary.ts b/services/self-service/src/main/resources/webapp/src/dictionary/azure.dictionary.ts
index 00379fc..b247012 100644
--- a/services/self-service/src/main/resources/webapp/src/dictionary/azure.dictionary.ts
+++ b/services/self-service/src/main/resources/webapp/src/dictionary/azure.dictionary.ts
@@ -43,7 +43,7 @@ export const NAMING_CONVENTION = {
         'service': 'meterCategory',
         'service_filter_key': 'category',
         'type': '',
-        'resourceType': 'resourceType',
+        'resourceType': 'resource_type',
         'instance_size': 'size',
         'dlabId': 'dlabId'
     },
diff --git a/services/self-service/src/main/resources/webapp/src/dictionary/gcp.dictionary.ts b/services/self-service/src/main/resources/webapp/src/dictionary/gcp.dictionary.ts
index 1bf1111..4e5019a 100644
--- a/services/self-service/src/main/resources/webapp/src/dictionary/gcp.dictionary.ts
+++ b/services/self-service/src/main/resources/webapp/src/dictionary/gcp.dictionary.ts
@@ -44,7 +44,7 @@ export const NAMING_CONVENTION = {
       'service': 'product',
       'service_filter_key': 'product',
       'type': 'dlab_resource_type',
-      'resourceType': 'resource_type',
+      'resourceType': 'dlab_resource_type',
       'instance_size': 'shape',
       'dlabId': 'dlab_id'
   },


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@dlab.apache.org
For additional commands, e-mail: commits-help@dlab.apache.org