- }
- /** Edit project @public */
- public editProject(): void {
- this.isLoadingResults = true;
- const apiURLHeader: APIURLHEADER = {
- url: environment.PROJECTS_URL + '/' + this.projectRef
- };
- const projectPayload: ProjectDetails = {
- name: this.projectForm.value.project_name
- };
- this.addQuotaLimit(projectPayload);
- this.restService.patchResource(apiURLHeader, projectPayload).subscribe(() => {
- this.activeModal.close(this.modalData);
- this.isLoadingResults = false;
- this.projectService.setHeaderProjects();
- this.notifierService.notify('success', this.translateService.instant('PAGE.PROJECT.UPDATEDSUCCESSFULLY'));
- }, (error: ERRORDATA) => {
- this.restService.handleError(error, 'patch');
- this.isLoadingResults = false;
- });
- }
- /** Get domain name @private */
- private getDomainName(): void {
- this.restService.getResource(environment.DOMAIN_URL).subscribe((domains: { project_domain_name: string, user_domain_name: string }) => {
- let domainNames: string[] = [];
- if (!isNullOrUndefined(domains.project_domain_name)) {
- domainNames = domainNames.concat(domains.project_domain_name.split(','));
- }
- if (!isNullOrUndefined(domains.user_domain_name)) {
- domainNames = domainNames.concat(domains.user_domain_name.split(','));
- }
- domainNames = Array.from(new Set(domainNames));
- this.checkDomainNames(domainNames);
- this.isLoadingResults = false;
- }, (error: ERRORDATA) => {
- this.restService.handleError(error, 'get');
- this.isLoadingResults = false;
- });
- }
-
- /** Check the domain names and create modal for domain select @private */
- private checkDomainNames(domainNames: string[]): void {
- if (domainNames.length > 0) {
- domainNames.forEach((domainName: string) => {
- if (!domainName.endsWith(':ro')) {
- this.domains.push({ id: domainName, text: domainName });
+ /** Handle enable quota limit checkbox event @public */
+ public checkQuota(): void {
+ if (this.getFormControl('enable_quota').value) {
+ this.quotaItems.forEach((quotaItem: QUOTAITEM): void => {
+ this.projectForm.addControl(quotaItem.value, new FormControl(''));
+ });
+ } else {
+ this.quotaItems.forEach((quotaItem: QUOTAITEM): void => {
+ this.getFormControl(quotaItem.value).setValue('');
+ });