Skip to content

Commit

Permalink
Feat/tracking (#6095)
Browse files Browse the repository at this point in the history
* fix(Matomo): Adjust tracking code

* feat(Tracking): Adjusted tracking to allow configuration via env and tracking on component level

* removed unnecessary file

* adjustments

* ...

* clean code

* working on adding tracker to all components..

* feat(Tracking): Added tracking to all routed components

* fix(Linting):blacked code

* added env variables to template

---------

Co-authored-by: denbicloud <[email protected]>
Co-authored-by: dweinholz <[email protected]>
  • Loading branch information
3 people authored Jun 21, 2024
1 parent f7271dd commit a0d6d44
Show file tree
Hide file tree
Showing 69 changed files with 3,361 additions and 3,229 deletions.
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
npm-debug.log
testem.log
/typings

/.nx
#test environment
/tests/environment.json
*e2e/environment.json
Expand Down
Binary file not shown.
Binary file modified .nx/cache/nx_files.nxt
Binary file not shown.
1 change: 0 additions & 1 deletion angular.json
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@
]
},
"scripts": [
"src/assets/js/matomo.js"
],
"vendorChunk": true,
"extractLicenses": false,
Expand Down
13 changes: 13 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@
"ngx-bootstrap": "12.0.0",
"ngx-clipboard": "16.0.0",
"ngx-cookie-service": "17.1.0",
"ngx-matomo-client": "6.2.0",
"ngx-owl-carousel-o": "17.0.0",
"ngx-scrollbar": "13.0.3",
"postcss-loader": "8.1.1",
Expand Down
19 changes: 11 additions & 8 deletions src/app/api-connector/applications.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -58,9 +58,12 @@ export class ApplicationsService {
}

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

getModificationUser(project_id: string | number): Observable<User> {
Expand Down Expand Up @@ -148,11 +151,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
49 changes: 31 additions & 18 deletions src/app/api-connector/credits.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,19 +21,29 @@ export class CreditsService {
* @returns The expected credits for the resources.
*/
public getCreditsForApplication(flavors: Flavor[], months: number): Observable<number> {

return this.http.post<number>(`${ApiSettings.getApiBaseURL()}creditManager/getCreditsForApplication/`, { flavors, months }, {
withCredentials: true,
});
return this.http.post<number>(
`${ApiSettings.getApiBaseURL()}creditManager/getCreditsForApplication/`,
{ flavors, months },
{
withCredentials: true,
},
);
}

/**
* Get credits for project application.
*
* @returns The expected credits for the resources.
*/
public getExtraCreditsForExtension(cpus: number, ram: number, months: number, projectApplicationId: string): Observable<number> {
const params: HttpParams = new HttpParams().set('new_cpu', cpus.toString()).set('new_ram', ram.toString())
public getExtraCreditsForExtension(
cpus: number,
ram: number,
months: number,
projectApplicationId: string,
): Observable<number> {
const params: HttpParams = new HttpParams()
.set('new_cpu', cpus.toString())
.set('new_ram', ram.toString())
.set('new_lifetime', months.toString())
.set('project_application_id', projectApplicationId);

Expand All @@ -49,7 +59,8 @@ export class CreditsService {
* @returns The expected credits for the resources.
*/
public getExtraCreditsForLifetimeExtension(months: number, projectApplicationId: string): Observable<number> {
const params: HttpParams = new HttpParams().set('new_lifetime', months.toString())
const params: HttpParams = new HttpParams()
.set('new_lifetime', months.toString())
.set('project_application_id', projectApplicationId);

return this.http.get<number>(`${ApiSettings.getApiBaseURL()}creditManager/getExtraCreditsNumberLifetime/`, {
Expand All @@ -64,7 +75,6 @@ export class CreditsService {
* @returns The expected credits for the resources.
*/
public getExtraCreditsForResourceExtension(flavors: Flavor[], projectApplicationId: string): Observable<number> {

return this.http.post<number>(
`${ApiSettings.getApiBaseURL()}creditManager/getExtraCreditsNumberResource/`,
{ flavors, projectApplicationId },
Expand Down Expand Up @@ -116,7 +126,10 @@ export class CreditsService {
start_timestamp: number,
): Observable<{}> {
const params: {} = {
hours, flavor_pairs, compute_center_name, start_timestamp,
hours,
flavor_pairs,
compute_center_name,
start_timestamp,
};

return this.http.post(`${ApiSettings.getApiBase()}public/credits_calculator/needed/`, params, {
Expand All @@ -131,7 +144,10 @@ export class CreditsService {
start_timestamp: number,
): Observable<{}> {
const params: {} = {
credits, flavor_pairs, compute_center_name, start_timestamp,
credits,
flavor_pairs,
compute_center_name,
start_timestamp,
};

return this.http.post(`${ApiSettings.getApiBase()}public/credits_calculator/time/`, params, {
Expand All @@ -140,13 +156,10 @@ export class CreditsService {
}

public getCreditsWeights(): Observable<ResourceWeight[]> {

return this.http.get<IResourceWeight[]>(`${ApiSettings.getApiBase()}public/creditsweights/`).pipe(
map(
(weights: IResourceWeight[]): ResourceWeight[] => weights.map(
(weight: IResourceWeight): ResourceWeight => new ResourceWeight(weight),
),
),
);
return this.http
.get<IResourceWeight[]>(`${ApiSettings.getApiBase()}public/creditsweights/`)
.pipe(
map((weights: IResourceWeight[]): ResourceWeight[] => weights.map((weight: IResourceWeight): ResourceWeight => new ResourceWeight(weight))),
);
}
}
Loading

0 comments on commit a0d6d44

Please sign in to comment.