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 {FormBuilder, FormGroup, Validators} from "@angular/forms";
import {StringUtils} from "../openaireLibrary/utils/string-utils.class";
import {Option} from "../openaireLibrary/sharedComponents/input/input.component";
@Component({
selector: 'admin',
@ -163,8 +164,8 @@ export class AdminComponent implements OnInit, OnDestroy{
api: API;
activeIssuer: string;
issuer: string;
issuers: string[] = [];
availableIssuers: string[] = [];
issuers: Option[] = [];
availableIssuers: Option[] = [];
index: number = -1;
activeIssuerIndex = 0;
copyServicesForm: FormGroup;
@ -185,8 +186,14 @@ export class AdminComponent implements OnInit, OnDestroy{
this.issuer = this.activeIssuer;
this.apis = apisByIssuers[0].apis;
}
this.issuers = apisByIssuers.map(api => api.issuer);
this.availableIssuers = this.issuers.filter(issuer => issuer != this.activeIssuer);
this.issuers = apisByIssuers.map(api => {
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;
}, error => {
this.apis = [];
@ -219,7 +226,7 @@ export class AdminComponent implements OnInit, OnDestroy{
this.subscriptions.push(this.apisService.copyServices(copyServices).subscribe(apis => {
this.apisByIssuers[0].apis = apis;
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;
}, 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>
<icon *ngIf="!api.details" name="warning" class="clickable uk-margin-xsmall-left"
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>
</td>
</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 {
return api?.details?.logoUri?api.details.logoUri:"assets/common-assets/placeholder.png";
}