/** Modal service to initiate the project add @private */
public projectAdd(): void {
- const modalRef: NgbModalRef = this.modalService.open(ProjectCreateUpdateComponent, { backdrop: 'static' });
+ const modalRef: NgbModalRef = this.modalService.open(ProjectCreateUpdateComponent, { size: 'lg', backdrop: 'static' });
modalRef.componentInstance.projectType = 'Add';
modalRef.result.then((result: MODALCLOSERESPONSEDATA) => {
if (result) {
creationDate: this.sharedService.convertEpochTime(!isNullOrUndefined(projectData._admin) ? projectData._admin.created : null),
id: projectData._id,
project: projectData._id,
- quotas: !isNullOrUndefined(projectData.quotas) ? projectData.quotas : null
+ quotas: !isNullOrUndefined(projectData.quotas) && Object.keys(projectData.quotas).length !== 0 ? projectData.quotas : null
};
}
<label class="col-sm-12 col-form-label mandatory-label"
[ngClass]="{'text-danger': projectForm.invalid === true && submitted === true}">{{'MANDATORYCHECK' | translate}}</label>
<label class="col-sm-4 col-form-label">{{'PROJECT' | translate}} {{'NAME' | translate}}*</label>
- <div class="col-sm-8">
+ <div class="col-sm-4">
<input placeholder="{{'PROJECT' | translate}} {{'NAME' | translate}}" type="text" class="form-control"
formControlName="project_name" [ngClass]="{ 'is-invalid': submitted && f.project_name.errors }" required>
</div>
</div>
<div class="form-group row" *ngIf="getProjectType === 'Add'">
<label class="col-sm-4 col-form-label">{{'DOMAIN' | translate}} {{'NAME' | translate}}</label>
- <div class="col-sm-8">
+ <div class="col-sm-4">
<ng-select [clearable]="false" placeholder="{{'SELECT' | translate}}" [items]="domains" bindLabel="title"
bindValue="value" formControlName="domain_name" id="domain_name"
[ngClass]="{ 'is-invalid': submitted && f.domain_name.errors }"></ng-select>
<div class="form-check form-check-inline ml-2">
<input class="form-check-input" type="checkbox" formControlName="enable_quota" (change)="checkQuota()"
id="quotaCheck" *ngIf="getProjectType === 'Add' || quotaRefs === null">
- <label class="form-check-label" for="quotaCheck">{{'PAGE.PROJECT.QUOTA' | translate}}</label>
+ <label class="form-check-label" for="quotaCheck"><b>{{'PAGE.PROJECT.QUOTA' | translate}}</b></label>
</div>
<div class="row mt-1" [ngbCollapse]="!f.enable_quota.value">
<div class="form-group col-sm-6" *ngFor="let quota of quotaItems;">
<div class="row">
<label class="col-sm-7 col-form-label">{{quota.title | translate}}*</label>
<div class="col-sm-5">
- <input placeholder="{{'COUNT' | translate}}" type="number" min="{{quota.minValue}}"
- class="form-control" [formControlName]="quota.value" [ngClass]="{ 'is-invalid': submitted && f[quota.value].errors }" required>
+ <input placeholder="{{'COUNT' | translate}}" type="number"
+ class="form-control" [formControlName]="quota.value" [ngClass]="{ 'is-invalid': submitted && f[quota.value].errors }">
</div>
</div>
</div>
public checkQuota(): void {
if (this.getFormControl('enable_quota').value) {
this.quotaItems.forEach((quotaItem: QUOTAITEM): void => {
- this.projectForm.addControl(quotaItem.value, new FormControl(quotaItem.minValue, Validators.required));
+ this.projectForm.addControl(quotaItem.value, new FormControl(''));
});
} else {
this.quotaItems.forEach((quotaItem: QUOTAITEM): void => {
- this.getFormControl(quotaItem.value).setValue(quotaItem.minValue);
+ this.getFormControl(quotaItem.value).setValue('');
});
}
}
if (this.getFormControl('enable_quota').value) {
payload.quotas = {};
this.quotaItems.forEach((quotaItem: QUOTAITEM): void => {
- payload.quotas[quotaItem.value] = this.getFormControl(quotaItem.value).value;
+ if (this.getFormControl(quotaItem.value).value !== '') {
+ payload.quotas[quotaItem.value] = this.getFormControl(quotaItem.value).value;
+ }
});
+ if (Object.keys(payload.quotas).length === 0) {
+ delete payload.quotas;
+ }
}
}
this.quotaItems.forEach((quotaItem: QUOTAITEM): void => {
if (!isNullOrUndefined(quotaRef[quotaItem.value])) {
this.projectForm.addControl(quotaItem.value, new FormControl(quotaRef[quotaItem.value],
- [Validators.required, Validators.min(quotaItem.minValue), Validators.max(quotaItem.maxValue)]));
+ [Validators.max(quotaItem.maxValue)]));
} else {
- this.projectForm.addControl(quotaItem.value, new FormControl(quotaItem.minValue, [Validators.required,
- Validators.min(quotaItem.minValue), Validators.max(quotaItem.maxValue)]));
+ this.projectForm.addControl(quotaItem.value, new FormControl('', [Validators.max(quotaItem.maxValue)]));
}
});
} else {
this.quotaItems.forEach((quotaItem: QUOTAITEM): void => {
- this.projectForm.addControl(quotaItem.value, new FormControl(quotaItem.minValue, [Validators.required,
- Validators.min(quotaItem.minValue), Validators.max(quotaItem.maxValue)]));
+ this.projectForm.addControl(quotaItem.value, new FormControl('', [Validators.min(quotaItem.minValue),
+ Validators.max(quotaItem.maxValue)]));
});
}
}
/** Edit project @public */
public projectEdit(): void {
- const modalRef: NgbModalRef = this.modalService.open(ProjectCreateUpdateComponent, { backdrop: 'static' });
+ const modalRef: NgbModalRef = this.modalService.open(ProjectCreateUpdateComponent, { size: 'lg', backdrop: 'static' });
modalRef.componentInstance.projectType = 'Edit';
modalRef.result.then((result: MODALCLOSERESPONSEDATA) => {
if (result) {
this.getFormControl('scalingname').setValue(null);
const scalingGroupDescriptorName: SCALING[] = [];
if (!isNullOrUndefined(this.params.data)) {
- console.log(this.params.data);
const vnfdPackageDetails: VNFD = this.params.data.filter((vnfdData: VNFD): boolean => vnfdData.id === vnfID)[0];
if (vnfdPackageDetails.df.length > 0) {
vnfdPackageDetails.df.forEach((df: DF): void => {