dlab-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dgnatys...@apache.org
Subject [incubator-dlab] branch develop updated: [DLAB-1781]: Prevent applying if user has not changed anything for quotas (#767)
Date Wed, 27 May 2020 10:44:04 GMT
This is an automated email from the ASF dual-hosted git repository.

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


The following commit(s) were added to refs/heads/develop by this push:
     new de8abf1  [DLAB-1781]: Prevent applying if user has not changed anything for quotas
(#767)
de8abf1 is described below

commit de8abf19409f03c9479bd1842aefcff0ada6ea7b
Author: Dmytro Gnatyshyn <42860905+DG1202@users.noreply.github.com>
AuthorDate: Wed May 27 13:43:54 2020 +0300

    [DLAB-1781]: Prevent applying if user has not changed anything for quotas (#767)
---
 .../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


Mime
View raw message