Add missing cdk-editor. Change mandatory fields in apis. Add redirect on personal-info if it is navigated from guard.
This commit is contained in:
parent
ce3b2789f8
commit
4ff41c4a9b
|
@ -23,6 +23,7 @@
|
||||||
"@angular/platform-browser-dynamic": "^14.2.3",
|
"@angular/platform-browser-dynamic": "^14.2.3",
|
||||||
"@angular/material": "^14.2.2",
|
"@angular/material": "^14.2.2",
|
||||||
"@angular/router": "^14.2.3",
|
"@angular/router": "^14.2.3",
|
||||||
|
"ng2-ckeditor": "1.3.7",
|
||||||
"rxjs": "^6.5.1",
|
"rxjs": "^6.5.1",
|
||||||
"jquery": "^3.4.1",
|
"jquery": "^3.4.1",
|
||||||
"tslib": "^2.3.0",
|
"tslib": "^2.3.0",
|
||||||
|
|
|
@ -60,8 +60,7 @@ declare var copy;
|
||||||
customClass="uk-text-secondary" (click)="openInfoModal(i)"></icon>
|
customClass="uk-text-secondary" (click)="openInfoModal(i)"></icon>
|
||||||
<icon *ngIf="api.invalid" name="warning" class="clickable uk-margin-xsmall-left"
|
<icon *ngIf="api.invalid" name="warning" class="clickable uk-margin-xsmall-left"
|
||||||
customClass="uk-text-warning"
|
customClass="uk-text-warning"
|
||||||
uk-tooltip="You have to fill missing information regarding your service in order to preview your details.
|
uk-tooltip="Please click edit to fill the missing information and preview your details."></icon>
|
||||||
Click edit to fill the missing information"></icon>
|
|
||||||
</span>
|
</span>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
|
@ -77,20 +76,20 @@ declare var copy;
|
||||||
[formInput]="form.get('name')"></div>
|
[formInput]="form.get('name')"></div>
|
||||||
<div class="uk-width-1-2@m uk-width-1-1" input type="logoURL" placeholder="Service URL"
|
<div class="uk-width-1-2@m uk-width-1-1" input type="logoURL" placeholder="Service URL"
|
||||||
[formInput]="form.get('url')"></div>
|
[formInput]="form.get('url')"></div>
|
||||||
|
<div class="uk-width-1-1" input type="textarea" placeholder="Service Description"
|
||||||
|
[formInput]="form.get('description')">
|
||||||
|
</div>
|
||||||
|
<div class="uk-width-1-1" input type="chips" placeholder="Target groups"
|
||||||
|
[addExtraChips]="true" [separators]="[',']" [visibleChips]="groups.length"
|
||||||
|
[formInput]="target" [options]="groups" [showOptionsOnEmpty]="false" [hint]="'Add a target group of your service'">
|
||||||
|
<div note>Separate groups with commas</div>
|
||||||
|
</div>
|
||||||
<div class="uk-width-1-2@m uk-width-1-1" input type="logoURL" placeholder="Logo URL"
|
<div class="uk-width-1-2@m uk-width-1-1" input type="logoURL" placeholder="Logo URL"
|
||||||
[formInput]="form.get('logoURL')">
|
[formInput]="form.get('logoURL')">
|
||||||
</div>
|
</div>
|
||||||
<div class="uk-width-1-2@m uk-width-1-1" input type="select" placeholder="Service Frequency of use"
|
<div class="uk-width-1-2@m uk-width-1-1" input type="select" placeholder="Service Frequency of use"
|
||||||
[formInput]="form.get('frequency')" [options]="frequency">
|
[formInput]="form.get('frequency')" [options]="frequency">
|
||||||
</div>
|
</div>
|
||||||
<div class="uk-width-1-1" input type="textarea" placeholder="Service Description"
|
|
||||||
[formInput]="form.get('description')">
|
|
||||||
</div>
|
|
||||||
<div class="uk-width-1-1" input type="chips" placeholder="Target groups"
|
|
||||||
[addExtraChips]="true" [separators]="[',']"
|
|
||||||
[formInput]="target" [options]="groups" [hint]="'Add a target group of your service'">
|
|
||||||
<div note>Separate groups with commas</div>
|
|
||||||
</div>
|
|
||||||
<div class="uk-width-1-1">
|
<div class="uk-width-1-1">
|
||||||
<label class="uk-text-bold">Security Level</label>
|
<label class="uk-text-bold">Security Level</label>
|
||||||
<div id="security-hint" class="uk-margin">Register your service to get a client id and a client
|
<div id="security-hint" class="uk-margin">Register your service to get a client id and a client
|
||||||
|
@ -102,16 +101,17 @@ declare var copy;
|
||||||
<label><input type="radio" name="securityLevel" [disabled]="index !== -1"
|
<label><input type="radio" name="securityLevel" [disabled]="index !== -1"
|
||||||
class="uk-radio" (ngModelChange)="securityChanged($event)"
|
class="uk-radio" (ngModelChange)="securityChanged($event)"
|
||||||
[ngModel]="advanced" [value]="false"><span
|
[ngModel]="advanced" [value]="false"><span
|
||||||
class="uk-margin-small-left">Basic</span></label>
|
class="uk-margin-small-left" [class.uk-text-muted]="index !== -1">Basic</span></label>
|
||||||
</div>
|
</div>
|
||||||
<div>
|
<div>
|
||||||
<label><input type="radio" name="securityLevel" [disabled]="index !== -1"
|
<label><input type="radio" name="securityLevel" [disabled]="index !== -1"
|
||||||
class="uk-radio" (ngModelChange)="securityChanged($event)"
|
class="uk-radio" (ngModelChange)="securityChanged($event)"
|
||||||
[ngModel]="advanced" [value]="true"><span class="uk-margin-small-left">Advanced</span></label>
|
[ngModel]="advanced" [value]="true"><span
|
||||||
|
class="uk-margin-small-left" [class.uk-text-muted]="index !== -1">Advanced</span></label>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<ng-container *ngIf="advanced">
|
<div id="advanced" class="uk-width-1-1" *ngIf="advanced">
|
||||||
<div class="uk-width-1-1">
|
<div class="uk-width-1-1">
|
||||||
<div class="uk-flex uk-flex-between">
|
<div class="uk-flex uk-flex-between">
|
||||||
<label class="uk-text-bold">Public Key</label>
|
<label class="uk-text-bold">Public Key</label>
|
||||||
|
@ -135,7 +135,7 @@ declare var copy;
|
||||||
rows="5" placeholder="Key Value" [hint]="hint"></div>
|
rows="5" placeholder="Key Value" [hint]="hint"></div>
|
||||||
<div *ngIf="!byValue" class="uk-width-1-1" type="logoURL" input [formInput]="form.get('uri')"
|
<div *ngIf="!byValue" class="uk-width-1-1" type="logoURL" input [formInput]="form.get('uri')"
|
||||||
placeholder="Key URI"></div>
|
placeholder="Key URI"></div>
|
||||||
</ng-container>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</modal-alert>
|
</modal-alert>
|
||||||
<modal-alert #deleteModal [overflowBody]="false" (alertOutput)="confirm()"></modal-alert>
|
<modal-alert #deleteModal [overflowBody]="false" (alertOutput)="confirm()"></modal-alert>
|
||||||
|
@ -214,10 +214,10 @@ declare var copy;
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</ng-template>
|
</ng-template>
|
||||||
<li>
|
<li>id="edit-service"
|
||||||
<div class="uk-flex">
|
<div class="uk-flex">
|
||||||
<div class="uk-text-bold uk-width-small uk-margin-xsmall-right">Creation Date</div>
|
<div class="uk-text-bold uk-width-small uk-margin-xsmall-right">Creation Date</div>
|
||||||
<div class="uk-width-expand uk-text-break">{{api.service.creationDate | date: 'dd-mm-YYYY hh:MM'}}</div>
|
<div class="uk-width-expand uk-text-break">{{api.service.creationDate | date: 'dd-MM-YYYY hh:mm'}}</div>
|
||||||
</div>
|
</div>
|
||||||
</li>
|
</li>
|
||||||
</ul>
|
</ul>
|
||||||
|
@ -296,8 +296,8 @@ export class ApisComponent implements OnInit, OnDestroy {
|
||||||
this.form = this.fb.group({
|
this.form = this.fb.group({
|
||||||
name: this.fb.control(api.service.name, Validators.required),
|
name: this.fb.control(api.service.name, Validators.required),
|
||||||
keyType: this.fb.control(api.service.keyType),
|
keyType: this.fb.control(api.service.keyType),
|
||||||
description: this.fb.control(api.service.description),
|
description: this.fb.control(api.service.description, Validators.required),
|
||||||
frequency: this.fb.control(api.service.frequency, Validators.required),
|
frequency: this.fb.control(api.service.frequency),
|
||||||
target: this.fb.array([], Validators.required),
|
target: this.fb.array([], Validators.required),
|
||||||
logoURL: this.fb.control(api.details.logoUri, [StringUtils.urlValidator()]),
|
logoURL: this.fb.control(api.details.logoUri, [StringUtils.urlValidator()]),
|
||||||
url: this.fb.control(api.service.url, [Validators.required, StringUtils.urlValidator()]),
|
url: this.fb.control(api.service.url, [Validators.required, StringUtils.urlValidator()]),
|
||||||
|
@ -383,6 +383,7 @@ export class ApisComponent implements OnInit, OnDestroy {
|
||||||
this.advanced = event;
|
this.advanced = event;
|
||||||
if(this.advanced) {
|
if(this.advanced) {
|
||||||
this.keyTypeChanged(true);
|
this.keyTypeChanged(true);
|
||||||
|
document.getElementById('advanced').scrollIntoView({behavior: 'smooth'});
|
||||||
} else {
|
} else {
|
||||||
this.form.get('keyType').setValue(null);
|
this.form.get('keyType').setValue(null);
|
||||||
}
|
}
|
||||||
|
|
|
@ -1 +1 @@
|
||||||
Subproject commit 55a045433077a4fb866345456694e6490654c89f
|
Subproject commit 2b7c5da3d7049f327f97ac9b274d5d71f6206284
|
|
@ -54,6 +54,7 @@ export class PersonalInfoComponent implements OnInit, OnDestroy {
|
||||||
info: PersonalInfo = null;
|
info: PersonalInfo = null;
|
||||||
affiliationTypeOptions: string[] = ['Organization', 'University', 'SME', 'Public Sector'];
|
affiliationTypeOptions: string[] = ['Organization', 'University', 'SME', 'Public Sector'];
|
||||||
message: boolean = false;
|
message: boolean = false;
|
||||||
|
redirect: string;
|
||||||
|
|
||||||
constructor(private fb: FormBuilder,
|
constructor(private fb: FormBuilder,
|
||||||
private personalService: PersonalService,
|
private personalService: PersonalService,
|
||||||
|
@ -64,6 +65,7 @@ export class PersonalInfoComponent implements OnInit, OnDestroy {
|
||||||
const navigation = this.router.getCurrentNavigation();
|
const navigation = this.router.getCurrentNavigation();
|
||||||
if (navigation && navigation.extras.state) {
|
if (navigation && navigation.extras.state) {
|
||||||
this.message = navigation.extras.state.message;
|
this.message = navigation.extras.state.message;
|
||||||
|
this.redirect = navigation.extras.state.redirect;
|
||||||
} else {
|
} else {
|
||||||
this.message = false;
|
this.message = false;
|
||||||
}
|
}
|
||||||
|
@ -116,6 +118,9 @@ export class PersonalInfoComponent implements OnInit, OnDestroy {
|
||||||
this.initForm();
|
this.initForm();
|
||||||
this.loading = false;
|
this.loading = false;
|
||||||
this.message = false;
|
this.message = false;
|
||||||
|
if(this.redirect) {
|
||||||
|
this.router.navigate([this.redirect]);
|
||||||
|
}
|
||||||
}, error => {
|
}, error => {
|
||||||
console.error(error);
|
console.error(error);
|
||||||
NotificationHandler.rise('An error has occurred. Please try again later.', 'danger');
|
NotificationHandler.rise('An error has occurred. Please try again later.', 'danger');
|
||||||
|
|
|
@ -98,7 +98,7 @@ export class ApisService {
|
||||||
}
|
}
|
||||||
|
|
||||||
private setInvalid(api: API) {
|
private setInvalid(api: API) {
|
||||||
api.invalid = !api.service.url || !api.service.frequency || !api.service.target || api.service.target.length == 0;
|
api.invalid = !api.service.url || !api.service.description || !api.service.target || api.service.target.length == 0;
|
||||||
return api;
|
return api;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -16,7 +16,7 @@ export class HasPersonalInfoGuard implements CanActivate {
|
||||||
canActivate(route: ActivatedRouteSnapshot, state: RouterStateSnapshot): Observable<boolean | UrlTree> | Promise<boolean | UrlTree> | boolean | UrlTree {
|
canActivate(route: ActivatedRouteSnapshot, state: RouterStateSnapshot): Observable<boolean | UrlTree> | Promise<boolean | UrlTree> | boolean | UrlTree {
|
||||||
return this.personalService.getPersonalInfo().pipe(catchError(() => of(null)), map(info => !!info), tap(hasInfo => {
|
return this.personalService.getPersonalInfo().pipe(catchError(() => of(null)), map(info => !!info), tap(hasInfo => {
|
||||||
if(!hasInfo) {
|
if(!hasInfo) {
|
||||||
this.router.navigate(['/personal-info'], {skipLocationChange: true, state: {message: true}});
|
this.router.navigate(['/personal-info'], {skipLocationChange: true, state: {message: true, redirect: state.url}});
|
||||||
}
|
}
|
||||||
}));
|
}));
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue