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