Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -224,10 +224,10 @@ export class ProfileService implements OnDestroy {
return this.paService.check(profile, headers);
}

createProfile(path: string, type: ProfileType, version: ProfileVersion): Observable<ProfileResponse> {
createProfile(type: ProfileType, version: ProfileVersion): Observable<ProfileResponse> {
const params = new HttpParams().set('type', type).set('version', version);
this.profileType = type;
return this.apiService.get<ProfileResponse>(path, { params });
return this.apiService.get<ProfileResponse>(this.pastisConfig.createProfileByTypeUrl, { params });
}

createProfilePa(profile: Profile) {
Expand Down
10 changes: 7 additions & 3 deletions ui/ui-frontend/projects/pastis/src/app/main/main.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,8 @@ import { ProfileService } from '../core/services/profile.service';
import { SedaService } from '../core/services/seda.service';
import { NgxUiLoaderService } from 'ngx-ui-loader';
import { tap } from 'rxjs/operators';
import { ProfileType } from '../models/profile-type.enum';
import { ProfileVersion } from '../models/profile-version.enum';

@Component({
selector: 'app-home',
Expand Down Expand Up @@ -139,7 +141,9 @@ export class MainComponent implements OnInit, OnDestroy {
// Check for query params to create a new profile
this.route.queryParams.subscribe((queryParams) => {
if (queryParams['type'] && queryParams['version']) {
this.createNewProfile(queryParams['type'], queryParams['version']);
const type: ProfileType = queryParams?.type;
const version: ProfileVersion = queryParams?.version;
this.createNewProfile(type, version);
} else {
// No valid params, redirect to list
this.router.navigate(['/'], { skipLocationChange: false });
Expand Down Expand Up @@ -212,10 +216,10 @@ export class MainComponent implements OnInit, OnDestroy {
});
}

private createNewProfile(profileType: string, profileVersion: string) {
private createNewProfile(profileType: ProfileType, profileVersion: ProfileVersion) {
this.loaderService.start();
this.profileService
.createProfile('/pastis/profile', profileType as any, profileVersion as any)
.createProfile(profileType, profileVersion)
.pipe(
tap((profileResponse) => {
this.uploadedProfileResponse = profileResponse;
Expand Down
Loading