diff --git a/src/app/applications/addcloudapplication.component.ts b/src/app/applications/addcloudapplication.component.ts index 9ee6b3adf5..66150b1af5 100644 --- a/src/app/applications/addcloudapplication.component.ts +++ b/src/app/applications/addcloudapplication.component.ts @@ -10,6 +10,7 @@ import {FlavorService} from '../api-connector/flavor.service'; import {Flavor} from '../virtualmachines/virtualmachinemodels/flavor'; import {FlavorType} from '../virtualmachines/virtualmachinemodels/flavorType'; import {forEach} from '@angular/router/src/utils/collection'; +import {AbstractBaseClasse} from "../shared_modules/baseClass/abstract-base-class"; @Component({ templateUrl: 'addcloudapplication.component.html', @@ -17,7 +18,7 @@ import {forEach} from '@angular/router/src/utils/collection'; styleUrls: ['addcloudapplication.component.css'] }) -export class AddcloudapplicationComponent { +export class AddcloudapplicationComponent extends AbstractBaseClasse{ /** * If shortname is valid. @@ -25,32 +26,7 @@ export class AddcloudapplicationComponent { */ public wronginput: boolean = false; - //notification Modal variables - /** - * Notification Modal title. - * @type {string} - */ - public notificationModalTitle: string = 'Notification'; - /** - * Notification Modal message. - * @type {string} - */ - public notificationModalMessage: string = 'Please wait...'; - /** - * Notification Modal type. - * @type {string} - */ - public notificationModalType: string = 'info'; - /** - * If Notification Modal is closable. - * @type {boolean} - */ - public notificationModalIsClosable: boolean = false; - /** - * If Notification Modal stays. - * @type {boolean} - */ - public notificationModalStay: boolean = true; + /** * Contains errors recieved when submitting an application. */ @@ -123,6 +99,7 @@ export class AddcloudapplicationComponent { */ constructor(private specialhardwareservice: SpecialHardwareService, private applicationsservice: ApplicationsService, private flavorservice: FlavorService) { + super(); this.getSpecialHardware(); this.getListOfFlavors(); this.getListOfTypes(); @@ -273,7 +250,7 @@ export class AddcloudapplicationComponent { this.error = null; if (this.wronginput == true) { - this.updateNotificaitonModal('Failed', 'The application was not submitted, please check the required fields and try again.', true, 'danger'); + this.updateNotificationModal('Failed', 'The application was not submitted, please check the required fields and try again.', true, 'danger'); this.notificationModalStay = true; } else { @@ -288,7 +265,7 @@ export class AddcloudapplicationComponent { } this.applicationsservice.addNewApplication(values).toPromise() .then(result => { - this.updateNotificaitonModal('Success', 'The application was submitted', true, 'success'); + this.updateNotificationModal('Success', 'The application was submitted', true, 'success'); this.notificationModalStay = false; }).catch(error => { var error_json = error @@ -299,37 +276,12 @@ export class AddcloudapplicationComponent { } - this.updateNotificaitonModal('Failed', 'The application was not submitted, please check the required fields and try again.', true, 'danger'); + this.updateNotificationModal('Failed', 'The application was not submitted, please check the required fields and try again.', true, 'danger'); this.notificationModalStay = true; }) } } - /** - * Update notification modal attributes. - * @param {string} title - * @param {string} message - * @param closable - * @param {string} type - */ - public updateNotificaitonModal(title: string, message: string, closable: true, type: string) { - this.notificationModalTitle = title; - this.notificationModalMessage = message; - this.notificationModalIsClosable = closable; - this.notificationModalType = type; - } - - /** - * Reset notificaton modal attributes. - */ - public resetNotificationModal() { - - this.notificationModalTitle = 'Notification'; - this.notificationModalMessage = 'Please wait...'; - this.notificationModalType = 'info'; - this.notificationModalIsClosable = false; - this.notificationModalStay = true; - } /** * Check if shortname is valid. diff --git a/src/app/applications/addsinglevm.component.ts b/src/app/applications/addsinglevm.component.ts index 2136ee8e04..45de329c07 100644 --- a/src/app/applications/addsinglevm.component.ts +++ b/src/app/applications/addsinglevm.component.ts @@ -5,25 +5,20 @@ import {SpecialHardwareService} from '../api-connector/special-hardware.service' import {SpecialHardware} from './special_hardware.model' import {ApiSettings} from '../api-connector/api-settings.service' import {ApplicationsService} from '../api-connector/applications.service' +import {AbstractBaseClasse} from "../shared_modules/baseClass/abstract-base-class"; @Component({ templateUrl: 'addsinglevm.component.html', providers: [SpecialHardwareService, ApiSettings, ApplicationsService] }) -export class AddsinglevmComponent { +export class AddsinglevmComponent extends AbstractBaseClasse{ /** * Check if the shortname provided is valid. * @type {boolean} */ public wronginput: boolean = false; - //notification Modal variables - public notificationModalTitle: string = 'Notification'; - public notificationModalMessage: string = 'Please wait...'; - public notificationModalType: string = 'info'; - public notificationModalIsClosable: boolean = false; - public notificationModalStay: boolean = true; public error: string[]; public project_application_vms_requested=3; @@ -41,6 +36,7 @@ export class AddsinglevmComponent { constructor(private specialhardwareservice: SpecialHardwareService, private applicationsservice: ApplicationsService) { + super(); this.getSpecialHardware(); } @@ -69,7 +65,7 @@ export class AddsinglevmComponent { onSubmit(f: NgForm) { this.error = null; if (this.wronginput == true) { - this.updateNotificaitonModal('Failed', 'The application was not submitted, please check the required fields and try again.', true, 'danger'); + this.updateNotificationModal('Failed', 'The application was not submitted, please check the required fields and try again.', true, 'danger'); this.notificationModalStay = true; } else { @@ -83,7 +79,7 @@ export class AddsinglevmComponent { this.applicationsservice.addNewApplication(values).toPromise() .then(result => { - this.updateNotificaitonModal('Success', 'The application was submitted', true, 'success'); + this.updateNotificationModal('Success', 'The application was submitted', true, 'success'); this.notificationModalStay = false; }).catch(error => { var error_json = error; @@ -94,37 +90,12 @@ export class AddsinglevmComponent { } - this.updateNotificaitonModal('Failed', 'The application was not submitted, please check the required fields and try again.', true, 'danger'); + this.updateNotificationModal('Failed', 'The application was not submitted, please check the required fields and try again.', true, 'danger'); this.notificationModalStay = true; }) } } - /** - * Update notification modal attributes with values. - * @param {string} title - * @param {string} message - * @param closable - * @param {string} type - */ - public updateNotificaitonModal(title: string, message: string, closable: true, type: string) { - this.notificationModalTitle = title; - this.notificationModalMessage = message; - this.notificationModalIsClosable = closable; - this.notificationModalType = type; - } - - /** - * Reset notification modal. - */ - public resetNotificationModal() { - - this.notificationModalTitle = 'Notification'; - this.notificationModalMessage = 'Please wait...'; - this.notificationModalType = 'info'; - this.notificationModalIsClosable = false; - this.notificationModalStay = true; - } /** * Check if shortname is valid. diff --git a/src/app/applications/applications.component.ts b/src/app/applications/applications.component.ts index 299cec3895..b1615970fd 100644 --- a/src/app/applications/applications.component.ts +++ b/src/app/applications/applications.component.ts @@ -740,11 +740,11 @@ export class ApplicationsComponent extends AbstractBaseClasse { this.groupservice.assignGroupToResource(new_group_id.toString(), compute_center).subscribe(res => { this.applicationstatusservice.setApplicationStatus(application_id, this.application_statuses.WAIT_FOR_CONFIRMATION, compute_center).subscribe(result => { if (result['Error']) { - this.updateNotificaitonModal("Failed", result['Error'], true, "danger"); + this.updateNotificationModal("Failed", result['Error'], true, "danger"); } else { - this.updateNotificaitonModal("Success", "The new project was created", true, "success"); + this.updateNotificationModal("Success", "The new project was created", true, "success"); } for (let app of this.user_applications) { if (app.Id == application_id) { @@ -774,7 +774,7 @@ export class ApplicationsComponent extends AbstractBaseClasse { , error => { console.log(error); - this.updateNotificaitonModal("Failed", "Project could not be created!", true, "danger"); + this.updateNotificationModal("Failed", "Project could not be created!", true, "danger"); }) } @@ -795,7 +795,7 @@ export class ApplicationsComponent extends AbstractBaseClasse { let new_group_id: number; this.applicationstatusservice.setApplicationStatus(application_id, this.application_statuses.APPROVED, compute_center).subscribe(result => { if (result['Error']) { - this.updateNotificaitonModal("Failed", result['Error'], true, "danger"); + this.updateNotificationModal("Failed", result['Error'], true, "danger"); this } @@ -813,11 +813,11 @@ export class ApplicationsComponent extends AbstractBaseClasse { this.groupservice.addAdmin(new_group_id, manager_member_user_id, compute_center).subscribe(res => { this.groupservice.setPerunGroupAttributes(application_id, new_group_id).subscribe(res => { if (result['Error']) { - this.updateNotificaitonModal("Failed", result['Error'], true, "danger"); + this.updateNotificationModal("Failed", result['Error'], true, "danger"); } else { - this.updateNotificaitonModal("Success", "The new project was created", true, "success"); + this.updateNotificationModal("Success", "The new project was created", true, "success"); } for (let app of this.user_applications) { @@ -850,7 +850,7 @@ export class ApplicationsComponent extends AbstractBaseClasse { }, error => { console.log(error); - this.updateNotificaitonModal("Failed", "Project could not be created!", true, "danger"); + this.updateNotificationModal("Failed", "Project could not be created!", true, "danger"); }) @@ -868,7 +868,7 @@ export class ApplicationsComponent extends AbstractBaseClasse { } } - this.updateNotificaitonModal("Success", "The project was assigned to the facility.", true, "success"); + this.updateNotificationModal("Success", "The project was assigned to the facility.", true, "success"); }) @@ -876,7 +876,7 @@ export class ApplicationsComponent extends AbstractBaseClasse { }, error => { console.log(error); - this.updateNotificaitonModal("Failed", "Project could not be created!", true, "danger"); + this.updateNotificationModal("Failed", "Project could not be created!", true, "danger"); }); } @@ -893,10 +893,10 @@ export class ApplicationsComponent extends AbstractBaseClasse { this.user_applications = []; this.getUserApplications(); this.getAllApplications(); - this.updateNotificaitonModal("Success", "The Application was declined", true, "success"); + this.updateNotificationModal("Success", "The Application was declined", true, "success"); }) .catch(error => { - this.updateNotificaitonModal("Failed", "Application could be declined!", true, "danger"); + this.updateNotificationModal("Failed", "Application could be declined!", true, "danger"); }); } @@ -907,7 +907,7 @@ export class ApplicationsComponent extends AbstractBaseClasse { public deleteApplication(application_id) { this.applicataionsservice.deleteApplication(application_id).toPromise() .then(result => { - this.updateNotificaitonModal('Success', 'The application has been successfully removed', true, 'success'); + this.updateNotificationModal('Success', 'The application has been successfully removed', true, 'success'); }).then(result => { this.user_applications = []; this.all_applications = []; @@ -915,7 +915,7 @@ export class ApplicationsComponent extends AbstractBaseClasse { this.getAllApplications(); }) .catch(error => { - this.updateNotificaitonModal("Failed", "Application could not be removed!", true, "danger"); + this.updateNotificationModal("Failed", "Application could not be removed!", true, "danger"); }); } diff --git a/src/app/facility_manager/facility.application.component.ts b/src/app/facility_manager/facility.application.component.ts index fbc1df1efe..38c4bfeb59 100644 --- a/src/app/facility_manager/facility.application.component.ts +++ b/src/app/facility_manager/facility.application.component.ts @@ -14,6 +14,7 @@ import {ApplicationStatus} from "../applications/application_status.model"; import {ApplicationStatusService} from "../api-connector/application-status.service"; import {ApplicationsService} from "../api-connector/applications.service"; import {SpecialHardwareService} from "../api-connector/special-hardware.service"; +import {AbstractBaseClasse} from "../shared_modules/baseClass/abstract-base-class"; @Component({ selector: 'app-facility.application', @@ -22,12 +23,7 @@ import {SpecialHardwareService} from "../api-connector/special-hardware.service" providers: [FacilityService, UserService, GroupService, PerunSettings, ApplicationStatusService, ApplicationsService, SpecialHardwareService, ApiSettings] }) -export class FacilityApplicationComponent implements OnInit { - //notification Modal variables - public notificationModalTitle: string = "Notification"; - public notificationModalMessage: string = "Please wait..."; - public notificationModalType: string = "info"; - public notificationModalIsClosable: boolean = false; +export class FacilityApplicationComponent extends AbstractBaseClasse implements OnInit { /** * User which requested the Application {id: Elixir Id of user : {name and email}}. @@ -87,6 +83,7 @@ export class FacilityApplicationComponent implements OnInit { private applicationstatusservice: ApplicationStatusService, private specialhardwareservice: SpecialHardwareService, private facilityService: FacilityService) { + super(); this.facilityService.getManagerFacilities().subscribe(result => { this.managerFacilities = result; @@ -215,14 +212,14 @@ export class FacilityApplicationComponent implements OnInit { approveApplication(application_id: number) { - this.updateNotificaitonModal('Approving Application', 'Waiting..', true, 'info') + this.updateNotificationModal('Approving Application', 'Waiting..', true, 'info') this.facilityService.approveFacilityApplication(this.selectedFacility['FacilityId'], application_id).subscribe(res => { - this.updateNotificaitonModal('Success', 'Successfully approved the application.', true, 'success'); + this.updateNotificationModal('Success', 'Successfully approved the application.', true, 'success'); this.all_applications = []; this.getAllApplications(this.selectedFacility['FacilityId']) }, error => { - this.updateNotificaitonModal('Failed', 'Failed to approve the application.', true, 'danger'); + this.updateNotificationModal('Failed', 'Failed to approve the application.', true, 'danger'); }) @@ -233,15 +230,15 @@ export class FacilityApplicationComponent implements OnInit { * @param {number} application_id */ declineApplication(application_id: number) { - this.updateNotificaitonModal('Decline Application', 'Waiting..', true, 'info'); + this.updateNotificationModal('Decline Application', 'Waiting..', true, 'info'); this.facilityService.declineFacilityApplication(this.selectedFacility['FacilityId'], application_id).subscribe(res => { - this.updateNotificaitonModal('Success', 'Successfully declined the application.', true, 'success'); + this.updateNotificationModal('Success', 'Successfully declined the application.', true, 'success'); this.all_applications = []; this.getAllApplications(this.selectedFacility['FacilityId']) }, error => { - this.updateNotificaitonModal('Failed', 'Failed to decline the application.', true, 'danger'); + this.updateNotificationModal('Failed', 'Failed to decline the application.', true, 'danger'); }) @@ -337,29 +334,6 @@ export class FacilityApplicationComponent implements OnInit { return s; } - /** - * Reset notification modal values to default. - */ - public resetNotificationModal() { - this.notificationModalTitle = "Notification"; - this.notificationModalMessage = "Please wait..."; - this.notificationModalType = "info"; - this.notificationModalIsClosable = false; - } - - /** - * Update notification modal with values submitted. - * @param {string} title - * @param {string} message - * @param closable - * @param {string} type - */ - public updateNotificaitonModal(title: string, message: string, closable: true, type: string) { - this.notificationModalTitle = title; - this.notificationModalMessage = message; - this.notificationModalIsClosable = closable; - this.notificationModalType = type; - } /** * Get id by status name. diff --git a/src/app/projectmanagement/overview.component.html b/src/app/projectmanagement/overview.component.html index 774bf20b69..a58b5f45a9 100755 --- a/src/app/projectmanagement/overview.component.html +++ b/src/app/projectmanagement/overview.component.html @@ -263,7 +263,7 @@