[Trunk|Admin]: Curators edit personal info: On add affiliation transform logoUrl to tinyUrl.

git-svn-id: https://svn.driver.research-infrastructures.eu/driver/dnet40/modules/uoa-admin-portal/trunk@56014 d315682c-612b-4755-9ff5-7f18f6832af3
This commit is contained in:
k.triantafyllou 2019-06-06 10:53:47 +00:00
parent b657c3df29
commit 77b0742079
3 changed files with 23 additions and 11 deletions

View File

@ -9,7 +9,7 @@ import {CuratorService} from '../../openaireLibrary/connect/curators/curator.ser
import {Affiliation, Curator} from '../../openaireLibrary/utils/entities/CuratorInfo';
import {HelperFunctions} from '../../openaireLibrary/utils/HelperFunctions.class';
import {AlertModal} from '../../openaireLibrary/utils/modal/alert';
import {CuratorPhotoService} from '../../openaireLibrary/services/curatorPhoto.service';
import {UtilitiesService} from '../../openaireLibrary/services/utilities.service';
@Component({
selector: 'curator',
@ -40,7 +40,7 @@ export class CuratorComponent implements OnInit {
private route: ActivatedRoute,
private _router: Router,
private curatorService: CuratorService,
private curatorPhotoService: CuratorPhotoService) {
private utilitiesService: UtilitiesService) {
}
@ -223,9 +223,9 @@ export class CuratorComponent implements OnInit {
if (this.hasChanged && this.curator && this.curator.name && this.curator.name !== '') {
this.showLoading = true;
if (this.file) {
this.curatorPhotoService.uploadPhoto(this.properties.uploadService + '/' + this.curator._id, this.file).subscribe((res) => {
this.utilitiesService.uploadPhoto(this.properties.uploadService + '/' + this.curator._id, this.file).subscribe((res) => {
if (this.curator.photo && this.curator.photo !== '') {
this.curatorPhotoService.deletePhoto(this.properties.deleteUrl + '/' + this.curator.photo).subscribe();
this.utilitiesService.deletePhoto(this.properties.deleteUrl + '/' + this.curator.photo).subscribe();
}
this.curator.photo = res.filename;
this.curatorService.updateCurator(this.properties.adminToolsAPIURL + 'curator',
@ -268,12 +268,24 @@ export class CuratorComponent implements OnInit {
addAffiliation() {
if (!this.isEmptyAffiliation()) {
if (this.index === -1) {
this.curator.affiliations.push(this.affiliation);
if(!HelperFunctions.isTiny(this.affiliation.logo_url)) {
this.utilitiesService.getTiny(this.properties.tinyUrl + this.affiliation.logo_url).subscribe((res)=> {
this.affiliation.logo_url = res;
if (this.index === -1) {
this.curator.affiliations.push(this.affiliation);
} else {
this.curator.affiliations[this.index] = this.affiliation;
}
this.change();
})
} else {
this.curator.affiliations[this.index] = this.affiliation;
if (this.index === -1) {
this.curator.affiliations.push(this.affiliation);
} else {
this.curator.affiliations[this.index] = this.affiliation;
}
this.change();
}
this.change();
}
}

View File

@ -10,7 +10,7 @@ import {IsCommunity} from '../../openaireLibrary/connect/communityGuard/isCommun
import {ConnectAdminLoginGuard} from '../../openaireLibrary/connect/communityGuard/connectAdminLoginGuard.guard';
import {CuratorService} from '../../openaireLibrary/connect/curators/curator.service';
import {AlertModalModule} from '../../openaireLibrary/utils/modal/alertModal.module';
import {CuratorPhotoService} from '../../openaireLibrary/services/curatorPhoto.service';
import {UtilitiesService} from '../../openaireLibrary/services/utilities.service';
@NgModule({
imports: [
@ -21,7 +21,7 @@ import {CuratorPhotoService} from '../../openaireLibrary/services/curatorPhoto.s
CuratorComponent
],
providers: [
CuratorService, CuratorPhotoService, IsCommunity, ConnectAdminLoginGuard
CuratorService, UtilitiesService, IsCommunity, ConnectAdminLoginGuard
],
exports: [
CuratorComponent

View File

@ -32,7 +32,7 @@
"uploadService" : "http://mpagasas.di.uoa.gr:8000/upload",
"downloadUrl" : "http://mpagasas.di.uoa.gr:8000/download",
"deleteUrl" : "http://mpagasas.di.uoa.gr:8000/delete",
"tinyUrl": "http://mpagasas.uoa.gr:8000/tiny?url=",
"tinyUrl": "http://mpagasas.di.uoa.gr:8000/tiny?url=",
"vocabulariesAPI" :"https://beta.services.openaire.eu/provision/mvc/vocabularies/",