You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@dlab.apache.org by dg...@apache.org on 2020/07/08 14:48:37 UTC

[incubator-dlab] branch DLAB-1925 created (now 20a3f41)

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

dgnatyshyn pushed a change to branch DLAB-1925
in repository https://gitbox.apache.org/repos/asf/incubator-dlab.git.


      at 20a3f41  [DLAB-1925] Change total instance number for EMR, fixed billing on resource

This branch includes the following new commits:

     new 20a3f41  [DLAB-1925] Change total instance number for EMR, fixed billing on resource

The 1 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.



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


[incubator-dlab] 01/01: [DLAB-1925] Change total instance number for EMR, fixed billing on resource

Posted by dg...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

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

commit 20a3f412b30f23b326cbb5d0619a77122bcfbd09
Author: Dmytro_Gnatyshyn <di...@ukr.net>
AuthorDate: Wed Jul 8 17:48:14 2020 +0300

    [DLAB-1925] Change total instance number for EMR, fixed billing on resource
---
 .../app/administration/project/project-data.service.ts   | 13 +++++++++----
 .../project/project-list/project-list.component.html     |  4 ++--
 .../cluster-details/cluster-details.component.html       |  5 ++++-
 .../resources-grid/resources-grid.component.html         |  2 +-
 .../src/app/resources/scheduler/scheduler.component.html | 16 ++++++++--------
 .../src/app/resources/scheduler/scheduler.component.ts   |  9 +++++----
 .../notification-dialog/notification-dialog.component.ts |  2 +-
 7 files changed, 30 insertions(+), 21 deletions(-)

diff --git a/services/self-service/src/main/resources/webapp/src/app/administration/project/project-data.service.ts b/services/self-service/src/main/resources/webapp/src/app/administration/project/project-data.service.ts
index 014c89b..a461686 100644
--- a/services/self-service/src/main/resources/webapp/src/app/administration/project/project-data.service.ts
+++ b/services/self-service/src/main/resources/webapp/src/app/administration/project/project-data.service.ts
@@ -47,11 +47,16 @@ export class ProjectDataService {
             if (response && this.endpointsList.length) {
               response.forEach(project => project.endpoints.forEach(endpoint => {
                 const filtredEndpoints =  this.endpointsList.filter(v => v.name === endpoint.name);
-                if (filtredEndpoints.length) {
-                  endpoint.endpointStatus = this.endpointsList.filter(v => v.name === endpoint.name)[0].status;
-                } else {
-                  endpoint.endpointStatus = 'N/A';
+                const idx = this.endpointsList.findIndex(v => v.name === endpoint.name);
+                // console.log('IDX ', idx);
+                // if (filtredEndpoints.length) {
+                if (idx >= 0) {
+                  endpoint.endpointStatus = this.endpointsList[idx].status;
                 }
+
+                // } else {
+                //   endpoint.endpointStatus = 'N/A';
+                // }
               }));
             }
           return of(response);
diff --git a/services/self-service/src/main/resources/webapp/src/app/administration/project/project-list/project-list.component.html b/services/self-service/src/main/resources/webapp/src/app/administration/project/project-list/project-list.component.html
index 04f525b..ef03098 100644
--- a/services/self-service/src/main/resources/webapp/src/app/administration/project/project-list/project-list.component.html
+++ b/services/self-service/src/main/resources/webapp/src/app/administration/project/project-list/project-list.component.html
@@ -51,12 +51,12 @@
           </div>
           <div class="resource-status">
             <span [ngClass]="{'active' : endpoint.endpointStatus === 'ACTIVE', 'failed': endpoint.endpointStatus === 'INACTIVE'}">
-              {{ endpoint.endpointStatus | titlecase }}
+              {{ (endpoint.endpointStatus | titlecase) || 'N/A'}}
             </span>
           </div>
 
           <span class="status resource-status"
-            ngClass="{{endpoint.status.toLowerCase() || ''}}">{{ endpoint.status.toLowerCase() }}</span>
+            [ngClass]="endpoint?.status.toLowerCase() || ''">{{ endpoint?.status.toLowerCase() }}</span>
         </div>
       </ng-template>
     </td>
diff --git a/services/self-service/src/main/resources/webapp/src/app/resources/computational/cluster-details/cluster-details.component.html b/services/self-service/src/main/resources/webapp/src/app/resources/computational/cluster-details/cluster-details.component.html
index 58ec39f..25f41d9 100644
--- a/services/self-service/src/main/resources/webapp/src/app/resources/computational/cluster-details/cluster-details.component.html
+++ b/services/self-service/src/main/resources/webapp/src/app/resources/computational/cluster-details/cluster-details.component.html
@@ -71,7 +71,10 @@
               <p>Total instance number:</p>
             </div>
           </ng-template>
-          <div class="col"><span>{{ resource[DICTIONARY[PROVIDER][resource.image].total_instance_number] || 1}}</span></div>
+          <div class="col">
+            <span *ngIf="DICTIONARY[PROVIDER].cloud_provider === 'aws'">{{ resource.totalInstanceCount > 0 ? resource.totalInstanceCount : resource.dataengine_instance_count}}</span>
+            <span *ngIf="DICTIONARY[PROVIDER].cloud_provider === 'gcp'">1</span>
+          </div>
         </div>
         <div class="row-wrap"
           *ngIf="DICTIONARY[PROVIDER].cloud_provider === 'gcp' && resource.image === 'docker.dlab-dataengine-service'">
diff --git a/services/self-service/src/main/resources/webapp/src/app/resources/resources-grid/resources-grid.component.html b/services/self-service/src/main/resources/webapp/src/app/resources/resources-grid/resources-grid.component.html
index 2f9088c..0edb5e7 100644
--- a/services/self-service/src/main/resources/webapp/src/app/resources/resources-grid/resources-grid.component.html
+++ b/services/self-service/src/main/resources/webapp/src/app/resources/resources-grid/resources-grid.component.html
@@ -137,7 +137,7 @@
             </computational-resources-list>
           </td>
           <td *ngIf="healthStatus?.billingEnabled" class="cost-col">
-            <span class="total_cost">{{ element.cost || 'N/A' }} {{ element.currency_code || '' }}</span>
+            <span class="total_cost">{{ element.billing.report_lines.length ? element.cost : 'N/A' }} {{ element.currency_code || '' }}</span>
             <span (click)="element.billing && printCostDetails(element)" class="currency_details"
               [ngClass]="{ 'not-allowed' : !element.billing.report_lines.length }">
               <i class="material-icons">help_outline</i>
diff --git a/services/self-service/src/main/resources/webapp/src/app/resources/scheduler/scheduler.component.html b/services/self-service/src/main/resources/webapp/src/app/resources/scheduler/scheduler.component.html
index 304c511..c49628e 100644
--- a/services/self-service/src/main/resources/webapp/src/app/resources/scheduler/scheduler.component.html
+++ b/services/self-service/src/main/resources/webapp/src/app/resources/scheduler/scheduler.component.html
@@ -64,7 +64,7 @@
               <mat-form-field>
                 <input matInput [matDatepicker]="startDate" placeholder="Choose start date" formControlName="startDate">
                 <mat-datepicker-toggle
-                  [ngClass]="{'not-allowed' : destination.type === 'СOMPUTATIONAL' && inherit || !enableSchedule }"
+
                   matSuffix [for]="startDate"></mat-datepicker-toggle>
                 <mat-datepicker #startDate></mat-datepicker>
               </mat-form-field>
@@ -72,9 +72,9 @@
             <div class="col-3">
               <mat-form-field>
                 <input matInput [matDatepicker]="finishDate" placeholder="Choose finish date"
-                  formControlName="finishDate" [disabled]="destination.type === 'СOMPUTATIONAL' && inherit ||!enableSchedule">
-                <mat-datepicker-toggle matSuffix [for]="finishDate" [disabled]="destination.type === 'СOMPUTATIONAL' && inherit ||!enableSchedule"></mat-datepicker-toggle>
-                <mat-datepicker #finishDate [disabled]="destination.type === 'СOMPUTATIONAL' && inherit ||!enableSchedule"></mat-datepicker>
+                  formControlName="finishDate">
+                <mat-datepicker-toggle matSuffix [for]="finishDate" [ngClass]="{'not-allowed' : destination.type === 'СOMPUTATIONAL' && inherit || !enableSchedule }"></mat-datepicker-toggle>
+                <mat-datepicker #finishDate ></mat-datepicker>
               </mat-form-field>
             </div>
             <div class="col-3" *ngIf="destination.type === 'СOMPUTATIONAL'; else timezone">
@@ -103,11 +103,11 @@
             <div class="control-group col-3 time-range">
               <dlab-time-picker [(pickTime)]="startTime" [label]="'Choose start time'"
                 [disable]="destination.type === 'СOMPUTATIONAL' && inherit || !enableSchedule">
+                {{destination.type}}
               </dlab-time-picker>
             </div>
             <div class="control-group col-3 time-range">
-<!--              <dlab-time-picker [(pickTime)]="endTime" [label]="'Choose finish time'" [disable]="destination.type === 'СOMPUTATIONAL' && inherit ||!enableSchedule">-->
-              <dlab-time-picker [(pickTime)]="endTime" [label]="'Choose finish time'" [disable]="true">
+              <dlab-time-picker [(pickTime)]="endTime" [label]="'Choose finish time'" [disable]="destination.type === 'СOMPUTATIONAL' && inherit ||!enableSchedule">
               </dlab-time-picker>
             </div>
             <div class="control-group col-3 time-range" *ngIf="destination.type === 'СOMPUTATIONAL'">
@@ -141,7 +141,7 @@
               <label>Start date:</label>
               <mat-button-toggle *ngFor="let day of weekdays; let i = index" value="{{ day }}"
                 (change)="onDaySelect($event, day, 'start')"
-                [disabled]="(destination.type === 'СOMPUTATIONAL' && inherit) || !enableSchedule"
+                [disabled]="destination.type === 'СOMPUTATIONAL' && inherit || !enableSchedule"
                 [checked]="selectedStartWeekDays[day.toLowerCase()]">{{ day[0] }}
               </mat-button-toggle>
             </div>
@@ -149,7 +149,7 @@
               <label>Stop date:</label>
               <mat-button-toggle *ngFor="let day of weekdays; let i = index" value="{{ day }}"
                 (change)="onDaySelect($event, day, 'stop')"
-                [disabled]="(destination.type === 'СOMPUTATIONAL' && inherit) || !enableSchedule"
+                [disabled]="destination.type === 'СOMPUTATIONAL' && inherit || !enableSchedule"
                 [checked]="selectedStopWeekDays[day.toLowerCase()]">{{ day[0] }}
               </mat-button-toggle>
             </div>
diff --git a/services/self-service/src/main/resources/webapp/src/app/resources/scheduler/scheduler.component.ts b/services/self-service/src/main/resources/webapp/src/app/resources/scheduler/scheduler.component.ts
index 0df2a59..c923677 100644
--- a/services/self-service/src/main/resources/webapp/src/app/resources/scheduler/scheduler.component.ts
+++ b/services/self-service/src/main/resources/webapp/src/app/resources/scheduler/scheduler.component.ts
@@ -88,7 +88,6 @@ export class SchedulerComponent implements OnInit {
 
   public open(notebook, type, resource?): void {
     this.notebook = notebook;
-    console.log(this.notebook)
     this.zones = _moment.tz.names()
       .map(item => [_moment.tz(item).format('Z'), item])
       .sort()
@@ -141,8 +140,10 @@ export class SchedulerComponent implements OnInit {
     if (this.destination.type === 'СOMPUTATIONAL' && this.inherit) {
       this.getExploratorySchedule(this.notebook.project, this.notebook.name);
       this.schedulerForm.get('startDate').disable();
+      this.schedulerForm.get('finishDate').disable();
     } else {
       this.schedulerForm.get('startDate').enable();
+      this.schedulerForm.get('finishDate').enable();
     }
   }
 
@@ -156,7 +157,7 @@ export class SchedulerComponent implements OnInit {
       ? this.schedulerForm.get('startDate').enable()
       : this.schedulerForm.get('startDate').disable();
 
-    this.enableSchedule ? this.schedulerForm.get('finishDate').enable() : this.schedulerForm.get('finishDate').disable();
+    this.enableSchedule && this.destination.type !== 'СOMPUTATIONAL' ? this.schedulerForm.get('finishDate').enable() : this.schedulerForm.get('finishDate').disable();
     this.enableSchedule ? this.schedulerForm.get('terminateDate').enable() : this.schedulerForm.get('terminateDate').disable();
 
     if (this.enableSchedule && $event.source) this.enableIdleTimeView = false;
@@ -256,7 +257,6 @@ export class SchedulerComponent implements OnInit {
   }
 
   private setScheduleByInactivity() {
-    console.log(this.notebook)
     const data = { sync_start_required: this.parentInherit, check_inactivity_required: this.enableIdleTime, max_inactivity: this.schedulerForm.controls.inactivityTime.value };
     (this.destination.type === 'СOMPUTATIONAL')
       ? this.setInactivity(this.notebook.project, this.notebook.name, data, this.destination.computational_name)
@@ -266,7 +266,7 @@ export class SchedulerComponent implements OnInit {
   private formInit(start?: string, end?: string, terminate?: string) {
     this.schedulerForm = this.formBuilder.group({
       startDate: { disabled: this.inherit, value: start ? _moment(start).format() : null },
-      finishDate: { disabled: false, value: end ? _moment(end).format() : null },
+      finishDate: { disabled: this.inherit, value: end ? _moment(end).format() : null },
       terminateDate: { disabled: false, value: terminate ? _moment(terminate).format() : null },
       inactivityTime: [this.inactivityLimits.min,
       [Validators.compose([Validators.pattern(this.integerRegex), this.validInactivityRange.bind(this)])]]
@@ -284,6 +284,7 @@ export class SchedulerComponent implements OnInit {
           this.startTime = params.start_time ? SchedulerCalculations.convertTimeFormat(params.start_time) : null;
           this.endTime = params.end_time ? SchedulerCalculations.convertTimeFormat(params.end_time) : null;
           this.formInit(params.begin_date, params.finish_date, params.terminate_datetime);
+          console.log();
           this.schedulerForm.controls.inactivityTime.setValue(params.max_inactivity || this.inactivityLimits.min);
           this.enableIdleTime = params.check_inactivity_required;
           this.considerInactivity = params.consider_inactivity || false;
diff --git a/services/self-service/src/main/resources/webapp/src/app/shared/modal-dialog/notification-dialog/notification-dialog.component.ts b/services/self-service/src/main/resources/webapp/src/app/shared/modal-dialog/notification-dialog/notification-dialog.component.ts
index 1f9794c..7ccfbf5 100644
--- a/services/self-service/src/main/resources/webapp/src/app/shared/modal-dialog/notification-dialog/notification-dialog.component.ts
+++ b/services/self-service/src/main/resources/webapp/src/app/shared/modal-dialog/notification-dialog/notification-dialog.component.ts
@@ -40,7 +40,7 @@ import {Endpoint} from '../../../administration/project/project.component';
               <div *ngIf="data.type === 'list'" class="info">
                   <div *ngIf="data.template.notebook.length > 0">
                       Following notebook server<span *ngIf="data.template.notebook.length>1">s</span>
-                    <span *ngFor="let item of data.template.notebook">&nbsp;
+                    <span *ngFor="let item of data.template.notebook">
                         <span class="strong info">{{ item.exploratory_name}}</span> on project <span
                         class="strong info">{{ item.project }}</span>
                         <span *ngIf="data.template.notebook.length > 1"> , </span>


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