Skip to content

Commit

Permalink
Fix for #100
Browse files Browse the repository at this point in the history
  • Loading branch information
kostistr committed Nov 3, 2023
1 parent ad80b7d commit c6c7497
Show file tree
Hide file tree
Showing 68 changed files with 1,032 additions and 2,491 deletions.
18 changes: 7 additions & 11 deletions src/app/app-resources-routing.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,13 @@ import { ListResourceCategoriesComponent } from './p_resources/admin/catalogMana
import { EditResourceCategoriesComponent } from './p_resources/admin/catalogManagement/edit-resource-categories/edit-resource-categories.component';
import { ListResourceSpecsComponent } from './p_resources/admin/catalogManagement/list-resource-spec/list-resource-spec.component';
import { EditResourceSpecsComponent } from './p_resources/admin/catalogManagement/edit-resource-spec/edit-resource-spec.component';
import { ResourceOsmAddComponent } from './p_resources/admin/catalogManagement/resource-osm-add/resource-osm-add.component';
import { PreviewResourceComponent } from './p_resources/admin/inventoryManagement/preview-resource/preview-resource.component';
import { ListResourceInventoryComponent } from './p_resources/admin/inventoryManagement/list-resource-inventory/list-resource-inventory.component';
import { ResourcePoolManagementComponent } from './p_resources/admin/resourcePoolManagement/resource-pool-management/resource-pool-management.component';
import { ResourceReservationManagementComponent } from './p_resources/admin/resourcePoolManagement/resource-reservation-management/resource-reservation-management.component';
import { ListResourcePoolsComponent } from './p_resources/admin/resourcePoolManagement/list-resource-pools/list-resource-pools.component';
import { ResourceReservationCalendarComponent } from './p_resources/admin/resourcePoolManagement/resource-reservation-calendar/resource-reservation-calendar.component';
import { EditResourceReservationComponent } from './p_resources/admin/resourcePoolManagement/edit-resource-reservation/edit-resource-reservation.component';
import { EditResourcePoolComponent } from './p_resources/admin/resourcePoolManagement/edit-resource-pool/edit-resource-pool.component';
import { ListResourceReservationsComponent } from './p_resources/admin/resourcePoolManagement/list-resource-reservations/list-resource-reservations.component';

const routes: Routes = [
// { path: 'resources_marketplace', component: ResourcesMarketplaceComponent },
Expand All @@ -29,17 +28,14 @@ const routes: Routes = [
{ path: 'resource_spec_update/:id', component: EditResourceSpecsComponent },
{ path: 'resource_spec_update', component: EditResourceSpecsComponent },
{ path: 'resource_inventory', component: ListResourceInventoryComponent },
{ path: 'resource_osm_add', component: ResourceOsmAddComponent },
{ path: 'resource_osm_add/:id', component: ResourceOsmAddComponent },
{ path: 'resource/:id', component: PreviewResourceComponent },
{ path: 'new_resource', component: PreviewResourceComponent },

{ path: 'resource-pool-management', component: ResourcePoolManagementComponent },
{ path: 'resource_pool_update/:id', component: EditResourcePoolComponent },
{ path: 'resource_pool_update', component: EditResourcePoolComponent },
{ path: 'resource_pools', component: ListResourcePoolsComponent },
{ path: 'resource_pool/:id', component: EditResourcePoolComponent },
{ path: 'resource_pool', component: EditResourcePoolComponent },

{ path: 'resource-reservation-management', component: ResourceReservationManagementComponent },
{ path: 'resource_reservation_calendar', component: ResourceReservationCalendarComponent },
{ path: 'resource_reservations', component: ListResourceReservationsComponent },
{ path: 'resource_reservations_calendar', component: ResourceReservationCalendarComponent },
{ path: 'resource_reservation_update/:id', component: EditResourceReservationComponent},
{ path: 'resource_reservation_update', component: EditResourceReservationComponent },

Expand Down
25 changes: 8 additions & 17 deletions src/app/app-resources.module.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { AssignPoolResourceRelationshipsComponent } from './p_resources/admin/resourcePoolManagement/assign-resources/assign-pool-resources.component';
import { AssignPoolResourceRelationshipsComponent } from './p_resources/admin/resourcePoolManagement/edit-resource-pool/assign-resources/assign-pool-resources.component';
import { NgModule, NO_ERRORS_SCHEMA } from '@angular/core';
import { CommonModule } from '@angular/common';

Expand All @@ -8,7 +8,6 @@ import { AppResourcesRoutingModule } from './app-resources-routing.module';

import { SharedModule } from './shared.module';
import { EditResourceCatalogsComponent } from './p_resources/admin/catalogManagement/edit-resource-catalogs/edit-resource-catalogs.component';
import { ResourceOsmAddComponent } from './p_resources/admin/catalogManagement/resource-osm-add/resource-osm-add.component';
import { DeleteResourceCatalogsComponent } from './p_resources/admin/catalogManagement/delete-resource-catalogs/delete-resource-catalogs.component';
import { ListResourceCategoriesComponent } from './p_resources/admin/catalogManagement/list-resource-categories/list-resource-categories.component';
import { EditResourceCategoriesComponent } from './p_resources/admin/catalogManagement/edit-resource-categories/edit-resource-categories.component';
Expand All @@ -25,15 +24,10 @@ import { DeleteResourceSpecAttachmentComponent } from './p_resources/admin/catal
import { AssignResourceSpecRelationshipsComponent } from './p_resources/admin/catalogManagement/edit-resource-spec/assign-resource-spec-relationships/assign-resource-spec-relationships.component';
import { DeleteResourceComponent } from './p_resources/admin/catalogManagement/delete-resource/delete-resource.component';
import { PreviewResourceComponent } from './p_resources/admin/inventoryManagement/preview-resource/preview-resource.component';
import { EditResourceComponent } from './p_resources/admin/inventoryManagement/edit-resource/edit-resource.component';
import { EditResourceRelationshipsComponent } from './p_resources/admin/inventoryManagement/edit-resource/edit-resource-relationships/edit-resource-relationships.component';
import { AssignResourceRelationshipsComponent } from './p_resources/admin/inventoryManagement/edit-resource/assign-resource-relationships/assign-resource-relationships.component';


import { ResourcePoolManagementComponent } from './p_resources/admin/resourcePoolManagement/resource-pool-management/resource-pool-management.component';
import { ListResourcePoolsComponent } from './p_resources/admin/resourcePoolManagement/list-resource-pools/list-resource-pools.component';
import { EditResourcePoolComponent } from './p_resources/admin/resourcePoolManagement/edit-resource-pool/edit-resource-pool.component';
import { DeleteResourcePoolComponent } from './p_resources/admin/resourcePoolManagement/delete-resource-pool/delete-resource-pool.component';
import { ResourceReservationManagementComponent } from './p_resources/admin/resourcePoolManagement/resource-reservation-management/resource-reservation-management.component';
import { EditResourceReservationComponent } from './p_resources/admin/resourcePoolManagement/edit-resource-reservation/edit-resource-reservation.component';

import { FullCalendarModule } from '@fullcalendar/angular';
Expand All @@ -45,6 +39,8 @@ import resourceTimelinePlugin from '@fullcalendar/resource-timeline';


import { ResourceReservationCalendarComponent } from './p_resources/admin/resourcePoolManagement/resource-reservation-calendar/resource-reservation-calendar.component';
import { ListResourceReservationsComponent } from './p_resources/admin/resourcePoolManagement/list-resource-reservations/list-resource-reservations.component';
import { ResourceReservationsCalendarComponent } from './p_resources/admin/resourcePoolManagement/list-resource-reservations/resource-reservations-calendar/resource-reservations-calendar.component';


FullCalendarModule.registerPlugins([ // register FullCalendar plugins
Expand All @@ -69,24 +65,21 @@ FullCalendarModule.registerPlugins([ // register FullCalendar plugins
AssignResourceCandidatesComponent,
EditResourceSpecsComponent,
EditResourceSpecCharacteristicsComponent,
ResourceOsmAddComponent,
DiscardChangesComponent,
ListResourceSpecsComponent,
DeleteResourceSpecComponent,
ListResourceInventoryComponent,
AssignResourceSpecRelationshipsComponent,
DeleteResourceComponent,
PreviewResourceComponent,
EditResourceComponent,
EditResourceRelationshipsComponent,
AssignResourceRelationshipsComponent,
ResourcePoolManagementComponent,
ListResourcePoolsComponent,
EditResourcePoolComponent,
DeleteResourcePoolComponent,
ResourceReservationManagementComponent,
EditResourceReservationComponent,
ResourceReservationCalendarComponent,
AssignPoolResourceRelationshipsComponent
AssignPoolResourceRelationshipsComponent,
ListResourceReservationsComponent,
ResourceReservationsCalendarComponent
],
imports: [
CommonModule,
Expand All @@ -99,7 +92,6 @@ FullCalendarModule.registerPlugins([ // register FullCalendar plugins
DeleteResourceSpecCharacteristicsComponent,
EditResourceCategoriesComponent,
DeleteResourceSpecAttachmentComponent,
ResourceOsmAddComponent,
DiscardChangesComponent,
EditResourceSpecsComponent,
DeleteResourceCategoriesComponent,
Expand All @@ -109,7 +101,6 @@ FullCalendarModule.registerPlugins([ // register FullCalendar plugins
DeleteResourceCatalogsComponent,
DeleteResourceSpecComponent,
AssignResourceSpecRelationshipsComponent,
EditResourceComponent,
EditResourcePoolComponent,
DeleteResourcePoolComponent,
EditResourceReservationComponent,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -295,8 +295,12 @@ class ResourceSpecificationService extends __BaseService {
let __params = this.newParams();
let __headers = new HttpHeaders();
let __body: any = null;
let __formData = new FormData();
__body = __formData;

// EDIT: editing auto-generated services from ng-swagger-gen
if (params.afile != null) { __formData.append('afile', params.afile as string | Blob);}

__body = params.afile;
let req = new HttpRequest<any>(
'POST',
this.rootUrl + `/resourceCatalogManagement/v4/resourceSpecification/${encodeURIComponent(params.id)}/attachment`,
Expand Down Expand Up @@ -512,7 +516,9 @@ module ResourceSpecificationService {
/**
* The Attachment file to be added
*/
afile?: string;

//EDIT: Manually editing auto-generated property
afile: Blob;
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ export class DeleteResourceCatalogsComponent implements OnInit {

confirmDelete() {
this.catalogService.deleteResourceCatalog(this.data.id).subscribe(
data => console.log(data),
data => {},
error => console.error(error),
() => this.dialogRef.close('deleted')
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ export class DeleteResourceSpecComponent implements OnInit {
confirmDelete() {
// this.dialogRef.close('deleted')
this.specService.deleteResourceSpecification(this.data.id).subscribe(
data => console.log(data),
data => {},
error => { this.dialogRef.close(error); console.error(error) },
() => this.dialogRef.close('deleted')
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ export class DeleteResourceComponent implements OnInit {
confirmDelete() {
// this.dialogRef.close('deleted')
this.resourceService.deleteResource(this.data.id).subscribe(
data => console.log(data),
data => {},
error => { this.dialogRef.close(error); console.error(error) },
() => this.dialogRef.close('deleted')
)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
<div class="container">
<h4 mat-dialog-title class="row shadowed mb-3" *ngIf="!newCatalog">
<i class="row far fa-clipboard mr-2"></i>
<i class="far fa-clipboard mr-2"></i>
<span>Edit Resource Catalog</span>
<div class="row card-stats">
Last updated at {{catalog?.lastUpdate | date:'short'}} (Local Time)
</div>
</h4>

<h4 mat-dialog-title class="row shadowed mb-3" *ngIf="newCatalog">
<i class="row far fa-clipboard mr-2"></i>
<i class="far fa-clipboard mr-2"></i>
<span>Create New Resource Catalog</span>
</h4>
<form [formGroup]="editForm">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,6 @@ export class EditResourceCatalogsComponent implements OnInit {
newCatalog: boolean = false

ngOnInit() {
// this.editForm.get('category').valueChanges.subscribe( val => console.log(val))
this.retrieveResourceCategories()

if (this.data)
Expand All @@ -93,8 +92,6 @@ export class EditResourceCatalogsComponent implements OnInit {
this.filteredCategories = this.categoryInputCtrl.valueChanges.pipe(
startWith(null),
map( (category: string | ResourceCategory) => typeof(category) === 'string' ? this._filter(category) : this.nonSelectedRootCategories.slice() ));

// console.log(this.nonSelectedCategories)
}
)
}
Expand Down Expand Up @@ -182,15 +179,15 @@ export class EditResourceCatalogsComponent implements OnInit {

if (this.newCatalog) {
this.catalogService.createResourceCatalog(updateObj).subscribe(
data => console.log(data),
data => {},
error => console.error(error),
() => this.dialogRef.close('created')
)
}

else {
this.catalogService.patchResourceCatalog({id: this.catalogID, body: updateObj}).subscribe(
data => console.log(data),
data => {},
error => console.error(error),
() => this.dialogRef.close('updated')
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,6 @@ export class AssignResourceCandidatesComponent implements OnInit {
candidateInputCtrl = new FormControl()

ngOnInit() {
console.log(this.data)
this.listResourceCandidates()
}

Expand Down Expand Up @@ -89,7 +88,6 @@ export class AssignResourceCandidatesComponent implements OnInit {
}

private _filter(value: string): ResourceCandidate[] {
console.log(value)
const filterValue = value.toLowerCase();
return this.availableCandidates.filter(cat => cat.name && cat.name.toLowerCase().indexOf(filterValue) !== -1);
}
Expand All @@ -99,7 +97,6 @@ export class AssignResourceCandidatesComponent implements OnInit {
}

removeResourceCandidate(spec:ResourceCandidate) {
console.log(spec)
const index = this.assignedCandidates.indexOf(spec);
if (index >= 0) {
this.assignedCandidates.splice(index, 1);
Expand All @@ -113,14 +110,10 @@ export class AssignResourceCandidatesComponent implements OnInit {
}

submitDialog() {
console.log('submit')
console.log(this.assignedCandidates)
const updateCandidatesObj: ResourceCategoryUpdate = { resourceCandidate: this.assignedCandidates.map(cand => {return {id: cand.id, name: cand.name}}) }
console.log(updateCandidatesObj)
console.log(this.resourceCategory.id)
this.categoryService.patchResourceCategory({id: this.resourceCategory.id, resourceCategory: updateCandidatesObj}).subscribe(
data => console.log(data),
error => console.log(error),
data => {},
error => console.error(error),
() => { this.dialogRef.close('updated') }
)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,16 +59,16 @@ export class CreateResourceCategoryChildrenComponent implements OnInit {
let createdChildCategory: ResourceCategory
this.categoryService.createResourceCategory(creationObj).subscribe(
data => {createdChildCategory = data},
error => console.log(error),
error => console.error(error),
() => {
this.parentCategory.category.push({id: createdChildCategory.id})
const updateObj: ResourceCategoryUpdate = {
category: this.parentCategory.category
}

this.categoryService.patchResourceCategory({resourceCategory: updateObj, id: this.parentCategory.id}).subscribe(
data => console.log(data),
error => console.log(error),
data => {},
error => console.error(error),
() => this.dialogRef.close('created')
)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -189,7 +189,6 @@ export class EditResourceCategoriesComponent implements OnInit, OnDestroy {

dialogRef.afterClosed().subscribe (
result => {
console.log(result)
if (result){
this.toast.success("Subcategories list is successfully updated")
this.retrieveResourceCategory()
Expand Down Expand Up @@ -218,7 +217,6 @@ export class EditResourceCategoriesComponent implements OnInit, OnDestroy {

dialogRef.afterClosed().subscribe (
result => {
console.log(result)
if (result) {
this.toast.success("Resource Specifications list is successfully updated")
this.retrieveResourceCategory()
Expand Down Expand Up @@ -251,16 +249,15 @@ export class EditResourceCategoriesComponent implements OnInit, OnDestroy {
validFor: this.editForm.value.validFor,
}

//Εδώ πρέπει να πάρουμε το parentid από το name του parent resource category
//we are taking parentID from the name of parent resource category
if (!this.editForm.get('isRoot').value)
{
// console.log("Received parent id:"+this.editForm.get('parentId').value)
updateObj.parentId = this.editForm.get('parentId').value.id
updateObj.isRoot=false
}

let updatedCategory: ResourceCategory
// console.log("Updated object to be sent "+JSON.stringify(updateObj))

if (this.newCategory) {
this.categoryService.createResourceCategory(updateObj).subscribe(
data => { updatedCategory = data },
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,6 @@ export class AssignResourceSpecRelationshipsComponent implements OnInit {
filteredSpecs$: Observable<ResourceSpecification[]>

ngOnInit() {
console.log(this.data)
this.listResourceSpecs()
}

Expand Down Expand Up @@ -87,7 +86,6 @@ export class AssignResourceSpecRelationshipsComponent implements OnInit {
}

private _filter(value: string): ResourceSpecification[] {
console.log(value)
const filterValue = value.toLowerCase();
return this.nonSelectedSpecs.filter(cat => cat.name.toLowerCase().indexOf(filterValue) !== -1);
}
Expand All @@ -97,7 +95,6 @@ export class AssignResourceSpecRelationshipsComponent implements OnInit {
}

removeResourceSpec(spec:ResourceSpecification) {
console.log(spec)
const index = this.selectedSpecs.indexOf(spec);
if (index >= 0) {
this.selectedSpecs.splice(index, 1);
Expand All @@ -117,9 +114,8 @@ export class AssignResourceSpecRelationshipsComponent implements OnInit {
resourceSpecRelationship: this.selectedSpecs.map(spec =>{ return {id: spec.id, name: spec.name}})
}

console.log(updateRelationshipsObj)
this.specService.patchResourceSpecification({id: this.data.resourceSpec.id, serviceSpecification: updateRelationshipsObj}).subscribe(
data => console.log(data),
data => {},
error => console.error(error),
() => {this.dialogRef.close('updated')}
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,11 +30,8 @@ export class DeleteResourceSpecAttachmentComponent implements OnInit {
attachment: this.data.resourceSpecAttachmentArray
}


console.log(this.data)

this.specService.patchResourceSpecification({ id: this.data.resourceSpec.id, serviceSpecification: updateSpecObj }).subscribe(
data => console.log(data),
data => {},
error => console.error(error),
() => this.dialogRef.close('deleted')
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,12 +29,8 @@ export class DeleteResourceSpecCharacteristicsComponent implements OnInit {
resourceSpecCharacteristic: this.data.resourceSpecCharacteristicArray
}


console.log(updateSpecObj)

console.log(this.data.resourceSpec)
this.specService.patchResourceSpecification({ id: this.data.resourceSpec.id, serviceSpecification: updateSpecObj }).subscribe(
data => console.log(data),
data => {},
error => console.error(error),
() => this.dialogRef.close('deleted')
)
Expand Down
Loading

0 comments on commit c6c7497

Please sign in to comment.