Skip to content

Commit

Permalink
Merge pull request #6085 from deNBI/refacotr/pi_countt_and_faster_app…
Browse files Browse the repository at this point in the history
…lication_loading

Refacotr/pi countt and faster application loading
  • Loading branch information
dweinholz authored Jun 17, 2024
2 parents e0c8b33 + 82a299e commit f7271dd
Show file tree
Hide file tree
Showing 55 changed files with 3,947 additions and 3,812 deletions.
Binary file added .nx/cache/18.3.4-nx.linux-x64-gnu.node
Binary file not shown.
Binary file added .nx/cache/nx_files.nxt
Binary file not shown.
34 changes: 29 additions & 5 deletions src/app/api-connector/applications.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import { Application } from '../applications/application.model/application.model
import { ApplicationLifetimeExtension } from '../applications/application_extension.model';
import { ApplicationModification } from '../applications/application_modification.model';
import { ApplicationCreditRequest } from '../applications/application_credit_request';
import { User } from '../applications/application.model/user.model';

/**
* Service which provides methods for creating application.
Expand Down Expand Up @@ -44,6 +45,29 @@ export class ApplicationsService {
);
}

getApplicationPI(application_id: string | number): Observable<User> {
return this.http.get<User>(`${ApiSettings.getApiBaseURL()}project_applications/${application_id}/pi/`, {
withCredentials: true,
});
}

getApplicationUser(application_id: string | number): Observable<User> {
return this.http.get<User>(`${ApiSettings.getApiBaseURL()}project_applications/${application_id}/user/`, {
withCredentials: true,
});
}

getLifetimeExtensionUser(lifetimeextension_id: string | number): Observable<User> {
return this.http.get<User>(`${ApiSettings.getApiBaseURL()}project_applications/lifetime/extensions/${lifetimeextension_id}/user/`, {
withCredentials: true,
});
}

getModificationUser(project_id: string | number): Observable<User> {
return this.http.get<User>(`${ApiSettings.getApiBaseURL()}project_applications/modifications/${project_id}/user/`, {
withCredentials: true,
});
}
getApplicationValidationByHash(hash: string): Observable<Application> {
return this.http.get<Application>(`${ApiSettings.getApiBaseURL()}project_applications/validation/${hash}/`, {
withCredentials: true,
Expand Down Expand Up @@ -124,11 +148,11 @@ export class ApplicationsService {
}

/**
* Checks if some client has the resource available for an application.
*
* @param app_id
* @returns
*/
* Checks if some client has the resource available for an application.
*
* @param app_id
* @returns
*/
getApplicationClientAvaiable(app_id: string): Observable<any> {
return this.http.get(`${ApiSettings.getApiBaseURL()}project_applications/${app_id}/clients/resource/`, {
withCredentials: true,
Expand Down
2 changes: 1 addition & 1 deletion src/app/api-connector/credits.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import { ResourceWeight, IResourceWeight } from '../credits-calculator/resource-
/**
* Service which delivers functions for services related to the credit service.
*/
@Injectable()
@Injectable({ providedIn: 'root' })
export class CreditsService {
constructor(private http: HttpClient) {
this.http = http;
Expand Down
6 changes: 3 additions & 3 deletions src/app/api-connector/facility.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -683,7 +683,7 @@ export class FacilityService {
* @param application_id
* @returns
*/
declineFacilityApplication(facility: number, application_id: number): Observable<any> {
declineFacilityApplication(facility: string|number, application_id: number|string): Observable<any> {
const params: HttpParams = new HttpParams().set('action', 'decline');

return this.http.post(
Expand Down Expand Up @@ -760,13 +760,13 @@ export class FacilityService {
});
}

approveTerminationByFM(groupId: number | string, facility: number): Observable<object> {
approveTerminationByFM(groupId: number | string, facility: number|string): Observable<object> {
return this.http.delete(`${ApiSettings.getApiBaseURL()}computecenters/${facility}/projects/${groupId}/`, {
withCredentials: true,
});
}

declineTerminationByFM(groupId: number | string, facility: number): Observable<object> {
declineTerminationByFM(groupId: number | string, facility: number|string): Observable<object> {
return this.http.get(`${ApiSettings.getApiBaseURL()}computecenters/${facility}/projects/${groupId}/`, {
withCredentials: true,
});
Expand Down
2 changes: 1 addition & 1 deletion src/app/api-connector/flavor.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import { FlavorType } from '../virtualmachines/virtualmachinemodels/flavorType';
/**
* Service which provides methods for Flavors.
*/
@Injectable()
@Injectable({ providedIn: 'root' })
export class FlavorService {
constructor(private http: HttpClient) {
this.http = http;
Expand Down
2 changes: 1 addition & 1 deletion src/app/api-connector/group.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ export class GroupService {
}
}

assignGroupToResource(groupid: string, computecenter: string): Observable<any> {
assignGroupToResource(groupid: number, computecenter: string): Observable<any> {
const params: HttpParams = new HttpParams().set('compute_center', computecenter);

return this.http.post(`${ApiSettings.getApiBaseURL()}projects/${groupid}/resource/`, params, {
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
<tr>
<td>
<app-application-badges
[application]="application"></app-application-badges>
</td>
<td>{{ application?.project_application_name }}</td>
<td>{{ application?.project_application_shortname }}</td>
<td>{{ application?.project_application_date_submitted }}</td>
<td style="word-wrap: break-word; min-width: 110px; max-width: 130px; white-space: normal">
@if (application?.project_application_user?.username) {
{{ application?.project_application_user?.username }}
} @else {
<span class="spinner-border text-info"></span>

}

</td>
<td>{{ application?.project_application_institute }}</td>

@if (voView) {

<app-application-vo-actions (switchCollapseEvent)="switchCollaps()" class="table-line"
[application]="application"
[tabState]="tabState" [computeCenters]="computeCenters"
(reloadNumbersTrigger)="triggerReloadNumbers()"
(removeApplicationTrigger)="triggerRemoveApplication()"></app-application-vo-actions>
} @else if (facilityView) {
<app-application-facility-actions (switchCollapseEvent)="switchCollaps()" class="table-line"
[application]="application"
[tabState]="tabState"
(reloadNumbersTrigger)="triggerReloadNumbers()"
(removeApplicationTrigger)="triggerRemoveApplication()"></app-application-facility-actions>
}

</tr>
<td colspan="12">
@if (!isCollapsed) {

<app-application-detail
[class.collapse_no_margin]="isCollapsed
"
[class.collapse]="isCollapsed
"
[application]="application"
></app-application-detail>
}
</td>


Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
.table-line {
display: contents;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
import { ComponentFixture, TestBed } from '@angular/core/testing';

import { ApplicationCardComponent } from './application-card.component';

describe('ApplicationCardComponent', () => {
let component: ApplicationCardComponent;
let fixture: ComponentFixture<ApplicationCardComponent>;

beforeEach(async () => {
await TestBed.configureTestingModule({
imports: [ApplicationCardComponent],
}).compileComponents();

fixture = TestBed.createComponent(ApplicationCardComponent);
component = fixture.componentInstance;
fixture.detectChanges();
});

it('should create', () => {
expect(component).toBeTruthy();
});
});
Loading

0 comments on commit f7271dd

Please sign in to comment.