Admin Panel: Convert issuers to Optionp[] and add tooltip class. Add text-break on notification of copy.

This commit is contained in:
Konstantinos Triantafyllou 2023-07-28 12:16:01 +03:00
parent c6cac97814
commit 8f6e9aa282
2 changed files with 13 additions and 10 deletions

View File

@ -5,6 +5,7 @@ import {AlertModal} from "../openaireLibrary/utils/modal/alert";
import {NotificationHandler} from "../openaireLibrary/utils/notification-handler"; import {NotificationHandler} from "../openaireLibrary/utils/notification-handler";
import {FormBuilder, FormGroup, Validators} from "@angular/forms"; import {FormBuilder, FormGroup, Validators} from "@angular/forms";
import {StringUtils} from "../openaireLibrary/utils/string-utils.class"; import {StringUtils} from "../openaireLibrary/utils/string-utils.class";
import {Option} from "../openaireLibrary/sharedComponents/input/input.component";
@Component({ @Component({
selector: 'admin', selector: 'admin',
@ -163,8 +164,8 @@ export class AdminComponent implements OnInit, OnDestroy{
api: API; api: API;
activeIssuer: string; activeIssuer: string;
issuer: string; issuer: string;
issuers: string[] = []; issuers: Option[] = [];
availableIssuers: string[] = []; availableIssuers: Option[] = [];
index: number = -1; index: number = -1;
activeIssuerIndex = 0; activeIssuerIndex = 0;
copyServicesForm: FormGroup; copyServicesForm: FormGroup;
@ -185,8 +186,14 @@ export class AdminComponent implements OnInit, OnDestroy{
this.issuer = this.activeIssuer; this.issuer = this.activeIssuer;
this.apis = apisByIssuers[0].apis; this.apis = apisByIssuers[0].apis;
} }
this.issuers = apisByIssuers.map(api => api.issuer); this.issuers = apisByIssuers.map(api => {
this.availableIssuers = this.issuers.filter(issuer => issuer != this.activeIssuer); return {
label: api.issuer,
value: api.issuer,
tooltip: '<span class="uk-text-break">' + api.issuer + '</span>'
}
});
this.availableIssuers = this.issuers.filter(option => option.value != this.activeIssuer);
this.loading = false; this.loading = false;
}, error => { }, error => {
this.apis = []; this.apis = [];
@ -219,7 +226,7 @@ export class AdminComponent implements OnInit, OnDestroy{
this.subscriptions.push(this.apisService.copyServices(copyServices).subscribe(apis => { this.subscriptions.push(this.apisService.copyServices(copyServices).subscribe(apis => {
this.apisByIssuers[0].apis = apis; this.apisByIssuers[0].apis = apis;
this.changeIssuer(this.activeIssuer); this.changeIssuer(this.activeIssuer);
NotificationHandler.rise('Services has been copied successfully to ' + this.activeIssuer); NotificationHandler.rise('Services has been copied successfully to ' + '<span class="uk-text-break">' + this.activeIssuer + '<span>');
this.loading = false; this.loading = false;
}, error => { }, error => {
console.error(error); console.error(error);

View File

@ -62,7 +62,7 @@ declare var copy;
uk-tooltip="Please click edit to fill the missing information and preview your details."></icon> uk-tooltip="Please click edit to fill the missing information and preview your details."></icon>
<icon *ngIf="!api.details" name="warning" class="clickable uk-margin-xsmall-left" <icon *ngIf="!api.details" name="warning" class="clickable uk-margin-xsmall-left"
customClass="uk-text-warning" customClass="uk-text-warning"
uk-tooltip="This service doesn't exists in our database. Please contact administrator."></icon> uk-tooltip="This service doesn't exist in our database. Please contact administrator."></icon>
</span> </span>
</td> </td>
</tr> </tr>
@ -411,10 +411,6 @@ export class ApisComponent implements OnInit, OnDestroy {
})); }));
} }
jsonPretty(value: any) {
return JSON.stringify(value, null, 2);
}
public getLogoUrl(api: API): string { public getLogoUrl(api: API): string {
return api?.details?.logoUri?api.details.logoUri:"assets/common-assets/placeholder.png"; return api?.details?.logoUri?api.details.logoUri:"assets/common-assets/placeholder.png";
} }