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/05/27 10:43:17 UTC

[incubator-dlab] branch DLAB-1781 created (now 9608683)

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

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


      at 9608683  [DLAB-1781]: Prevent applying if user has not changed anything for quotas

This branch includes the following new commits:

     new 9608683  [DLAB-1781]: Prevent applying if user has not changed anything for quotas

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-1781]: Prevent applying if user has not changed anything for quotas

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

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

commit 960868320fdd2cb87be77abb55ab4e260ef94712
Author: Dmytro Gnatyshyn <di...@ukr.net>
AuthorDate: Wed May 27 13:42:13 2020 +0300

    [DLAB-1781]: Prevent applying if user has not changed anything for quotas
---
 .../manage-environment-dilog.component.html           |  2 +-
 .../manage-environment-dilog.component.ts             |  5 +++++
 .../resources-grid/resources-grid.component.ts        | 19 ++++++++++++++++++-
 .../webapp/src/app/resources/resources.component.html | 11 +++++++++--
 4 files changed, 33 insertions(+), 4 deletions(-)

diff --git a/services/self-service/src/main/resources/webapp/src/app/administration/management/manage-environment/manage-environment-dilog.component.html b/services/self-service/src/main/resources/webapp/src/app/administration/management/manage-environment/manage-environment-dilog.component.html
index 74ff5af..e3c77b8 100644
--- a/services/self-service/src/main/resources/webapp/src/app/administration/management/manage-environment/manage-environment-dilog.component.html
+++ b/services/self-service/src/main/resources/webapp/src/app/administration/management/manage-environment/manage-environment-dilog.component.html
@@ -97,7 +97,7 @@
             </div>
             <div class="text-center m-top-30">
               <button mat-raised-button type="button" (click)="dialogRef.close()" class="butt action">Cancel</button>
-              <button mat-raised-button type="submit" [disabled]="!manageUsersForm.valid" class="butt butt-success"
+              <button mat-raised-button type="submit" [disabled]="!manageUsersForm.valid || isFormChanged" class="butt butt-success"
                 [ngClass]="{'not-allowed': !manageUsersForm.valid}">Apply</button>
             </div>
           </mat-list>
diff --git a/services/self-service/src/main/resources/webapp/src/app/administration/management/manage-environment/manage-environment-dilog.component.ts b/services/self-service/src/main/resources/webapp/src/app/administration/management/manage-environment/manage-environment-dilog.component.ts
index f99944f..5187fa0 100644
--- a/services/self-service/src/main/resources/webapp/src/app/administration/management/manage-environment/manage-environment-dilog.component.ts
+++ b/services/self-service/src/main/resources/webapp/src/app/administration/management/manage-environment/manage-environment-dilog.component.ts
@@ -37,6 +37,8 @@ export class ManageEnvironmentComponent implements OnInit {
   public manageTotalsForm: FormGroup;
 
   @Output() manageEnv: EventEmitter<{}> = new EventEmitter();
+  private initialFormState: any;
+  private isFormChanged: boolean = true;
 
   constructor(
     @Inject(MAT_DIALOG_DATA) public data: any,
@@ -50,10 +52,12 @@ export class ManageEnvironmentComponent implements OnInit {
     this.setProjectsControl();
     this.manageUsersForm.controls['total'].setValue(this.data.total.conf_max_budget || '');
     this.onFormChange();
+    this.initialFormState = this.manageUsersForm.value;
   }
 
   public onFormChange() {
     this.manageUsersForm.valueChanges.subscribe(value => {
+      this.isFormChanged = JSON.stringify(this.initialFormState) === JSON.stringify(this.manageUsersForm.value);
       if ((this.getCurrentTotalValue() && this.getCurrentTotalValue() >= this.getCurrentUsersTotal())) {
         this.manageUsersForm.controls['projects']['controls'].forEach(v => {
             v.controls['budget'].setErrors(null);
@@ -86,6 +90,7 @@ export class ManageEnvironmentComponent implements OnInit {
   }
 
   public setProjectsControl() {
+    console.log(this.data.projectsList);
     this.manageUsersForm.setControl('projects',
       this._fb.array((this.data.projectsList || []).map((x: any) => this._fb.group({
         project: x.name,
diff --git a/services/self-service/src/main/resources/webapp/src/app/resources/resources-grid/resources-grid.component.ts b/services/self-service/src/main/resources/webapp/src/app/resources/resources-grid/resources-grid.component.ts
index 19b1eb5..9003974 100644
--- a/services/self-service/src/main/resources/webapp/src/app/resources/resources-grid/resources-grid.component.ts
+++ b/services/self-service/src/main/resources/webapp/src/app/resources/resources-grid/resources-grid.component.ts
@@ -23,7 +23,7 @@ import { animate, state, style, transition, trigger } from '@angular/animations'
 import { ToastrService } from 'ngx-toastr';
 import { MatDialog } from '@angular/material/dialog';
 
-import { UserResourceService } from '../../core/services';
+import {ProjectService, UserResourceService} from '../../core/services';
 
 import { ExploratoryModel, Exploratory } from './resources-grid.model';
 import { FilterConfigurationModel } from './filter-configuration.model';
@@ -90,6 +90,8 @@ export class ResourcesGridComponent implements OnInit {
   public displayedColumns: string[] = this.filteringColumns.map(item => item.name);
   public displayedFilterColumns: string[] = this.filteringColumns.map(item => item.filter_class);
   public bucketsList;
+  public activeProjectsList: any;
+
 
 
   constructor(
@@ -97,11 +99,25 @@ export class ResourcesGridComponent implements OnInit {
     private userResourceService: UserResourceService,
     private dialog: MatDialog,
     private progressBarService: ProgressBarService,
+    private projectService: ProjectService,
   ) { }
 
   ngOnInit(): void {
     this.buildGrid();
+    this.getUserProjects();
+  }
 
+  public getUserProjects() {
+    this.projectService.getUserProjectsList(true).subscribe((projects: any) => {
+      this.activeProjectsList = projects;
+      console.log(projects);
+      // console.log(projects);
+      // const activeProject = projects.find(item => item.name === this.resourceGrid.activeProject);
+      // if (this.resourceGrid.activeProject && activeProject) {
+      //   this.setEndpoints(activeProject);
+      //   this.createExploratoryForm.controls['project'].setValue(activeProject.name);
+      // }
+    });
   }
 
   public buildGrid(): void {
@@ -255,6 +271,7 @@ export class ResourcesGridComponent implements OnInit {
 
     if (filteredData.length) this.filtering = true;
     if (config) {
+      console.log(config);
       this.activeProject = config.project;
       filteredData = filteredData
         .filter(project => config.project ? project.project === config.project : project)
diff --git a/services/self-service/src/main/resources/webapp/src/app/resources/resources.component.html b/services/self-service/src/main/resources/webapp/src/app/resources/resources.component.html
index 513d7fe..50c91c2 100644
--- a/services/self-service/src/main/resources/webapp/src/app/resources/resources.component.html
+++ b/services/self-service/src/main/resources/webapp/src/app/resources/resources.component.html
@@ -20,11 +20,18 @@
 <div class="base-retreat">
   <div class="sub-nav">
     <div class="selection">
+      <span
+        matTooltip="{{!healthStatus?.projectAssigned ? 'You are not assigned to any project' : 'You have not any active project'}}"
+        matTooltipPosition="above"
+        matTooltipDisabled="{{healthStatus?.projectAssigned && resourcesGrid.activeProjectsList.length}}"
+        [matTooltipClass]="'bucket-item-tooltip'"
+      >
+        <span>{{resourcesGrid.activeProject}}</span>
       <button mat-raised-button class="butt butt-create" (click)="createEnvironment()"
-        [disabled]="!healthStatus?.projectAssigned">
+        [disabled]="!healthStatus?.projectAssigned || !resourcesGrid.activeProjectsList.length">
         <i class="material-icons">add</i>Create new
       </button>
-
+      </span>
       <div class="mat-reset">
         <div class="control selector-wrapper" *ngIf="projects.length">
           <mat-form-field>


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