You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@dlab.apache.org by of...@apache.org on 2020/03/31 11:12:31 UTC
[incubator-dlab] branch DLAB-1571 updated: Admin per project
This is an automated email from the ASF dual-hosted git repository.
ofuks pushed a commit to branch DLAB-1571
in repository https://gitbox.apache.org/repos/asf/incubator-dlab.git
The following commit(s) were added to refs/heads/DLAB-1571 by this push:
new 09ffe7c Admin per project
09ffe7c is described below
commit 09ffe7cc3eafd68701336b140f9ad1df4bdf566d
Author: Oleh Fuks <ol...@gmail.com>
AuthorDate: Tue Mar 31 14:12:18 2020 +0300
Admin per project
---
.../dlab/backendapi/service/impl/BillingServiceImpl.java | 16 ++++++++--------
1 file changed, 8 insertions(+), 8 deletions(-)
diff --git a/services/self-service/src/main/java/com/epam/dlab/backendapi/service/impl/BillingServiceImpl.java b/services/self-service/src/main/java/com/epam/dlab/backendapi/service/impl/BillingServiceImpl.java
index 3601d21..08502a2 100644
--- a/services/self-service/src/main/java/com/epam/dlab/backendapi/service/impl/BillingServiceImpl.java
+++ b/services/self-service/src/main/java/com/epam/dlab/backendapi/service/impl/BillingServiceImpl.java
@@ -147,28 +147,28 @@ public class BillingServiceImpl implements BillingService {
private Map<String, BillingReportLine> getBillableResources(UserInfo user, Set<ProjectDTO> projects) {
Stream<BillingReportLine> billableAdminResources = Stream.empty();
- final Stream<BillingReportLine> billableEdges = projects
- .stream()
- .collect(Collectors.toMap(ProjectDTO::getName, ProjectDTO::getEndpoints))
- .entrySet()
- .stream()
- .flatMap(e -> projectEdges(sbn, e.getKey(), e.getValue()));
final Stream<BillingReportLine> billableUserInstances = exploratoryService.findAll(projects)
.stream()
.filter(userInstance -> Objects.nonNull(userInstance.getExploratoryId()))
.flatMap(ui -> BillingUtils.exploratoryBillingDataStream(ui, configuration.getMaxSparkInstanceCount()));
if (UserRoles.isAdmin(user)) {
+ final Stream<BillingReportLine> billableEdges = projects
+ .stream()
+ .collect(Collectors.toMap(ProjectDTO::getName, ProjectDTO::getEndpoints))
+ .entrySet()
+ .stream()
+ .flatMap(e -> projectEdges(sbn, e.getKey(), e.getValue()));
final Stream<BillingReportLine> ssnBillingDataStream = BillingUtils.ssnBillingDataStream(sbn);
final Stream<BillingReportLine> billableSharedEndpoints = endpointService.getEndpoints()
.stream()
.flatMap(endpoint -> BillingUtils.sharedEndpointBillingDataStream(endpoint.getName(), sbn));
- billableAdminResources = Stream.of(ssnBillingDataStream, billableSharedEndpoints)
+ billableAdminResources = Stream.of(billableEdges, ssnBillingDataStream, billableSharedEndpoints)
.flatMap(s -> s);
}
- final Map<String, BillingReportLine> billableResources = Stream.of(billableEdges, billableUserInstances, billableAdminResources)
+ final Map<String, BillingReportLine> billableResources = Stream.of(billableUserInstances, billableAdminResources)
.flatMap(s -> s)
.collect(Collectors.toMap(BillingReportLine::getDlabId, b -> b));
log.debug("Billable resources are: {}", billableResources);
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@dlab.apache.org
For additional commands, e-mail: commits-help@dlab.apache.org