Compare commits
58 Commits
master
...
on-push-st
Author | SHA1 | Date |
---|---|---|
Konstantina Galouni | cdfced0dd8 | |
Konstantina Galouni | 2127bfdf16 | |
Konstantinos Triantafyllou | 4231b65880 | |
Konstantinos Triantafyllou | 9b79d0c1e0 | |
Konstantina Galouni | 01f54d788d | |
Konstantina Galouni | ac46ecb997 | |
Konstantina Galouni | 786f4c9864 | |
Konstantina Galouni | c5bd710621 | |
Konstantinos Triantafyllou | 267944103f | |
Konstantina Galouni | aedc2e1f6f | |
Konstantina Galouni | 2cd8059794 | |
Konstantina Galouni | 353ff67ea5 | |
Konstantina Galouni | e74dc1b58f | |
Konstantina Galouni | 22d0498f8a | |
Konstantina Galouni | ce87f0690d | |
argirok | 68125b3577 | |
argirok | 474a73e2f7 | |
argirok | afdf6bf964 | |
Konstantina Galouni | 5f8988eac1 | |
Konstantinos Triantafyllou | 9e9332f1a3 | |
Konstantinos Triantafyllou | a2b1bb8f70 | |
Konstantina Galouni | 559220c77c | |
Konstantina Galouni | 4d80f6f39c | |
Konstantina Galouni | cc43504306 | |
Konstantinos Triantafyllou | b729341199 | |
Konstantina Galouni | eeb63a2de9 | |
Konstantina Galouni | 4b3e805d31 | |
Konstantina Galouni | 1613916dfd | |
Konstantina Galouni | c219c8370b | |
Konstantina Galouni | 6886df2caa | |
Alex Martzios | 9b04260a60 | |
Alex Martzios | 6d9d118d57 | |
Konstantina Galouni | c7817731f0 | |
Konstantina Galouni | 438075f8df | |
Konstantinos Triantafyllou | 8f4e653d50 | |
Alex Martzios | c4180c7aa2 | |
Alex Martzios | 31e61d55a0 | |
argirok | 609f09cc9f | |
argirok | 275b94dec3 | |
Konstantinos Triantafyllou | 4f9f2f2505 | |
Konstantinos Triantafyllou | 0111ea6681 | |
Konstantinos Triantafyllou | c69d1cd94d | |
Konstantinos Triantafyllou | 901f9f769d | |
Konstantinos Triantafyllou | e6d03d324f | |
Konstantinos Triantafyllou | 69cdb2cec2 | |
Konstantinos Triantafyllou | 4f10c5c5f4 | |
Konstantinos Triantafyllou | e91830f2f8 | |
Konstantinos Triantafyllou | 0fb20de588 | |
Konstantinos Triantafyllou | b71bdfa559 | |
Konstantina Galouni | dc1679c565 | |
Konstantinos Triantafyllou | d63092cd9e | |
Konstantina Galouni | c351349f8e | |
Konstantina Galouni | dcfc6b0b6a | |
Konstantina Galouni | 07569f24e1 | |
Konstantina Galouni | 18791ec9d2 | |
Konstantina Galouni | 78d262dd3b | |
argirok | d6b924bcaa | |
argirok | 95097beaae |
|
@ -28,6 +28,7 @@ export class ClaimResult {
|
||||||
|
|
||||||
export class ClaimProject {
|
export class ClaimProject {
|
||||||
public funderId: string;
|
public funderId: string;
|
||||||
|
public funderShortname: string;
|
||||||
public funderName: string;
|
public funderName: string;
|
||||||
public acronym: string;
|
public acronym: string;
|
||||||
public startDate: string;
|
public startDate: string;
|
||||||
|
@ -92,6 +93,7 @@ export class ClaimRecord2Insert {
|
||||||
targetAccessRights: string;
|
targetAccessRights: string;
|
||||||
targetEmbargoEndDate: string;
|
targetEmbargoEndDate: string;
|
||||||
claimedInDashboard: string;
|
claimedInDashboard: string;
|
||||||
|
idSuffix:string;
|
||||||
|
|
||||||
constructor() {
|
constructor() {
|
||||||
|
|
||||||
|
|
|
@ -65,35 +65,36 @@ export class ClaimProjectsSearchFormComponent {
|
||||||
}
|
}
|
||||||
|
|
||||||
search(page,size) {
|
search(page,size) {
|
||||||
if(this.keyword.length == 0){
|
if (this.keyword.length == 0) {
|
||||||
this.showResults =false;
|
this.showResults = false;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
this.showResults =true;
|
this.showResults = true;
|
||||||
this.openaireResults = [];
|
this.openaireResults = [];
|
||||||
this.openaireResultsStatus = this.errorCodes.LOADING;
|
this.openaireResultsStatus = this.errorCodes.LOADING;
|
||||||
this.prevFilters = this.filters;
|
this.prevFilters = this.filters;
|
||||||
|
|
||||||
//searchProjects (params: string, refineParams:string, page: number, size: number, refineFields:string[] , properties:EnvProperties ):any {
|
//searchProjects (params: string, refineParams:string, page: number, size: number, refineFields:string[] , properties:EnvProperties ):any {
|
||||||
this.sub = this._projectService.searchProjects(this.createOpenaireQueryParams(),(page==1)? this.refineFieldsQuery:null, page, size, (page==1)?this.refineFields:[], this.properties).subscribe(
|
this.sub = this._projectService.advancedSearchProjects(this.createOpenaireQueryParams(), page, size, this.properties, (page == 1) ? this.refineFieldsQuery : null, (page == 1) ? this.refineFields : [], this.createOpenaireRefineQuery()).subscribe(
|
||||||
|
// this.sub = this._projectService.searchProjects(this.createOpenaireQueryParams(),(page==1)? this.refineFieldsQuery:null, page, size, (page==1)?this.refineFields:[], this.properties).subscribe(
|
||||||
data => {
|
data => {
|
||||||
if(data != null) {
|
if (data != null) {
|
||||||
this.openaireResultsPage=page;
|
this.openaireResultsPage = page;
|
||||||
this.openaireResultsNum = data[0];
|
this.openaireResultsNum = data[0];
|
||||||
this.openaireResults =ClaimProjectsSearchFormComponent.openaire2ClaimEntity(data[1], this.properties);
|
this.openaireResults = ClaimProjectsSearchFormComponent.openaire2ClaimEntity(data[1], this.properties);
|
||||||
if(data[2] && data[2].length > 0){
|
if (data[2] && data[2].length > 0) {
|
||||||
this.filters = this.checkSelectedFilters( data[2], this.prevFilters);
|
this.filters = this.checkSelectedFilters(data[2], this.prevFilters);
|
||||||
}
|
|
||||||
|
|
||||||
this.openaireResultsStatus = this.errorCodes.DONE;
|
|
||||||
if(this.openaireResultsNum == 0){
|
|
||||||
this.openaireResultsStatus = this.errorCodes.NONE;
|
|
||||||
this.filters = this.checkSelectedFilters( [], this.prevFilters);
|
|
||||||
}
|
|
||||||
}else {
|
|
||||||
this.openaireResultsStatus = this.errorCodes.ERROR;
|
|
||||||
}
|
}
|
||||||
},
|
|
||||||
|
this.openaireResultsStatus = this.errorCodes.DONE;
|
||||||
|
if (this.openaireResultsNum == 0) {
|
||||||
|
this.openaireResultsStatus = this.errorCodes.NONE;
|
||||||
|
this.filters = this.checkSelectedFilters([], this.prevFilters);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
this.openaireResultsStatus = this.errorCodes.ERROR;
|
||||||
|
}
|
||||||
|
},
|
||||||
err => {
|
err => {
|
||||||
this.openaireResultsStatus = this.errorCodes.ERROR;
|
this.openaireResultsStatus = this.errorCodes.ERROR;
|
||||||
//console.log(err.status);
|
//console.log(err.status);
|
||||||
|
@ -177,9 +178,10 @@ export class ClaimProjectsSearchFormComponent {
|
||||||
const entity: ClaimEntity = new ClaimEntity();
|
const entity: ClaimEntity = new ClaimEntity();
|
||||||
entity.project = new ClaimProject();
|
entity.project = new ClaimProject();
|
||||||
entity.project.funderId = item.funderId;
|
entity.project.funderId = item.funderId;
|
||||||
entity.project.funderName = item.funderShortname;
|
entity.project.funderShortname = item.funderShortname?item.funderShortname:(entity.project.funderId.split("::")[1]);
|
||||||
|
entity.project.funderName = item.funderName;
|
||||||
entity.id = item.id;
|
entity.id = item.id;
|
||||||
entity.project.url = properties.searchLinkToProject + entity.id;
|
entity.project.url = (item.code !="unidentified") ? properties.searchLinkToProject + entity.id : null;
|
||||||
entity.title = item.title.name;
|
entity.title = item.title.name;
|
||||||
entity.project.acronym = item.acronym;
|
entity.project.acronym = item.acronym;
|
||||||
entity.project.startDate = item.startYear;
|
entity.project.startDate = item.startYear;
|
||||||
|
@ -202,12 +204,16 @@ export class ClaimProjectsSearchFormComponent {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
createOpenaireQueryParams():string {
|
createOpenaireQueryParams(): string {
|
||||||
let query = "";
|
let query = "";
|
||||||
if(this.keyword.length > 0){
|
if (this.keyword.length > 0) {
|
||||||
query += "q=" + StringUtils.quote(StringUtils.URIEncode(this.keyword));
|
// query += "q=" + StringUtils.quote(StringUtils.URIEncode(this.keyword));
|
||||||
|
query += StringUtils.quote(StringUtils.URIEncode(this.keyword));
|
||||||
}
|
}
|
||||||
|
return query;
|
||||||
|
}
|
||||||
|
|
||||||
|
createOpenaireRefineQuery(): string {
|
||||||
/*if(this.startYear.length > 0 ){
|
/*if(this.startYear.length > 0 ){
|
||||||
query+='&fq=projectstartyear exact \"'+this.startYear+'\"'
|
query+='&fq=projectstartyear exact \"'+this.startYear+'\"'
|
||||||
}
|
}
|
||||||
|
@ -215,30 +221,30 @@ export class ClaimProjectsSearchFormComponent {
|
||||||
query+='&fq=projectendyear exact \"'+this.endYear+'\"'
|
query+='&fq=projectendyear exact \"'+this.endYear+'\"'
|
||||||
}*/
|
}*/
|
||||||
let allFqs = "";
|
let allFqs = "";
|
||||||
for (let filter of this.filters){
|
for (let filter of this.filters) {
|
||||||
if(filter.countSelectedValues > 0){
|
if (filter.countSelectedValues > 0) {
|
||||||
let count_selected=0;
|
let count_selected = 0;
|
||||||
let fq = "";
|
let fq = "";
|
||||||
for (let value of filter.values){
|
for (let value of filter.values) {
|
||||||
if(value.selected == true){
|
if (value.selected == true) {
|
||||||
count_selected++;
|
count_selected++;
|
||||||
fq+=(fq.length > 0 ? " " + filter.filterOperator + " ":"" ) + filter.filterId + " exact " + (StringUtils.quote(value.id));
|
fq += (fq.length > 0 ? " " + filter.filterOperator + " " : "") + filter.filterId + " exact " + (StringUtils.quote(value.id));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if(count_selected > 0){
|
if (count_selected > 0) {
|
||||||
fq="&fq="+StringUtils.URIEncode(fq);
|
fq = "&fq=" + StringUtils.URIEncode(fq);
|
||||||
allFqs += fq;
|
allFqs += fq;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
for (let i=0; i<this.rangeFilters.length; i++){
|
for (let i = 0; i < this.rangeFilters.length; i++) {
|
||||||
let filter = this.rangeFilters[i];
|
let filter = this.rangeFilters[i];
|
||||||
//selectedFromValue, selectedToValue, equalityOp, equalityOpFrom, equalityOpTo, filterOp ){
|
//selectedFromValue, selectedToValue, equalityOp, equalityOpFrom, equalityOpTo, filterOp ){
|
||||||
allFqs+= NewSearchPageComponent.createRangeFilterQuery(this.rangeFields[i],filter.selectedFromValue, filter.selectedToValue, " within ", ">=" ,"<=", "and" )
|
allFqs += NewSearchPageComponent.createRangeFilterQuery(this.rangeFields[i], filter.selectedFromValue, filter.selectedToValue, " within ", ">=", "<=", "and")
|
||||||
}
|
}
|
||||||
return query+allFqs;
|
return allFqs + "&type=projects";
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public yearChanged() {
|
public yearChanged() {
|
||||||
this.search(this.page, this.size);
|
this.search(this.page, this.size);
|
||||||
|
|
||||||
|
@ -273,20 +279,21 @@ export class ClaimProjectsSearchFormComponent {
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
filter.countAllValues = filter.values.length;
|
||||||
}
|
}
|
||||||
if(filters.length == 0 ){
|
if(filters.length == 0 ){
|
||||||
for(let j=0; j< prevFilters.length ; j++){
|
for(let j=0; j< prevFilters.length ; j++) {
|
||||||
let filter = Object.assign({}, prevFilters[j]);
|
let filter = Object.assign({}, prevFilters[j]);
|
||||||
filter.values = [];
|
filter.values = [];
|
||||||
for(let filterValue of prevFilters[j].values) {
|
for (let filterValue of prevFilters[j].values) {
|
||||||
if(filterValue.selected){
|
if (filterValue.selected) {
|
||||||
filterValue.number = 0;
|
filterValue.number = 0;
|
||||||
filter.values.push(filterValue);
|
filter.values.push(filterValue);
|
||||||
}
|
|
||||||
}
|
|
||||||
filters.push(filter)
|
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
filter.countAllValues = filter.values.length;
|
||||||
|
filters.push(filter)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return filters;
|
return filters;
|
||||||
}
|
}
|
||||||
|
|
|
@ -364,7 +364,7 @@ export class DisplayClaimsComponent implements OnInit, OnDestroy {
|
||||||
if (claimDateStr < lastUpdateDateStr) {
|
if (claimDateStr < lastUpdateDateStr) {
|
||||||
return true;
|
return true;
|
||||||
} else {
|
} else {
|
||||||
return claim.target.collectedFrom != "infrastruct_::openaire" && claim.indexed;
|
return claim.target.collectedFrom != "infrastruct_::openaire";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -58,22 +58,20 @@ export class SearchDataciteService {
|
||||||
entity.result.journal = null;
|
entity.result.journal = null;
|
||||||
entity.result.DOI = item.attributes.doi;
|
entity.result.DOI = item.attributes.doi;
|
||||||
entity.id = item.attributes.doi;
|
entity.id = item.attributes.doi;
|
||||||
entity.title = item.attributes.title;
|
entity.title = Array.isArray(item.attributes.titles) && item.attributes.titles[0].title?item.attributes.titles[0].title:null;
|
||||||
entity.result.url = properties.doiURL + item.attributes.doi;
|
entity.result.url = properties.doiURL + item.attributes.doi;
|
||||||
entity.result.source = 'datacite';
|
entity.result.source = 'datacite';
|
||||||
entity.type = 'dataset';
|
entity.type = 'dataset';
|
||||||
entity.result.date = item.attributes.published;
|
entity.result.date = item.attributes.publicationYear;
|
||||||
entity.result.accessRights = "OPEN";
|
entity.result.accessRights = "OPEN";
|
||||||
entity.result.publisher = item.attributes['container-title'];
|
entity.result.publisher = item.attributes['publisher'];
|
||||||
entity.result.journal = null;
|
entity.result.journal = null;
|
||||||
entity.result.record = item;
|
entity.result.record = item;
|
||||||
if (item.attributes.author) {
|
if (item.attributes.creators) {
|
||||||
entity.result.authors = [];
|
entity.result.authors = [];
|
||||||
for (let j = 0; j < item.attributes.author.length; j++) {
|
for (let j = 0; j < item.attributes.creators.length; j++) {
|
||||||
const author = item.attributes.author[j];
|
const author = item.attributes.creators[j].name;
|
||||||
if(author.family || author.literal) {
|
entity.result.authors.push(author);
|
||||||
entity.result.authors.push((author.family) ? author.family + (author.given ? ', ' + author.given : '') : author.literal);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
results.push(entity);
|
results.push(entity);
|
||||||
|
|
|
@ -156,6 +156,7 @@ export class DirectLinkingComponent {
|
||||||
entity.project.code = project.code;
|
entity.project.code = project.code;
|
||||||
entity.project.endDate = project.endDate;
|
entity.project.endDate = project.endDate;
|
||||||
entity.project.funderId = project.funderId;
|
entity.project.funderId = project.funderId;
|
||||||
|
entity.project.funderShortname = project.funderShortName?project.funderShortName:(entity.project.funderId.split("::")[1]);
|
||||||
entity.project.funderName = project.funderName;
|
entity.project.funderName = project.funderName;
|
||||||
entity.project.fundingLevel0 = project.fundingLevel0;
|
entity.project.fundingLevel0 = project.fundingLevel0;
|
||||||
entity.project.jurisdiction = project.jurisdiction;
|
entity.project.jurisdiction = project.jurisdiction;
|
||||||
|
|
|
@ -156,13 +156,14 @@ export class ClaimInsertComponent {
|
||||||
this.loading.open();
|
this.loading.open();
|
||||||
let claims: ClaimRecord2Insert[] = [];
|
let claims: ClaimRecord2Insert[] = [];
|
||||||
let directclaims: DirectIndexRecord[] = [];
|
let directclaims: DirectIndexRecord[] = [];
|
||||||
|
let idSuffix = (new Date()).getTime() + "";
|
||||||
let dashboard = this.properties.environment+"_"+this.properties.dashboard + (this.communityId?("_"+this.communityId):'');
|
let dashboard = this.properties.environment+"_"+this.properties.dashboard + (this.communityId?("_"+this.communityId):'');
|
||||||
for (let j = 0; j < this.sources.length; j++) { // if an external result -> direct insert in the index
|
for (let j = 0; j < this.sources.length; j++) { // if an external result -> direct insert in the index
|
||||||
const result: ClaimEntity = this.sources[j];
|
const result: ClaimEntity = this.sources[j];
|
||||||
if (result.result && ["crossref", "datacite", "orcid"].indexOf(result.result.source) != -1) {
|
if (result.result && ["crossref", "datacite", "orcid"].indexOf(result.result.source) != -1) {
|
||||||
directclaims.push({
|
directclaims.push({
|
||||||
"id": result.id,
|
"id": result.id,
|
||||||
"record": ClaimInsertComponent.createDirectClaim(result, this.results)
|
"record": ClaimInsertComponent.createDirectClaim(result, this.results, idSuffix)
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -173,12 +174,12 @@ export class ClaimInsertComponent {
|
||||||
if (this.sources.length > 0) {
|
if (this.sources.length > 0) {
|
||||||
directclaims.push({
|
directclaims.push({
|
||||||
"id": entity.id,
|
"id": entity.id,
|
||||||
"record": ClaimInsertComponent.createDirectClaim(entity, this.sources)
|
"record": ClaimInsertComponent.createDirectClaim(entity, this.sources, idSuffix)
|
||||||
});
|
});
|
||||||
} else if (this.inlineEntity) {
|
} else if (this.inlineEntity) {
|
||||||
directclaims.push({
|
directclaims.push({
|
||||||
"id": entity.id,
|
"id": entity.id,
|
||||||
"record": ClaimInsertComponent.createDirectClaim(entity, [this.inlineEntity])
|
"record": ClaimInsertComponent.createDirectClaim(entity, [this.inlineEntity], idSuffix)
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -187,11 +188,11 @@ export class ClaimInsertComponent {
|
||||||
for (let j = 0; j < this.sources.length; j++) {
|
for (let j = 0; j < this.sources.length; j++) {
|
||||||
const result: ClaimEntity = this.sources[j]; // this is a research result
|
const result: ClaimEntity = this.sources[j]; // this is a research result
|
||||||
if (entity.result) {
|
if (entity.result) {
|
||||||
claims.push(ClaimInsertComponent.createResultClaim(result, entity, user.email, dashboard));
|
claims.push(ClaimInsertComponent.createResultClaim(result, entity, user.email, dashboard, idSuffix));
|
||||||
} else if (entity.context) {
|
} else if (entity.context) {
|
||||||
claims.push(ClaimInsertComponent.createContextClaim(result, entity, user.email, dashboard));
|
claims.push(ClaimInsertComponent.createContextClaim(result, entity, user.email, dashboard, idSuffix));
|
||||||
} else if (entity.project) {
|
} else if (entity.project) {
|
||||||
claims.push(ClaimInsertComponent.createProjectClaim(result, entity, user.email, dashboard));
|
claims.push(ClaimInsertComponent.createProjectClaim(result, entity, user.email, dashboard, idSuffix));
|
||||||
}
|
}
|
||||||
this.infoToLog.push([ result.title?result.title: result.id, entity.title?entity.title:entity.id]);
|
this.infoToLog.push([ result.title?result.title: result.id, entity.title?entity.title:entity.id]);
|
||||||
|
|
||||||
|
@ -201,15 +202,15 @@ export class ClaimInsertComponent {
|
||||||
if (this.inlineEntity.result) {
|
if (this.inlineEntity.result) {
|
||||||
if (entity.result) {
|
if (entity.result) {
|
||||||
|
|
||||||
claims.push(ClaimInsertComponent.createResultClaim(this.inlineEntity, entity, user.email, dashboard));
|
claims.push(ClaimInsertComponent.createResultClaim(this.inlineEntity, entity, user.email, dashboard, idSuffix));
|
||||||
} else if (entity.context) {
|
} else if (entity.context) {
|
||||||
claims.push(ClaimInsertComponent.createContextClaim(this.inlineEntity, entity, user.email, dashboard));
|
claims.push(ClaimInsertComponent.createContextClaim(this.inlineEntity, entity, user.email, dashboard, idSuffix));
|
||||||
} else if (entity.project) {
|
} else if (entity.project) {
|
||||||
claims.push(ClaimInsertComponent.createProjectClaim(this.inlineEntity, entity, user.email, dashboard));
|
claims.push(ClaimInsertComponent.createProjectClaim(this.inlineEntity, entity, user.email, dashboard, idSuffix));
|
||||||
}
|
}
|
||||||
} else if (this.inlineEntity.project) {
|
} else if (this.inlineEntity.project) {
|
||||||
if (entity.result) {
|
if (entity.result) {
|
||||||
claims.push(ClaimInsertComponent.createProjectClaim(entity, this.inlineEntity, user.email, dashboard));
|
claims.push(ClaimInsertComponent.createProjectClaim(entity, this.inlineEntity, user.email, dashboard, idSuffix));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -390,7 +391,7 @@ export class ClaimInsertComponent {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
private static createContextClaim(resultEntity: ClaimEntity, contextEntity: ClaimEntity, user: any, dashboard:string): ClaimRecord2Insert {
|
private static createContextClaim(resultEntity: ClaimEntity, contextEntity: ClaimEntity, user: any, dashboard:string, idSuffix:string): ClaimRecord2Insert {
|
||||||
return {
|
return {
|
||||||
claimedBy: user,
|
claimedBy: user,
|
||||||
sourceId: contextEntity.context.concept.id,
|
sourceId: contextEntity.context.concept.id,
|
||||||
|
@ -403,11 +404,12 @@ export class ClaimInsertComponent {
|
||||||
targetCollectedFrom: resultEntity.result.source,
|
targetCollectedFrom: resultEntity.result.source,
|
||||||
targetAccessRights: resultEntity.result.accessRights,
|
targetAccessRights: resultEntity.result.accessRights,
|
||||||
targetEmbargoEndDate: ClaimInsertComponent.getEmbargoEndDate(resultEntity),
|
targetEmbargoEndDate: ClaimInsertComponent.getEmbargoEndDate(resultEntity),
|
||||||
claimedInDashboard : dashboard
|
claimedInDashboard : dashboard,
|
||||||
|
idSuffix : idSuffix
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
private static createProjectClaim(resultEntity: ClaimEntity, projectEntity: ClaimEntity, user: any, dashboard:string): ClaimRecord2Insert {
|
private static createProjectClaim(resultEntity: ClaimEntity, projectEntity: ClaimEntity, user: any, dashboard:string, idSuffix:string): ClaimRecord2Insert {
|
||||||
return {
|
return {
|
||||||
claimedBy: user,
|
claimedBy: user,
|
||||||
sourceId: projectEntity.id,
|
sourceId: projectEntity.id,
|
||||||
|
@ -420,11 +422,12 @@ export class ClaimInsertComponent {
|
||||||
targetCollectedFrom: resultEntity.result.source,
|
targetCollectedFrom: resultEntity.result.source,
|
||||||
targetAccessRights: resultEntity.result.accessRights,
|
targetAccessRights: resultEntity.result.accessRights,
|
||||||
targetEmbargoEndDate: ClaimInsertComponent.getEmbargoEndDate(resultEntity),
|
targetEmbargoEndDate: ClaimInsertComponent.getEmbargoEndDate(resultEntity),
|
||||||
claimedInDashboard : dashboard
|
claimedInDashboard : dashboard,
|
||||||
|
idSuffix : idSuffix
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
private static createResultClaim(inlineResult: ClaimEntity, resultEntity: ClaimEntity, user: string, dashboard:string): ClaimRecord2Insert {
|
private static createResultClaim(inlineResult: ClaimEntity, resultEntity: ClaimEntity, user: string, dashboard:string, idSuffix:string): ClaimRecord2Insert {
|
||||||
|
|
||||||
return {
|
return {
|
||||||
claimedBy: user,
|
claimedBy: user,
|
||||||
|
@ -438,7 +441,9 @@ export class ClaimInsertComponent {
|
||||||
targetCollectedFrom: inlineResult.result.source,
|
targetCollectedFrom: inlineResult.result.source,
|
||||||
targetAccessRights: inlineResult.result.accessRights,
|
targetAccessRights: inlineResult.result.accessRights,
|
||||||
targetEmbargoEndDate: ClaimInsertComponent.getEmbargoEndDate(inlineResult),
|
targetEmbargoEndDate: ClaimInsertComponent.getEmbargoEndDate(inlineResult),
|
||||||
claimedInDashboard : dashboard
|
claimedInDashboard : dashboard,
|
||||||
|
idSuffix : idSuffix
|
||||||
|
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -448,12 +453,13 @@ export class ClaimInsertComponent {
|
||||||
}
|
}
|
||||||
return ""
|
return ""
|
||||||
}
|
}
|
||||||
|
static createOpenAIREId(id, idSuffix:string):string {
|
||||||
static createDirectClaim(resultEntity: ClaimEntity, results: ClaimEntity[]) {
|
return id.indexOf( "::" ) == -1 ? ("userclaim___::" + Md5.hashStr(id + idSuffix)):id;
|
||||||
|
}
|
||||||
|
static createDirectClaim(resultEntity: ClaimEntity, results: ClaimEntity[], idSuffix:string) {
|
||||||
let entity = {};
|
let entity = {};
|
||||||
const md5_id = Md5.hashStr(resultEntity.id);
|
entity["originalId"] = this.createOpenAIREId(resultEntity.id, idSuffix);
|
||||||
entity["originalId"] = "userclaim___::" + md5_id;
|
entity["openaireId"] = this.createOpenAIREId(resultEntity.id, idSuffix);
|
||||||
entity["openaireId"] = "userclaim___::" + md5_id;
|
|
||||||
entity["title"] = resultEntity.title;
|
entity["title"] = resultEntity.title;
|
||||||
entity["title"] = (Array.isArray(resultEntity.title) && resultEntity.title.length > 0) ? resultEntity.title[0] : resultEntity.title;
|
entity["title"] = (Array.isArray(resultEntity.title) && resultEntity.title.length > 0) ? resultEntity.title[0] : resultEntity.title;
|
||||||
|
|
||||||
|
@ -502,7 +508,7 @@ export class ClaimInsertComponent {
|
||||||
entity["linksToProjects"] = [];
|
entity["linksToProjects"] = [];
|
||||||
}
|
}
|
||||||
let project: ClaimEntity = results[i];
|
let project: ClaimEntity = results[i];
|
||||||
entity["linksToProjects"].push("info:eu-repo/grantAgreement/" + project.project.funderName + "/" + project.project.fundingLevel0 + "/" + project.project.code + "/" + project.project.jurisdiction + "/" + project.title + "/" + project.project.acronym);
|
entity["linksToProjects"].push("info:eu-repo/grantAgreement/" + project.project.funderShortname + "/" + project.project.fundingLevel0 + "/" + project.project.code + "/" + project.project.jurisdiction + "/" + project.title + "/" + project.project.acronym);
|
||||||
|
|
||||||
} else if (results[i].context) {
|
} else if (results[i].context) {
|
||||||
|
|
||||||
|
|
|
@ -16,10 +16,10 @@ import {ClaimEntity} from '../../claim-utils/claimHelper.class';
|
||||||
</div>
|
</div>
|
||||||
<div class="uk-text-small uk-flex uk-flex-wrap" [style.grid-gap]="shortVersion?'10px':'20px'"
|
<div class="uk-text-small uk-flex uk-flex-wrap" [style.grid-gap]="shortVersion?'10px':'20px'"
|
||||||
[class.uk-margin-small-top]="!shortVersion">
|
[class.uk-margin-small-top]="!shortVersion">
|
||||||
<div *ngIf="entity.project.funderName">
|
<div *ngIf="entity.project.funderName || entity.project.funderShortname">
|
||||||
<span class="uk-text-meta">Funder: </span>{{entity.project.funderName}}
|
<span class="uk-text-meta">Funder: </span>{{entity.project.funderName?entity.project.funderName:entity.project.funderShortname}}
|
||||||
</div>
|
</div>
|
||||||
<div *ngIf="entity.project.code">
|
<div *ngIf="entity.project.code && entity.project.code!='unidentified'">
|
||||||
<span class="uk-text-meta">Project Code: </span>{{entity.project.code}}
|
<span class="uk-text-meta">Project Code: </span>{{entity.project.code}}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -372,10 +372,8 @@ export class MenuComponent implements OnInit {
|
||||||
}
|
}
|
||||||
|
|
||||||
public valueChange() {
|
public valueChange() {
|
||||||
this.elements.disable();
|
|
||||||
this.cdr.detectChanges();
|
this.cdr.detectChanges();
|
||||||
this.elements.init();
|
this.elements.init();
|
||||||
this.elements.enable();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public get displayMenuItems() {
|
public get displayMenuItems() {
|
||||||
|
|
|
@ -8,26 +8,26 @@
|
||||||
<div class="uk-flex uk-flex-left@m uk-flex-center uk-width-expand">
|
<div class="uk-flex uk-flex-left@m uk-flex-center uk-width-expand">
|
||||||
<ul class="uk-subnav uk-subnav-pill">
|
<ul class="uk-subnav uk-subnav-pill">
|
||||||
<li [class.uk-active]="showCurrent" (click)="showCurrent = true">
|
<li [class.uk-active]="showCurrent" (click)="showCurrent = true">
|
||||||
<a class="uk-text-capitalize">{{role}}s</a>
|
<a class="uk-text-capitalize">{{stakeholderUtils.roles[role]}}s</a>
|
||||||
</li>
|
</li>
|
||||||
<li [class.uk-active]="!showCurrent" (click)="showCurrent = false">
|
<li [class.uk-active]="!showCurrent" (click)="showCurrent = false">
|
||||||
<a>Pending {{role}}s</a>
|
<a>Pending {{stakeholderUtils.roles[role]}}s</a>
|
||||||
</li>
|
</li>
|
||||||
</ul>
|
</ul>
|
||||||
</div>
|
</div>
|
||||||
<div class="uk-width-expand@m uk-width-1-1 uk-grid uk-flex-right@m uk-flex-center uk-flex-middle" uk-grid>
|
<div class="uk-width-expand@m uk-width-1-1 uk-grid uk-flex-right@m uk-flex-center uk-flex-middle" uk-grid>
|
||||||
<div *ngIf="showCurrent" [disabled]="loadActive" search-input class="uk-width-expand@l uk-width-1-1"
|
<div *ngIf="showCurrent" [disabled]="loadActive" search-input class="uk-width-expand@l uk-width-1-1"
|
||||||
[searchControl]="filterForm.get('active')" [expandable]="true" [placeholder]="'Search ' + role + 's'" searchInputClass="outer">
|
[searchControl]="filterForm.get('active')" [expandable]="true" [placeholder]="'Search ' + stakeholderUtils.roles[role] + 's'" searchInputClass="outer">
|
||||||
</div>
|
</div>
|
||||||
<div *ngIf="!showCurrent" [disabled]="loadPending" search-input class="uk-width-expand@l uk-width-1-1"
|
<div *ngIf="!showCurrent" [disabled]="loadPending" search-input class="uk-width-expand@l uk-width-1-1"
|
||||||
[searchControl]="filterForm.get('pending')" [expandable]="true" [placeholder]="'Search invitations'" searchInputClass="outer">
|
[searchControl]="filterForm.get('pending')" [expandable]="true" [placeholder]="'Search invitations'" searchInputClass="outer">
|
||||||
</div>
|
</div>
|
||||||
<div>
|
<div>
|
||||||
<button *ngIf="exists" class="uk-button uk-button-default uk-flex uk-flex-middle"
|
<button *ngIf="canInvite" class="uk-button uk-button-default uk-flex uk-flex-middle"
|
||||||
[attr.uk-tooltip]="inviteDisableMessage" [class.uk-disabled]="loadPending || loadPending"
|
[attr.uk-tooltip]="inviteDisableMessage" [class.uk-disabled]="loadPending || loadPending"
|
||||||
[disabled]="loadActive || loadPending || !!inviteDisableMessage" (click)="openInviteModal()">
|
[disabled]="loadActive || loadPending || !!inviteDisableMessage" (click)="openInviteModal()">
|
||||||
<icon name="person_add" [flex]="true" type="filled"></icon>
|
<icon name="person_add" [flex]="true" type="filled"></icon>
|
||||||
<span class="uk-margin-small-left uk-text-bold uk-text-uppercase">Invite {{role}}</span>
|
<span class="uk-margin-small-left uk-text-bold uk-text-uppercase">Invite {{stakeholderUtils.roles[role]}}</span>
|
||||||
</button>
|
</button>
|
||||||
<button *ngIf="!exists && isCurator" class="uk-button uk-button-default uk-flex uk-flex-middle"
|
<button *ngIf="!exists && isCurator" class="uk-button uk-button-default uk-flex uk-flex-middle"
|
||||||
(click)="openCreateRoleModal()">
|
(click)="openCreateRoleModal()">
|
||||||
|
@ -47,16 +47,16 @@
|
||||||
<div *ngIf="!loadActive && !loadPending">
|
<div *ngIf="!loadActive && !loadPending">
|
||||||
<div *ngIf="(showCurrent && showActive.length == 0) || (!showCurrent && showPending.length == 0)"
|
<div *ngIf="(showCurrent && showActive.length == 0) || (!showCurrent && showPending.length == 0)"
|
||||||
class="uk-card uk-card-default uk-padding-large uk-text-center uk-margin-bottom uk-text-bold">
|
class="uk-card uk-card-default uk-padding-large uk-text-center uk-margin-bottom uk-text-bold">
|
||||||
<div *ngIf="showCurrent">No {{role}}s found</div>
|
<div *ngIf="showCurrent">No {{stakeholderUtils.roles[role]}}s found</div>
|
||||||
<div *ngIf="!showCurrent">No pending {{role}} invitations found</div>
|
<div *ngIf="!showCurrent">No pending {{stakeholderUtils.roles[role]}} invitations found</div>
|
||||||
</div>
|
</div>
|
||||||
<div *ngIf="(showCurrent && showActive.length > 0) || (!showCurrent && showPending.length > 0)">
|
<div *ngIf="(showCurrent && showActive.length > 0) || (!showCurrent && showPending.length > 0)">
|
||||||
<no-load-paging *ngIf="showCurrent" [type]="(showActive.length > 1)?(role + 's'):role"
|
<no-load-paging *ngIf="showCurrent" [type]="(showActive.length > 1)?(stakeholderUtils.roles[role] + 's'):role"
|
||||||
(pageChange)="updateActivePage($event)"
|
(pageChange)="updateActivePage($event)"
|
||||||
[page]="activePage" [pageSize]="pageSize"
|
[page]="activePage" [pageSize]="pageSize"
|
||||||
[totalResults]="showActive.length">
|
[totalResults]="showActive.length">
|
||||||
</no-load-paging>
|
</no-load-paging>
|
||||||
<no-load-paging *ngIf="!showCurrent" [type]="role + ' ' + (showPending.length > 1?'invitations':'invitation')"
|
<no-load-paging *ngIf="!showCurrent" [type]="stakeholderUtils.roles[role] + ' ' + (showPending.length > 1?'invitations':'invitation')"
|
||||||
(pageChange)="updatePendingPage($event)"
|
(pageChange)="updatePendingPage($event)"
|
||||||
[page]="pendingPage" [pageSize]="pageSize"
|
[page]="pendingPage" [pageSize]="pageSize"
|
||||||
[totalResults]="showPending.length">
|
[totalResults]="showPending.length">
|
||||||
|
@ -109,12 +109,12 @@
|
||||||
</modal-alert>
|
</modal-alert>
|
||||||
<modal-alert #deleteModal [overflowBody]="false" (alertOutput)="deleteActive()" classTitle="uk-background-primary uk-light">
|
<modal-alert #deleteModal [overflowBody]="false" (alertOutput)="deleteActive()" classTitle="uk-background-primary uk-light">
|
||||||
<div *ngIf="selectedUser">
|
<div *ngIf="selectedUser">
|
||||||
Are you sure you want to remove <span class="uk-text-bold">{{selectedUser}}</span> from {{role}}s?
|
Are you sure you want to remove <span class="uk-text-bold">{{selectedUser}}</span> from {{stakeholderUtils.roles[role]}}s?
|
||||||
</div>
|
</div>
|
||||||
</modal-alert>
|
</modal-alert>
|
||||||
<modal-alert #deletePendingModal [overflowBody]="false" (alertOutput)="deletePending()" classTitle="uk-background-primary uk-light">
|
<modal-alert #deletePendingModal [overflowBody]="false" (alertOutput)="deletePending()" classTitle="uk-background-primary uk-light">
|
||||||
<div *ngIf="selectedUser">
|
<div *ngIf="selectedUser">
|
||||||
Are you sure you want to cancel {{role}} invitation of <span class="uk-text-bold">{{selectedUser}}</span>?
|
Are you sure you want to cancel {{stakeholderUtils.roles[role]}} invitation of <span class="uk-text-bold">{{selectedUser}}</span>?
|
||||||
</div>
|
</div>
|
||||||
</modal-alert>
|
</modal-alert>
|
||||||
<modal-alert #createRoleModal [overflowBody]="false" (alertOutput)="createGroup()" classTitle="uk-background-primary uk-light"
|
<modal-alert #createRoleModal [overflowBody]="false" (alertOutput)="createGroup()" classTitle="uk-background-primary uk-light"
|
||||||
|
|
|
@ -23,6 +23,7 @@ import {NotificationHandler} from "../../../utils/notification-handler";
|
||||||
import {ClearCacheService} from "../../../services/clear-cache.service";
|
import {ClearCacheService} from "../../../services/clear-cache.service";
|
||||||
import {catchError, map, tap} from "rxjs/operators";
|
import {catchError, map, tap} from "rxjs/operators";
|
||||||
import {InputComponent} from "../../../sharedComponents/input/input.component";
|
import {InputComponent} from "../../../sharedComponents/input/input.component";
|
||||||
|
import {StakeholderUtils} from "../../../monitor-admin/utils/indicator-utils";
|
||||||
|
|
||||||
class InvitationResponse {
|
class InvitationResponse {
|
||||||
email: string;
|
email: string;
|
||||||
|
@ -43,7 +44,9 @@ export class RoleUsersComponent implements OnInit, OnDestroy, OnChanges {
|
||||||
@Input()
|
@Input()
|
||||||
public id: string;
|
public id: string;
|
||||||
@Input()
|
@Input()
|
||||||
public type: string;
|
set type(type: string) {
|
||||||
|
this._type = Role.mapType(type);
|
||||||
|
}
|
||||||
@Input()
|
@Input()
|
||||||
public name: string;
|
public name: string;
|
||||||
@Input()
|
@Input()
|
||||||
|
@ -53,6 +56,8 @@ export class RoleUsersComponent implements OnInit, OnDestroy, OnChanges {
|
||||||
@Input()
|
@Input()
|
||||||
public deleteAuthorizationLevel: 'curator' | 'manager' = 'curator';
|
public deleteAuthorizationLevel: 'curator' | 'manager' = 'curator';
|
||||||
@Input()
|
@Input()
|
||||||
|
public inviteAuthorizationLevel: 'curator' | 'manager' = 'manager';
|
||||||
|
@Input()
|
||||||
public message: string = null;
|
public message: string = null;
|
||||||
@Input()
|
@Input()
|
||||||
public emailComposer: Function;
|
public emailComposer: Function;
|
||||||
|
@ -86,12 +91,13 @@ export class RoleUsersComponent implements OnInit, OnDestroy, OnChanges {
|
||||||
@ViewChild('deleteModal') deleteModal: AlertModal;
|
@ViewChild('deleteModal') deleteModal: AlertModal;
|
||||||
@ViewChild('deletePendingModal') deletePendingModal: AlertModal;
|
@ViewChild('deletePendingModal') deletePendingModal: AlertModal;
|
||||||
@ViewChild('createRoleModal') createRoleModal: AlertModal;
|
@ViewChild('createRoleModal') createRoleModal: AlertModal;
|
||||||
|
public stakeholderUtils: StakeholderUtils = new StakeholderUtils();
|
||||||
|
private _type: string;
|
||||||
|
|
||||||
constructor(private userRegistryService: UserRegistryService,
|
constructor(private userRegistryService: UserRegistryService,
|
||||||
private userManagementService: UserManagementService,
|
private userManagementService: UserManagementService,
|
||||||
private clearCacheService: ClearCacheService,
|
private clearCacheService: ClearCacheService,
|
||||||
private notificationService: NotificationService,
|
private notificationService: NotificationService,
|
||||||
private router: Router,
|
|
||||||
private cdr: ChangeDetectorRef,
|
private cdr: ChangeDetectorRef,
|
||||||
private fb: UntypedFormBuilder) {
|
private fb: UntypedFormBuilder) {
|
||||||
}
|
}
|
||||||
|
@ -140,7 +146,7 @@ export class RoleUsersComponent implements OnInit, OnDestroy, OnChanges {
|
||||||
updateLists() {
|
updateLists() {
|
||||||
this.loadActive = true;
|
this.loadActive = true;
|
||||||
this.loadPending = true;
|
this.loadPending = true;
|
||||||
this.subs.push(this.userRegistryService.getActive(this.type, this.id, this.role, true).subscribe(users => {
|
this.subs.push(this.userRegistryService.getActive(this._type, this.id, this.role, true).subscribe(users => {
|
||||||
this.active = users;
|
this.active = users;
|
||||||
this.filterActiveBySearch(this.filterForm.value.active);
|
this.filterActiveBySearch(this.filterForm.value.active);
|
||||||
this.loadActive = false;
|
this.loadActive = false;
|
||||||
|
@ -153,7 +159,7 @@ export class RoleUsersComponent implements OnInit, OnDestroy, OnChanges {
|
||||||
}
|
}
|
||||||
this.loadActive = false;
|
this.loadActive = false;
|
||||||
}));
|
}));
|
||||||
this.subs.push(this.userRegistryService.getPending(this.type, this.id, this.role, true).subscribe(users => {
|
this.subs.push(this.userRegistryService.getPending(this._type, this.id, this.role, true).subscribe(users => {
|
||||||
this.pending = users;
|
this.pending = users;
|
||||||
this.filterPendingBySearch(this.filterForm.value.pending);
|
this.filterPendingBySearch(this.filterForm.value.pending);
|
||||||
this.loadPending = false;
|
this.loadPending = false;
|
||||||
|
@ -182,7 +188,7 @@ export class RoleUsersComponent implements OnInit, OnDestroy, OnChanges {
|
||||||
openDeleteModal(item: any) {
|
openDeleteModal(item: any) {
|
||||||
if (this.showCurrent) {
|
if (this.showCurrent) {
|
||||||
this.selectedUser = item.email;
|
this.selectedUser = item.email;
|
||||||
this.deleteModal.alertTitle = 'Delete ' + this.role;
|
this.deleteModal.alertTitle = 'Delete ' + this.stakeholderUtils.roles[this.role];
|
||||||
this.deleteModal.open();
|
this.deleteModal.open();
|
||||||
} else {
|
} else {
|
||||||
this.selectedUser = item;
|
this.selectedUser = item;
|
||||||
|
@ -192,7 +198,7 @@ export class RoleUsersComponent implements OnInit, OnDestroy, OnChanges {
|
||||||
}
|
}
|
||||||
|
|
||||||
openInviteModal() {
|
openInviteModal() {
|
||||||
this.inviteModal.alertTitle = 'Invite ' + this.role;
|
this.inviteModal.alertTitle = 'Invite ' + this.stakeholderUtils.roles[this.role];
|
||||||
this.inviteModal.okButtonLeft = false;
|
this.inviteModal.okButtonLeft = false;
|
||||||
this.inviteModal.okButtonText = 'Send';
|
this.inviteModal.okButtonText = 'Send';
|
||||||
this.emailsForm = this.fb.array([], Validators.required);
|
this.emailsForm = this.fb.array([], Validators.required);
|
||||||
|
@ -205,8 +211,8 @@ export class RoleUsersComponent implements OnInit, OnDestroy, OnChanges {
|
||||||
this.createRoleModal.okButtonLeft = false;
|
this.createRoleModal.okButtonLeft = false;
|
||||||
this.createRoleModal.okButtonText = 'Create';
|
this.createRoleModal.okButtonText = 'Create';
|
||||||
this.roleFb = this.fb.group({
|
this.roleFb = this.fb.group({
|
||||||
name: this.fb.control(Role.roleName(this.type, this.id), Validators.required),
|
name: this.fb.control(Role.roleName(this._type, this.id), Validators.required),
|
||||||
description: this.fb.control(Role.roleName(this.type, this.id), Validators.required)
|
description: this.fb.control(Role.roleName(this._type, this.id), Validators.required)
|
||||||
});
|
});
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
this.roleFb.get('name').disable();
|
this.roleFb.get('name').disable();
|
||||||
|
@ -217,7 +223,7 @@ export class RoleUsersComponent implements OnInit, OnDestroy, OnChanges {
|
||||||
|
|
||||||
deleteActive() {
|
deleteActive() {
|
||||||
this.loadActive = true;
|
this.loadActive = true;
|
||||||
this.subs.push(this.userRegistryService.remove(this.type, this.id, this.selectedUser, this.role).subscribe(() => {
|
this.subs.push(this.userRegistryService.remove(this._type, this.id, this.selectedUser, this.role).subscribe(() => {
|
||||||
this.active = this.active.filter(user => user.email != this.selectedUser);
|
this.active = this.active.filter(user => user.email != this.selectedUser);
|
||||||
if (this.currentActivePage.length === 0) {
|
if (this.currentActivePage.length === 0) {
|
||||||
this.activePage = 1;
|
this.activePage = 1;
|
||||||
|
@ -235,13 +241,13 @@ export class RoleUsersComponent implements OnInit, OnDestroy, OnChanges {
|
||||||
|
|
||||||
deletePending() {
|
deletePending() {
|
||||||
this.loadPending = true;
|
this.loadPending = true;
|
||||||
this.subs.push(this.userRegistryService.cancelInvitation(this.type, this.id, this.selectedUser, this.role).subscribe(() => {
|
this.subs.push(this.userRegistryService.cancelInvitation(this._type, this.id, this.selectedUser, this.role).subscribe(() => {
|
||||||
this.pending = this.pending.filter(user => user != this.selectedUser);
|
this.pending = this.pending.filter(user => user != this.selectedUser);
|
||||||
this.filterPendingBySearch(this.filterForm.value.pending);
|
this.filterPendingBySearch(this.filterForm.value.pending);
|
||||||
if (this.currentPendingPage.length === 0) {
|
if (this.currentPendingPage.length === 0) {
|
||||||
this.pendingPage = 1;
|
this.pendingPage = 1;
|
||||||
}
|
}
|
||||||
NotificationHandler.rise(StringUtils.capitalize(this.role) + ' invitation to ' + this.selectedUser + ' has been <b>canceled</b>');
|
NotificationHandler.rise(StringUtils.capitalize(this.stakeholderUtils.roles[this.role]) + ' invitation to ' + this.selectedUser + ' has been <b>canceled</b>');
|
||||||
this.loadPending = false;
|
this.loadPending = false;
|
||||||
}, error => {
|
}, error => {
|
||||||
NotificationHandler.rise('An error has occurred. Please try again later', 'danger');
|
NotificationHandler.rise('An error has occurred. Please try again later', 'danger');
|
||||||
|
@ -262,12 +268,12 @@ export class RoleUsersComponent implements OnInit, OnDestroy, OnChanges {
|
||||||
let current = null;
|
let current = null;
|
||||||
let invitations = (<Array<any>>this.emailsForm.value).map(email => {
|
let invitations = (<Array<any>>this.emailsForm.value).map(email => {
|
||||||
current = email;
|
current = email;
|
||||||
return this.userRegistryService.invite(this.type, this.id, {
|
return this.userRegistryService.invite(this._type, this.id, {
|
||||||
link: this.link,
|
link: this.link,
|
||||||
email: this.emailComposer(this.name, email, this.role)
|
email: this.emailComposer(this.name, email, this.role)
|
||||||
}, this.role).pipe(map(invitation => new InvitationResponse(email, invitation), catchError(error => {
|
}, this.role).pipe(catchError(error => {
|
||||||
return of(new InvitationResponse(current, null));
|
return of(null);
|
||||||
})));
|
}), map(invitation => new InvitationResponse(email, invitation)));
|
||||||
});
|
});
|
||||||
this.subs.push(forkJoin(invitations).subscribe(responses => {
|
this.subs.push(forkJoin(invitations).subscribe(responses => {
|
||||||
let notifications = responses.map(response => {
|
let notifications = responses.map(response => {
|
||||||
|
@ -289,7 +295,8 @@ export class RoleUsersComponent implements OnInit, OnDestroy, OnChanges {
|
||||||
return of(null);
|
return of(null);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
NotificationHandler.rise('An error has occurred while sending the invitation mail to ' + response.email + '.Please try again later', 'danger');
|
NotificationHandler.rise('An error has occurred while sending the invitation mail to ' +
|
||||||
|
response.email + '.Check if the user is already a ' + this.stakeholderUtils.roles[this.role] + ' or try again later', 'danger');
|
||||||
return of(null);
|
return of(null);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
@ -304,12 +311,12 @@ export class RoleUsersComponent implements OnInit, OnDestroy, OnChanges {
|
||||||
createGroup() {
|
createGroup() {
|
||||||
this.loadActive = true;
|
this.loadActive = true;
|
||||||
this.loadPending = true;
|
this.loadPending = true;
|
||||||
this.userRegistryService.createRole(this.type, this.id).subscribe(() => {
|
this.userRegistryService.createRole(this._type, this.id).subscribe(() => {
|
||||||
NotificationHandler.rise('Group has been <b> successfully created</b>');
|
NotificationHandler.rise('Group has been <b> successfully created</b>');
|
||||||
this.updateLists();
|
this.updateLists();
|
||||||
}, error => {
|
}, error => {
|
||||||
if(error.status === 409) {
|
if(error.status === 409) {
|
||||||
NotificationHandler.rise('Group already exists. You can try to invite a ' + this.role + ' instead.', 'warning');
|
NotificationHandler.rise('Group already exists. You can try to invite a ' + this.stakeholderUtils.roles[this.role] + ' instead.', 'warning');
|
||||||
this.updateLists();
|
this.updateLists();
|
||||||
} else {
|
} else {
|
||||||
NotificationHandler.rise('An error has occurred. Please try again later', 'danger');
|
NotificationHandler.rise('An error has occurred. Please try again later', 'danger');
|
||||||
|
@ -322,17 +329,21 @@ export class RoleUsersComponent implements OnInit, OnDestroy, OnChanges {
|
||||||
public get canDelete() {
|
public get canDelete() {
|
||||||
return (this.deleteAuthorizationLevel === 'curator'?this.isCurator:this.isManager);
|
return (this.deleteAuthorizationLevel === 'curator'?this.isCurator:this.isManager);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public get canInvite() {
|
||||||
|
return this.exists && (this.inviteAuthorizationLevel === 'curator'?this.isCurator:this.isManager);
|
||||||
|
}
|
||||||
|
|
||||||
public isMe(userId: string) {
|
public isMe(userId: string) {
|
||||||
return userId && userId.includes(this.user.id) && !this.isCurator;
|
return userId && userId.includes(this.user.id) && !this.isCurator;
|
||||||
}
|
}
|
||||||
|
|
||||||
public get isManager(): boolean {
|
public get isManager(): boolean {
|
||||||
return this.isCurator || !!Session.isManager(this.type, this.id, this.user);
|
return this.isCurator || !!Session.isManager(this._type, this.id, this.user);
|
||||||
}
|
}
|
||||||
|
|
||||||
public get isCurator(): boolean {
|
public get isCurator(): boolean {
|
||||||
return this.isPortalAdmin || !!Session.isCurator(this.type, this.user);
|
return this.isPortalAdmin || !!Session.isCurator(this._type, this.user);
|
||||||
}
|
}
|
||||||
|
|
||||||
public get isPortalAdmin(): boolean {
|
public get isPortalAdmin(): boolean {
|
||||||
|
|
|
@ -32,7 +32,7 @@
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="uk-width-2-5@m uk-width-1-1@s uk-text-center" uk-scrollspy-class>
|
<div class="uk-width-2-5@m uk-width-1-1@s uk-text-center" uk-scrollspy-class>
|
||||||
<img src="assets/common-assets/fos/fos-hero-img.svg" loading="lazy">
|
<img src="assets/common-assets/fos/fos-hero-img.svg" loading="lazy" alt="FoS logo">
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -89,7 +89,7 @@ import {RouterHelper} from "../../utils/routerHelper.class";
|
||||||
</ng-container>
|
</ng-container>
|
||||||
</span>
|
</span>
|
||||||
<ng-container *ngIf="status">
|
<ng-container *ngIf="status">
|
||||||
<span>{{status}}</span>
|
<span>{{status}} <ng-container *ngIf="currentDate <= endDate && currentDate >= startDate">(M{{calcCurrentMonth}})</ng-container></span>
|
||||||
</ng-container>
|
</ng-container>
|
||||||
<ng-container *ngIf="date">
|
<ng-container *ngIf="date">
|
||||||
<span>{{date | date: 'dd MMM yyyy': 'UTC'}}</span>
|
<span>{{date | date: 'dd MMM yyyy': 'UTC'}}</span>
|
||||||
|
@ -295,7 +295,7 @@ export class EntityMetadataComponent {
|
||||||
return this.projects.map(project => {
|
return this.projects.map(project => {
|
||||||
let value = project.funderShortname ? project.funderShortname : project.funderName;
|
let value = project.funderShortname ? project.funderShortname : project.funderName;
|
||||||
if (project.acronym || project.title) {
|
if (project.acronym || project.title) {
|
||||||
value = value + ' | ' + (project.acronym ? project.acronym :
|
value = (value ? value + ' | ' : '') + (project.acronym ? project.acronym :
|
||||||
(project.title.length > 25 ? (project.title.slice(0, 25) + '...'): project.title));
|
(project.title.length > 25 ? (project.title.slice(0, 25) + '...'): project.title));
|
||||||
}
|
}
|
||||||
// if(project.code) {
|
// if(project.code) {
|
||||||
|
@ -364,4 +364,18 @@ export class EntityMetadataComponent {
|
||||||
this.projectsModal.open();
|
this.projectsModal.open();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public get calcCurrentMonth() {
|
||||||
|
let currentDate = new Date(this.currentDate);
|
||||||
|
let startDate = new Date(this.startDate);
|
||||||
|
|
||||||
|
var months;
|
||||||
|
months = (currentDate.getFullYear() - startDate.getFullYear()) * 12;
|
||||||
|
months -= startDate.getMonth();
|
||||||
|
months += currentDate.getMonth();
|
||||||
|
if(startDate.getDate() > currentDate.getDate()) {
|
||||||
|
months--;
|
||||||
|
}
|
||||||
|
return months <= 0 ? 0 : months+1;
|
||||||
|
}
|
||||||
}
|
}
|
|
@ -5,7 +5,6 @@ import { CommonModule } from '@angular/common';
|
||||||
import { FormsModule } from '@angular/forms';
|
import { FormsModule } from '@angular/forms';
|
||||||
import { RouterModule } from '@angular/router';
|
import { RouterModule } from '@angular/router';
|
||||||
|
|
||||||
import {TabPagingComponent} from './tabPaging.component';
|
|
||||||
import {ShowTitleComponent} from './showTitle.component';
|
import {ShowTitleComponent} from './showTitle.component';
|
||||||
import {AddThisComponent} from './addThis.component';
|
import {AddThisComponent} from './addThis.component';
|
||||||
|
|
||||||
|
@ -14,11 +13,11 @@ import {AddThisComponent} from './addThis.component';
|
||||||
CommonModule, FormsModule, RouterModule
|
CommonModule, FormsModule, RouterModule
|
||||||
],
|
],
|
||||||
declarations: [
|
declarations: [
|
||||||
TabPagingComponent, ShowTitleComponent, AddThisComponent
|
ShowTitleComponent, AddThisComponent
|
||||||
],
|
],
|
||||||
providers:[],
|
providers:[],
|
||||||
exports: [
|
exports: [
|
||||||
TabPagingComponent, ShowTitleComponent, AddThisComponent
|
ShowTitleComponent, AddThisComponent
|
||||||
]
|
]
|
||||||
})
|
})
|
||||||
export class LandingModule { }
|
export class LandingModule { }
|
||||||
|
|
|
@ -581,7 +581,7 @@ export class ParsingFunctions {
|
||||||
|
|
||||||
return eoscSubjectsFound;
|
return eoscSubjectsFound;
|
||||||
}
|
}
|
||||||
|
|
||||||
// publication & dataset landing : for subjects and otherSubjects and classifiedSubjects
|
// publication & dataset landing : for subjects and otherSubjects and classifiedSubjects
|
||||||
parseAllSubjects(_subjects: any, vocabulary: any): [string[], Map<string, string[]>, Map<string, string[]>, string[], string[],] {
|
parseAllSubjects(_subjects: any, vocabulary: any): [string[], Map<string, string[]>, Map<string, string[]>, string[], string[],] {
|
||||||
// let eoscSubjectsFound = [];
|
// let eoscSubjectsFound = [];
|
||||||
|
@ -590,12 +590,12 @@ export class ParsingFunctions {
|
||||||
let classifiedSubjects: Map<string, string[]>;
|
let classifiedSubjects: Map<string, string[]>;
|
||||||
let fos: string[];
|
let fos: string[];
|
||||||
let sdg: string[];
|
let sdg: string[];
|
||||||
|
|
||||||
let setOfEoscSubjects: Set<string> = new Set();
|
let setOfEoscSubjects: Set<string> = new Set();
|
||||||
|
|
||||||
let subject;
|
let subject;
|
||||||
let length = Array.isArray(_subjects) ? _subjects.length : 1;
|
let length = Array.isArray(_subjects) ? _subjects.length : 1;
|
||||||
|
|
||||||
for (let i = 0; i < length; i++) {
|
for (let i = 0; i < length; i++) {
|
||||||
subject = Array.isArray(_subjects) ? _subjects[i] : _subjects;
|
subject = Array.isArray(_subjects) ? _subjects[i] : _subjects;
|
||||||
if (subject.classid != "") {
|
if (subject.classid != "") {
|
||||||
|
@ -628,7 +628,7 @@ export class ParsingFunctions {
|
||||||
if (classifiedSubjects == undefined) {
|
if (classifiedSubjects == undefined) {
|
||||||
classifiedSubjects = new Map<string, string[]>();
|
classifiedSubjects = new Map<string, string[]>();
|
||||||
}
|
}
|
||||||
|
|
||||||
let content: string = subject.content + "";
|
let content: string = subject.content + "";
|
||||||
// let checkAndAddEoscSubjectResp = this.checkAndAddEoscSubject(setOfEoscSubjects, eoscSubjectsFound, subject, content);
|
// let checkAndAddEoscSubjectResp = this.checkAndAddEoscSubject(setOfEoscSubjects, eoscSubjectsFound, subject, content);
|
||||||
// let found: boolean = checkAndAddEoscSubjectResp["found"];
|
// let found: boolean = checkAndAddEoscSubjectResp["found"];
|
||||||
|
@ -639,7 +639,11 @@ export class ParsingFunctions {
|
||||||
if (!classifiedSubjects.has(subject.classname)) {
|
if (!classifiedSubjects.has(subject.classname)) {
|
||||||
classifiedSubjects.set(subject.classname, new Array<string>());
|
classifiedSubjects.set(subject.classname, new Array<string>());
|
||||||
}
|
}
|
||||||
classifiedSubjects.get(subject.classname).push(content);
|
if(properties.environment == "production") {
|
||||||
|
classifiedSubjects.get(subject.classname).push(content);
|
||||||
|
} else {
|
||||||
|
classifiedSubjects.get(subject.classname).push(subject.classid + ": " + content);
|
||||||
|
}
|
||||||
// }
|
// }
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
@ -659,6 +663,14 @@ export class ParsingFunctions {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if(properties.environment != "production" && classifiedSubjects != null) {
|
||||||
|
for (let classified of classifiedSubjects.keys()) {
|
||||||
|
subjects = subjects.concat(classifiedSubjects.get(classified));
|
||||||
|
}
|
||||||
|
classifiedSubjects = null;
|
||||||
|
}
|
||||||
|
|
||||||
return [subjects, otherSubjects, classifiedSubjects, fos, sdg];
|
return [subjects, otherSubjects, classifiedSubjects, fos, sdg];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,24 +0,0 @@
|
||||||
import {Component, Input, Output, EventEmitter} from '@angular/core';
|
|
||||||
|
|
||||||
@Component({
|
|
||||||
selector: 'tabPaging',
|
|
||||||
template: `
|
|
||||||
<div class="uk-panel" *ngIf="!showAll && length > 10">
|
|
||||||
<a (click)="changeShowAll.emit({value: true});">
|
|
||||||
<div class="uk-float-right">view all {{length | number}}</div>
|
|
||||||
</a>
|
|
||||||
</div>
|
|
||||||
`
|
|
||||||
})
|
|
||||||
|
|
||||||
export class TabPagingComponent {
|
|
||||||
@Input() showAll: boolean;
|
|
||||||
@Input() length: number;
|
|
||||||
@Output() changeShowAll: EventEmitter<any> = new EventEmitter();
|
|
||||||
|
|
||||||
constructor () {
|
|
||||||
}
|
|
||||||
|
|
||||||
ngOnInit() {
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -18,7 +18,7 @@ import {ResultPreviewModule} from "../../../utils/result-preview/result-preview.
|
||||||
@NgModule({
|
@NgModule({
|
||||||
imports: [
|
imports: [
|
||||||
CommonModule, FormsModule, ResultLandingUtilsModule,
|
CommonModule, FormsModule, ResultLandingUtilsModule,
|
||||||
PagingModule, ErrorMessagesModule, ShowAuthorsModule, LandingModule, NoLoadPaging, ResultPreviewModule
|
PagingModule, ErrorMessagesModule, ShowAuthorsModule, NoLoadPaging, ResultPreviewModule
|
||||||
],
|
],
|
||||||
declarations: [
|
declarations: [
|
||||||
OrganizationsDeletedByInferenceComponent
|
OrganizationsDeletedByInferenceComponent
|
||||||
|
|
|
@ -28,7 +28,7 @@ import {HelperFunctions} from "../../../utils/HelperFunctions.class";
|
||||||
<li *ngFor="let result of results.slice((page-1)*pageSize, page*pageSize)">
|
<li *ngFor="let result of results.slice((page-1)*pageSize, page*pageSize)">
|
||||||
<result-preview [modal]="modal" [properties]="properties" [hasLink]="false" [result]="getResultPreview(result)"
|
<result-preview [modal]="modal" [properties]="properties" [hasLink]="false" [result]="getResultPreview(result)"
|
||||||
[showOrcid]="false" [prevPath]="prevPath" [showInline]="true"
|
[showOrcid]="false" [prevPath]="prevPath" [showInline]="true"
|
||||||
[isDeletedByInferenceModal]="true"></result-preview>
|
[isDeletedByInferenceModal]="true" [isMobile]="isMobile"></result-preview>
|
||||||
</li>
|
</li>
|
||||||
</ul>
|
</ul>
|
||||||
<no-load-paging *ngIf="results.length > pageSize" [type]="type"
|
<no-load-paging *ngIf="results.length > pageSize" [type]="type"
|
||||||
|
@ -40,6 +40,7 @@ import {HelperFunctions} from "../../../utils/HelperFunctions.class";
|
||||||
`
|
`
|
||||||
})
|
})
|
||||||
export class DeletedByInferenceComponent {
|
export class DeletedByInferenceComponent {
|
||||||
|
@Input() isMobile: boolean = false;
|
||||||
@Input() prevPath: string = "";
|
@Input() prevPath: string = "";
|
||||||
public results: ResultLandingInfo[] = [];
|
public results: ResultLandingInfo[] = [];
|
||||||
@Input() id: string;
|
@Input() id: string;
|
||||||
|
|
|
@ -145,8 +145,7 @@ export class DeletedByInferenceService {
|
||||||
if(author.orcid_pending) {
|
if(author.orcid_pending) {
|
||||||
author.orcid_pending = author.orcid_pending.toUpperCase();
|
author.orcid_pending = author.orcid_pending.toUpperCase();
|
||||||
}
|
}
|
||||||
|
if(result['authors'][author.rank] && result['authors'][author.rank].fullName == author.content) {
|
||||||
if(result['authors'][author.rank] && results['authors'][author.rank].fullName == author.content) {
|
|
||||||
if(!author.orcid && result['authors'][author.rank].orcid) {
|
if(!author.orcid && result['authors'][author.rank].orcid) {
|
||||||
author.orcid = result['authors'][author.rank].orcid;
|
author.orcid = result['authors'][author.rank].orcid;
|
||||||
} else if(!author.orcid_pending && result['authors'][author.rank].orcid_pending) {
|
} else if(!author.orcid_pending && result['authors'][author.rank].orcid_pending) {
|
||||||
|
|
|
@ -79,7 +79,8 @@
|
||||||
[type]="resultLandingInfo.resultType"
|
[type]="resultLandingInfo.resultType"
|
||||||
[result]="resultLandingInfo" [id]="resultLandingInfo.objIdentifier">
|
[result]="resultLandingInfo" [id]="resultLandingInfo.objIdentifier">
|
||||||
<!-- ORCID -->
|
<!-- ORCID -->
|
||||||
<div *ngIf="properties.adminToolsPortalType == 'explore' || properties.adminToolsPortalType == 'community' || properties.adminToolsPortalType == 'aggregator'"
|
<div *ngIf="properties.adminToolsPortalType == 'explore' || properties.adminToolsPortalType == 'community'
|
||||||
|
|| properties.adminToolsPortalType == 'aggregator' || properties.dashboard == 'irish'"
|
||||||
class="uk-margin-small-right">
|
class="uk-margin-small-right">
|
||||||
<orcid-work [resultId]="id" [resultTitle]="resultLandingInfo.title" [resultLandingInfo]="resultLandingInfo"
|
<orcid-work [resultId]="id" [resultTitle]="resultLandingInfo.title" [resultLandingInfo]="resultLandingInfo"
|
||||||
[pids]="pidsArrayString" [pageType]="'landing'">
|
[pids]="pidsArrayString" [pageType]="'landing'">
|
||||||
|
@ -544,7 +545,8 @@
|
||||||
</div>
|
</div>
|
||||||
<hr class="uk-margin-remove">
|
<hr class="uk-margin-remove">
|
||||||
</ng-container>
|
</ng-container>
|
||||||
<ng-container *ngIf="properties.adminToolsPortalType == 'explore' || properties.adminToolsPortalType == 'community' || properties.adminToolsPortalType == 'aggregator'" >
|
<ng-container *ngIf="properties.adminToolsPortalType == 'explore' || properties.adminToolsPortalType == 'community'
|
||||||
|
|| properties.adminToolsPortalType == 'aggregator' || properties.dashboard == 'irish'" >
|
||||||
<div class="uk-padding-small uk-padding-remove-horizontal ">
|
<div class="uk-padding-small uk-padding-remove-horizontal ">
|
||||||
<orcid-work [resultId]="id" [resultTitle]="resultLandingInfo?.title" [resultLandingInfo]="resultLandingInfo"
|
<orcid-work [resultId]="id" [resultTitle]="resultLandingInfo?.title" [resultLandingInfo]="resultLandingInfo"
|
||||||
[pids]="pidsArrayString" [pageType]="'landing'" [isMobile]="true"
|
[pids]="pidsArrayString" [pageType]="'landing'" [isMobile]="true"
|
||||||
|
@ -1167,19 +1169,27 @@
|
||||||
<deletedByInference *ngIf="type == 'publication' && deleteByInferenceOpened"
|
<deletedByInference *ngIf="type == 'publication' && deleteByInferenceOpened"
|
||||||
[id]="resultLandingInfo.record['result']['header']['dri:objIdentifier']"
|
[id]="resultLandingInfo.record['result']['header']['dri:objIdentifier']"
|
||||||
[ids]="resultLandingInfo.deletedByInferenceIds"
|
[ids]="resultLandingInfo.deletedByInferenceIds"
|
||||||
[resultType]="type" [type]="openaireEntities.PUBLICATIONS"></deletedByInference>
|
[resultType]="type" [type]="openaireEntities.PUBLICATIONS"
|
||||||
|
[isMobile]="isMobile"
|
||||||
|
[modal]="alertModalDeletedByInferenceFS"></deletedByInference>
|
||||||
<deletedByInference *ngIf="type == 'dataset' && deleteByInferenceOpened"
|
<deletedByInference *ngIf="type == 'dataset' && deleteByInferenceOpened"
|
||||||
[id]="resultLandingInfo.record['result']['header']['dri:objIdentifier']"
|
[id]="resultLandingInfo.record['result']['header']['dri:objIdentifier']"
|
||||||
[ids]="resultLandingInfo.deletedByInferenceIds"
|
[ids]="resultLandingInfo.deletedByInferenceIds"
|
||||||
[resultType]="'dataset'" [type]="openaireEntities.DATASETS"></deletedByInference>
|
[resultType]="'dataset'" [type]="openaireEntities.DATASETS"
|
||||||
|
[isMobile]="isMobile"
|
||||||
|
[modal]="alertModalDeletedByInferenceFS"></deletedByInference>
|
||||||
<deletedByInference *ngIf="type == 'software' && deleteByInferenceOpened"
|
<deletedByInference *ngIf="type == 'software' && deleteByInferenceOpened"
|
||||||
[id]="resultLandingInfo.record['result']['header']['dri:objIdentifier']"
|
[id]="resultLandingInfo.record['result']['header']['dri:objIdentifier']"
|
||||||
[ids]="resultLandingInfo.deletedByInferenceIds"
|
[ids]="resultLandingInfo.deletedByInferenceIds"
|
||||||
[resultType]="type" [type]="openaireEntities.SOFTWARE"></deletedByInference>
|
[resultType]="type" [type]="openaireEntities.SOFTWARE"
|
||||||
|
[isMobile]="isMobile"
|
||||||
|
[modal]="alertModalDeletedByInferenceFS"></deletedByInference>
|
||||||
<deletedByInference *ngIf="type == 'orp' && deleteByInferenceOpened"
|
<deletedByInference *ngIf="type == 'orp' && deleteByInferenceOpened"
|
||||||
[id]="resultLandingInfo.record['result']['header']['dri:objIdentifier']"
|
[id]="resultLandingInfo.record['result']['header']['dri:objIdentifier']"
|
||||||
[ids]="resultLandingInfo.deletedByInferenceIds"
|
[ids]="resultLandingInfo.deletedByInferenceIds"
|
||||||
[resultType]="'other'" [type]="openaireEntities.OTHER"></deletedByInference>
|
[resultType]="'other'" [type]="openaireEntities.OTHER"
|
||||||
|
[isMobile]="isMobile"
|
||||||
|
[modal]="alertModalDeletedByInferenceFS"></deletedByInference>
|
||||||
</fs-modal>
|
</fs-modal>
|
||||||
|
|
||||||
<fs-modal *ngIf="resultLandingInfo" #citeFsModal classTitle="uk-tile-default uk-border-bottom">
|
<fs-modal *ngIf="resultLandingInfo" #citeFsModal classTitle="uk-tile-default uk-border-bottom">
|
||||||
|
|
|
@ -38,6 +38,7 @@ import {SafeHtmlPipeModule} from '../../utils/pipes/safeHTMLPipe.module';
|
||||||
import {EntityActionsModule} from "../../utils/entity-actions/entity-actions.module";
|
import {EntityActionsModule} from "../../utils/entity-actions/entity-actions.module";
|
||||||
import {ResultLandingRoutingModule} from "./resultLanding-routing.module";
|
import {ResultLandingRoutingModule} from "./resultLanding-routing.module";
|
||||||
import {OrcidCoreModule} from "../../orcid/orcid-core.module";
|
import {OrcidCoreModule} from "../../orcid/orcid-core.module";
|
||||||
|
import {SearchTabModule} from "../../utils/tabs/contents/search-tab.module";
|
||||||
|
|
||||||
@NgModule({
|
@NgModule({
|
||||||
imports: [
|
imports: [
|
||||||
|
|
|
@ -20,7 +20,7 @@ import {StakeholderBaseComponent} from "../../utils/stakeholder-base.component";
|
||||||
template: `
|
template: `
|
||||||
<div class="uk-margin-medium-bottom">
|
<div class="uk-margin-medium-bottom">
|
||||||
<form *ngIf="stakeholderFb" [formGroup]="stakeholderFb">
|
<form *ngIf="stakeholderFb" [formGroup]="stakeholderFb">
|
||||||
<div class="uk-grid uk-grid-large" uk-grid>
|
<div class="uk-grid" uk-grid>
|
||||||
<div class="uk-width-1-2@m">
|
<div class="uk-width-1-2@m">
|
||||||
<div input id="name" [formInput]="stakeholderFb.get('name')"
|
<div input id="name" [formInput]="stakeholderFb.get('name')"
|
||||||
placeholder="Name"></div>
|
placeholder="Name"></div>
|
||||||
|
@ -126,6 +126,19 @@ import {StakeholderBaseComponent} from "../../utils/stakeholder-base.component";
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
<div *ngIf="canChangeCopy" class="uk-width-1-1">
|
||||||
|
<h6>Instance Type</h6>
|
||||||
|
<div class="uk-width-auto uk-flex uk-flex-middle">
|
||||||
|
<label class="uk-margin-right">
|
||||||
|
<input type="radio" [value]="true" formControlName="copy"/>
|
||||||
|
<span class="uk-margin-xsmall-left">Copy</span>
|
||||||
|
</label>
|
||||||
|
<label class="uk-margin-right">
|
||||||
|
<input type="radio" [value]="false" formControlName="copy"/>
|
||||||
|
<span class="uk-margin-xsmall-left">Reference</span>
|
||||||
|
</label>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</form>
|
</form>
|
||||||
<div #notify [class.uk-hidden]="!stakeholderFb" notify-form
|
<div #notify [class.uk-hidden]="!stakeholderFb" notify-form
|
||||||
|
@ -145,6 +158,7 @@ export class EditStakeholderComponent extends StakeholderBaseComponent {
|
||||||
public stakeholder: Stakeholder;
|
public stakeholder: Stakeholder;
|
||||||
public isDefault: boolean;
|
public isDefault: boolean;
|
||||||
public isNew: boolean;
|
public isNew: boolean;
|
||||||
|
public isFull: boolean;
|
||||||
public loading: boolean = false;
|
public loading: boolean = false;
|
||||||
public typesByRole: Option[];
|
public typesByRole: Option[];
|
||||||
public statsProfiles: string[];
|
public statsProfiles: string[];
|
||||||
|
@ -172,7 +186,7 @@ export class EditStakeholderComponent extends StakeholderBaseComponent {
|
||||||
super.ngOnDestroy();
|
super.ngOnDestroy();
|
||||||
}
|
}
|
||||||
|
|
||||||
public init(stakeholder: Stakeholder, alias: string[], defaultStakeholders: Stakeholder[], isDefault: boolean, isNew: boolean) {
|
public init(stakeholder: Stakeholder, alias: string[], defaultStakeholders: Stakeholder[], isDefault: boolean, isNew: boolean, isFull: boolean = false) {
|
||||||
this.reset();
|
this.reset();
|
||||||
this.deleteCurrentPhoto = false;
|
this.deleteCurrentPhoto = false;
|
||||||
this.stakeholder = stakeholder;
|
this.stakeholder = stakeholder;
|
||||||
|
@ -183,6 +197,7 @@ export class EditStakeholderComponent extends StakeholderBaseComponent {
|
||||||
this.defaultStakeholders = defaultStakeholders;
|
this.defaultStakeholders = defaultStakeholders;
|
||||||
this.isDefault = isDefault;
|
this.isDefault = isDefault;
|
||||||
this.isNew = isNew;
|
this.isNew = isNew;
|
||||||
|
this.isFull = isFull;
|
||||||
this.subscriptions.push(this.userManagementService.getUserInfo().subscribe(user => {
|
this.subscriptions.push(this.userManagementService.getUserInfo().subscribe(user => {
|
||||||
this.user = user;
|
this.user = user;
|
||||||
if (this.isCurator) {
|
if (this.isCurator) {
|
||||||
|
@ -220,6 +235,7 @@ export class EditStakeholderComponent extends StakeholderBaseComponent {
|
||||||
funderType: this.fb.control(this.stakeholder.funderType),
|
funderType: this.fb.control(this.stakeholder.funderType),
|
||||||
topics: this.fb.control(this.stakeholder.topics),
|
topics: this.fb.control(this.stakeholder.topics),
|
||||||
isUpload: this.fb.control(this.stakeholder.isUpload),
|
isUpload: this.fb.control(this.stakeholder.isUpload),
|
||||||
|
copy: this.fb.control(this.stakeholder.copy),
|
||||||
logoUrl: this.fb.control(this.stakeholder.logoUrl),
|
logoUrl: this.fb.control(this.stakeholder.logoUrl),
|
||||||
});
|
});
|
||||||
if (this.stakeholder.isUpload) {
|
if (this.stakeholder.isUpload) {
|
||||||
|
@ -246,7 +262,7 @@ export class EditStakeholderComponent extends StakeholderBaseComponent {
|
||||||
this.subscriptions.push(this.stakeholderFb.get('type').valueChanges.subscribe(value => {
|
this.subscriptions.push(this.stakeholderFb.get('type').valueChanges.subscribe(value => {
|
||||||
this.onTypeChange(value, defaultStakeholders);
|
this.onTypeChange(value, defaultStakeholders);
|
||||||
}));
|
}));
|
||||||
this.stakeholderFb.setControl('defaultId', this.fb.control(stakeholder.defaultId, (this.isDefault && !this.isNew) ? [] : Validators.required));
|
this.stakeholderFb.setControl('defaultId', this.fb.control(this.stakeholder.defaultId, (this.isDefault && !this.isNew) ? [] : Validators.required));
|
||||||
if (!this.isNew) {
|
if (!this.isNew) {
|
||||||
this.notification = NotificationUtils.editStakeholder(this.user.firstname + ' ' + this.user.lastname, this.stakeholder.name);
|
this.notification = NotificationUtils.editStakeholder(this.user.firstname + ' ' + this.user.lastname, this.stakeholder.name);
|
||||||
this.notify.reset(this.notification.message);
|
this.notify.reset(this.notification.message);
|
||||||
|
@ -304,6 +320,13 @@ export class EditStakeholderComponent extends StakeholderBaseComponent {
|
||||||
return this.isNew && this.stakeholderFb.get('type').valid && !!this.defaultStakeholdersOptions;
|
return this.isNew && this.stakeholderFb.get('type').valid && !!this.defaultStakeholdersOptions;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public get canChangeCopy(): boolean {
|
||||||
|
return this.isCurator &&
|
||||||
|
!this.stakeholderFb.get('isDefault').getRawValue() &&
|
||||||
|
this.stakeholderFb.get('defaultId').getRawValue() &&
|
||||||
|
this.stakeholderFb.get('defaultId').getRawValue() !== '-1';
|
||||||
|
}
|
||||||
|
|
||||||
reset() {
|
reset() {
|
||||||
this.uploadError = null;
|
this.uploadError = null;
|
||||||
this.stakeholderFb = null;
|
this.stakeholderFb = null;
|
||||||
|
@ -350,15 +373,15 @@ export class EditStakeholderComponent extends StakeholderBaseComponent {
|
||||||
|
|
||||||
public saveStakeholder(callback: Function, errorCallback: Function = null) {
|
public saveStakeholder(callback: Function, errorCallback: Function = null) {
|
||||||
if (this.isNew) {
|
if (this.isNew) {
|
||||||
let defaultStakeholder = this.defaultStakeholders.find(value => value._id === this.stakeholderFb.getRawValue().defaultId);
|
let copyId = null;
|
||||||
this.stakeholderFb.setValue(this.stakeholderUtils.createFunderFromDefaultProfile(this.stakeholderFb.getRawValue(),
|
|
||||||
(defaultStakeholder ? defaultStakeholder.topics : []), this.stakeholderFb.getRawValue().isDefault));
|
|
||||||
this.removePhoto();
|
|
||||||
if (this.stakeholderFb.getRawValue().isDefault) {
|
if (this.stakeholderFb.getRawValue().isDefault) {
|
||||||
|
copyId = this.stakeholderFb.getRawValue().defaultId !== '-1'?this.stakeholderFb.getRawValue().defaultId:null;
|
||||||
this.stakeholderFb.get('defaultId').setValue(null);
|
this.stakeholderFb.get('defaultId').setValue(null);
|
||||||
|
this.stakeholderFb.removeControl('isDefault');
|
||||||
}
|
}
|
||||||
|
this.removePhoto();
|
||||||
this.subscriptions.push(this.stakeholderService.buildStakeholder(this.properties.monitorServiceAPIURL,
|
this.subscriptions.push(this.stakeholderService.buildStakeholder(this.properties.monitorServiceAPIURL,
|
||||||
this.stakeholderFb.getRawValue()).subscribe(stakeholder => {
|
this.stakeholderFb.getRawValue(), copyId).subscribe(stakeholder => {
|
||||||
this.notification.entity = stakeholder._id;
|
this.notification.entity = stakeholder._id;
|
||||||
this.notification.stakeholder = stakeholder.alias;
|
this.notification.stakeholder = stakeholder.alias;
|
||||||
this.notification.stakeholderType = stakeholder.type;
|
this.notification.stakeholderType = stakeholder.type;
|
||||||
|
@ -375,7 +398,7 @@ export class EditStakeholderComponent extends StakeholderBaseComponent {
|
||||||
this.loading = false;
|
this.loading = false;
|
||||||
}));
|
}));
|
||||||
} else {
|
} else {
|
||||||
this.subscriptions.push(this.stakeholderService.saveElement(this.properties.monitorServiceAPIURL, this.stakeholderFb.getRawValue()).subscribe(stakeholder => {
|
this.subscriptions.push(this.stakeholderService.saveElement(this.properties.monitorServiceAPIURL, this.stakeholderFb.getRawValue(), [], this.isFull).subscribe(stakeholder => {
|
||||||
this.notification.entity = stakeholder._id;
|
this.notification.entity = stakeholder._id;
|
||||||
this.notification.stakeholder = stakeholder.alias;
|
this.notification.stakeholder = stakeholder.alias;
|
||||||
this.notification.stakeholderType = stakeholder.type;
|
this.notification.stakeholderType = stakeholder.type;
|
||||||
|
|
|
@ -5,9 +5,10 @@ import {InputModule} from "../../../sharedComponents/input/input.module";
|
||||||
import {ReactiveFormsModule} from "@angular/forms";
|
import {ReactiveFormsModule} from "@angular/forms";
|
||||||
import {IconsModule} from "../../../utils/icons/icons.module";
|
import {IconsModule} from "../../../utils/icons/icons.module";
|
||||||
import {NotifyFormModule} from "../../../notifications/notify-form/notify-form.module";
|
import {NotifyFormModule} from "../../../notifications/notify-form/notify-form.module";
|
||||||
|
import {MatSlideToggleModule} from "@angular/material/slide-toggle";
|
||||||
|
|
||||||
@NgModule({
|
@NgModule({
|
||||||
imports: [CommonModule, InputModule, ReactiveFormsModule, IconsModule, NotifyFormModule],
|
imports: [CommonModule, InputModule, ReactiveFormsModule, IconsModule, NotifyFormModule, MatSlideToggleModule],
|
||||||
declarations: [EditStakeholderComponent],
|
declarations: [EditStakeholderComponent],
|
||||||
exports: [EditStakeholderComponent]
|
exports: [EditStakeholderComponent]
|
||||||
})
|
})
|
||||||
|
|
|
@ -48,7 +48,7 @@ export class GeneralComponent extends BaseComponent implements OnInit {
|
||||||
}
|
}
|
||||||
|
|
||||||
public reset() {
|
public reset() {
|
||||||
this.editStakeholderComponent.init(this.stakeholder, this.alias, this.defaultStakeholders, this.stakeholder.defaultId == null, false)
|
this.editStakeholderComponent.init(this.stakeholder, this.alias, this.defaultStakeholders, this.stakeholder.defaultId == null, false, true)
|
||||||
}
|
}
|
||||||
|
|
||||||
public save() {
|
public save() {
|
||||||
|
|
|
@ -31,7 +31,7 @@
|
||||||
<div *ngIf="!loading" uk-height-match="target: .titleContainer; row: false">
|
<div *ngIf="!loading" uk-height-match="target: .titleContainer; row: false">
|
||||||
<div uk-height-match="target: .logoContainer; row: false">
|
<div uk-height-match="target: .logoContainer; row: false">
|
||||||
<div *ngIf="tab != 'profiles' && isCurator()" class="uk-section">
|
<div *ngIf="tab != 'profiles' && isCurator()" class="uk-section">
|
||||||
<div class="uk-flex uk-flex-middle uk-flex-between uk-margin-small-bottom">
|
<div class="uk-flex uk-flex-middle uk-flex-between uk-margin-bottom">
|
||||||
<h4 class="uk-margin-remove">Profile Templates</h4>
|
<h4 class="uk-margin-remove">Profile Templates</h4>
|
||||||
<paging-no-load *ngIf="displayDefaultStakeholders?.length > pageSize"
|
<paging-no-load *ngIf="displayDefaultStakeholders?.length > pageSize"
|
||||||
(pageChange)="updateCurrentTemplatesPage($event)"
|
(pageChange)="updateCurrentTemplatesPage($event)"
|
||||||
|
@ -39,8 +39,7 @@
|
||||||
[totalResults]="displayDefaultStakeholders.length">
|
[totalResults]="displayDefaultStakeholders.length">
|
||||||
</paging-no-load>
|
</paging-no-load>
|
||||||
</div>
|
</div>
|
||||||
<div class="uk-grid uk-child-width-1-3@l uk-child-width-1-2@m uk-child-width-1-1 uk-grid-match"
|
<div class="uk-grid uk-child-width-1-3@l uk-child-width-1-2@m uk-child-width-1-1 uk-grid-match" uk-grid>
|
||||||
uk-grid>
|
|
||||||
<ng-template ngFor
|
<ng-template ngFor
|
||||||
[ngForOf]="displayDefaultStakeholders.slice((currentTemplatesPage-1)*pageSize, currentTemplatesPage*pageSize)"
|
[ngForOf]="displayDefaultStakeholders.slice((currentTemplatesPage-1)*pageSize, currentTemplatesPage*pageSize)"
|
||||||
let-stakeholder>
|
let-stakeholder>
|
||||||
|
@ -59,7 +58,7 @@
|
||||||
</h4>
|
</h4>
|
||||||
</div>
|
</div>
|
||||||
<div *ngIf="tab != 'templates' && isManager()" class="uk-section">
|
<div *ngIf="tab != 'templates' && isManager()" class="uk-section">
|
||||||
<div class="uk-flex uk-flex-middle uk-flex-between uk-margin-small-bottom">
|
<div class="uk-flex uk-flex-middle uk-flex-between uk-margin-bottom">
|
||||||
<h4 class="uk-margin-remove">Profiles</h4>
|
<h4 class="uk-margin-remove">Profiles</h4>
|
||||||
<paging-no-load *ngIf="displayStakeholders?.length > pageSize"
|
<paging-no-load *ngIf="displayStakeholders?.length > pageSize"
|
||||||
(pageChange)="updateCurrentPage($event)"
|
(pageChange)="updateCurrentPage($event)"
|
||||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -20,7 +20,7 @@ import {
|
||||||
Visibility
|
Visibility
|
||||||
} from "../../monitor/entities/stakeholder";
|
} from "../../monitor/entities/stakeholder";
|
||||||
import {
|
import {
|
||||||
AbstractControl,
|
AbstractControl, FormArray, FormGroup,
|
||||||
UntypedFormArray,
|
UntypedFormArray,
|
||||||
UntypedFormBuilder,
|
UntypedFormBuilder,
|
||||||
UntypedFormControl,
|
UntypedFormControl,
|
||||||
|
@ -31,8 +31,8 @@ import {AlertModal} from "../../utils/modal/alert";
|
||||||
import {StatisticsService} from "../utils/services/statistics.service";
|
import {StatisticsService} from "../utils/services/statistics.service";
|
||||||
import {HelperFunctions} from "../../utils/HelperFunctions.class";
|
import {HelperFunctions} from "../../utils/HelperFunctions.class";
|
||||||
import {DomSanitizer, SafeResourceUrl} from "@angular/platform-browser";
|
import {DomSanitizer, SafeResourceUrl} from "@angular/platform-browser";
|
||||||
import {Reorder, StakeholderService} from "../../monitor/services/stakeholder.service";
|
import {MoveIndicator, SectionInfo, StakeholderService} from "../../monitor/services/stakeholder.service";
|
||||||
import {Observable, Subscriber} from "rxjs";
|
import {BehaviorSubject, Observable, Subscriber} from "rxjs";
|
||||||
import {LayoutService} from "../../dashboard/sharedComponents/sidebar/layout.service";
|
import {LayoutService} from "../../dashboard/sharedComponents/sidebar/layout.service";
|
||||||
import {Router} from "@angular/router";
|
import {Router} from "@angular/router";
|
||||||
import {Role, Session, User} from "../../login/utils/helper.class";
|
import {Role, Session, User} from "../../login/utils/helper.class";
|
||||||
|
@ -45,6 +45,7 @@ import {NotificationHandler} from "../../utils/notification-handler";
|
||||||
import {IndicatorStakeholderBaseComponent} from "../utils/stakeholder-base.component";
|
import {IndicatorStakeholderBaseComponent} from "../utils/stakeholder-base.component";
|
||||||
import {properties} from "../../../../environments/environment";
|
import {properties} from "../../../../environments/environment";
|
||||||
import {StatsProfilesService} from "../utils/services/stats-profiles.service";
|
import {StatsProfilesService} from "../utils/services/stats-profiles.service";
|
||||||
|
import {TransitionGroupComponent} from "../../utils/transition-group/transition-group.component";
|
||||||
|
|
||||||
declare var UIkit;
|
declare var UIkit;
|
||||||
declare var copy;
|
declare var copy;
|
||||||
|
@ -82,6 +83,8 @@ export class IndicatorsComponent extends IndicatorStakeholderBaseComponent imple
|
||||||
public index: number = -1;
|
public index: number = -1;
|
||||||
public editing: boolean = false;
|
public editing: boolean = false;
|
||||||
public dragging: boolean = false;
|
public dragging: boolean = false;
|
||||||
|
/* Reorder indicators */
|
||||||
|
public to: BehaviorSubject<SectionInfo> = new BehaviorSubject<SectionInfo>(null);
|
||||||
/** Caches */
|
/** Caches */
|
||||||
public safeUrls: Map<string, SafeResourceUrl> = new Map<string, SafeResourceUrl>([]);
|
public safeUrls: Map<string, SafeResourceUrl> = new Map<string, SafeResourceUrl>([]);
|
||||||
public numberResponses: Map<string, any> = new Map<string, any>();
|
public numberResponses: Map<string, any> = new Map<string, any>();
|
||||||
|
@ -94,12 +97,13 @@ export class IndicatorsComponent extends IndicatorStakeholderBaseComponent imple
|
||||||
public sectionTypeToDelete: string;
|
public sectionTypeToDelete: string;
|
||||||
public sectionChildrenActionOnDelete: string;
|
public sectionChildrenActionOnDelete: string;
|
||||||
public indicatorChildrenActionOnDelete: string;
|
public indicatorChildrenActionOnDelete: string;
|
||||||
urlParameterizedMessage = null;
|
|
||||||
showCheckForSchemaEnhancements: boolean = false;
|
|
||||||
private notification: Notification;
|
private notification: Notification;
|
||||||
@ViewChild('editNumberNotify', {static: true}) editNumberNotify: NotifyFormComponent;
|
@ViewChild('editNumberNotify', {static: true}) editNumberNotify: NotifyFormComponent;
|
||||||
@ViewChild('editChartNotify', {static: true}) editChartNotify: NotifyFormComponent;
|
@ViewChild('editChartNotify', {static: true}) editChartNotify: NotifyFormComponent;
|
||||||
@ViewChild('deleteNotify', {static: true}) deleteNotify: NotifyFormComponent;
|
@ViewChild('deleteNotify', {static: true}) deleteNotify: NotifyFormComponent;
|
||||||
|
/* Transition Groups */
|
||||||
|
@ViewChild('numbersTransition') numbersTransition: TransitionGroupComponent;
|
||||||
|
@ViewChild('chartsTransition') chartsTransition: TransitionGroupComponent;
|
||||||
|
|
||||||
public isFullscreen: boolean = false;
|
public isFullscreen: boolean = false;
|
||||||
|
|
||||||
|
@ -124,7 +128,6 @@ export class IndicatorsComponent extends IndicatorStakeholderBaseComponent imple
|
||||||
private notificationService: NotificationService,
|
private notificationService: NotificationService,
|
||||||
private fb: UntypedFormBuilder,
|
private fb: UntypedFormBuilder,
|
||||||
protected _router: Router,
|
protected _router: Router,
|
||||||
private cdr: ChangeDetectorRef,
|
|
||||||
private sanitizer: DomSanitizer) {
|
private sanitizer: DomSanitizer) {
|
||||||
super()
|
super()
|
||||||
this.filesToUpload = [];
|
this.filesToUpload = [];
|
||||||
|
@ -186,7 +189,7 @@ export class IndicatorsComponent extends IndicatorStakeholderBaseComponent imple
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
if (document !== undefined) {
|
if (document !== undefined) {
|
||||||
let callback = (list, type: IndicatorType, action: 'moved' | 'added' | 'removed'): void => {
|
let callback = (list): string[] => {
|
||||||
let items: HTMLCollection = list.current.children;
|
let items: HTMLCollection = list.current.children;
|
||||||
let reordered = [];
|
let reordered = [];
|
||||||
for (let i = 0; i < items.length; i++) {
|
for (let i = 0; i < items.length; i++) {
|
||||||
|
@ -194,12 +197,7 @@ export class IndicatorsComponent extends IndicatorStakeholderBaseComponent imple
|
||||||
reordered.push(items.item(i).id);
|
reordered.push(items.item(i).id);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
let reorder: Reorder = {
|
return reordered;
|
||||||
action: action,
|
|
||||||
target: list.detail[1].id,
|
|
||||||
ids: reordered
|
|
||||||
}
|
|
||||||
this.reorderIndicators(list.current.id.toString().split('-')[1], type, reorder);
|
|
||||||
};
|
};
|
||||||
this.numbers.forEach((section) => {
|
this.numbers.forEach((section) => {
|
||||||
this.subscriptions.push(UIkit.util.on(document, 'start', '#number-' + section._id, (): void => {
|
this.subscriptions.push(UIkit.util.on(document, 'start', '#number-' + section._id, (): void => {
|
||||||
|
@ -209,24 +207,32 @@ export class IndicatorsComponent extends IndicatorStakeholderBaseComponent imple
|
||||||
this.dragging = false;
|
this.dragging = false;
|
||||||
}));
|
}));
|
||||||
this.subscriptions.push(UIkit.util.on(document, 'moved', '#number-' + section._id, (list): void => {
|
this.subscriptions.push(UIkit.util.on(document, 'moved', '#number-' + section._id, (list): void => {
|
||||||
callback(list, "number", 'moved');
|
this.reorderIndicators(section._id, 'number', callback(list));
|
||||||
}));
|
}));
|
||||||
this.subscriptions.push(UIkit.util.on(document, 'added', '#number-' + section._id, (list): void => {
|
this.subscriptions.push(UIkit.util.on(document, 'added', '#number-' + section._id, (list): void => {
|
||||||
callback(list, "number", 'added');
|
this.to.next({id: section._id, indicators: callback(list)});
|
||||||
}));
|
}));
|
||||||
this.subscriptions.push(UIkit.util.on(document, 'removed', '#number-' + section._id, (list): void => {
|
this.subscriptions.push(UIkit.util.on(document, 'removed', '#number-' + section._id, (list): void => {
|
||||||
callback(list, "number", 'removed');
|
let sub = this.to.asObservable().subscribe(to => {
|
||||||
|
if (to) {
|
||||||
|
let from: SectionInfo = {id: section._id, indicators: callback(list)};
|
||||||
|
this.moveIndicator({target: list.detail[1].id, from: from, to: to});
|
||||||
|
setTimeout(() => {
|
||||||
|
sub.unsubscribe();
|
||||||
|
})
|
||||||
|
}
|
||||||
|
})
|
||||||
}));
|
}));
|
||||||
});
|
});
|
||||||
this.charts.forEach((section) => {
|
this.charts.forEach((section) => {
|
||||||
this.subscriptions.push(UIkit.util.on(document, 'moved', '#chart-' + section._id, (list): void => {
|
this.subscriptions.push(UIkit.util.on(document, 'moved', '#chart-' + section._id, (list): void => {
|
||||||
callback(list, "chart", 'moved');
|
this.reorderIndicators(section._id, 'chart', callback(list));
|
||||||
}));
|
}));
|
||||||
this.subscriptions.push(UIkit.util.on(document, 'added', '#chart-' + section._id, (list): void => {
|
this.subscriptions.push(UIkit.util.on(document, 'added', '#chart-' + section._id, (list): void => {
|
||||||
callback(list, "chart", 'added');
|
//callback(list, "chart", 'added');
|
||||||
}));
|
}));
|
||||||
this.subscriptions.push(UIkit.util.on(document, 'removed', '#chart-' + section._id, (list): void => {
|
this.subscriptions.push(UIkit.util.on(document, 'removed', '#chart-' + section._id, (list): void => {
|
||||||
callback(list, "chart", 'removed');
|
// callback(list, "chart", 'removed');
|
||||||
}));
|
}));
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@ -263,7 +269,7 @@ export class IndicatorsComponent extends IndicatorStakeholderBaseComponent imple
|
||||||
setNumbers() {
|
setNumbers() {
|
||||||
this.numberSections = this.fb.array([]);
|
this.numberSections = this.fb.array([]);
|
||||||
this.numberResults.clear();
|
this.numberResults.clear();
|
||||||
let urls: Map<string, [number, number][]> = new Map<string, [number, number][]>();
|
let urls: Map<string, [number, number, number][]> = new Map<string, [number, number, number][]>();
|
||||||
this.numbers.forEach((section, i) => {
|
this.numbers.forEach((section, i) => {
|
||||||
this.numberSections.push(this.fb.group({
|
this.numberSections.push(this.fb.group({
|
||||||
_id: this.fb.control(section._id),
|
_id: this.fb.control(section._id),
|
||||||
|
@ -275,11 +281,13 @@ export class IndicatorsComponent extends IndicatorStakeholderBaseComponent imple
|
||||||
indicators: this.fb.control(section.indicators)
|
indicators: this.fb.control(section.indicators)
|
||||||
}));
|
}));
|
||||||
section.indicators.forEach((number, j) => {
|
section.indicators.forEach((number, j) => {
|
||||||
let url = this.indicatorUtils.getFullUrl(this.stakeholder, number.indicatorPaths[0]);
|
number.indicatorPaths.forEach((indicatorPath, k) => {
|
||||||
const pair = JSON.stringify([number.indicatorPaths[0].source, url]);
|
let url = this.indicatorUtils.getFullUrl(this.stakeholder, indicatorPath);
|
||||||
const indexes = urls.get(pair) ? urls.get(pair) : [];
|
const pair = JSON.stringify([indicatorPath.source, url]);
|
||||||
indexes.push([i, j]);
|
const indexes = urls.get(pair) ? urls.get(pair) : [];
|
||||||
urls.set(pair, indexes);
|
indexes.push([i, j, k]);
|
||||||
|
urls.set(pair, indexes);
|
||||||
|
});
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
this.numberSubscription.forEach(value => {
|
this.numberSubscription.forEach(value => {
|
||||||
|
@ -301,10 +309,10 @@ export class IndicatorsComponent extends IndicatorStakeholderBaseComponent imple
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
private calculateResults(response: any, indexes: [number, number][]) {
|
private calculateResults(response: any, indexes: [number, number, number][]) {
|
||||||
indexes.forEach(([i, j]) => {
|
indexes.forEach(([i, j, k]) => {
|
||||||
let result = JSON.parse(JSON.stringify(response));
|
let result = JSON.parse(JSON.stringify(response));
|
||||||
this.numbers[i].indicators[j].indicatorPaths[0].jsonPath.forEach(jsonPath => {
|
this.numbers[i].indicators[j].indicatorPaths[k].jsonPath.forEach(jsonPath => {
|
||||||
if (result) {
|
if (result) {
|
||||||
result = result[jsonPath];
|
result = result[jsonPath];
|
||||||
}
|
}
|
||||||
|
@ -317,14 +325,14 @@ export class IndicatorsComponent extends IndicatorStakeholderBaseComponent imple
|
||||||
} else {
|
} else {
|
||||||
result = 0;
|
result = 0;
|
||||||
}
|
}
|
||||||
this.numberResults.set(i + '-' + j, result);
|
this.numberResults.set(i + '-' + j + '-' + k, result);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
get charts(): Section[] {
|
get charts(): Section[] {
|
||||||
if (this.stakeholder.topics[this.topicIndex] &&
|
if (this.stakeholder.topics[this.topicIndex] &&
|
||||||
this.stakeholder.topics[this.topicIndex].categories[this.categoryIndex] &&
|
this.stakeholder.topics[this.topicIndex].categories[this.categoryIndex] &&
|
||||||
this.stakeholder.topics[this.topicIndex].categories[this.categoryIndex].subCategories[this.subcategoryIndex]) {
|
this.stakeholder.topics[this.topicIndex].categories[this.categoryIndex].subCategories[this.subcategoryIndex]) {
|
||||||
return this.stakeholder.topics[this.topicIndex].categories[this.categoryIndex].subCategories[this.subcategoryIndex].charts;
|
return this.stakeholder.topics[this.topicIndex].categories[this.categoryIndex].subCategories[this.subcategoryIndex].charts;
|
||||||
} else {
|
} else {
|
||||||
return [];
|
return [];
|
||||||
|
@ -333,8 +341,8 @@ export class IndicatorsComponent extends IndicatorStakeholderBaseComponent imple
|
||||||
|
|
||||||
get numbers(): Section[] {
|
get numbers(): Section[] {
|
||||||
if (this.stakeholder.topics[this.topicIndex] &&
|
if (this.stakeholder.topics[this.topicIndex] &&
|
||||||
this.stakeholder.topics[this.topicIndex].categories[this.categoryIndex] &&
|
this.stakeholder.topics[this.topicIndex].categories[this.categoryIndex] &&
|
||||||
this.stakeholder.topics[this.topicIndex].categories[this.categoryIndex].subCategories[this.subcategoryIndex]) {
|
this.stakeholder.topics[this.topicIndex].categories[this.categoryIndex].subCategories[this.subcategoryIndex]) {
|
||||||
return this.stakeholder.topics[this.topicIndex].categories[this.categoryIndex].subCategories[this.subcategoryIndex].numbers;
|
return this.stakeholder.topics[this.topicIndex].categories[this.categoryIndex].subCategories[this.subcategoryIndex].numbers;
|
||||||
} else {
|
} else {
|
||||||
return [];
|
return [];
|
||||||
|
@ -351,9 +359,9 @@ export class IndicatorsComponent extends IndicatorStakeholderBaseComponent imple
|
||||||
|
|
||||||
get canEdit() {
|
get canEdit() {
|
||||||
return this.stakeholder &&
|
return this.stakeholder &&
|
||||||
this.stakeholder.topics[this.topicIndex] &&
|
this.stakeholder.topics[this.topicIndex] &&
|
||||||
this.stakeholder.topics[this.topicIndex].categories[this.categoryIndex] &&
|
this.stakeholder.topics[this.topicIndex].categories[this.categoryIndex] &&
|
||||||
this.stakeholder.topics[this.topicIndex].categories[this.categoryIndex].subCategories[this.subcategoryIndex] && !this.loading;
|
this.stakeholder.topics[this.topicIndex].categories[this.categoryIndex].subCategories[this.subcategoryIndex] && !this.loading;
|
||||||
}
|
}
|
||||||
|
|
||||||
public get numberIndicatorPaths(): UntypedFormArray {
|
public get numberIndicatorPaths(): UntypedFormArray {
|
||||||
|
@ -364,6 +372,14 @@ export class IndicatorsComponent extends IndicatorStakeholderBaseComponent imple
|
||||||
return this.chartIndicatorFb.get('indicatorPaths') as UntypedFormArray;
|
return this.chartIndicatorFb.get('indicatorPaths') as UntypedFormArray;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public getActiveIndicatorPath(indicator: Indicator) {
|
||||||
|
if (indicator.activePath) {
|
||||||
|
return indicator.indicatorPaths[indicator.activePath];
|
||||||
|
} else {
|
||||||
|
return indicator.indicatorPaths[0];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public getNumberClassBySize(size: IndicatorSize) {
|
public getNumberClassBySize(size: IndicatorSize) {
|
||||||
if (size === 'small') {
|
if (size === 'small') {
|
||||||
return 'uk-width-medium@m uk-width-1-1';
|
return 'uk-width-medium@m uk-width-1-1';
|
||||||
|
@ -460,7 +476,7 @@ export class IndicatorsComponent extends IndicatorStakeholderBaseComponent imple
|
||||||
}
|
}
|
||||||
|
|
||||||
public getParameters(index: number, type: IndicatorType = 'chart'): UntypedFormArray {
|
public getParameters(index: number, type: IndicatorType = 'chart'): UntypedFormArray {
|
||||||
if(type === 'chart') {
|
if (type === 'chart') {
|
||||||
return this.chartIndicatorPaths.at(index).get('parameters') as UntypedFormArray;
|
return this.chartIndicatorPaths.at(index).get('parameters') as UntypedFormArray;
|
||||||
} else {
|
} else {
|
||||||
return this.numberIndicatorPaths.at(index).get('parameters') as UntypedFormArray;
|
return this.numberIndicatorPaths.at(index).get('parameters') as UntypedFormArray;
|
||||||
|
@ -473,7 +489,7 @@ export class IndicatorsComponent extends IndicatorStakeholderBaseComponent imple
|
||||||
|
|
||||||
private getSecureUrlByStakeHolder(indicatorPath: IndicatorPath) {
|
private getSecureUrlByStakeHolder(indicatorPath: IndicatorPath) {
|
||||||
return this.sanitizer.bypassSecurityTrustResourceUrl(
|
return this.sanitizer.bypassSecurityTrustResourceUrl(
|
||||||
this.indicatorUtils.getChartUrl(indicatorPath.source, this.indicatorUtils.getFullUrl(this.stakeholder, indicatorPath)));
|
this.indicatorUtils.getChartUrl(indicatorPath.source, this.indicatorUtils.getFullUrl(this.stakeholder, indicatorPath)));
|
||||||
}
|
}
|
||||||
|
|
||||||
private getUrlByStakeHolder(indicatorPath: IndicatorPath) {
|
private getUrlByStakeHolder(indicatorPath: IndicatorPath) {
|
||||||
|
@ -485,61 +501,57 @@ export class IndicatorsComponent extends IndicatorStakeholderBaseComponent imple
|
||||||
jsonPath.push(this.fb.control('', Validators.required));
|
jsonPath.push(this.fb.control('', Validators.required));
|
||||||
}
|
}
|
||||||
this.numberIndicatorPaths.push(this.fb.group({
|
this.numberIndicatorPaths.push(this.fb.group({
|
||||||
url: this.fb.control(url, [Validators.required, StringUtils.urlValidator()]),
|
url: this.fb.control(url, [Validators.required, StringUtils.urlValidator()]),
|
||||||
jsonPath: jsonPath,
|
jsonPath: jsonPath,
|
||||||
result: this.fb.control(0, Validators.required),
|
result: this.fb.control(0, Validators.required),
|
||||||
source: this.fb.control(source, Validators.required),
|
source: this.fb.control(source, Validators.required),
|
||||||
parameters: parameters,
|
parameters: parameters,
|
||||||
format: this.fb.control(format, Validators.required)
|
format: this.fb.control(format, Validators.required)
|
||||||
}
|
}
|
||||||
));
|
));
|
||||||
let index = this.numberIndicatorPaths.length - 1;
|
let index = this.numberIndicatorPaths.length - 1;
|
||||||
if (this.numberIndicatorPaths.at(index).get('url').valid) {
|
if (this.numberIndicatorPaths.at(index).get('url').valid) {
|
||||||
this.validateJsonPath(index);
|
this.validateJsonPath(index);
|
||||||
this.checkForSchemaEnhancements(this.numberIndicatorPaths.at(index).get('url').value);
|
|
||||||
}
|
}
|
||||||
if (this.indicator.defaultId === null) {
|
if (this.indicator.defaultId === null) {
|
||||||
this.subscriptions.push(this.numberIndicatorPaths.at(index).get('url').valueChanges.subscribe(value => {
|
this.subscriptions.push(this.numberIndicatorPaths.at(index).get('url').valueChanges.subscribe(value => {
|
||||||
this.numberIndicatorPaths.at(index).get('result').setValue(null);
|
this.numberIndicatorPaths.at(index).get('result').setValue(null);
|
||||||
if (this.numberIndicatorPaths.at(index).get('url').valid) {
|
if (this.numberIndicatorPaths.at(index).get('url').valid) {
|
||||||
let indicatorPath: IndicatorPath = this.indicatorUtils.generateIndicatorByNumberUrl(this.indicatorUtils.getNumberSource(value), value, this.stakeholder, this.numberIndicatorPaths.at(index).get('jsonPath').value, this.indicatorUtils.numberSources.get(this.indicatorUtils.getNumberSource(value)));
|
let indicatorPath: IndicatorPath = this.indicatorUtils.generateIndicatorByNumberUrl(this.indicatorUtils.getNumberSource(value), value, this.stakeholder, this.numberIndicatorPaths.at(index).get('jsonPath').value, this.indicatorUtils.numberSources.get(this.indicatorUtils.getNumberSource(value)));
|
||||||
this.checkForSchemaEnhancements(this.numberIndicatorPaths.at(index).get('url').value);
|
if (this.indicator.indicatorPaths[index]) {
|
||||||
if (this.indicator.indicatorPaths[index]) {
|
this.indicator.indicatorPaths[index] = indicatorPath;
|
||||||
this.indicator.indicatorPaths[index] = indicatorPath;
|
} else {
|
||||||
} else {
|
this.indicator.indicatorPaths.push(indicatorPath);
|
||||||
this.indicator.indicatorPaths.push(indicatorPath);
|
}
|
||||||
}
|
if (indicatorPath.source) {
|
||||||
if (indicatorPath.source) {
|
this.numberIndicatorPaths.at(index).get('source').setValue(indicatorPath.source);
|
||||||
this.numberIndicatorPaths.at(index).get('source').setValue(indicatorPath.source);
|
}
|
||||||
}
|
(this.numberIndicatorPaths.at(index) as UntypedFormGroup).setControl('parameters', this.getParametersAsFormArray(indicatorPath));
|
||||||
(this.numberIndicatorPaths.at(index) as UntypedFormGroup).setControl('parameters', this.getParametersAsFormArray(indicatorPath));
|
if (indicatorPath.jsonPath.length > 1 && this.getJsonPath(index).length == 1) {
|
||||||
if (indicatorPath.jsonPath.length > 1 && this.getJsonPath(index).length == 1) {
|
let paths = indicatorPath.jsonPath;
|
||||||
let paths = indicatorPath.jsonPath;
|
for (let i = 0; i < paths.length; i++) {
|
||||||
for (let i = 0; i < paths.length; i++) {
|
if (i == this.getJsonPath(index).length) {
|
||||||
if (i == this.getJsonPath(index).length) {
|
this.getJsonPath(index).push(this.fb.control('', Validators.required));
|
||||||
this.getJsonPath(index).push(this.fb.control('', Validators.required));
|
}
|
||||||
}
|
}
|
||||||
|
this.getJsonPath(index).setValue(paths)
|
||||||
}
|
}
|
||||||
this.getJsonPath(index).setValue(paths)
|
|
||||||
}
|
}
|
||||||
} else {
|
})
|
||||||
this.urlParameterizedMessage = null;
|
|
||||||
}
|
|
||||||
})
|
|
||||||
);
|
);
|
||||||
|
|
||||||
this.subscriptions.push(this.numberIndicatorPaths.at(index).get('jsonPath').valueChanges.subscribe(value => {
|
this.subscriptions.push(this.numberIndicatorPaths.at(index).get('jsonPath').valueChanges.subscribe(value => {
|
||||||
if (this.indicator.indicatorPaths[index]) {
|
if (this.indicator.indicatorPaths[index]) {
|
||||||
this.indicator.indicatorPaths[index].jsonPath = value;
|
this.indicator.indicatorPaths[index].jsonPath = value;
|
||||||
}
|
}
|
||||||
this.numberIndicatorPaths.at(index).get('result').setValue(null);
|
this.numberIndicatorPaths.at(index).get('result').setValue(null);
|
||||||
})
|
})
|
||||||
);
|
);
|
||||||
this.subscriptions.push(this.numberIndicatorPaths.at(index).get('source').valueChanges.subscribe(value => {
|
this.subscriptions.push(this.numberIndicatorPaths.at(index).get('source').valueChanges.subscribe(value => {
|
||||||
if (this.indicator.indicatorPaths[index]) {
|
if (this.indicator.indicatorPaths[index]) {
|
||||||
this.indicator.indicatorPaths[index].source = value;
|
this.indicator.indicatorPaths[index].source = value;
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
);
|
);
|
||||||
} else {
|
} else {
|
||||||
this.numberIndicatorPaths.at(index).get('url').disable();
|
this.numberIndicatorPaths.at(index).get('url').disable();
|
||||||
|
@ -550,20 +562,18 @@ export class IndicatorsComponent extends IndicatorStakeholderBaseComponent imple
|
||||||
|
|
||||||
public addChartIndicatorPath(value: string = '', parameters: UntypedFormArray = new UntypedFormArray([]), disableUrl: boolean = false, type: string = null) {
|
public addChartIndicatorPath(value: string = '', parameters: UntypedFormArray = new UntypedFormArray([]), disableUrl: boolean = false, type: string = null) {
|
||||||
this.chartIndicatorPaths.push(this.fb.group({
|
this.chartIndicatorPaths.push(this.fb.group({
|
||||||
url: this.fb.control(value, [Validators.required, StringUtils.urlValidator()]),
|
url: this.fb.control(value, [Validators.required, StringUtils.urlValidator()]),
|
||||||
parameters: parameters,
|
parameters: parameters,
|
||||||
type: this.fb.control(type)
|
type: this.fb.control(type)
|
||||||
}
|
}
|
||||||
));
|
));
|
||||||
let index = this.chartIndicatorPaths.length - 1;
|
let index = this.chartIndicatorPaths.length - 1;
|
||||||
if (disableUrl) {
|
if (disableUrl) {
|
||||||
this.chartIndicatorPaths.at(index).get('url').disable();
|
this.chartIndicatorPaths.at(index).get('url').disable();
|
||||||
} else {
|
} else {
|
||||||
this.checkForSchemaEnhancements(this.chartIndicatorPaths.at(index).get('url').value);
|
|
||||||
this.urlSubscriptions.push(this.chartIndicatorPaths.at(index).get('url').valueChanges.subscribe(value => {
|
this.urlSubscriptions.push(this.chartIndicatorPaths.at(index).get('url').valueChanges.subscribe(value => {
|
||||||
if (this.chartIndicatorPaths.at(index).get('url').valid) {
|
if (this.chartIndicatorPaths.at(index).get('url').valid) {
|
||||||
let indicatorPath: IndicatorPath = this.indicatorUtils.generateIndicatorByChartUrl(this.indicatorUtils.getChartSource(value), value, this.chartIndicatorPaths.at(index).get('type').value, this.stakeholder);
|
let indicatorPath: IndicatorPath = this.indicatorUtils.generateIndicatorByChartUrl(this.indicatorUtils.getChartSource(value), value, this.chartIndicatorPaths.at(index).get('type').value, this.stakeholder);
|
||||||
this.checkForSchemaEnhancements(this.chartIndicatorPaths.at(index).get('url').value);
|
|
||||||
(this.chartIndicatorPaths.at(index) as UntypedFormGroup).get('type').setValue(indicatorPath.type);
|
(this.chartIndicatorPaths.at(index) as UntypedFormGroup).get('type').setValue(indicatorPath.type);
|
||||||
(this.chartIndicatorPaths.at(index) as UntypedFormGroup).setControl('parameters', this.getParametersAsFormArray(indicatorPath));
|
(this.chartIndicatorPaths.at(index) as UntypedFormGroup).setControl('parameters', this.getParametersAsFormArray(indicatorPath));
|
||||||
if (!this.indicator.indicatorPaths[index]) {
|
if (!this.indicator.indicatorPaths[index]) {
|
||||||
|
@ -573,13 +583,75 @@ export class IndicatorsComponent extends IndicatorStakeholderBaseComponent imple
|
||||||
indicatorPath.safeResourceUrl = this.indicator.indicatorPaths[index].safeResourceUrl;
|
indicatorPath.safeResourceUrl = this.indicator.indicatorPaths[index].safeResourceUrl;
|
||||||
this.indicator.indicatorPaths[index] = indicatorPath;
|
this.indicator.indicatorPaths[index] = indicatorPath;
|
||||||
}
|
}
|
||||||
} else {
|
|
||||||
this.urlParameterizedMessage = null;
|
|
||||||
}
|
}
|
||||||
}));
|
}));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public removeNumberIndicatorPath(index: number) {
|
||||||
|
this.numberIndicatorPaths.removeAt(index);
|
||||||
|
this.indicator.indicatorPaths.splice(index, 1);
|
||||||
|
this.numbersTransition.init();
|
||||||
|
if (this.indicator.activePath === index) {
|
||||||
|
this.activeNumberIndicatorPath(Math.max(0, index - 1));
|
||||||
|
} else if (this.indicator.activePath > index) {
|
||||||
|
this.activeNumberIndicatorPath(this.indicator.activePath - 1);
|
||||||
|
}
|
||||||
|
this.numberIndicatorFb.markAsDirty();
|
||||||
|
}
|
||||||
|
|
||||||
|
public removeChartIndicatorPath(index: number) {
|
||||||
|
this.chartIndicatorPaths.removeAt(index);
|
||||||
|
this.indicator.indicatorPaths.splice(index, 1);
|
||||||
|
this.chartsTransition.init();
|
||||||
|
if (this.indicator.activePath === index) {
|
||||||
|
this.activeChartIndicatorPath(Math.max(0, index - 1));
|
||||||
|
} else if (this.indicator.activePath > index) {
|
||||||
|
this.activeChartIndicatorPath(this.indicator.activePath - 1);
|
||||||
|
}
|
||||||
|
this.chartIndicatorFb.markAsDirty();
|
||||||
|
}
|
||||||
|
|
||||||
|
public moveIndicatorPath(form: FormGroup,
|
||||||
|
type: 'number' | 'chart', index: number,
|
||||||
|
newIndex: number = index - 1) {
|
||||||
|
let indicatorPaths = type == 'number'?this.numberIndicatorPaths:this.chartIndicatorPaths;
|
||||||
|
if(type == 'number') {
|
||||||
|
this.numbersTransition.init();
|
||||||
|
} else {
|
||||||
|
this.chartsTransition.init();
|
||||||
|
}
|
||||||
|
let a = indicatorPaths.at(index);
|
||||||
|
let b = indicatorPaths.at(newIndex);
|
||||||
|
indicatorPaths.setControl(index, b);
|
||||||
|
indicatorPaths.setControl(newIndex, a);
|
||||||
|
HelperFunctions.swap(this.indicator.indicatorPaths, index, newIndex);
|
||||||
|
if (this.indicator.activePath === index) {
|
||||||
|
this.indicator.activePath = newIndex;
|
||||||
|
} else if (this.indicator.activePath === newIndex) {
|
||||||
|
this.indicator.activePath = index;
|
||||||
|
}
|
||||||
|
form.markAsDirty();
|
||||||
|
}
|
||||||
|
|
||||||
|
public activeNumberIndicatorPath(index: number) {
|
||||||
|
let paths = this.numberIndicatorPaths;
|
||||||
|
if (index == paths.length) {
|
||||||
|
this.addNumberIndicatorPath();
|
||||||
|
this.numbersTransition.init();
|
||||||
|
}
|
||||||
|
this.indicator.activePath = index;
|
||||||
|
}
|
||||||
|
|
||||||
|
public activeChartIndicatorPath(index: number) {
|
||||||
|
let paths = this.chartIndicatorPaths;
|
||||||
|
if (index == paths.length) {
|
||||||
|
this.addChartIndicatorPath();
|
||||||
|
this.chartsTransition.init();
|
||||||
|
}
|
||||||
|
this.indicator.activePath = index;
|
||||||
|
}
|
||||||
|
|
||||||
private getJsonPathAsFormArray(indicatorPath: IndicatorPath): UntypedFormArray {
|
private getJsonPathAsFormArray(indicatorPath: IndicatorPath): UntypedFormArray {
|
||||||
let jsonPath = this.fb.array([]);
|
let jsonPath = this.fb.array([]);
|
||||||
if (indicatorPath.jsonPath) {
|
if (indicatorPath.jsonPath) {
|
||||||
|
@ -593,6 +665,9 @@ export class IndicatorsComponent extends IndicatorStakeholderBaseComponent imple
|
||||||
private getParametersAsFormArray(indicatorPath: IndicatorPath): UntypedFormArray {
|
private getParametersAsFormArray(indicatorPath: IndicatorPath): UntypedFormArray {
|
||||||
let parameters = this.fb.array([]);
|
let parameters = this.fb.array([]);
|
||||||
if (indicatorPath.parameters) {
|
if (indicatorPath.parameters) {
|
||||||
|
if(!indicatorPath.parameters.statsProfile) {
|
||||||
|
indicatorPath.parameters.statsProfile = null;
|
||||||
|
}
|
||||||
Object.keys(indicatorPath.parameters).forEach(key => {
|
Object.keys(indicatorPath.parameters).forEach(key => {
|
||||||
if (this.indicatorUtils.ignoredParameters.indexOf(key) === -1) {
|
if (this.indicatorUtils.ignoredParameters.indexOf(key) === -1) {
|
||||||
if (this.indicatorUtils.parametersValidators.has(key)) {
|
if (this.indicatorUtils.parametersValidators.has(key)) {
|
||||||
|
@ -613,7 +688,21 @@ export class IndicatorsComponent extends IndicatorStakeholderBaseComponent imple
|
||||||
}
|
}
|
||||||
|
|
||||||
public editNumberIndicatorOpen(section: Section, id = null) {
|
public editNumberIndicatorOpen(section: Section, id = null) {
|
||||||
this.urlParameterizedMessage = null;
|
this.editNumberModal.cancelButtonText = 'Cancel';
|
||||||
|
this.editNumberModal.okButtonLeft = false;
|
||||||
|
this.editNumberModal.alertMessage = false;
|
||||||
|
if (this.index === -1) {
|
||||||
|
this.editNumberModal.alertTitle = 'Create a new number indicator';
|
||||||
|
this.editNumberModal.okButtonText = 'Save';
|
||||||
|
this.notification = NotificationUtils.createIndicator(this.user.firstname + ' ' + this.user.lastname, this.stakeholder.name);
|
||||||
|
this.editNumberNotify.reset(this.notification.message);
|
||||||
|
} else {
|
||||||
|
this.editNumberModal.alertTitle = 'Edit number indicator\'s information';
|
||||||
|
this.editNumberModal.okButtonText = 'Save Changes';
|
||||||
|
this.notification = NotificationUtils.editIndicator(this.user.firstname + ' ' + this.user.lastname, this.stakeholder.name);
|
||||||
|
this.editNumberNotify.reset(this.notification.message);
|
||||||
|
}
|
||||||
|
this.editNumberModal.stayOpen = true;
|
||||||
this.section = section;
|
this.section = section;
|
||||||
this.index = (id) ? section.indicators.findIndex(value => value._id === id) : -1;
|
this.index = (id) ? section.indicators.findIndex(value => value._id === id) : -1;
|
||||||
if (this.index !== -1) {
|
if (this.index !== -1) {
|
||||||
|
@ -655,26 +744,26 @@ export class IndicatorsComponent extends IndicatorStakeholderBaseComponent imple
|
||||||
this.numberIndicatorFb.get('description').disable();
|
this.numberIndicatorFb.get('description').disable();
|
||||||
}, 0);
|
}, 0);
|
||||||
}
|
}
|
||||||
this.editNumberModal.cancelButtonText = 'Cancel';
|
|
||||||
this.editNumberModal.okButtonLeft = false;
|
|
||||||
this.editNumberModal.alertMessage = false;
|
|
||||||
if (this.index === -1) {
|
|
||||||
this.editNumberModal.alertTitle = 'Create a new number indicator';
|
|
||||||
this.editNumberModal.okButtonText = 'Save';
|
|
||||||
this.notification = NotificationUtils.createIndicator(this.user.firstname + ' ' + this.user.lastname, this.stakeholder.name);
|
|
||||||
this.editNumberNotify.reset(this.notification.message);
|
|
||||||
} else {
|
|
||||||
this.editNumberModal.alertTitle = 'Edit number indicator\'s information';
|
|
||||||
this.editNumberModal.okButtonText = 'Save Changes';
|
|
||||||
this.notification = NotificationUtils.editIndicator(this.user.firstname + ' ' + this.user.lastname, this.stakeholder.name);
|
|
||||||
this.editNumberNotify.reset(this.notification.message);
|
|
||||||
}
|
|
||||||
this.editNumberModal.stayOpen = true;
|
|
||||||
this.editNumberModal.open();
|
this.editNumberModal.open();
|
||||||
}
|
}
|
||||||
|
|
||||||
public editChartIndicatorOpen(section: Section, id = null) {
|
public editChartIndicatorOpen(section: Section, id = null) {
|
||||||
this.urlParameterizedMessage = null;
|
this.editChartModal.cancelButtonText = 'Cancel';
|
||||||
|
this.editChartModal.okButtonLeft = false;
|
||||||
|
this.editChartModal.alertMessage = false;
|
||||||
|
if (this.index === -1) {
|
||||||
|
this.editChartModal.alertTitle = 'Create a new chart indicator';
|
||||||
|
this.editChartModal.okButtonText = 'Save';
|
||||||
|
this.notification = NotificationUtils.createIndicator(this.user.firstname + ' ' + this.user.lastname, this.stakeholder.name);
|
||||||
|
this.editChartNotify.reset(this.notification.message);
|
||||||
|
} else {
|
||||||
|
this.editChartModal.alertTitle = 'Edit chart indicator\'s information';
|
||||||
|
this.editChartModal.okButtonText = 'Save Changes';
|
||||||
|
this.notification = NotificationUtils.editIndicator(this.user.firstname + ' ' + this.user.lastname, this.stakeholder.name);
|
||||||
|
;
|
||||||
|
this.editChartNotify.reset(this.notification.message);
|
||||||
|
}
|
||||||
|
this.editChartModal.stayOpen = true;
|
||||||
this.urlSubscriptions.forEach(value => {
|
this.urlSubscriptions.forEach(value => {
|
||||||
if (value instanceof Subscriber) {
|
if (value instanceof Subscriber) {
|
||||||
value.unsubscribe();
|
value.unsubscribe();
|
||||||
|
@ -698,7 +787,7 @@ export class IndicatorsComponent extends IndicatorStakeholderBaseComponent imple
|
||||||
});
|
});
|
||||||
this.indicator.indicatorPaths.forEach(indicatorPath => {
|
this.indicator.indicatorPaths.forEach(indicatorPath => {
|
||||||
this.addChartIndicatorPath(this.getUrlByStakeHolder(indicatorPath),
|
this.addChartIndicatorPath(this.getUrlByStakeHolder(indicatorPath),
|
||||||
this.getParametersAsFormArray(indicatorPath), this.indicator.defaultId !== null, indicatorPath.type);
|
this.getParametersAsFormArray(indicatorPath), this.indicator.defaultId !== null, indicatorPath.type);
|
||||||
indicatorPath.safeResourceUrl = this.getSecureUrlByStakeHolder(indicatorPath);
|
indicatorPath.safeResourceUrl = this.getSecureUrlByStakeHolder(indicatorPath);
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
|
@ -721,22 +810,6 @@ export class IndicatorsComponent extends IndicatorStakeholderBaseComponent imple
|
||||||
this.chartIndicatorFb.get('description').disable();
|
this.chartIndicatorFb.get('description').disable();
|
||||||
}, 0);
|
}, 0);
|
||||||
}
|
}
|
||||||
this.editChartModal.cancelButtonText = 'Cancel';
|
|
||||||
this.editChartModal.okButtonLeft = false;
|
|
||||||
this.editChartModal.alertMessage = false;
|
|
||||||
if (this.index === -1) {
|
|
||||||
this.editChartModal.alertTitle = 'Create a new chart indicator';
|
|
||||||
this.editChartModal.okButtonText = 'Save';
|
|
||||||
this.notification = NotificationUtils.createIndicator(this.user.firstname + ' ' + this.user.lastname, this.stakeholder.name);
|
|
||||||
this.editChartNotify.reset(this.notification.message);
|
|
||||||
} else {
|
|
||||||
this.editChartModal.alertTitle = 'Edit chart indicator\'s information';
|
|
||||||
this.editChartModal.okButtonText = 'Save Changes';
|
|
||||||
this.notification = NotificationUtils.editIndicator(this.user.firstname + ' ' + this.user.lastname, this.stakeholder.name);
|
|
||||||
;
|
|
||||||
this.editChartNotify.reset(this.notification.message);
|
|
||||||
}
|
|
||||||
this.editChartModal.stayOpen = true;
|
|
||||||
this.editChartModal.open();
|
this.editChartModal.open();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -836,7 +909,7 @@ export class IndicatorsComponent extends IndicatorStakeholderBaseComponent imple
|
||||||
this.setCharts();
|
this.setCharts();
|
||||||
this.setNumbers();
|
this.setNumbers();
|
||||||
this.initReorder();
|
this.initReorder();
|
||||||
if(properties.notificationsAPIURL) {
|
if (properties.notificationsAPIURL) {
|
||||||
this.notification = NotificationUtils.importIndicators(this.user.fullname, this.stakeholder.alias);
|
this.notification = NotificationUtils.importIndicators(this.user.fullname, this.stakeholder.alias);
|
||||||
this.notification.entity = this.stakeholder.topics[this.topicIndex].categories[this.categoryIndex].subCategories[this.index]._id;
|
this.notification.entity = this.stakeholder.topics[this.topicIndex].categories[this.categoryIndex].subCategories[this.index]._id;
|
||||||
this.notification.name = this.user.firstname;
|
this.notification.name = this.user.firstname;
|
||||||
|
@ -889,7 +962,23 @@ export class IndicatorsComponent extends IndicatorStakeholderBaseComponent imple
|
||||||
this.loading = false;
|
this.loading = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
reorderIndicators(sectionId: string, type: IndicatorType, reorder: Reorder) {
|
moveIndicator(moveIndicator: MoveIndicator) {
|
||||||
|
this.editing = true;
|
||||||
|
let path = [
|
||||||
|
this.stakeholder._id,
|
||||||
|
this.stakeholder.topics[this.topicIndex]._id,
|
||||||
|
this.stakeholder.topics[this.topicIndex].categories[this.categoryIndex]._id,
|
||||||
|
this.stakeholder.topics[this.topicIndex].categories[this.categoryIndex].subCategories[this.subcategoryIndex]._id
|
||||||
|
];
|
||||||
|
this.subscriptions.push(this.stakeholderService.moveIndicator(this.properties.monitorServiceAPIURL, path, moveIndicator).subscribe(subCategory => {
|
||||||
|
this.stakeholder.topics[this.topicIndex].categories[this.categoryIndex].subCategories[this.subcategoryIndex] = subCategory;
|
||||||
|
this.setCharts();
|
||||||
|
this.setNumbers();
|
||||||
|
this.editing = false;
|
||||||
|
}));
|
||||||
|
}
|
||||||
|
|
||||||
|
reorderIndicators(sectionId: string, type: IndicatorType, indicators: string[]) {
|
||||||
this.editing = true;
|
this.editing = true;
|
||||||
let path = [
|
let path = [
|
||||||
this.stakeholder._id,
|
this.stakeholder._id,
|
||||||
|
@ -898,7 +987,7 @@ export class IndicatorsComponent extends IndicatorStakeholderBaseComponent imple
|
||||||
this.stakeholder.topics[this.topicIndex].categories[this.categoryIndex].subCategories[this.subcategoryIndex]._id,
|
this.stakeholder.topics[this.topicIndex].categories[this.categoryIndex].subCategories[this.subcategoryIndex]._id,
|
||||||
sectionId
|
sectionId
|
||||||
];
|
];
|
||||||
this.subscriptions.push(this.stakeholderService.reorderIndicators(this.properties.monitorServiceAPIURL, path, reorder, type).subscribe(indicators => {
|
this.subscriptions.push(this.stakeholderService.reorderIndicators(this.properties.monitorServiceAPIURL, path, indicators).subscribe(indicators => {
|
||||||
if (type === 'chart') {
|
if (type === 'chart') {
|
||||||
this.charts.find(section => section._id === sectionId).indicators = indicators;
|
this.charts.find(section => section._id === sectionId).indicators = indicators;
|
||||||
this.setCharts();
|
this.setCharts();
|
||||||
|
@ -912,7 +1001,7 @@ export class IndicatorsComponent extends IndicatorStakeholderBaseComponent imple
|
||||||
|
|
||||||
hasDifference(index: number, type: IndicatorType = 'chart'): boolean {
|
hasDifference(index: number, type: IndicatorType = 'chart'): boolean {
|
||||||
let hasDifference = false;
|
let hasDifference = false;
|
||||||
if(type === 'chart') {
|
if (type === 'chart') {
|
||||||
this.chartIndicatorPaths.at(index).value.parameters.forEach(parameter => {
|
this.chartIndicatorPaths.at(index).value.parameters.forEach(parameter => {
|
||||||
if (parameter.value !== this.indicator.indicatorPaths[index].parameters[parameter.key]) {
|
if (parameter.value !== this.indicator.indicatorPaths[index].parameters[parameter.key]) {
|
||||||
hasDifference = true;
|
hasDifference = true;
|
||||||
|
@ -921,7 +1010,7 @@ export class IndicatorsComponent extends IndicatorStakeholderBaseComponent imple
|
||||||
});
|
});
|
||||||
return hasDifference || this.indicator.indicatorPaths[index].safeResourceUrl.toString() !==
|
return hasDifference || this.indicator.indicatorPaths[index].safeResourceUrl.toString() !==
|
||||||
this.getSecureUrlByStakeHolder(this.indicator.indicatorPaths[index]).toString();
|
this.getSecureUrlByStakeHolder(this.indicator.indicatorPaths[index]).toString();
|
||||||
} else if(type === 'number') {
|
} else if (type === 'number') {
|
||||||
let indicatorPath = this.numberIndicatorPaths.at(index).value;
|
let indicatorPath = this.numberIndicatorPaths.at(index).value;
|
||||||
indicatorPath.parameters.forEach(parameter => {
|
indicatorPath.parameters.forEach(parameter => {
|
||||||
if (parameter.value !== this.indicator.indicatorPaths[index].parameters[parameter.key]) {
|
if (parameter.value !== this.indicator.indicatorPaths[index].parameters[parameter.key]) {
|
||||||
|
@ -942,12 +1031,12 @@ export class IndicatorsComponent extends IndicatorStakeholderBaseComponent imple
|
||||||
}
|
}
|
||||||
|
|
||||||
refreshIndicator(type: IndicatorType = 'chart') {
|
refreshIndicator(type: IndicatorType = 'chart') {
|
||||||
if(type === 'chart') {
|
if (type === 'chart') {
|
||||||
this.indicator = this.indicatorUtils.generateIndicatorByForm(this.chartIndicatorFb.value, this.indicator.indicatorPaths, 'chart');
|
this.indicator = this.indicatorUtils.generateIndicatorByForm(this.chartIndicatorFb.value, this.indicator.indicatorPaths, 'chart');
|
||||||
this.indicator.indicatorPaths.forEach(indicatorPath => {
|
this.indicator.indicatorPaths.forEach(indicatorPath => {
|
||||||
indicatorPath.safeResourceUrl = this.getSecureUrlByStakeHolder(indicatorPath);
|
indicatorPath.safeResourceUrl = this.getSecureUrlByStakeHolder(indicatorPath);
|
||||||
});
|
});
|
||||||
} else if(type === 'number') {
|
} else if (type === 'number') {
|
||||||
this.indicator = this.indicatorUtils.generateIndicatorByForm(this.numberIndicatorFb.value, this.indicator.indicatorPaths, 'number');
|
this.indicator = this.indicatorUtils.generateIndicatorByForm(this.numberIndicatorFb.value, this.indicator.indicatorPaths, 'number');
|
||||||
this.indicator.indicatorPaths.forEach((indicatorPath, index) => {
|
this.indicator.indicatorPaths.forEach((indicatorPath, index) => {
|
||||||
this.validateJsonPath(index);
|
this.validateJsonPath(index);
|
||||||
|
@ -1191,10 +1280,6 @@ export class IndicatorsComponent extends IndicatorStakeholderBaseComponent imple
|
||||||
}));
|
}));
|
||||||
}
|
}
|
||||||
|
|
||||||
private checkForSchemaEnhancements(url: string) {
|
|
||||||
this.showCheckForSchemaEnhancements = this.isAdministrator && url && !this.properties.useOldStatisticsSchema && this.indicatorUtils.checkForSchemaEnhancements(url) && this.properties.dashboard != 'irish';
|
|
||||||
}
|
|
||||||
|
|
||||||
migrateFromOldImportJsonFile(charts) {
|
migrateFromOldImportJsonFile(charts) {
|
||||||
// first section contains numbers
|
// first section contains numbers
|
||||||
// second contains charts
|
// second contains charts
|
||||||
|
@ -1210,6 +1295,11 @@ export class IndicatorsComponent extends IndicatorStakeholderBaseComponent imple
|
||||||
if (chart['sectionIndex'] == null) {
|
if (chart['sectionIndex'] == null) {
|
||||||
chart['sectionIndex'] = chart['type'] == 'chart' ? chartsSection : 0;
|
chart['sectionIndex'] = chart['type'] == 'chart' ? chartsSection : 0;
|
||||||
}
|
}
|
||||||
|
if (chart.url && chart.jsonPath) {
|
||||||
|
chart.indicatorPaths = [{url: chart.url, jsonPath: chart.jsonPath}];
|
||||||
|
} else if(chart.url) {
|
||||||
|
chart.indicatorPaths = [{url: chart.url}];
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return charts;
|
return charts;
|
||||||
}
|
}
|
||||||
|
@ -1217,7 +1307,7 @@ export class IndicatorsComponent extends IndicatorStakeholderBaseComponent imple
|
||||||
importIndicatorsAndSave(stakeholder: Stakeholder, charts: any[]) {
|
importIndicatorsAndSave(stakeholder: Stakeholder, charts: any[]) {
|
||||||
let sectionsToSave: Section[] = [];
|
let sectionsToSave: Section[] = [];
|
||||||
let countIndicators = 0;
|
let countIndicators = 0;
|
||||||
if(stakeholder.type !== this.stakeholder.type) {
|
if (stakeholder.type !== this.stakeholder.type) {
|
||||||
UIkit.notification("The type of this profile is not the same with the file's one!", {
|
UIkit.notification("The type of this profile is not the same with the file's one!", {
|
||||||
status: 'warning',
|
status: 'warning',
|
||||||
timeout: 6000,
|
timeout: 6000,
|
||||||
|
@ -1230,23 +1320,25 @@ export class IndicatorsComponent extends IndicatorStakeholderBaseComponent imple
|
||||||
let duplicates = 0;
|
let duplicates = 0;
|
||||||
charts = this.migrateFromOldImportJsonFile(charts);
|
charts = this.migrateFromOldImportJsonFile(charts);
|
||||||
for (let chart of charts) {
|
for (let chart of charts) {
|
||||||
chart.visibility = this.showVisibility?chart.visibility:this.stakeholderUtils.defaultValue(this.stakeholderUtils.visibilities);
|
chart.visibility = this.showVisibility ? chart.visibility : this.stakeholderUtils.defaultValue(this.stakeholderUtils.visibilities);
|
||||||
if (!sectionsToSave[chart['sectionIndex']]) {
|
if (!sectionsToSave[chart['sectionIndex']]) {
|
||||||
let sectionToSave = new Section(chart['sectionType'] ? chart['sectionType'] : chart['type'], chart['sectionTitle']);
|
let sectionToSave = new Section(chart['sectionType'] ? chart['sectionType'] : chart['type'], chart['sectionTitle']);
|
||||||
sectionToSave.indicators = [];
|
sectionToSave.indicators = [];
|
||||||
sectionsToSave[chart['sectionIndex']] = sectionToSave;
|
sectionsToSave[chart['sectionIndex']] = sectionToSave;
|
||||||
}
|
}
|
||||||
let exists = false;
|
let exists = false;
|
||||||
let indicatorPath;
|
let indicatorPaths: IndicatorPath[] = [];
|
||||||
// validate indicators' schema from file
|
// validate indicators' schema from file
|
||||||
let invalid_file_message;
|
let invalid_file_message;
|
||||||
if (!chart.type) {
|
if (!chart.type) {
|
||||||
invalid_file_message = "No indicator type is specified. Type should be chart or number.";
|
invalid_file_message = "No indicator type is specified. Type should be chart or number.";
|
||||||
} else if (chart.type != "chart" && chart.type != "number") {
|
} else if (chart.type != "chart" && chart.type != "number") {
|
||||||
invalid_file_message = "Invalid indicator type. Type should be chart or number.";
|
invalid_file_message = "Invalid indicator type. Type should be chart or number.";
|
||||||
} else if (chart.type == "number" && !chart.jsonPath) {
|
} else if (chart.indicatorPaths.length === 0) {
|
||||||
|
invalid_file_message = "No indicator paths are specified."
|
||||||
|
} else if (chart.type == "number" && chart.indicatorPaths.filter(path => !path.jsonPath).length > 0) {
|
||||||
invalid_file_message = "No jsonPath is specified for number indicator."
|
invalid_file_message = "No jsonPath is specified for number indicator."
|
||||||
} else if (!chart.url) {
|
} else if (chart.indicatorPaths.filter(path => !path.url).length > 0) {
|
||||||
invalid_file_message = "No indicator url is specified.";
|
invalid_file_message = "No indicator url is specified.";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1261,29 +1353,38 @@ export class IndicatorsComponent extends IndicatorStakeholderBaseComponent imple
|
||||||
}
|
}
|
||||||
|
|
||||||
if (chart.type == "chart") {
|
if (chart.type == "chart") {
|
||||||
indicatorPath = this.indicatorUtils.generateIndicatorByChartUrl(this.indicatorUtils.getChartSource(chart.url), chart.url, chart.type, stakeholder);
|
indicatorPaths = chart.indicatorPaths.map(path => this.indicatorUtils.generateIndicatorByChartUrl(this.indicatorUtils.getChartSource(path.url), path.url, chart.type, stakeholder));
|
||||||
for (let section of this.stakeholder.topics[this.topicIndex].categories[this.categoryIndex].subCategories[this.index].charts) {
|
this.stakeholder.topics[this.topicIndex].categories[this.categoryIndex].subCategories[this.index].charts.forEach((section: Section) => {
|
||||||
for (let chart of section.indicators) {
|
section.indicators.forEach(indicator => {
|
||||||
if (JSON.stringify(chart.indicatorPaths[0].chartObject) == JSON.stringify(indicatorPath.chartObject)) {
|
indicator.indicatorPaths.forEach(path => {
|
||||||
duplicates++;
|
let size = indicatorPaths.length;
|
||||||
exists = true;
|
indicatorPaths = indicatorPaths.filter(indicatorPath => JSON.stringify(path.chartObject) !== JSON.stringify(indicatorPath.chartObject))
|
||||||
}
|
if (indicatorPaths.length < size) {
|
||||||
}
|
duplicates = duplicates + (size - indicatorPaths.length);
|
||||||
}
|
exists = true;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
});
|
||||||
|
});
|
||||||
} else if (chart.type == "number") {
|
} else if (chart.type == "number") {
|
||||||
indicatorPath = this.indicatorUtils.generateIndicatorByNumberUrl(this.indicatorUtils.getNumberSource(chart.url), chart.url, stakeholder,
|
indicatorPaths = chart.indicatorPaths.map(path =>
|
||||||
chart.jsonPath, this.indicatorUtils.numberSources.get(this.indicatorUtils.getNumberSource(chart.url)));
|
this.indicatorUtils.generateIndicatorByNumberUrl(this.indicatorUtils.getNumberSource(path.url), path.url,
|
||||||
for (let section of this.stakeholder.topics[this.topicIndex].categories[this.categoryIndex].subCategories[this.index].numbers) {
|
stakeholder, path.jsonPath, this.indicatorUtils.numberSources.get(this.indicatorUtils.getNumberSource(path.url))));
|
||||||
for (let chart of section.indicators) {
|
this.stakeholder.topics[this.topicIndex].categories[this.categoryIndex].subCategories[this.index].numbers.forEach((section: Section) => {
|
||||||
if (JSON.stringify(chart.indicatorPaths[0].chartObject) == JSON.stringify(indicatorPath.chartObject)) {
|
section.indicators.forEach(indicator => {
|
||||||
duplicates++;
|
indicator.indicatorPaths.forEach(path => {
|
||||||
exists = true;
|
let size = indicatorPaths.length;
|
||||||
}
|
indicatorPaths = indicatorPaths.filter(indicatorPath => JSON.stringify(path.chartObject) !== JSON.stringify(indicatorPath.chartObject))
|
||||||
}
|
if (indicatorPaths.length < size) {
|
||||||
}
|
duplicates = duplicates + (size - indicatorPaths.length);
|
||||||
|
exists = true;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
});
|
||||||
|
});
|
||||||
}
|
}
|
||||||
if (!exists) {
|
if (indicatorPaths.length > 0) {
|
||||||
let i: Indicator = new Indicator(chart.name, chart.description, chart.additionalDescription, chart.type, chart.width, chart.height, this.showVisibility?"RESTRICTED":this.stakeholderUtils.defaultValue(this.stakeholderUtils.visibilities), [indicatorPath]);
|
let i: Indicator = new Indicator(chart.name, chart.description, chart.additionalDescription, chart.type, chart.width, chart.height, this.showVisibility ? "RESTRICTED" : this.stakeholderUtils.defaultValue(this.stakeholderUtils.visibilities), indicatorPaths);
|
||||||
sectionsToSave[chart['sectionIndex']].indicators.push(i);
|
sectionsToSave[chart['sectionIndex']].indicators.push(i);
|
||||||
countIndicators++;
|
countIndicators++;
|
||||||
}
|
}
|
||||||
|
@ -1315,36 +1416,41 @@ export class IndicatorsComponent extends IndicatorStakeholderBaseComponent imple
|
||||||
let indexIndicator: number = 0;
|
let indexIndicator: number = 0;
|
||||||
this.stakeholder.topics[this.topicIndex].categories[this.categoryIndex].subCategories[subcategoryIndex].numbers.forEach(section => {
|
this.stakeholder.topics[this.topicIndex].categories[this.categoryIndex].subCategories[subcategoryIndex].numbers.forEach(section => {
|
||||||
section.indicators.forEach(indicator => {
|
section.indicators.forEach(indicator => {
|
||||||
indicator.indicatorPaths.forEach(indicatorPath => {
|
indicators[indexIndicator] = {
|
||||||
indicators[indexIndicator] = {
|
"indicatorPaths": indicator.indicatorPaths.map(path => {
|
||||||
"type": indicator.type, "name": indicator.name, "jsonPath": indicatorPath.jsonPath,
|
return {
|
||||||
"description": indicator.description, "additionalDescription": indicator.additionalDescription,
|
jsonPath: path.jsonPath,
|
||||||
"visibility": indicator.visibility, "width": indicator.width, "height": indicator.height,
|
url: this.indicatorUtils.getNumberUrl(path.source, this.indicatorUtils.getFullUrl(this.stakeholder, path))
|
||||||
"url": this.indicatorUtils.getNumberUrl(indicatorPath.source, this.indicatorUtils.getFullUrl(this.stakeholder, indicatorPath)),
|
}
|
||||||
"sectionTitle": section.title,
|
}),
|
||||||
"sectionType": section.type,
|
"type": indicator.type, "name": indicator.name,
|
||||||
"sectionIndex": index
|
"description": indicator.description, "additionalDescription": indicator.additionalDescription,
|
||||||
};
|
"visibility": indicator.visibility, "width": indicator.width, "height": indicator.height,
|
||||||
indexIndicator++;
|
"sectionTitle": section.title,
|
||||||
});
|
"sectionType": section.type,
|
||||||
|
"sectionIndex": index
|
||||||
|
};
|
||||||
|
indexIndicator++;
|
||||||
});
|
});
|
||||||
index++;
|
index++;
|
||||||
});
|
});
|
||||||
|
|
||||||
this.stakeholder.topics[this.topicIndex].categories[this.categoryIndex].subCategories[subcategoryIndex].charts.forEach(section => {
|
this.stakeholder.topics[this.topicIndex].categories[this.categoryIndex].subCategories[subcategoryIndex].charts.forEach(section => {
|
||||||
section.indicators.forEach(indicator => {
|
section.indicators.forEach(indicator => {
|
||||||
indicator.indicatorPaths.forEach(indicatorPath => {
|
indicators[indexIndicator] = {
|
||||||
indicators[indexIndicator] = {
|
"indicatorPaths": indicator.indicatorPaths.map(path => {
|
||||||
"type": indicator.type, "name": indicator.name,
|
return {
|
||||||
"description": indicator.description, "additionalDescription": indicator.additionalDescription,
|
url: this.getUrlByStakeHolder(path)
|
||||||
"visibility": indicator.visibility, "width": indicator.width, "height": indicator.height,
|
}
|
||||||
"url": this.getUrlByStakeHolder(indicatorPath),
|
}),
|
||||||
"sectionTitle": section.title,
|
"type": indicator.type, "name": indicator.name,
|
||||||
"sectionType": section.type,
|
"description": indicator.description, "additionalDescription": indicator.additionalDescription,
|
||||||
"sectionIndex": index
|
"visibility": indicator.visibility, "width": indicator.width, "height": indicator.height,
|
||||||
};
|
"sectionTitle": section.title,
|
||||||
indexIndicator++;
|
"sectionType": section.type,
|
||||||
});
|
"sectionIndex": index
|
||||||
|
};
|
||||||
|
indexIndicator++;
|
||||||
});
|
});
|
||||||
index++;
|
index++;
|
||||||
|
|
||||||
|
@ -1404,7 +1510,7 @@ export class IndicatorsComponent extends IndicatorStakeholderBaseComponent imple
|
||||||
this.makeFileRequest(this.properties.utilsService + '/upload?type=json', [], this.filesToUpload).then(async (result: string) => {
|
this.makeFileRequest(this.properties.utilsService + '/upload?type=json', [], this.filesToUpload).then(async (result: string) => {
|
||||||
let json = JSON.parse(result);
|
let json = JSON.parse(result);
|
||||||
// validate file
|
// validate file
|
||||||
if(json && Array.isArray(json)) {
|
if (json && Array.isArray(json)) {
|
||||||
UIkit.notification("This file is not supported any more. Please export indicators and try again!", {
|
UIkit.notification("This file is not supported any more. Please export indicators and try again!", {
|
||||||
status: 'danger',
|
status: 'danger',
|
||||||
timeout: 6000,
|
timeout: 6000,
|
||||||
|
@ -1466,4 +1572,8 @@ export class IndicatorsComponent extends IndicatorStakeholderBaseComponent imple
|
||||||
document.body.removeChild(tempBox);
|
document.body.removeChild(tempBox);
|
||||||
NotificationHandler.rise('Copied to clipboard');
|
NotificationHandler.rise('Copied to clipboard');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
get isEditable(): boolean {
|
||||||
|
return this.stakeholder.copy || this.stakeholder.defaultId == null || this.stakeholder.defaultId == '-1';
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -28,12 +28,15 @@
|
||||||
</span>
|
</span>
|
||||||
<span class="uk-margin-xsmall-left hide-on-close" [class.uk-invisible-hover]="topicIndex !== i"
|
<span class="uk-margin-xsmall-left hide-on-close" [class.uk-invisible-hover]="topicIndex !== i"
|
||||||
(click)="$event.stopPropagation();$event.preventDefault()">
|
(click)="$event.stopPropagation();$event.preventDefault()">
|
||||||
<a class="uk-link-reset uk-flex uk-flex-middle">
|
<icon *ngIf="!isEditable && showVisibility" [flex]="true" [name]="stakeholderUtils.visibilityIcon.get(topic.visibility)"
|
||||||
|
ratio="0.6"></icon>
|
||||||
|
<a *ngIf="isEditable && (isCurator || showVisibility)" class="uk-link-reset uk-flex uk-flex-middle">
|
||||||
<icon *ngIf="showVisibility" [flex]="true" [name]="stakeholderUtils.visibilityIcon.get(topic.visibility)"
|
<icon *ngIf="showVisibility" [flex]="true" [name]="stakeholderUtils.visibilityIcon.get(topic.visibility)"
|
||||||
ratio="0.6"></icon>
|
ratio="0.6"></icon>
|
||||||
<icon [flex]="true" name="more_vert"></icon>
|
<icon [flex]="true" name="more_vert"></icon>
|
||||||
</a>
|
</a>
|
||||||
<div #element uk-dropdown="mode: click; pos: bottom-left; offset: 5; delay-hide: 0; flip: false; container: body">
|
<div #element *ngIf="isEditable && (isCurator || showVisibility)"
|
||||||
|
uk-dropdown="mode: click; pos: bottom-left; offset: 5; delay-hide: 0; flip: false; container: body">
|
||||||
<ul class="uk-nav uk-dropdown-nav">
|
<ul class="uk-nav uk-dropdown-nav">
|
||||||
<ng-container *ngIf="isCurator">
|
<ng-container *ngIf="isCurator">
|
||||||
<li>
|
<li>
|
||||||
|
@ -106,12 +109,14 @@
|
||||||
<span class="uk-width-expand uk-text-truncate">{{category.name}}</span>
|
<span class="uk-width-expand uk-text-truncate">{{category.name}}</span>
|
||||||
<span class="uk-margin-xsmall-left hide-on-close" [class.uk-invisible-hover]="categoryIndex !== j"
|
<span class="uk-margin-xsmall-left hide-on-close" [class.uk-invisible-hover]="categoryIndex !== j"
|
||||||
(click)="$event.stopPropagation();$event.preventDefault()">
|
(click)="$event.stopPropagation();$event.preventDefault()">
|
||||||
<a class="uk-link-reset uk-flex uk-flex-middle">
|
<icon *ngIf="!isEditable && showVisibility" [flex]="true" [name]="stakeholderUtils.visibilityIcon.get(category.visibility)"
|
||||||
|
ratio="0.6"></icon>
|
||||||
|
<a *ngIf="isEditable && (isCurator || showVisibility)" class="uk-link-reset uk-flex uk-flex-middle">
|
||||||
<icon *ngIf="showVisibility" [flex]="true" [name]="stakeholderUtils.visibilityIcon.get(category.visibility)"
|
<icon *ngIf="showVisibility" [flex]="true" [name]="stakeholderUtils.visibilityIcon.get(category.visibility)"
|
||||||
ratio="0.6"></icon>
|
ratio="0.6"></icon>
|
||||||
<icon [flex]="true" name="more_vert"></icon>
|
<icon [flex]="true" name="more_vert"></icon>
|
||||||
</a>
|
</a>
|
||||||
<div #element
|
<div #element *ngIf="isEditable && (isCurator || showVisibility)"
|
||||||
uk-dropdown="mode: click; pos: bottom-left; offset: 5; delay-hide: 0; flip: false; container: body">
|
uk-dropdown="mode: click; pos: bottom-left; offset: 5; delay-hide: 0; flip: false; container: body">
|
||||||
<ul class="uk-nav uk-dropdown-nav">
|
<ul class="uk-nav uk-dropdown-nav">
|
||||||
<ng-container *ngIf="isCurator">
|
<ng-container *ngIf="isCurator">
|
||||||
|
@ -175,7 +180,7 @@
|
||||||
</div>
|
</div>
|
||||||
</a>
|
</a>
|
||||||
</li>
|
</li>
|
||||||
<li *ngIf="isCurator">
|
<li *ngIf="isCurator && isEditable">
|
||||||
<a (click)="editCategoryOpen(); $event.preventDefault()" class="uk-flex uk-flex-middle">
|
<a (click)="editCategoryOpen(); $event.preventDefault()" class="uk-flex uk-flex-middle">
|
||||||
<icon name="add" [flex]="true"></icon>
|
<icon name="add" [flex]="true"></icon>
|
||||||
<span class="hide-on-close">Create new category</span>
|
<span class="hide-on-close">Create new category</span>
|
||||||
|
@ -183,7 +188,7 @@
|
||||||
</li>
|
</li>
|
||||||
</ul>
|
</ul>
|
||||||
</li>
|
</li>
|
||||||
<li *ngIf="isCurator" class="hide-on-close">
|
<li *ngIf="isCurator && isEditable" class="hide-on-close">
|
||||||
<a (click)="editTopicOpen(-1); $event.preventDefault()">
|
<a (click)="editTopicOpen(-1); $event.preventDefault()">
|
||||||
<div class="uk-flex uk-flex-middle">
|
<div class="uk-flex uk-flex-middle">
|
||||||
<div class="uk-width-auto">
|
<div class="uk-width-auto">
|
||||||
|
@ -235,12 +240,15 @@
|
||||||
<span class="uk-flex uk-flex-column uk-flex-center uk-margin-small-left"
|
<span class="uk-flex uk-flex-column uk-flex-center uk-margin-small-left"
|
||||||
[class.uk-invisible-hover]="subCategoryIndex !== i"
|
[class.uk-invisible-hover]="subCategoryIndex !== i"
|
||||||
(click)="$event.stopPropagation();$event.preventDefault()">
|
(click)="$event.stopPropagation();$event.preventDefault()">
|
||||||
<a class="uk-link-reset uk-flex uk-flex-middle">
|
<icon *ngIf="!isEditable && showVisibility" [flex]="true" [name]="stakeholderUtils.visibilityIcon.get(subCategory.visibility)"
|
||||||
|
ratio="0.6"></icon>
|
||||||
|
<a *ngIf="isEditable && (isCurator || showVisibility)" class="uk-link-reset uk-flex uk-flex-middle">
|
||||||
<icon *ngIf="showVisibility" [flex]="true" [name]="stakeholderUtils.visibilityIcon.get(subCategory.visibility)"
|
<icon *ngIf="showVisibility" [flex]="true" [name]="stakeholderUtils.visibilityIcon.get(subCategory.visibility)"
|
||||||
ratio="0.6"></icon>
|
ratio="0.6"></icon>
|
||||||
<icon [flex]="true" name="more_vert"></icon>
|
<icon [flex]="true" name="more_vert"></icon>
|
||||||
</a>
|
</a>
|
||||||
<div #element uk-dropdown="mode: click; pos: bottom-left; offset: 5; delay-hide: 0; container: body">
|
<div #element *ngIf="isEditable && (isCurator || showVisibility)"
|
||||||
|
uk-dropdown="mode: click; pos: bottom-left; offset: 5; delay-hide: 0; container: body">
|
||||||
<ul class="uk-nav uk-dropdown-nav">
|
<ul class="uk-nav uk-dropdown-nav">
|
||||||
<ng-container *ngIf="isCurator">
|
<ng-container *ngIf="isCurator">
|
||||||
<li>
|
<li>
|
||||||
|
@ -318,7 +326,7 @@
|
||||||
</span>
|
</span>
|
||||||
</li>
|
</li>
|
||||||
</ng-template>
|
</ng-template>
|
||||||
<li *ngIf="isCurator">
|
<li *ngIf="isCurator && isEditable">
|
||||||
<a (click)="editSubCategoryOpen(); $event.preventDefault()" class="uk-flex uk-flex-middle">
|
<a (click)="editSubCategoryOpen(); $event.preventDefault()" class="uk-flex uk-flex-middle">
|
||||||
<icon name="add" [flex]="true"></icon>
|
<icon name="add" [flex]="true"></icon>
|
||||||
<span class="uk-text-uppercase">Create new subcategory</span>
|
<span class="uk-text-uppercase">Create new subcategory</span>
|
||||||
|
|
|
@ -242,30 +242,18 @@ export class TopicComponent extends StakeholderBaseComponent implements OnInit,
|
||||||
}
|
}
|
||||||
|
|
||||||
topicChanged(callback: Function, save: boolean = false) {
|
topicChanged(callback: Function, save: boolean = false) {
|
||||||
if(this.topics && save) {
|
|
||||||
this.topics.disable();
|
|
||||||
}
|
|
||||||
if(this.categories) {
|
|
||||||
this.categories.disable();
|
|
||||||
}
|
|
||||||
if(this.subCategories) {
|
|
||||||
this.subCategories.disable();
|
|
||||||
}
|
|
||||||
if(callback) {
|
if(callback) {
|
||||||
callback();
|
callback();
|
||||||
}
|
}
|
||||||
this.cdr.detectChanges();
|
this.cdr.detectChanges();
|
||||||
if(this.topics && save) {
|
if(this.topics && save) {
|
||||||
this.topics.init();
|
this.topics.init();
|
||||||
this.topics.enable();
|
|
||||||
}
|
}
|
||||||
if(this.categories) {
|
if(this.categories) {
|
||||||
this.categories.init();
|
this.categories.init();
|
||||||
this.categories.enable();
|
|
||||||
}
|
}
|
||||||
if(this.subCategories) {
|
if(this.subCategories) {
|
||||||
this.subCategories.init();
|
this.subCategories.init();
|
||||||
this.subCategories.enable();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -359,6 +347,8 @@ export class TopicComponent extends StakeholderBaseComponent implements OnInit,
|
||||||
this.stakeholder.topics.splice(this.index, 1);
|
this.stakeholder.topics.splice(this.index, 1);
|
||||||
if(this.topicIndex === this.index) {
|
if(this.topicIndex === this.index) {
|
||||||
this.chooseTopic(Math.max(0, this.index - 1));
|
this.chooseTopic(Math.max(0, this.index - 1));
|
||||||
|
} else if(this.topicIndex > this.index) {
|
||||||
|
this.chooseTopic(this.topicIndex - 1);
|
||||||
}
|
}
|
||||||
}, true);
|
}, true);
|
||||||
};
|
};
|
||||||
|
@ -388,23 +378,15 @@ export class TopicComponent extends StakeholderBaseComponent implements OnInit,
|
||||||
}
|
}
|
||||||
|
|
||||||
categoryChanged(callback: Function, save: boolean = false) {
|
categoryChanged(callback: Function, save: boolean = false) {
|
||||||
if(this.categories && save) {
|
|
||||||
this.categories.disable();
|
|
||||||
}
|
|
||||||
if(this.subCategories) {
|
|
||||||
this.subCategories.disable();
|
|
||||||
}
|
|
||||||
if(callback) {
|
if(callback) {
|
||||||
callback();
|
callback();
|
||||||
}
|
}
|
||||||
this.cdr.detectChanges();
|
this.cdr.detectChanges();
|
||||||
if(this.categories && save) {
|
if(this.categories && save) {
|
||||||
this.categories.init();
|
this.categories.init();
|
||||||
this.categories.enable();
|
|
||||||
}
|
}
|
||||||
if(this.subCategories) {
|
if(this.subCategories) {
|
||||||
this.subCategories.init();
|
this.subCategories.init();
|
||||||
this.subCategories.enable();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -500,6 +482,8 @@ export class TopicComponent extends StakeholderBaseComponent implements OnInit,
|
||||||
this.stakeholder.topics[this.topicIndex].categories.splice(this.index, 1);
|
this.stakeholder.topics[this.topicIndex].categories.splice(this.index, 1);
|
||||||
if(this.categoryIndex === this.index) {
|
if(this.categoryIndex === this.index) {
|
||||||
this.chooseCategory(Math.max(0, this.index - 1));
|
this.chooseCategory(Math.max(0, this.index - 1));
|
||||||
|
} else if(this.categoryIndex > this.index) {
|
||||||
|
this.chooseCategory(this.categoryIndex - 1);
|
||||||
}
|
}
|
||||||
}, true);
|
}, true);
|
||||||
};
|
};
|
||||||
|
@ -528,16 +512,12 @@ export class TopicComponent extends StakeholderBaseComponent implements OnInit,
|
||||||
}
|
}
|
||||||
|
|
||||||
subCategoryChanged(callback: Function, save: boolean = false) {
|
subCategoryChanged(callback: Function, save: boolean = false) {
|
||||||
if(this.subCategories && save) {
|
|
||||||
this.subCategories.disable();
|
|
||||||
}
|
|
||||||
if(callback) {
|
if(callback) {
|
||||||
callback();
|
callback();
|
||||||
}
|
}
|
||||||
this.cdr.detectChanges();
|
this.cdr.detectChanges();
|
||||||
if(this.subCategories && save) {
|
if(this.subCategories && save) {
|
||||||
this.subCategories.init();
|
this.subCategories.init();
|
||||||
this.subCategories.enable();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -640,6 +620,8 @@ export class TopicComponent extends StakeholderBaseComponent implements OnInit,
|
||||||
this.stakeholder.topics[this.topicIndex].categories[this.categoryIndex].subCategories.splice(this.index, 1);
|
this.stakeholder.topics[this.topicIndex].categories[this.categoryIndex].subCategories.splice(this.index, 1);
|
||||||
if(this.subCategoryIndex === this.index) {
|
if(this.subCategoryIndex === this.index) {
|
||||||
this.chooseSubcategory(Math.max(0, this.index - 1));
|
this.chooseSubcategory(Math.max(0, this.index - 1));
|
||||||
|
} else if(this.subCategoryIndex > this.index) {
|
||||||
|
this.chooseSubcategory(this.subCategoryIndex - 1);
|
||||||
}
|
}
|
||||||
}, true);
|
}, true);
|
||||||
};
|
};
|
||||||
|
@ -777,4 +759,8 @@ export class TopicComponent extends StakeholderBaseComponent implements OnInit,
|
||||||
this.visibilityModal.alertFooter = false;
|
this.visibilityModal.alertFooter = false;
|
||||||
this.visibilityModal.open();
|
this.visibilityModal.open();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
get isEditable(): boolean {
|
||||||
|
return this.stakeholder.copy || this.stakeholder.defaultId == null || this.stakeholder.defaultId == '-1';
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -20,11 +20,12 @@ import {TransitionGroupModule} from "../../utils/transition-group/transition-gro
|
||||||
import {NumberRoundModule} from "../../utils/pipes/number-round.module";
|
import {NumberRoundModule} from "../../utils/pipes/number-round.module";
|
||||||
import {SideBarModule} from "../../dashboard/sharedComponents/sidebar/sideBar.module";
|
import {SideBarModule} from "../../dashboard/sharedComponents/sidebar/sideBar.module";
|
||||||
import {SidebarMobileToggleModule} from "../../dashboard/sharedComponents/sidebar/sidebar-mobile-toggle/sidebar-mobile-toggle.module";
|
import {SidebarMobileToggleModule} from "../../dashboard/sharedComponents/sidebar/sidebar-mobile-toggle/sidebar-mobile-toggle.module";
|
||||||
|
import {SliderTabsModule} from "../../sharedComponents/tabs/slider-tabs.module";
|
||||||
|
|
||||||
@NgModule({
|
@NgModule({
|
||||||
imports: [
|
imports: [
|
||||||
CommonModule, TopicRoutingModule, ClickModule, RouterModule, FormsModule, AlertModalModule,
|
CommonModule, TopicRoutingModule, ClickModule, RouterModule, FormsModule, AlertModalModule,
|
||||||
ReactiveFormsModule, InputModule, IconsModule, PageContentModule, LoadingModule, NotifyFormModule, LogoUrlPipeModule, TransitionGroupModule, NumberRoundModule, SideBarModule, SidebarMobileToggleModule
|
ReactiveFormsModule, InputModule, IconsModule, PageContentModule, LoadingModule, NotifyFormModule, LogoUrlPipeModule, TransitionGroupModule, NumberRoundModule, SideBarModule, SidebarMobileToggleModule, SliderTabsModule
|
||||||
],
|
],
|
||||||
declarations: [
|
declarations: [
|
||||||
TopicComponent, IndicatorsComponent
|
TopicComponent, IndicatorsComponent
|
||||||
|
|
|
@ -17,6 +17,11 @@ import {Session} from "../../login/utils/helper.class";
|
||||||
import {HelperFunctions} from "../../utils/HelperFunctions.class";
|
import {HelperFunctions} from "../../utils/HelperFunctions.class";
|
||||||
import {properties} from "src/environments/environment";
|
import {properties} from "src/environments/environment";
|
||||||
|
|
||||||
|
class Roles {
|
||||||
|
manager = 'manager';
|
||||||
|
member = 'member';
|
||||||
|
}
|
||||||
|
|
||||||
class Entities {
|
class Entities {
|
||||||
stakeholder = 'Dashboard';
|
stakeholder = 'Dashboard';
|
||||||
funder = 'Funder';
|
funder = 'Funder';
|
||||||
|
@ -37,6 +42,7 @@ class Entities {
|
||||||
}
|
}
|
||||||
|
|
||||||
export class StakeholderConfiguration {
|
export class StakeholderConfiguration {
|
||||||
|
public static ROLES: Roles = new Roles();
|
||||||
public static ENTITIES: Entities = new Entities();
|
public static ENTITIES: Entities = new Entities();
|
||||||
public static TYPES: Option[] = [
|
public static TYPES: Option[] = [
|
||||||
{value: 'funder', label: StakeholderConfiguration.ENTITIES.funder},
|
{value: 'funder', label: StakeholderConfiguration.ENTITIES.funder},
|
||||||
|
@ -55,9 +61,15 @@ export class StakeholderConfiguration {
|
||||||
{icon: 'incognito', value: "PRIVATE", label: 'Private'},
|
{icon: 'incognito', value: "PRIVATE", label: 'Private'},
|
||||||
];
|
];
|
||||||
public static CACHE_INDICATORS: boolean = true;
|
public static CACHE_INDICATORS: boolean = true;
|
||||||
|
public static NUMBER_MULTI_INDICATOR_PATHS = false;
|
||||||
|
public static CHART_MULTI_INDICATOR_PATHS = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
export class StakeholderUtils {
|
export class StakeholderUtils {
|
||||||
|
get roles() {
|
||||||
|
return StakeholderConfiguration.ROLES;
|
||||||
|
}
|
||||||
|
|
||||||
get entities() {
|
get entities() {
|
||||||
return StakeholderConfiguration.ENTITIES;
|
return StakeholderConfiguration.ENTITIES;
|
||||||
}
|
}
|
||||||
|
@ -82,6 +94,14 @@ export class StakeholderUtils {
|
||||||
return StakeholderConfiguration.CACHE_INDICATORS;
|
return StakeholderConfiguration.CACHE_INDICATORS;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
get hasMultiNumberIndicatorPaths() {
|
||||||
|
return StakeholderConfiguration.NUMBER_MULTI_INDICATOR_PATHS;
|
||||||
|
}
|
||||||
|
|
||||||
|
get hasMultiChartIndicatorPaths() {
|
||||||
|
return StakeholderConfiguration.CHART_MULTI_INDICATOR_PATHS;
|
||||||
|
}
|
||||||
|
|
||||||
visibilityIcon: Map<Visibility, string> = new Map<Visibility, string>(this.visibilities.map(option => [option.value, option.icon]));
|
visibilityIcon: Map<Visibility, string> = new Map<Visibility, string>(this.visibilities.map(option => [option.value, option.icon]));
|
||||||
|
|
||||||
defaultValue(options: Option[]) {
|
defaultValue(options: Option[]) {
|
||||||
|
@ -107,60 +127,6 @@ export class StakeholderUtils {
|
||||||
return types;
|
return types;
|
||||||
}
|
}
|
||||||
|
|
||||||
public createFunderFromDefaultProfile(funder: Stakeholder, defaultTopics: Topic[], isDefault: boolean = false): Stakeholder {
|
|
||||||
funder.topics = HelperFunctions.copy(defaultTopics);
|
|
||||||
for (let topic of funder.topics) {
|
|
||||||
topic.defaultId = !isDefault ? topic._id : null;
|
|
||||||
topic._id = null;
|
|
||||||
for (let category of topic.categories) {
|
|
||||||
category.defaultId = !isDefault ? category._id : null;
|
|
||||||
category._id = null;
|
|
||||||
let subTokeep: SubCategory[] = [];
|
|
||||||
for (let subCategory of category.subCategories) {
|
|
||||||
subCategory.defaultId = !isDefault ? subCategory._id : null;
|
|
||||||
subCategory._id = null;
|
|
||||||
subTokeep.push(subCategory);
|
|
||||||
for (let section of subCategory.charts) {
|
|
||||||
let chartsTokeep: Indicator[] = [];
|
|
||||||
section.defaultId = !isDefault ? section._id : null;
|
|
||||||
section.stakeholderAlias = funder.alias;
|
|
||||||
section._id = null;
|
|
||||||
for (let indicator of section.indicators) {
|
|
||||||
indicator.defaultId = !isDefault ? indicator._id : null;
|
|
||||||
indicator._id = null;
|
|
||||||
chartsTokeep.push(indicator);
|
|
||||||
for (let indicatorPath of indicator.indicatorPaths) {
|
|
||||||
if (indicatorPath.parameters) {
|
|
||||||
Object.keys(indicatorPath.parameters).forEach(key => {
|
|
||||||
if (key == "index_name") {
|
|
||||||
indicatorPath.parameters[key] = funder.index_name;
|
|
||||||
} else if (key == "index_id") {
|
|
||||||
indicatorPath.parameters[key] = funder.index_id;
|
|
||||||
} else if (key == "index_shortName") {
|
|
||||||
indicatorPath.parameters[key] = funder.index_shortName.toLowerCase();
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
section.indicators = chartsTokeep;
|
|
||||||
}
|
|
||||||
for (let section of subCategory.numbers) {
|
|
||||||
section.defaultId = !isDefault ? section._id : null;
|
|
||||||
section.stakeholderAlias = funder.alias;
|
|
||||||
section._id = null;
|
|
||||||
for (let indicator of section.indicators) {
|
|
||||||
indicator.defaultId = !isDefault ? indicator._id : null;
|
|
||||||
indicator._id = null;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
category.subCategories = subTokeep;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return funder;
|
|
||||||
}
|
|
||||||
|
|
||||||
aliasValidatorString(elements: string[]): ValidatorFn {
|
aliasValidatorString(elements: string[]): ValidatorFn {
|
||||||
return (control: AbstractControl): { [key: string]: string } | null => {
|
return (control: AbstractControl): { [key: string]: string } | null => {
|
||||||
|
@ -588,11 +554,11 @@ export class IndicatorUtils {
|
||||||
filterApplied = true;
|
filterApplied = true;
|
||||||
} else if (filterType == "start_year" || filterType == "end_year") {
|
} else if (filterType == "start_year" || filterType == "end_year") {
|
||||||
//if has date filter already
|
//if has date filter already
|
||||||
if (filterType == "start_year" && parseInt(filterValue) > parseInt(queries["query"]["filters"][filterposition.filter]['groupFilters'][filterposition.groupFilter]["values"][0])) {
|
// if (filterType == "start_year" && parseInt(filterValue) > parseInt(queries["query"]["filters"][filterposition.filter]['groupFilters'][filterposition.groupFilter]["values"][0])) {
|
||||||
queries["query"]["filters"][filterposition.filter]['groupFilters'][filterposition.groupFilter]["values"][0] = filterValue;
|
queries["query"]["filters"][filterposition.filter]['groupFilters'][filterposition.groupFilter]["values"][0] = filterValue;
|
||||||
} else if (filterType == "end_year" && parseInt(filterValue) < parseInt(queries["query"]["filters"][filterposition.filter]['groupFilters'][filterposition.groupFilter]["values"][0])) {
|
// } else if (filterType == "end_year" && parseInt(filterValue) < parseInt(queries["query"]["filters"][filterposition.filter]['groupFilters'][filterposition.groupFilter]["values"][0])) {
|
||||||
queries["query"]["filters"][filterposition.filter]['groupFilters'][filterposition.groupFilter]["values"][0] = filterValue;
|
queries["query"]["filters"][filterposition.filter]['groupFilters'][filterposition.groupFilter]["values"][0] = filterValue;
|
||||||
}
|
// }
|
||||||
filterApplied = true;
|
filterApplied = true;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -37,6 +37,7 @@ export class Stakeholder {
|
||||||
isUpload: boolean = false;
|
isUpload: boolean = false;
|
||||||
description: string;
|
description: string;
|
||||||
topics: any[];
|
topics: any[];
|
||||||
|
copy: boolean = true;
|
||||||
details?: any;
|
details?: any;
|
||||||
|
|
||||||
constructor(_id: string, type: StakeholderType, index_id: string, index_name: string, index_shortName: string, alias: string, visibility: Visibility, logoUrl: string, defaultId: string = null, description: string = null) {
|
constructor(_id: string, type: StakeholderType, index_id: string, index_name: string, index_shortName: string, alias: string, visibility: Visibility, logoUrl: string, defaultId: string = null, description: string = null) {
|
||||||
|
@ -50,6 +51,7 @@ export class Stakeholder {
|
||||||
this.visibility = visibility;
|
this.visibility = visibility;
|
||||||
this.logoUrl = logoUrl;
|
this.logoUrl = logoUrl;
|
||||||
this.description = description;
|
this.description = description;
|
||||||
|
this.copy = !!this.defaultId && this.defaultId !== '-1';
|
||||||
this.topics = [];
|
this.topics = [];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -183,6 +185,7 @@ export class Indicator {
|
||||||
visibility: Visibility;
|
visibility: Visibility;
|
||||||
defaultId: string;
|
defaultId: string;
|
||||||
indicatorPaths: IndicatorPath[];
|
indicatorPaths: IndicatorPath[];
|
||||||
|
activePath: number = 0;
|
||||||
overlay: Overlay = false;
|
overlay: Overlay = false;
|
||||||
|
|
||||||
constructor(name: string, description: string, additionalDescription:string, type: IndicatorType, width: IndicatorSize,height: IndicatorSize, visibility: Visibility, indicatorPaths: IndicatorPath[], defaultId: string = null) {
|
constructor(name: string, description: string, additionalDescription:string, type: IndicatorType, width: IndicatorSize,height: IndicatorSize, visibility: Visibility, indicatorPaths: IndicatorPath[], defaultId: string = null) {
|
||||||
|
@ -293,7 +296,7 @@ export class IndicatorFilterUtils {
|
||||||
}
|
}
|
||||||
static getFieldForTable(field, table){
|
static getFieldForTable(field, table){
|
||||||
if(["publication", "software", "dataset", "other", "result"].indexOf(table)!=-1 && IndicatorFilterUtils.filteredFields[field]["result"]){
|
if(["publication", "software", "dataset", "other", "result"].indexOf(table)!=-1 && IndicatorFilterUtils.filteredFields[field]["result"]){
|
||||||
return IndicatorFilterUtils.filteredFields[field]["result"];
|
return IndicatorFilterUtils.filteredFields[field]["result"].replace("result.",table + ".");
|
||||||
}else{
|
}else{
|
||||||
return IndicatorFilterUtils.filteredFields[field][table];
|
return IndicatorFilterUtils.filteredFields[field][table];
|
||||||
}
|
}
|
||||||
|
|
|
@ -53,7 +53,6 @@ export abstract class MonitorIndicatorStakeholderBaseComponent extends Indicator
|
||||||
minYear = Dates.currentYear - 20;
|
minYear = Dates.currentYear - 20;
|
||||||
maxYear = Dates.currentYear;
|
maxYear = Dates.currentYear;
|
||||||
public numberResults: Map<string, number> = new Map<string, number>();
|
public numberResults: Map<string, number> = new Map<string, number>();
|
||||||
public chartsActiveType: Map<string, IndicatorPath> = new Map<string, IndicatorPath>();
|
|
||||||
public clipboard;
|
public clipboard;
|
||||||
|
|
||||||
/** Services */
|
/** Services */
|
||||||
|
@ -214,15 +213,17 @@ export abstract class MonitorIndicatorStakeholderBaseComponent extends Indicator
|
||||||
(this.periodFilter.selectedFromValue && this.periodFilter.selectedToValue ? " - " : "") + (this.periodFilter.selectedToValue ? this.periodFilter.selectedToValue : "")) : "");
|
(this.periodFilter.selectedFromValue && this.periodFilter.selectedToValue ? " - " : "") + (this.periodFilter.selectedToValue ? this.periodFilter.selectedToValue : "")) : "");
|
||||||
//clear numbers when filters change
|
//clear numbers when filters change
|
||||||
this.numberResults.clear();
|
this.numberResults.clear();
|
||||||
let urls: Map<string, [number, number][]> = new Map<string, [number, number][]>();
|
let urls: Map<string, [number, number, number][]> = new Map<string, [number, number, number][]>();
|
||||||
this.activeSubCategory.numbers.forEach((section, i) => {
|
this.activeSubCategory.numbers.forEach((section, i) => {
|
||||||
section.indicators.forEach((number, j) => {
|
section.indicators.forEach((number, j) => {
|
||||||
if (this.hasPermission(number.visibility)) {
|
if (this.hasPermission(number.visibility)) {
|
||||||
let url = this.getFullUrl(number.indicatorPaths[0]);
|
number.indicatorPaths.forEach((indicatorPath, k) => {
|
||||||
const pair = JSON.stringify([number.indicatorPaths[0].source, url]);
|
let url = this.getFullUrl(indicatorPath);
|
||||||
const indexes = urls.get(pair) ? urls.get(pair) : [];
|
const pair = JSON.stringify([indicatorPath.source, url]);
|
||||||
indexes.push([i, j]);
|
const indexes = urls.get(pair) ? urls.get(pair) : [];
|
||||||
urls.set(pair, indexes);
|
indexes.push([i, j, k]);
|
||||||
|
urls.set(pair, indexes);
|
||||||
|
})
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
@ -231,10 +232,10 @@ export abstract class MonitorIndicatorStakeholderBaseComponent extends Indicator
|
||||||
let activeSubcategory = this.activeSubCategory._id;
|
let activeSubcategory = this.activeSubCategory._id;
|
||||||
this.subscriptions.push(this.statisticsService.getNumbers(this.indicatorUtils.getSourceType(pair[0]), pair[1]).subscribe(response => {
|
this.subscriptions.push(this.statisticsService.getNumbers(this.indicatorUtils.getSourceType(pair[0]), pair[1]).subscribe(response => {
|
||||||
if(activeSubcategory === this.activeSubCategory._id) {
|
if(activeSubcategory === this.activeSubCategory._id) {
|
||||||
indexes.forEach(([i, j]) => {
|
indexes.forEach(([i, j, k]) => {
|
||||||
if( this.activeSubCategory?.numbers[i]?.indicators[j]) {
|
if( this.activeSubCategory?.numbers[i]?.indicators[j]) {
|
||||||
let result = JSON.parse(JSON.stringify(response));
|
let result = JSON.parse(JSON.stringify(response));
|
||||||
this.activeSubCategory.numbers[i].indicators[j].indicatorPaths[0].jsonPath.forEach(jsonPath => {
|
this.activeSubCategory.numbers[i].indicators[j].indicatorPaths[k].jsonPath.forEach(jsonPath => {
|
||||||
if (result) {
|
if (result) {
|
||||||
result = result[jsonPath];
|
result = result[jsonPath];
|
||||||
}
|
}
|
||||||
|
@ -247,7 +248,7 @@ export abstract class MonitorIndicatorStakeholderBaseComponent extends Indicator
|
||||||
} else {
|
} else {
|
||||||
result = 0;
|
result = 0;
|
||||||
}
|
}
|
||||||
this.numberResults.set(i + '-' + j, result);
|
this.numberResults.set(i + '-' + j + '-' + k, result);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@ -255,10 +256,9 @@ export abstract class MonitorIndicatorStakeholderBaseComponent extends Indicator
|
||||||
});
|
});
|
||||||
this.activeSubCategory.charts.forEach((section, i) => {
|
this.activeSubCategory.charts.forEach((section, i) => {
|
||||||
section.indicators.forEach((indicator, j) => {
|
section.indicators.forEach((indicator, j) => {
|
||||||
if (indicator.indicatorPaths.length > 0) {
|
indicator.indicatorPaths.forEach((indicatorPath, k) => {
|
||||||
indicator.indicatorPaths[0].safeResourceUrl = this.getUrlByStakeHolder(indicator.indicatorPaths[0]);
|
indicator.indicatorPaths[k].safeResourceUrl = this.getUrlByStakeHolder(indicator.indicatorPaths[k]);
|
||||||
this.chartsActiveType.set(i + '-' + j, indicator.indicatorPaths[0]);
|
});
|
||||||
}
|
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
if (this.cdr && !(this.cdr as ViewRef).destroyed) {
|
if (this.cdr && !(this.cdr as ViewRef).destroyed) {
|
||||||
|
@ -271,10 +271,12 @@ export abstract class MonitorIndicatorStakeholderBaseComponent extends Indicator
|
||||||
this.indicatorUtils.getChartUrl(indicatorPath.source, this.getFullUrl(indicatorPath)));
|
this.indicatorUtils.getChartUrl(indicatorPath.source, this.getFullUrl(indicatorPath)));
|
||||||
}
|
}
|
||||||
|
|
||||||
public setActiveChart(i: number, j: number, type: string) {
|
public getActiveIndicatorPath(indicator: Indicator) {
|
||||||
let activeChart = this.activeSubCategory.charts[i].indicators[j].indicatorPaths.filter(indicatorPath => indicatorPath.type === type)[0];
|
if(indicator.activePath) {
|
||||||
activeChart.safeResourceUrl = this.getUrlByStakeHolder(activeChart);
|
return indicator.indicatorPaths[indicator.activePath];
|
||||||
this.chartsActiveType.set(i + '-' + j, activeChart);
|
} else {
|
||||||
|
return indicator.indicatorPaths[0];
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public filter() {
|
public filter() {
|
||||||
|
|
|
@ -1,16 +1,21 @@
|
||||||
import {Injectable} from "@angular/core";
|
import {Injectable} from "@angular/core";
|
||||||
import {HttpClient} from "@angular/common/http";
|
import {HttpClient} from "@angular/common/http";
|
||||||
import {BehaviorSubject, from, Observable, Subscriber} from "rxjs";
|
import {BehaviorSubject, from, Observable, Subscriber} from "rxjs";
|
||||||
import {Indicator, Section, Stakeholder, StakeholderInfo, Visibility} from "../entities/stakeholder";
|
import {Indicator, Section, Stakeholder, StakeholderInfo, SubCategory, Visibility} from "../entities/stakeholder";
|
||||||
import {HelperFunctions} from "../../utils/HelperFunctions.class";
|
import {HelperFunctions} from "../../utils/HelperFunctions.class";
|
||||||
import {map} from "rxjs/operators";
|
import {map} from "rxjs/operators";
|
||||||
import {properties} from "../../../../environments/environment";
|
import {properties} from "../../../../environments/environment";
|
||||||
import {CustomOptions} from "../../services/servicesUtils/customOptions.class";
|
import {CustomOptions} from "../../services/servicesUtils/customOptions.class";
|
||||||
|
|
||||||
export interface Reorder {
|
export interface SectionInfo {
|
||||||
action: 'moved' | 'added' | 'removed',
|
id: string;
|
||||||
target: string,
|
indicators: string[];
|
||||||
ids: string[];
|
}
|
||||||
|
|
||||||
|
export interface MoveIndicator {
|
||||||
|
target: string;
|
||||||
|
from: SectionInfo;
|
||||||
|
to: SectionInfo;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Injectable({
|
@Injectable({
|
||||||
|
@ -111,11 +116,15 @@ export class StakeholderService {
|
||||||
}));
|
}));
|
||||||
}
|
}
|
||||||
|
|
||||||
buildStakeholder(url: string, stakeholder: Stakeholder): Observable<Stakeholder> {
|
buildStakeholder(url: string, stakeholder: Stakeholder, copyId: string): Observable<Stakeholder> {
|
||||||
if (stakeholder.alias && stakeholder.alias.startsWith('/')) {
|
if (stakeholder.alias && stakeholder.alias.startsWith('/')) {
|
||||||
stakeholder.alias = stakeholder.alias.slice(1);
|
stakeholder.alias = stakeholder.alias.slice(1);
|
||||||
}
|
}
|
||||||
return this.http.post<Stakeholder>(url + '/build-stakeholder', stakeholder, CustomOptions.registryOptions()).pipe(map(stakeholder => {
|
let copy = {
|
||||||
|
stakeholder: stakeholder,
|
||||||
|
copyId: copyId
|
||||||
|
}
|
||||||
|
return this.http.post<Stakeholder>(url + '/build-stakeholder', copy, CustomOptions.registryOptions()).pipe(map(stakeholder => {
|
||||||
return HelperFunctions.copy(Stakeholder.checkIsUpload(stakeholder));
|
return HelperFunctions.copy(Stakeholder.checkIsUpload(stakeholder));
|
||||||
}));
|
}));
|
||||||
}
|
}
|
||||||
|
@ -124,13 +133,12 @@ export class StakeholderService {
|
||||||
return this.http.post<Visibility>(url + '/' + path.join('/') + '/change-visibility' + '?visibility=' + visibility + (propagate ? '&propagate=true' : ''), null, CustomOptions.registryOptions());
|
return this.http.post<Visibility>(url + '/' + path.join('/') + '/change-visibility' + '?visibility=' + visibility + (propagate ? '&propagate=true' : ''), null, CustomOptions.registryOptions());
|
||||||
}
|
}
|
||||||
|
|
||||||
saveElement(url: string, element: any, path: string[] = []): Observable<any> {
|
saveElement(url: string, element: any, path: string[] = [], isFull: boolean = false): Observable<any> {
|
||||||
if (element.alias && element.alias.startsWith('/')) {
|
if (element.alias && element.alias.startsWith('/')) {
|
||||||
element.alias = element.alias.slice(1);
|
element.alias = element.alias.slice(1);
|
||||||
}
|
}
|
||||||
path = HelperFunctions.encodeArray(path);
|
|
||||||
return this.http.post<any>(url + ((path.length > 0) ? '/' : '') + path.join('/') +
|
return this.http.post<any>(url + ((path.length > 0) ? '/' : '') + path.join('/') +
|
||||||
'/save', element, CustomOptions.registryOptions()).pipe(map(element => {
|
'/save' + (isFull?'/full':''), element, CustomOptions.registryOptions()).pipe(map(element => {
|
||||||
if (path.length === 0) {
|
if (path.length === 0) {
|
||||||
return HelperFunctions.copy(Stakeholder.checkIsUpload(element));
|
return HelperFunctions.copy(Stakeholder.checkIsUpload(element));
|
||||||
} else {
|
} else {
|
||||||
|
@ -140,7 +148,6 @@ export class StakeholderService {
|
||||||
}
|
}
|
||||||
|
|
||||||
saveBulkElements(url: string, indicators, path: string[] = []): Observable<any> {
|
saveBulkElements(url: string, indicators, path: string[] = []): Observable<any> {
|
||||||
path = HelperFunctions.encodeArray(path);
|
|
||||||
return this.http.post<any>(url + ((path.length > 0) ? '/' : '') + path.join('/') +
|
return this.http.post<any>(url + ((path.length > 0) ? '/' : '') + path.join('/') +
|
||||||
'/save-bulk', indicators, CustomOptions.registryOptions()).pipe(map(element => {
|
'/save-bulk', indicators, CustomOptions.registryOptions()).pipe(map(element => {
|
||||||
if (path.length === 0) {
|
if (path.length === 0) {
|
||||||
|
@ -152,7 +159,6 @@ export class StakeholderService {
|
||||||
}
|
}
|
||||||
|
|
||||||
saveSection(url: string, element: any, path: string[] = [], index: number = -1): Observable<Section> {
|
saveSection(url: string, element: any, path: string[] = [], index: number = -1): Observable<Section> {
|
||||||
path = HelperFunctions.encodeArray(path);
|
|
||||||
return this.http.post<Section>(url + ((path.length > 0) ? '/' : '') + path.join('/') +
|
return this.http.post<Section>(url + ((path.length > 0) ? '/' : '') + path.join('/') +
|
||||||
'/save/' + index, element, CustomOptions.registryOptions()).pipe(map(element => {
|
'/save/' + index, element, CustomOptions.registryOptions()).pipe(map(element => {
|
||||||
return HelperFunctions.copy(element);
|
return HelperFunctions.copy(element);
|
||||||
|
@ -160,7 +166,6 @@ export class StakeholderService {
|
||||||
}
|
}
|
||||||
|
|
||||||
deleteElement(url: string, path: string[], childrenAction: string = null): Observable<any> {
|
deleteElement(url: string, path: string[], childrenAction: string = null): Observable<any> {
|
||||||
path = HelperFunctions.encodeArray(path);
|
|
||||||
let params: string = "";
|
let params: string = "";
|
||||||
if (childrenAction) {
|
if (childrenAction) {
|
||||||
params = "?children=" + childrenAction;
|
params = "?children=" + childrenAction;
|
||||||
|
@ -169,17 +174,21 @@ export class StakeholderService {
|
||||||
}
|
}
|
||||||
|
|
||||||
reorderElements(url: string, path: string[], ids: string[]): Observable<any> {
|
reorderElements(url: string, path: string[], ids: string[]): Observable<any> {
|
||||||
path = HelperFunctions.encodeArray(path);
|
|
||||||
return this.http.post<any>(url + '/' + path.join('/') + '/reorder', ids, CustomOptions.registryOptions());
|
return this.http.post<any>(url + '/' + path.join('/') + '/reorder', ids, CustomOptions.registryOptions());
|
||||||
}
|
}
|
||||||
|
|
||||||
reorderIndicators(url: string, path: string[], reorder: Reorder, type: string = 'chart'): Observable<Indicator[]> {
|
reorderIndicators(url: string, path: string[], indicators: string[]): Observable<Indicator[]> {
|
||||||
path = HelperFunctions.encodeArray(path);
|
return this.http.post<Indicator[]>(url + '/' + path.join('/') + '/reorder', indicators, CustomOptions.registryOptions()).pipe(map(indicators => {
|
||||||
return this.http.post<Indicator[]>(url + '/' + path.join('/') + '/' + type + '/reorder', reorder, CustomOptions.registryOptions()).pipe(map(indicators => {
|
|
||||||
return HelperFunctions.copy(indicators);
|
return HelperFunctions.copy(indicators);
|
||||||
}));
|
}));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
moveIndicator(url: string, path: string[], moveIndicator: MoveIndicator): Observable<SubCategory> {
|
||||||
|
return this.http.post<SubCategory>(url + '/' + path.join('/') + '/moveIndicator', moveIndicator, CustomOptions.registryOptions()).pipe(map(subCategory => {
|
||||||
|
return HelperFunctions.copy(subCategory);
|
||||||
|
}));
|
||||||
|
}
|
||||||
|
|
||||||
getStakeholderAsObservable(): Observable<Stakeholder> {
|
getStakeholderAsObservable(): Observable<Stakeholder> {
|
||||||
return this.stakeholderSubject.asObservable();
|
return this.stakeholderSubject.asObservable();
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
import {Component, Input, ViewChild} from '@angular/core';
|
import {ChangeDetectorRef, Component, Input, ViewChild} from '@angular/core';
|
||||||
import {ActivatedRoute, Router} from "@angular/router";
|
import {ActivatedRoute, Router} from "@angular/router";
|
||||||
import {Subscriber, Subscription} from "rxjs";
|
import {Subscriber, Subscription} from "rxjs";
|
||||||
import {OrcidService} from "./orcid.service";
|
import {OrcidService} from "./orcid.service";
|
||||||
|
@ -85,7 +85,7 @@ declare var UIkit: any;
|
||||||
<ng-container *ngIf="!showOnlyUpdateButton">
|
<ng-container *ngIf="!showOnlyUpdateButton">
|
||||||
<span class="uk-margin-bottom uk-flex uk-flex-middle uk-flex-center">
|
<span class="uk-margin-bottom uk-flex uk-flex-middle uk-flex-center">
|
||||||
<span>ORCID </span>
|
<span>ORCID </span>
|
||||||
<img src="assets/common-assets/common/ORCIDiD_icon16x16.png" alt="" loading="lazy">
|
<img src="assets/common-assets/common/ORCIDiD_icon16x16.png" alt="ORCID logo" loading="lazy">
|
||||||
<span> ACTIONS</span>
|
<span> ACTIONS</span>
|
||||||
</span>
|
</span>
|
||||||
|
|
||||||
|
@ -330,7 +330,8 @@ export class OrcidWorkComponent {
|
||||||
private _router: Router,
|
private _router: Router,
|
||||||
private orcidService: OrcidService,
|
private orcidService: OrcidService,
|
||||||
private resultLandingService: ResultLandingService,
|
private resultLandingService: ResultLandingService,
|
||||||
private userManagementService: UserManagementService, private _logService: LogService, private _userProfileService: UserProfileService) {
|
private userManagementService: UserManagementService, private _logService: LogService, private _userProfileService: UserProfileService,
|
||||||
|
private cdr: ChangeDetectorRef) {
|
||||||
if (typeof document !== 'undefined') {
|
if (typeof document !== 'undefined') {
|
||||||
this.tokenUrl = properties.orcidTokenURL
|
this.tokenUrl = properties.orcidTokenURL
|
||||||
+ "client_id=" + properties.orcidClientId
|
+ "client_id=" + properties.orcidClientId
|
||||||
|
@ -444,6 +445,8 @@ export class OrcidWorkComponent {
|
||||||
this.subscriptions.push(this.orcidService.getPutCode(this.pids).subscribe(
|
this.subscriptions.push(this.orcidService.getPutCode(this.pids).subscribe(
|
||||||
putCodes => {
|
putCodes => {
|
||||||
this.putCodes = putCodes;
|
this.putCodes = putCodes;
|
||||||
|
this.cdr.markForCheck();
|
||||||
|
// this.cdr.detectChanges();
|
||||||
}, error => {
|
}, error => {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -525,7 +528,9 @@ export class OrcidWorkComponent {
|
||||||
this.putCodes.push("" + response['put-code']);
|
this.putCodes.push("" + response['put-code']);
|
||||||
this.creationDates.push(response['created-date']['value']);
|
this.creationDates.push(response['created-date']['value']);
|
||||||
this.updateDates.push(response['last-modified-date']['value']);
|
this.updateDates.push(response['last-modified-date']['value']);
|
||||||
|
this.cdr.markForCheck();
|
||||||
|
// this.cdr.detectChanges();
|
||||||
|
|
||||||
// this.closeGrantModal();
|
// this.closeGrantModal();
|
||||||
// this.message = "You have successfully added work with pids: "+this.pids+" in your ORCID record!";
|
// this.message = "You have successfully added work with pids: "+this.pids+" in your ORCID record!";
|
||||||
this.message = "You have successfully added work \"" + this.resultTitle + "\" in your ORCID record!";
|
this.message = "You have successfully added work \"" + this.resultTitle + "\" in your ORCID record!";
|
||||||
|
@ -701,6 +706,8 @@ export class OrcidWorkComponent {
|
||||||
deletedAll = false;
|
deletedAll = false;
|
||||||
} else {
|
} else {
|
||||||
this.putCodes.splice(i, 1);
|
this.putCodes.splice(i, 1);
|
||||||
|
this.cdr.markForCheck();
|
||||||
|
// this.cdr.detectChanges();
|
||||||
this.creationDates.splice(i, 1);
|
this.creationDates.splice(i, 1);
|
||||||
this.updateDates.splice(i, 1);
|
this.updateDates.splice(i, 1);
|
||||||
// this.works.splice(i, 1);
|
// this.works.splice(i, 1);
|
||||||
|
|
|
@ -12,6 +12,8 @@ import {EmailService} from "../utils/email/email.service";
|
||||||
import {Composer} from "../utils/email/composer";
|
import {Composer} from "../utils/email/composer";
|
||||||
import {ClearCacheService} from "../services/clear-cache.service";
|
import {ClearCacheService} from "../services/clear-cache.service";
|
||||||
import {BaseComponent} from "../sharedComponents/base/base.component";
|
import {BaseComponent} from "../sharedComponents/base/base.component";
|
||||||
|
import {StakeholderUtils} from "../monitor-admin/utils/indicator-utils";
|
||||||
|
import {StringUtils} from "../utils/string-utils.class";
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'role-verification',
|
selector: 'role-verification',
|
||||||
|
@ -19,12 +21,9 @@ import {BaseComponent} from "../sharedComponents/base/base.component";
|
||||||
<modal-alert #managerModal [overflowBody]="false" (alertOutput)="verifyManager()" (cancelOutput)="cancel()"
|
<modal-alert #managerModal [overflowBody]="false" (alertOutput)="verifyManager()" (cancelOutput)="cancel()"
|
||||||
[okDisabled]="code.invalid || loading">
|
[okDisabled]="code.invalid || loading">
|
||||||
<div>
|
<div>
|
||||||
You have been invited to join <span
|
You have been invited to join <span class="uk-text-bold">{{name}}</span> {{(dashboard)}} Dashboard as a {{stakeholderUtils.roles.manager}}.
|
||||||
class="uk-text-bold">{{name}}</span> {{(service === 'monitor' ? 'Monitor' : 'Research Community')}} Dashboard
|
|
||||||
as a manager.
|
|
||||||
<span class="uk-text-primary">Fill</span> in the <span class="uk-text-primary">verification code</span>, sent to
|
<span class="uk-text-primary">Fill</span> in the <span class="uk-text-primary">verification code</span>, sent to
|
||||||
your
|
your email, to accept the invitation request.
|
||||||
email, to accept the invitation request.
|
|
||||||
</div>
|
</div>
|
||||||
<div *ngIf="!loading" class="uk-margin-medium-top uk-flex uk-flex-center">
|
<div *ngIf="!loading" class="uk-margin-medium-top uk-flex uk-flex-center">
|
||||||
<div input [formInput]="code" class="uk-width-medium" placeholder="Verification code">
|
<div input [formInput]="code" class="uk-width-medium" placeholder="Verification code">
|
||||||
|
@ -36,14 +35,12 @@ import {BaseComponent} from "../sharedComponents/base/base.component";
|
||||||
</div>
|
</div>
|
||||||
</modal-alert>
|
</modal-alert>
|
||||||
<modal-alert #memberModal [overflowBody]="false" (cancelOutput)="cancel()"
|
<modal-alert #memberModal [overflowBody]="false" (cancelOutput)="cancel()"
|
||||||
(alertOutput)="verifyMember()" [okDisabled]="(code.invalid || loading) && !isMember">
|
(alertOutput)="verifyMember()" [okDisabled]="(code.invalid || loading)">
|
||||||
<div *ngIf="!isMember">
|
<div>
|
||||||
<div>
|
<div>
|
||||||
You have been invited to join <span class="uk-text-bold">{{name}}</span> Monitor Dashboard as a member.
|
You have been invited to join <span class="uk-text-bold">{{name}}</span> {{(dashboard)}} Dashboard as a {{stakeholderUtils.roles.member}}.
|
||||||
<span class="uk-text-primary">Fill</span> in the <span class="uk-text-primary">verification code</span>, sent
|
<span class="uk-text-primary">Fill</span> in the <span class="uk-text-primary">verification code</span>, sent
|
||||||
to
|
to your email, to accept the invitation request.
|
||||||
your
|
|
||||||
email, to accept the invitation request.
|
|
||||||
</div>
|
</div>
|
||||||
<div *ngIf="!loading" class="uk-margin-medium-top uk-flex uk-flex-wrap uk-flex-center">
|
<div *ngIf="!loading" class="uk-margin-medium-top uk-flex uk-flex-wrap uk-flex-center">
|
||||||
<div input [formInput]="code" class="uk-width-medium" placeholder="Verification code">
|
<div input [formInput]="code" class="uk-width-medium" placeholder="Verification code">
|
||||||
|
@ -54,13 +51,6 @@ import {BaseComponent} from "../sharedComponents/base/base.component";
|
||||||
<loading></loading>
|
<loading></loading>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div *ngIf="isMember">
|
|
||||||
<div>
|
|
||||||
Welcome! You are now a member of the OpenAIRE Monitor Dashboard for the <span
|
|
||||||
class="uk-text-bold">{{name}}</span>!
|
|
||||||
From now on, you will have access to our restricted content.
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</modal-alert>
|
</modal-alert>
|
||||||
<modal-alert #errorModal (alertOutput)="cancel()" [overflowBody]="false">
|
<modal-alert #errorModal (alertOutput)="cancel()" [overflowBody]="false">
|
||||||
<div>
|
<div>
|
||||||
|
@ -83,7 +73,7 @@ export class RoleVerificationComponent extends BaseComponent implements OnInit,
|
||||||
public id: string;
|
public id: string;
|
||||||
@Input()
|
@Input()
|
||||||
set type(type: string) {
|
set type(type: string) {
|
||||||
this._type = Role.GROUP + type;
|
this._type = Role.GROUP + Role.mapType(type);
|
||||||
}
|
}
|
||||||
@Input()
|
@Input()
|
||||||
public name: string;
|
public name: string;
|
||||||
|
@ -95,6 +85,8 @@ export class RoleVerificationComponent extends BaseComponent implements OnInit,
|
||||||
public userInfoLink = null;
|
public userInfoLink = null;
|
||||||
@Input()
|
@Input()
|
||||||
public relativeTo: ActivatedRoute = this._route;
|
public relativeTo: ActivatedRoute = this._route;
|
||||||
|
@Input()
|
||||||
|
public dashboard: string = 'Research Community';
|
||||||
public user: User;
|
public user: User;
|
||||||
public verification: any;
|
public verification: any;
|
||||||
public code: UntypedFormControl;
|
public code: UntypedFormControl;
|
||||||
|
@ -105,8 +97,8 @@ export class RoleVerificationComponent extends BaseComponent implements OnInit,
|
||||||
@ViewChild('errorModal') errorModal: AlertModal;
|
@ViewChild('errorModal') errorModal: AlertModal;
|
||||||
public error: string = null;
|
public error: string = null;
|
||||||
public loading: boolean = false;
|
public loading: boolean = false;
|
||||||
public isMember: boolean = false;
|
public stakeholderUtils: StakeholderUtils = new StakeholderUtils();
|
||||||
|
|
||||||
constructor(protected _route: ActivatedRoute,
|
constructor(protected _route: ActivatedRoute,
|
||||||
protected _router: Router,
|
protected _router: Router,
|
||||||
private fb: UntypedFormBuilder,
|
private fb: UntypedFormBuilder,
|
||||||
|
@ -117,18 +109,23 @@ export class RoleVerificationComponent extends BaseComponent implements OnInit,
|
||||||
private cdr: ChangeDetectorRef) {
|
private cdr: ChangeDetectorRef) {
|
||||||
super();
|
super();
|
||||||
}
|
}
|
||||||
|
|
||||||
ngOnInit() {
|
ngOnInit() {
|
||||||
this.reset();
|
this.reset();
|
||||||
}
|
}
|
||||||
|
|
||||||
ngAfterViewInit() {
|
ngAfterViewInit() {
|
||||||
|
this.init();
|
||||||
|
}
|
||||||
|
|
||||||
|
init() {
|
||||||
|
this.ngOnDestroy();
|
||||||
this.subscriptions.push(this.userManagementService.getUserInfo().subscribe(user => {
|
this.subscriptions.push(this.userManagementService.getUserInfo().subscribe(user => {
|
||||||
this.user = user;
|
this.user = user;
|
||||||
this.paramsSubscription = this._route.queryParams.subscribe(params => {
|
this.paramsSubscription = this._route.queryParams.subscribe(params => {
|
||||||
if (params) {
|
if (params) {
|
||||||
this.cdr.detectChanges();
|
this.cdr.detectChanges();
|
||||||
if(params['verify'] && !this.isMember) {
|
if(params['verify']) {
|
||||||
if (this.user) {
|
if (this.user) {
|
||||||
this.subscriptions.push(this.userRegistryService.getInvitation(params['verify']).subscribe(verification => {
|
this.subscriptions.push(this.userRegistryService.getInvitation(params['verify']).subscribe(verification => {
|
||||||
this.verification = verification;
|
this.verification = verification;
|
||||||
|
@ -155,51 +152,43 @@ export class RoleVerificationComponent extends BaseComponent implements OnInit,
|
||||||
relativeTo: this.relativeTo
|
relativeTo: this.relativeTo
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
} else if(this.isMember) {
|
|
||||||
this.openMemberModal();
|
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
this.isMember = false;
|
|
||||||
this.cdr.detectChanges();
|
this.cdr.detectChanges();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}));
|
}));
|
||||||
}
|
}
|
||||||
|
|
||||||
ngOnDestroy() {
|
ngOnDestroy() {
|
||||||
super.ngOnDestroy();
|
super.ngOnDestroy();
|
||||||
if (this.paramsSubscription instanceof Subscription) {
|
if (this.paramsSubscription instanceof Subscription) {
|
||||||
this.paramsSubscription.unsubscribe();
|
this.paramsSubscription.unsubscribe();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public openManagerModal() {
|
public openManagerModal() {
|
||||||
this.error = null;
|
this.error = null;
|
||||||
this.managerModal.okButtonLeft = false;
|
this.managerModal.okButtonLeft = false;
|
||||||
this.managerModal.okButtonText = 'Accept';
|
this.managerModal.okButtonText = 'Accept';
|
||||||
this.managerModal.stayOpen = true;
|
this.managerModal.stayOpen = true;
|
||||||
this.managerModal.cancelButtonText = 'Cancel';
|
this.managerModal.cancelButtonText = 'Cancel';
|
||||||
this.managerModal.alertTitle = 'Manager Invitation';
|
this.managerModal.alertTitle = StringUtils.capitalize(this.stakeholderUtils.roles.manager) + ' Invitation';
|
||||||
this.managerModal.open();
|
this.managerModal.open();
|
||||||
}
|
}
|
||||||
|
|
||||||
public openMemberModal() {
|
public openMemberModal() {
|
||||||
this.error = null;
|
this.error = null;
|
||||||
if(this.isMember) {
|
this.memberModal.cancelButton = true;
|
||||||
this.memberModal.cancelButton = false;
|
this.memberModal.okButtonText = 'Accept';
|
||||||
this.memberModal.okButtonText = 'Close';
|
|
||||||
} else {
|
|
||||||
this.memberModal.cancelButton = true;
|
|
||||||
this.memberModal.okButtonText = 'Accept';
|
|
||||||
}
|
|
||||||
this.memberModal.okButtonLeft = false;
|
this.memberModal.okButtonLeft = false;
|
||||||
this.memberModal.stayOpen = true;
|
this.memberModal.stayOpen = true;
|
||||||
this.memberModal.cancelButtonText = 'Cancel';
|
this.memberModal.cancelButtonText = 'Cancel';
|
||||||
this.memberModal.alertTitle = 'Member Invitation';
|
this.memberModal.alertTitle = StringUtils.capitalize(this.stakeholderUtils.roles.member) + ' Invitation';
|
||||||
this.cdr.detectChanges();
|
this.cdr.detectChanges();
|
||||||
this.memberModal.open();
|
this.memberModal.open();
|
||||||
}
|
}
|
||||||
|
|
||||||
public openErrorModal() {
|
public openErrorModal() {
|
||||||
this.error = null;
|
this.error = null;
|
||||||
this.errorModal.cancelButton = false;
|
this.errorModal.cancelButton = false;
|
||||||
|
@ -207,27 +196,20 @@ export class RoleVerificationComponent extends BaseComponent implements OnInit,
|
||||||
this.errorModal.alertTitle = 'Invalid URL';
|
this.errorModal.alertTitle = 'Invalid URL';
|
||||||
this.errorModal.open();
|
this.errorModal.open();
|
||||||
}
|
}
|
||||||
|
|
||||||
public verifyManager() {
|
public verifyManager() {
|
||||||
this.loading = true;
|
this.loading = true;
|
||||||
this.subscriptions.push(this.userRegistryService.verify(this.verification.id, this.code.value).subscribe(() => {
|
this.subscriptions.push(this.userRegistryService.verify(this.verification.id, this.code.value).subscribe(() => {
|
||||||
this.clearCacheService.clearCache('Managers updated');
|
this.clearCacheService.clearCache('Managers updated');
|
||||||
this.managerModal.cancel();
|
this.managerModal.cancel();
|
||||||
this.error = null;
|
this.error = null;
|
||||||
this.userManagementService.updateUserInfo(() => {
|
if(this.service === "irish" || this.service === "monitor") {
|
||||||
if (this.paramsSubscription instanceof Subscription) {
|
this.loading = false;
|
||||||
this.paramsSubscription.unsubscribe();
|
this.userManagementService.login(properties.domain + '/admin/' + this.verification.entity);
|
||||||
}
|
} else {
|
||||||
if(this.service === "irish") {
|
this.subscriptions.push(this.emailService.notifyManagers(this.id, 'manager',
|
||||||
this.loading = false;
|
|
||||||
this.userManagementService.login(properties.domain + '/admin/' + this.verification.entity);
|
|
||||||
} else if (this.service === "monitor" ) {
|
|
||||||
this.loading = false;
|
|
||||||
this._router.navigate(['/admin/' + this.verification.entity]);
|
|
||||||
} else {
|
|
||||||
this.subscriptions.push(this.emailService.notifyManagers(this.id, 'manager',
|
|
||||||
Composer.composeEmailToInformOldManagersForTheNewOnes(this.name, this.id)).subscribe(() => {
|
Composer.composeEmailToInformOldManagersForTheNewOnes(this.name, this.id)).subscribe(() => {
|
||||||
this.subscriptions.push(this.emailService.notifyNewManager(Composer.composeEmailForNewManager(this.id, this.name)).subscribe(
|
this.subscriptions.push(this.emailService.notifyNewManager(Composer.composeEmailForNewManager(this.id, this.name)).subscribe(
|
||||||
() => {
|
() => {
|
||||||
this.loading = false;
|
this.loading = false;
|
||||||
window.location.href = properties.adminPortalURL + '/' + this.verification.entity;
|
window.location.href = properties.adminPortalURL + '/' + this.verification.entity;
|
||||||
|
@ -237,49 +219,38 @@ export class RoleVerificationComponent extends BaseComponent implements OnInit,
|
||||||
this.loading = false;
|
this.loading = false;
|
||||||
window.location.href = properties.adminPortalURL + '/' + this.verification.entity;
|
window.location.href = properties.adminPortalURL + '/' + this.verification.entity;
|
||||||
}
|
}
|
||||||
));
|
));
|
||||||
}, error => {
|
}, error => {
|
||||||
console.error(error);
|
console.error(error);
|
||||||
this.loading = false;
|
this.loading = false;
|
||||||
window.location.href = properties.adminPortalURL + '/' + this.verification.entity;
|
window.location.href = properties.adminPortalURL + '/' + this.verification.entity;
|
||||||
}));
|
}));
|
||||||
}
|
}
|
||||||
});
|
|
||||||
}, error => {
|
}, error => {
|
||||||
this.loading = false;
|
this.loading = false;
|
||||||
this.error = 'The verification code is invalid';
|
this.error = 'The verification code is invalid';
|
||||||
}));
|
}));
|
||||||
}
|
}
|
||||||
|
|
||||||
public verifyMember() {
|
public verifyMember() {
|
||||||
this.loading = true;
|
this.loading = true;
|
||||||
if (!this.isMember) {
|
|
||||||
this.subscriptions.push(this.userRegistryService.verify(this.verification.id, this.code.value, "member").subscribe(() => {
|
this.subscriptions.push(this.userRegistryService.verify(this.verification.id, this.code.value, "member").subscribe(() => {
|
||||||
this.clearCacheService.clearCache('Members updated');
|
this.clearCacheService.clearCache('Members updated');
|
||||||
|
this.memberModal.cancel();
|
||||||
this.loading = false;
|
this.loading = false;
|
||||||
this.error = null;
|
this.error = null;
|
||||||
this.isMember = true;
|
window.location.href = window.location.href.split('?')[0];
|
||||||
this.userManagementService.updateUserInfo(() => {
|
|
||||||
if (this.paramsSubscription instanceof Subscription) {
|
|
||||||
this.paramsSubscription.unsubscribe();
|
|
||||||
}
|
|
||||||
this.cancel();
|
|
||||||
});
|
|
||||||
}, error => {
|
}, error => {
|
||||||
this.loading = false;
|
this.loading = false;
|
||||||
this.error = 'The verification code is invalid';
|
this.error = 'The verification code is invalid';
|
||||||
}));
|
}));
|
||||||
} else {
|
|
||||||
this.memberModal.cancel();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public reset() {
|
public reset() {
|
||||||
this.code = this.fb.control('', [Validators.required, Validators.pattern('^[+0-9]{6}$')]);
|
this.code = this.fb.control('', [Validators.required, Validators.pattern('^[+0-9]{6}$')]);
|
||||||
}
|
}
|
||||||
|
|
||||||
cancel() {
|
cancel() {
|
||||||
this.isMember = false;
|
|
||||||
this._router.navigate([]);
|
this._router.navigate([]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -34,9 +34,9 @@
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="uk-width-2-5@m uk-width-1-1@s uk-text-center uk-position-relative" uk-scrollspy-class>
|
<div class="uk-width-2-5@m uk-width-1-1@s uk-text-center uk-position-relative" uk-scrollspy-class>
|
||||||
<img src="assets/common-assets/sdg/sdg-hero-img.svg" loading="lazy">
|
<img src="assets/common-assets/sdg/sdg-hero-img.svg" loading="lazy" alt="SDGs logo">
|
||||||
<div class="uk-position-bottom-left uk-card uk-card-default uk-padding">
|
<div class="uk-position-bottom-left uk-card uk-card-default uk-padding">
|
||||||
<img src="assets/common-assets/sdg/sdg-badge.png" loading="lazy" style="max-width: 215px">
|
<img src="assets/common-assets/sdg/sdg-badge.png" loading="lazy" style="max-width: 215px" alt="SDGs big logo">
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
@ -61,7 +61,7 @@
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="uk-text-center">
|
<div class="uk-text-center">
|
||||||
<img [src]="'assets/common-assets/sdg/icons/g' + sdg.code + '.png'" alt="">
|
<img [src]="'assets/common-assets/sdg/icons/g' + sdg.code + '.png'" [alt]="'SDG code: '+sdg.code">
|
||||||
</div>
|
</div>
|
||||||
<div class="uk-text-center uk-padding-small uk-background-default" style="border-radius: 0 0 4px 4px;">
|
<div class="uk-text-center uk-padding-small uk-background-default" style="border-radius: 0 0 4px 4px;">
|
||||||
<span class="uk-text-large uk-text-bold uk-margin-small-bottom">{{sdg.number == null ? '0' : sdg.number | number}}</span>
|
<span class="uk-text-large uk-text-bold uk-margin-small-bottom">{{sdg.number == null ? '0' : sdg.number | number}}</span>
|
||||||
|
|
|
@ -33,6 +33,7 @@ import {RefineFieldResultsService} from "../services/refineFieldResults.service"
|
||||||
[includeOnlyResultsAndFilter]="includeOnlyResultsAndFilter"
|
[includeOnlyResultsAndFilter]="includeOnlyResultsAndFilter"
|
||||||
[searchForm]="searchForm"
|
[searchForm]="searchForm"
|
||||||
[sort]="false"
|
[sort]="false"
|
||||||
|
[showRefine]="refineFields?.length > 0"
|
||||||
[filters]="filters"
|
[filters]="filters"
|
||||||
[simpleView]="simpleView" formPlaceholderText="Search by organization name..."
|
[simpleView]="simpleView" formPlaceholderText="Search by organization name..."
|
||||||
[showSwitchSearchLink]="showSwitchSearchLink"
|
[showSwitchSearchLink]="showSwitchSearchLink"
|
||||||
|
|
|
@ -1,11 +1,11 @@
|
||||||
<ng-template #selected_filters_pills>
|
<ng-template #selected_filters_pills>
|
||||||
<h1 class="uk-margin-remove">
|
<h1 class="uk-margin-remove">
|
||||||
<div [class.uk-invisible]="list.children.length === 0">
|
<div [class.uk-invisible]="list.children.length === 0" [class.uk-margin-top]="list.children.length > 0">
|
||||||
<ul #list class="uk-grid uk-grid-small uk-flex-wrap" uk-grid>
|
<ul #list class="uk-grid uk-grid-small uk-flex-wrap" uk-grid>
|
||||||
<ng-container *ngFor="let customFilter of customFilters">
|
<ng-container *ngFor="let customFilter of customFilters">
|
||||||
<ng-container *ngIf="customFilter.isHiddenFilter">
|
<ng-container *ngIf="customFilter.isHiddenFilter">
|
||||||
<li class="uk-flex uk-flex-middle">
|
<li class="uk-flex uk-flex-middle">
|
||||||
<span class="uk-label uk-label-small uk-label-secondary uk-text-truncate target1">
|
<span class="uk-text-capitalize uk-label uk-label-small uk-label-secondary uk-text-truncate target1">
|
||||||
{{customFilter.valueName}}
|
{{customFilter.valueName}}
|
||||||
</span>
|
</span>
|
||||||
</li>
|
</li>
|
||||||
|
@ -15,7 +15,7 @@
|
||||||
<ng-container *ngFor="let type of resultTypes.values; let i = index;">
|
<ng-container *ngFor="let type of resultTypes.values; let i = index;">
|
||||||
<ng-container *ngIf="type.selected">
|
<ng-container *ngIf="type.selected">
|
||||||
<li class="">
|
<li class="">
|
||||||
<span class="uk-label uk-label-small uk-label-primary uk-flex uk-flex-middle target2">
|
<span class="uk-text-capitalize uk-label uk-label-small uk-label-secondary uk-flex uk-flex-middle target2">
|
||||||
<span class="uk-margin-small-right uk-width-expand uk-text-truncate">{{type.name}}</span>
|
<span class="uk-margin-small-right uk-width-expand uk-text-truncate">{{type.name}}</span>
|
||||||
<button [class.uk-disabled]="disabled" (click)="removeResultType(type.id)" class="uk-close uk-icon" [disabled]="disabled">
|
<button [class.uk-disabled]="disabled" (click)="removeResultType(type.id)" class="uk-close uk-icon" [disabled]="disabled">
|
||||||
<icon name="close" flex="true" ratio="0.7"></icon>
|
<icon name="close" flex="true" ratio="0.7"></icon>
|
||||||
|
@ -29,7 +29,7 @@
|
||||||
<ng-container *ngFor="let filter of rangeFilters ">
|
<ng-container *ngFor="let filter of rangeFilters ">
|
||||||
<ng-container *ngIf="filter.selectedFromAndToValues">
|
<ng-container *ngIf="filter.selectedFromAndToValues">
|
||||||
<li class="">
|
<li class="">
|
||||||
<span class="uk-label uk-label-small uk-label-primary uk-flex uk-flex-middle target3">
|
<span class="uk-text-capitalize uk-label uk-label-small uk-label-secondary uk-flex uk-flex-middle target3">
|
||||||
<span class="uk-margin-small-right uk-width-expand uk-text-truncate">{{filter.selectedFromAndToValues}}</span>
|
<span class="uk-margin-small-right uk-width-expand uk-text-truncate">{{filter.selectedFromAndToValues}}</span>
|
||||||
<button [class.uk-disabled]="disabled" (click)="removeRangeFilter(filter)" class="uk-close uk-icon" [disabled]="disabled">
|
<button [class.uk-disabled]="disabled" (click)="removeRangeFilter(filter)" class="uk-close uk-icon" [disabled]="disabled">
|
||||||
<icon name="close" flex="true" ratio="0.7"></icon>
|
<icon name="close" flex="true" ratio="0.7"></icon>
|
||||||
|
@ -44,7 +44,7 @@
|
||||||
<ng-container *ngFor="let value of getSelectedValues(filter); let i = index; let end = last; ">
|
<ng-container *ngFor="let value of getSelectedValues(filter); let i = index; let end = last; ">
|
||||||
<li *ngIf="!customFilter || (customFilter.isHiddenFilter && customFilter.valueId != value.id)"
|
<li *ngIf="!customFilter || (customFilter.isHiddenFilter && customFilter.valueId != value.id)"
|
||||||
class="">
|
class="">
|
||||||
<span class="uk-label uk-label-small uk-label-primary uk-flex uk-flex-middle target4">
|
<span class="uk-text-capitalize uk-label uk-label-small uk-label-secondary uk-flex uk-flex-middle target4">
|
||||||
<span
|
<span
|
||||||
class="uk-margin-small-right uk-width-expand uk-text-truncate">
|
class="uk-margin-small-right uk-width-expand uk-text-truncate">
|
||||||
<ng-container *ngIf="filter.type && (filter.type == 'boolean' || filter.type == 'triplet') else noboolean">
|
<ng-container *ngIf="filter.type && (filter.type == 'boolean' || filter.type == 'triplet') else noboolean">
|
||||||
|
@ -73,7 +73,7 @@
|
||||||
<ng-container *ngIf="filter.countSelectedValues > 0">
|
<ng-container *ngIf="filter.countSelectedValues > 0">
|
||||||
<ng-container *ngFor="let value of getSelectedValues(filter); let i = index; let end = last; ">
|
<ng-container *ngFor="let value of getSelectedValues(filter); let i = index; let end = last; ">
|
||||||
<li *ngIf="!customFilters || (customFilters[0].isHiddenFilter && customFilters[0].valueId != value.id)">
|
<li *ngIf="!customFilters || (customFilters[0].isHiddenFilter && customFilters[0].valueId != value.id)">
|
||||||
<span class="uk-label uk-label-small uk-label-primary uk-flex uk-flex-middle target5">
|
<span class="uk-text-capitalize uk-label uk-label-small uk-label-secondary uk-flex uk-flex-middle target5">
|
||||||
<span class="uk-margin-small-right uk-width-expand uk-text-truncate">
|
<span class="uk-margin-small-right uk-width-expand uk-text-truncate">
|
||||||
<ng-container *ngIf="filter.type && (filter.type == 'boolean' || filter.type == 'triplet') else noboolean">
|
<ng-container *ngIf="filter.type && (filter.type == 'boolean' || filter.type == 'triplet') else noboolean">
|
||||||
<span>{{filter.title}}:
|
<span>{{filter.title}}:
|
||||||
|
@ -288,7 +288,15 @@
|
||||||
</div>
|
</div>
|
||||||
<div class="uk-container uk-margin-top" [class.uk-container-large]="!mobile" [class.uk-container-expand]="mobile" [class.uk-padding-remove-horizontal]="mobile">
|
<div class="uk-container uk-margin-top" [class.uk-container-large]="!mobile" [class.uk-container-expand]="mobile" [class.uk-padding-remove-horizontal]="mobile">
|
||||||
<div class="uk-grid uk-margin-large-bottom" [class.uk-margin-top]="!mobile" uk-grid>
|
<div class="uk-grid uk-margin-large-bottom" [class.uk-margin-top]="!mobile" uk-grid>
|
||||||
<div *ngIf="!mobile && showRefine && (results.length > 0 || (searchUtils.refineStatus == errorCodes.LOADING && searchUtils.status != errorCodes.LOADING) || (!hideFilters &&
|
<!-- <div *ngIf="!mobile && showRefine -->
|
||||||
|
<!-- && (searchUtils.refineStatus == errorCodes.DONE && ((orderedFilters && orderedFilters.length > 0) || (staticFilters && staticFilters.length > 0)-->
|
||||||
|
<!-- || (rangeFilters && rangeFilters.length > 0) || (filters && filters.length > 0)))-->
|
||||||
|
<!-- && (results.length > 0 || (searchUtils.refineStatus == errorCodes.LOADING && searchUtils.status != errorCodes.LOADING) || (!hideFilters &&-->
|
||||||
|
<!-- (existingFiltersWithValues > 0 || (selectedRangeFilters + selectedFilters + selectedTypesNum) > 0))) "-->
|
||||||
|
<!-- class="uk-width-1-4@m search-filters">-->
|
||||||
|
<!-- </div>-->
|
||||||
|
<div *ngIf="!mobile && showRefine
|
||||||
|
&& (results.length > 0 || (searchUtils.refineStatus == errorCodes.LOADING && searchUtils.status != errorCodes.LOADING) || (!hideFilters &&
|
||||||
(existingFiltersWithValues > 0 || (selectedRangeFilters + selectedFilters + selectedTypesNum) > 0))) "
|
(existingFiltersWithValues > 0 || (selectedRangeFilters + selectedFilters + selectedTypesNum) > 0))) "
|
||||||
class="uk-width-1-4@m search-filters">
|
class="uk-width-1-4@m search-filters">
|
||||||
<ng-container *ngTemplateOutlet="filters_column; context: {}"></ng-container>
|
<ng-container *ngTemplateOutlet="filters_column; context: {}"></ng-container>
|
||||||
|
@ -308,31 +316,47 @@
|
||||||
[href]="openaireLink+this.routerHelper.createQueryParamsString(this.parameterNames, this.parameterValues)"
|
[href]="openaireLink+this.routerHelper.createQueryParamsString(this.parameterNames, this.parameterValues)"
|
||||||
target="_blank"> OpenAIRE - Explore</a>.
|
target="_blank"> OpenAIRE - Explore</a>.
|
||||||
</div>
|
</div>
|
||||||
<ng-container *ngIf="mobile">
|
|
||||||
|
<div class="uk-flex uk-flex-middle uk-child-width-auto uk-flex-between">
|
||||||
|
<!-- Total results, number of pages -->
|
||||||
|
<div class="uk-margin-remove-bottom uk-text-truncate" [class.uk-margin-medium-right]="!mobile" [class.uk-margin-right]="mobile" [class.uk-h6]="!mobile">
|
||||||
|
<ng-container *ngIf="results && searchUtils.totalResults > 0">
|
||||||
|
<span>{{searchUtils.totalResults|number}}</span>
|
||||||
|
<span class="uk-text-meta uk-text-capitalize"> {{type}}</span>
|
||||||
|
<ng-container *ngIf="searchTerm && simpleView">
|
||||||
|
<span class="uk-text-meta"> for </span>
|
||||||
|
<span class="uk-text-bold">{{searchTerm}}</span>
|
||||||
|
</ng-container>
|
||||||
|
<ng-container *ngIf="!simpleView && advancedSearchTerms > 0">
|
||||||
|
<span class="uk-text-bold"> ({{advancedSearchTerms}} rule{{advancedSearchTerms == 1 ? '' : 's'}} applied)</span>
|
||||||
|
</ng-container>
|
||||||
|
</ng-container>
|
||||||
|
<ng-container *ngIf="!loadPaging && oldTotalResults > 0 && searchUtils.status == errorCodes.LOADING">
|
||||||
|
<span>{{oldTotalResults|number}}</span>
|
||||||
|
<span class="uk-text-meta uk-text-capitalize"> {{type}}, page </span>
|
||||||
|
<span>{{searchUtils.page | number}}</span>
|
||||||
|
<span class="uk-text-meta"> of {{(totalPages(oldTotalResults)|number)}}</span>
|
||||||
|
</ng-container>
|
||||||
|
</div>
|
||||||
<!-- Download results -->
|
<!-- Download results -->
|
||||||
<div *ngIf="showDownload && (searchUtils.status !== errorCodes.LOADING || !loadPaging)"
|
<div *ngIf="mobile && showDownload && (searchUtils.status !== errorCodes.LOADING || !loadPaging)"
|
||||||
class="uk-margin-small-bottom uk-flex uk-flex-center">
|
class="uk-flex uk-flex-center">
|
||||||
<search-download
|
<search-download
|
||||||
*ngIf="( entityType !='community' && entityType != 'stakeholder') && usedBy == 'search'"
|
*ngIf="( entityType !='community' && entityType != 'stakeholder') && usedBy == 'search'"
|
||||||
[isDisabled]="disabled"
|
[isDisabled]="disabled"
|
||||||
[type]="csvPath" [csvParams]="csvParams" [totalResults]="searchUtils.totalResults">
|
[type]="csvPath" [csvParams]="csvParams" [totalResults]="searchUtils.totalResults">
|
||||||
</search-download>
|
</search-download>
|
||||||
<ng-container *ngIf="properties.zenodoDumpUrl && entityType == 'result'">
|
<ng-container *ngIf="properties.zenodoDumpUrl && entityType == 'result'">
|
||||||
<a [href]="properties.zenodoDumpUrl" target="_blank" class=" uk-margin-left uk-button uk-button-link uk-flex uk-flex-middle">
|
<a [href]="properties.zenodoDumpUrl" target="_blank" class=" uk-margin-left uk-button uk-button-link uk-flex uk-flex-middle">
|
||||||
<img src="assets/common-assets/common/zenodoDump.png" width="20"><span class="uk-margin-xsmall-left">Data dump</span>
|
<img src="assets/common-assets/common/zenodoDump.png" alt="Zenodo dump" width="20"><span class="uk-margin-xsmall-left">Data dump</span>
|
||||||
</a>
|
</a>
|
||||||
</ng-container>
|
</ng-container>
|
||||||
</div>
|
</div>
|
||||||
</ng-container>
|
|
||||||
<div *ngIf="(searchUtils.status !== errorCodes.LOADING || !loadPaging) && !mobile" class="uk-flex uk-flex-top">
|
<div *ngIf="!mobile" class="uk-flex uk-flex-middle">
|
||||||
<!-- filters pills -->
|
|
||||||
<div class="uk-width-expand@m">
|
|
||||||
<ng-container *ngTemplateOutlet="selected_filters_pills;"></ng-container>
|
|
||||||
</div>
|
|
||||||
<div class="uk-width-auto@m uk-margin-medium-left uk-flex uk-flex-middle">
|
|
||||||
<div *ngIf="searchUtils.totalResults > 10 || sort || searchUtils.totalResults > searchUtils.size ||
|
<div *ngIf="searchUtils.totalResults > 10 || sort || searchUtils.totalResults > searchUtils.size ||
|
||||||
(!loadPaging && oldTotalResults > searchUtils.size && searchUtils.status == errorCodes.LOADING)"
|
(!loadPaging && oldTotalResults > searchUtils.size && searchUtils.status == errorCodes.LOADING)"
|
||||||
class="uk-grid uk-flex-middle uk-child-width-1-1 uk-child-width-1-2@m" uk-grid>
|
class="uk-grid uk-flex-middle uk-child-width-1-1 uk-child-width-1-2@m" uk-grid>
|
||||||
<div>
|
<div>
|
||||||
<div class="uk-grid uk-flex-middle uk-grid-column-collapse" uk-grid>
|
<div class="uk-grid uk-flex-middle uk-grid-column-collapse" uk-grid>
|
||||||
<search-sorting *ngIf="sort && searchUtils.totalResults > 0"
|
<search-sorting *ngIf="sort && searchUtils.totalResults > 0"
|
||||||
|
@ -345,20 +369,27 @@
|
||||||
</div>
|
</div>
|
||||||
<!-- Download results -->
|
<!-- Download results -->
|
||||||
<div *ngIf="showDownload && (searchUtils.status !== errorCodes.LOADING || !loadPaging)"
|
<div *ngIf="showDownload && (searchUtils.status !== errorCodes.LOADING || !loadPaging)"
|
||||||
class="uk-margin-small-left uk-flex uk-flex-middle" [class.uk-flex-center]="mobile" [class.uk-margin-medium-top]="mobile">
|
class="uk-margin-small-left uk-flex uk-flex-middle" [class.uk-flex-center]="mobile" [class.uk-margin-medium-top]="mobile">
|
||||||
<search-download
|
<search-download
|
||||||
*ngIf="( entityType !='community' && entityType != 'stakeholder') && usedBy == 'search'"
|
*ngIf="( entityType !='community' && entityType != 'stakeholder') && usedBy == 'search'"
|
||||||
[isDisabled]="disabled"
|
[isDisabled]="disabled"
|
||||||
[type]="csvPath" [csvParams]="csvParams" [totalResults]="searchUtils.totalResults">
|
[type]="csvPath" [csvParams]="csvParams" [totalResults]="searchUtils.totalResults">
|
||||||
</search-download>
|
</search-download>
|
||||||
<ng-container *ngIf="properties.zenodoDumpUrl && entityType == 'result'">
|
<ng-container *ngIf="properties.zenodoDumpUrl && entityType == 'result'">
|
||||||
<a [href]="properties.zenodoDumpUrl" target="_blank" class=" uk-margin-left uk-button uk-button-link uk-flex uk-flex-middle">
|
<a [href]="properties.zenodoDumpUrl" target="_blank" class=" uk-margin-left uk-button uk-button-link uk-flex uk-flex-middle">
|
||||||
<img src="assets/common-assets/common/zenodoDump.png" width="20"><span class="uk-margin-xsmall-left">Data dump</span>
|
<img src="assets/common-assets/common/zenodoDump.png" alt="Zenodo dump" width="20"><span class="uk-margin-xsmall-left">Data dump</span>
|
||||||
</a>
|
</a>
|
||||||
</ng-container>
|
</ng-container>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<div *ngIf="(searchUtils.status !== errorCodes.LOADING || !loadPaging) && !mobile" class="uk-flex uk-flex-top">
|
||||||
|
<!-- filters pills -->
|
||||||
|
<div class="uk-width-expand@m">
|
||||||
|
<ng-container *ngTemplateOutlet="selected_filters_pills;"></ng-container>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
<div [class]="searchUtils.page > pagingLimit ? 'search-results' : ''"
|
<div [class]="searchUtils.page > pagingLimit ? 'search-results' : ''"
|
||||||
*ngIf="(searchUtils.page >= pagingLimit) && (searchUtils.totalResults > searchUtils.size*pagingLimit)">
|
*ngIf="(searchUtils.page >= pagingLimit) && (searchUtils.totalResults > searchUtils.size*pagingLimit)">
|
||||||
<p class="uk-alert uk-alert-warning" uk-alert>For more results please try a new, more specific query</p>
|
<p class="uk-alert uk-alert-warning" uk-alert>For more results please try a new, more specific query</p>
|
||||||
|
|
|
@ -1085,7 +1085,7 @@ export class NewSearchPageComponent implements OnInit, OnDestroy, OnChanges {
|
||||||
let params = "";
|
let params = "";
|
||||||
let doisParams = "";
|
let doisParams = "";
|
||||||
var DOIs: Identifier[] = Identifier.getIdentifiersFromString(value);
|
var DOIs: Identifier[] = Identifier.getIdentifiersFromString(value);
|
||||||
if ((entityType == 'publication' || entityType == 'dataset' || entityType == 'software' || entityType == 'other' || entityType == "result" || entityType == "dataprovider" || entityType == "service")) {
|
if ((entityType == 'publication' || entityType == 'dataset' || entityType == 'software' || entityType == 'other' || entityType == "result" || entityType == "dataprovider" || entityType == "service" || entityType == "organization")) {
|
||||||
for (let identifier of DOIs) {
|
for (let identifier of DOIs) {
|
||||||
// console.log(identifier)
|
// console.log(identifier)
|
||||||
// pidclassid exact \"doi\" and pid exact \"10.1016/j.nima.2015.11.134\"
|
// pidclassid exact \"doi\" and pid exact \"10.1016/j.nima.2015.11.134\"
|
||||||
|
|
|
@ -57,7 +57,7 @@ export class SearchResultComponent implements OnInit, OnChanges {
|
||||||
this.previewResults.push(this.getResultPreview(result));
|
this.previewResults.push(this.getResultPreview(result));
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((properties.adminToolsPortalType == "explore" || properties.adminToolsPortalType == "community" || properties.adminToolsPortalType == "aggregator")
|
if ((properties.adminToolsPortalType == "explore" || properties.adminToolsPortalType == "community" || properties.adminToolsPortalType == "aggregator" || properties.dashboard == "irish")
|
||||||
&& Session.isLoggedIn() && this.results && this.results.length > 0
|
&& Session.isLoggedIn() && this.results && this.results.length > 0
|
||||||
&& (this.type == "result" || this.type == "publication" || this.type == "dataset" || this.type == "software" || this.type == "other")
|
&& (this.type == "result" || this.type == "publication" || this.type == "dataset" || this.type == "software" || this.type == "other")
|
||||||
) {
|
) {
|
||||||
|
@ -78,6 +78,7 @@ export class SearchResultComponent implements OnInit, OnChanges {
|
||||||
// console.debug(i, this.previewResults[i].orcidPutCodes);
|
// console.debug(i, this.previewResults[i].orcidPutCodes);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
this.previewResults = JSON.parse(JSON.stringify(this.previewResults, this.replacer), this.reviver);
|
||||||
}, error => {
|
}, error => {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -85,6 +86,26 @@ export class SearchResultComponent implements OnInit, OnChanges {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private replacer(key, value) {
|
||||||
|
if(value instanceof Map) {
|
||||||
|
return {
|
||||||
|
dataType: 'Map',
|
||||||
|
value: Array.from(value.entries()), // or with spread: value: [...value]
|
||||||
|
};
|
||||||
|
} else {
|
||||||
|
return value;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private reviver(key, value) {
|
||||||
|
if(typeof value === 'object' && value !== null) {
|
||||||
|
if (value.dataType === 'Map') {
|
||||||
|
return new Map(value.value);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return value;
|
||||||
|
}
|
||||||
|
|
||||||
public getResultPreview(result: SearchResult): ResultPreview {
|
public getResultPreview(result: SearchResult): ResultPreview {
|
||||||
return ResultPreview.searchResultConvert(result, (result.entityType) ? result.entityType : this.type);
|
return ResultPreview.searchResultConvert(result, (result.entityType) ? result.entityType : this.type);
|
||||||
}
|
}
|
||||||
|
|
|
@ -231,6 +231,7 @@ export class SearchProjectsService {
|
||||||
let fundingData = Array.isArray(resData['fundingtree']) ? resData['fundingtree'][z] : resData['fundingtree'];
|
let fundingData = Array.isArray(resData['fundingtree']) ? resData['fundingtree'][z] : resData['fundingtree'];
|
||||||
if(fundingData.hasOwnProperty("funder")) {
|
if(fundingData.hasOwnProperty("funder")) {
|
||||||
result['funderShortname'] = fundingData['funder'].shortname;
|
result['funderShortname'] = fundingData['funder'].shortname;
|
||||||
|
result['funderName'] = fundingData['funder'].name;
|
||||||
result['funderId'] = fundingData['funder'].id;
|
result['funderId'] = fundingData['funder'].id;
|
||||||
result['jurisdiction'] = (fundingData['funder']['id']['jurisdiction'] )?fundingData['funder']['id']['jurisdiction']:"";
|
result['jurisdiction'] = (fundingData['funder']['id']['jurisdiction'] )?fundingData['funder']['id']['jurisdiction']:"";
|
||||||
|
|
||||||
|
|
|
@ -70,7 +70,7 @@ export class RefineResultsUtils {
|
||||||
}
|
}
|
||||||
public static inParenthesisThePartAfterCharacters(field, characters):string {
|
public static inParenthesisThePartAfterCharacters(field, characters):string {
|
||||||
if( field.name.indexOf(characters) !=-1){
|
if( field.name.indexOf(characters) !=-1){
|
||||||
return field.name.split(characters)[0]+" ("+field.name.split(characters)[1]+")";
|
return field.name.split(characters)[0]+ (field.name.split(characters)[1]?(" ("+field.name.split(characters)[1]+")"):"");
|
||||||
|
|
||||||
}
|
}
|
||||||
return field.name;
|
return field.name;
|
||||||
|
|
|
@ -101,7 +101,7 @@
|
||||||
<li><a
|
<li><a
|
||||||
[href]="'https://'+(properties.environment =='beta' || properties.environment =='development'?'beta.':'')+'monitor.openaire.eu'"
|
[href]="'https://'+(properties.environment =='beta' || properties.environment =='development'?'beta.':'')+'monitor.openaire.eu'"
|
||||||
target="_blank">Monitor</a></li>
|
target="_blank">Monitor</a></li>
|
||||||
<li><a href="https://graph.openaire.eu/develop/" target="_blank">Develop</a></li>
|
<li><a href="'https://'+(properties.environment =='beta' || properties.environment =='development'?'beta.':'')+'develop.openaire.eu" target="_blank">Develop</a></li>
|
||||||
</ul>
|
</ul>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -12,7 +12,7 @@
|
||||||
Send a message
|
Send a message
|
||||||
</div>
|
</div>
|
||||||
<div *ngIf="images.length > 0" class="uk-margin-small avatars">
|
<div *ngIf="images.length > 0" class="uk-margin-small avatars">
|
||||||
<img *ngFor="let image of images" [src]="image" class="uk-border-circle" >
|
<img *ngFor="let image of images" [src]="image" class="uk-border-circle" alt="contact person">
|
||||||
</div>
|
</div>
|
||||||
<div class="uk-text-bold">
|
<div class="uk-text-bold">
|
||||||
How can we help?
|
How can we help?
|
||||||
|
|
|
@ -19,7 +19,7 @@ import {properties} from "../../../../environments/environment";
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'showAuthors',
|
selector: 'showAuthors',
|
||||||
template: `
|
template: `
|
||||||
<ng-template #author_template let-author="author" let-i="i" let-italic="italic">
|
<ng-template #author_template let-author="author" let-i="i" let-italic="italic" let-modal="modal">
|
||||||
<span *ngIf="isSticky || (!author.orcid && !author.orcid_pending) || !isBrowser" style="margin-right: 5px;"
|
<span *ngIf="isSticky || (!author.orcid && !author.orcid_pending) || !isBrowser" style="margin-right: 5px;"
|
||||||
[class.uk-text-italic]="italic">
|
[class.uk-text-italic]="italic">
|
||||||
{{author.fullName + ";"}}
|
{{author.fullName + ";"}}
|
||||||
|
@ -36,7 +36,7 @@ import {properties} from "../../../../environments/environment";
|
||||||
</span>
|
</span>
|
||||||
</a>
|
</a>
|
||||||
<div *ngIf="!isMobile" class="default-dropdown uk-margin-remove-top uk-dropdown orcid-dropdown"
|
<div *ngIf="!isMobile" class="default-dropdown uk-margin-remove-top uk-dropdown orcid-dropdown"
|
||||||
uk-dropdown="mode:click; offset: 4;" style="min-width: 465px !important;" [attr.container]="isModal?'#modal-container':true">
|
uk-dropdown="mode:click; offset: 4; pos: bottom-right" style="min-width: 465px !important;" [attr.container]="'#modal-container'">
|
||||||
<ng-container *ngTemplateOutlet="dropdown"></ng-container>
|
<ng-container *ngTemplateOutlet="dropdown"></ng-container>
|
||||||
</div>
|
</div>
|
||||||
<mobile-dropdown *ngIf="isMobile" [toggle]="toggle">
|
<mobile-dropdown *ngIf="isMobile" [toggle]="toggle">
|
||||||
|
@ -112,7 +112,7 @@ import {properties} from "../../../../environments/environment";
|
||||||
</span>
|
</span>
|
||||||
<ng-container *ngFor="let author of authors.slice(0, viewAll?authors.length:authorsLimit) let i=index">
|
<ng-container *ngFor="let author of authors.slice(0, viewAll?authors.length:authorsLimit) let i=index">
|
||||||
<ng-container
|
<ng-container
|
||||||
*ngTemplateOutlet="author_template; context: { author: author, i:i, italic: true}"></ng-container>
|
*ngTemplateOutlet="author_template; context: { author: author, i:i, italic: true, modal: modal}"></ng-container>
|
||||||
</ng-container>
|
</ng-container>
|
||||||
<span *ngIf="!showAll && authors && authors.length > authorsLimit" class="uk-text-meta">
|
<span *ngIf="!showAll && authors && authors.length > authorsLimit" class="uk-text-meta">
|
||||||
+{{authors.length - authorsLimit | number}} more
|
+{{authors.length - authorsLimit | number}} more
|
||||||
|
@ -127,18 +127,18 @@ import {properties} from "../../../../environments/environment";
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<modal-alert *ngIf="!isMobile" #authorsModal>
|
<modal-alert *ngIf="!isMobile && showAll && authors && authors.length > authorsLimit" #authorsModal>
|
||||||
<div class="uk-text-small uk-text-emphasis uk-grid uk-grid-column-collapse uk-grid-row-small" uk-grid>
|
<div class="uk-text-small uk-text-emphasis uk-grid uk-grid-column-collapse uk-grid-row-small" uk-grid>
|
||||||
<ng-container *ngFor="let author of authors; let i=index">
|
<ng-container *ngFor="let author of authors; let i=index">
|
||||||
<ng-container *ngTemplateOutlet="author_template; context: { author: author, i:i}"></ng-container>
|
<ng-container *ngTemplateOutlet="author_template; context: { author: author, i:i, modal: authorsModal}"></ng-container>
|
||||||
</ng-container>
|
</ng-container>
|
||||||
</div>
|
</div>
|
||||||
</modal-alert>
|
</modal-alert>
|
||||||
|
|
||||||
<fs-modal *ngIf="isMobile" #authorsModal classTitle="uk-tile-default uk-border-bottom">
|
<fs-modal *ngIf="isMobile && showAll && authors && authors.length > authorsLimit" #authorsModal classTitle="uk-tile-default uk-border-bottom">
|
||||||
<div class="uk-text-small uk-text-emphasis uk-grid uk-grid-column-collapse uk-grid-row-small" uk-grid>
|
<div class="uk-text-small uk-text-emphasis uk-grid uk-grid-column-collapse uk-grid-row-small" uk-grid>
|
||||||
<ng-container *ngFor="let author of authors; let i=index">
|
<ng-container *ngFor="let author of authors; let i=index">
|
||||||
<ng-container *ngTemplateOutlet="author_template; context: { author: author, i:i}"></ng-container>
|
<ng-container *ngTemplateOutlet="author_template; context: { author: author, i:i, modal: authorsModal}"></ng-container>
|
||||||
</ng-container>
|
</ng-container>
|
||||||
</div>
|
</div>
|
||||||
</fs-modal>
|
</fs-modal>
|
||||||
|
@ -153,7 +153,6 @@ export class ShowAuthorsComponent {
|
||||||
@Input() authorsLimit: number = 7;
|
@Input() authorsLimit: number = 7;
|
||||||
@Input() showAll: boolean = true;
|
@Input() showAll: boolean = true;
|
||||||
@Input() modal: AlertModal;
|
@Input() modal: AlertModal;
|
||||||
@Input() isModal: boolean
|
|
||||||
@Input() viewAll: boolean = false;
|
@Input() viewAll: boolean = false;
|
||||||
@Input() showInline: boolean = false; // do not open modal for "view more" when this is true
|
@Input() showInline: boolean = false; // do not open modal for "view more" when this is true
|
||||||
public lessBtn: boolean = false;
|
public lessBtn: boolean = false;
|
||||||
|
@ -175,6 +174,9 @@ export class ShowAuthorsComponent {
|
||||||
if (this.modal) {
|
if (this.modal) {
|
||||||
this.modal.cancel();
|
this.modal.cancel();
|
||||||
}
|
}
|
||||||
|
if(this.authorsModal) {
|
||||||
|
this.authorsModal.cancel();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public viewAllClick() {
|
public viewAllClick() {
|
||||||
|
|
|
@ -2,6 +2,7 @@ import {Email} from "./email";
|
||||||
import {Body} from "./body";
|
import {Body} from "./body";
|
||||||
import {properties} from "../../../../environments/environment";
|
import {properties} from "../../../../environments/environment";
|
||||||
import {User} from "../../login/utils/helper.class";
|
import {User} from "../../login/utils/helper.class";
|
||||||
|
import {StakeholderConfiguration} from "../../monitor-admin/utils/indicator-utils";
|
||||||
|
|
||||||
export class Composer {
|
export class Composer {
|
||||||
private static noteBodySize = "14px";
|
private static noteBodySize = "14px";
|
||||||
|
@ -335,13 +336,13 @@ export class Composer {
|
||||||
email.subject = 'National Open Access Monitor Ireland | ' + name;
|
email.subject = 'National Open Access Monitor Ireland | ' + name;
|
||||||
email.recipient = recipient;
|
email.recipient = recipient;
|
||||||
email.body = '<p>Dear user,</p>' +
|
email.body = '<p>Dear user,</p>' +
|
||||||
'<p>You have been invited to be a ' + role +' of the for the National Open Access Monitor, Ireland dashboard for the ' + name + '.</p>' +
|
'<p>You have been invited to be a ' + StakeholderConfiguration.ROLES[role] +' of the for the National Open Access Monitor, Ireland dashboard for the ' + name + '.</p>' +
|
||||||
'<p>Click <a href="((__link__))" target="_blank">this URL</a> and use the verification code below to accept the invitation.</p>' +
|
'<p>Click <a href="((__link__))" target="_blank">this URL</a> and use the verification code below to accept the invitation.</p>' +
|
||||||
'<p>The verification code is <b>((__code__))</b>.</p>' +
|
'<p>The verification code is <b>((__code__))</b>.</p>' +
|
||||||
'<p>At your first sign in you will be asked to accept and consent to the "OpenAIRE Personal Data Protection Policy and Consent Form" to be able to use the service.</p>' +
|
'<p>At your first sign in you will be asked to accept and consent to the "OpenAIRE Personal Data Protection Policy and Consent Form" to be able to use the service.</p>' +
|
||||||
(role === "manager"?
|
(role === "manager"?
|
||||||
'<p>As a manager of the National Open Access Monitor, Ireland, you will have access to the administration part of the dashboard, where you will be able to also invite other users to become managers.</p>':
|
'<p>As a ' + StakeholderConfiguration.ROLES[role] + ' of the National Open Access Monitor, Ireland, you will have access to the administration part of the dashboard, where you will be able to also invite other users to become ' + StakeholderConfiguration.ROLES['member'] + 's.</p>':
|
||||||
'<p>As a member of the OpenAIRE Monitor Dashboard, you will have access to the restricted access areas of the profile for the ' + name + '.') +
|
'<p>As a ' + StakeholderConfiguration.ROLES[role] + ' of the National Open Access Monitor, Ireland, you will have access to the sandbox of the profile for the ' + name + '.') +
|
||||||
'<p>Please contact us at <a href="mailto:' + properties.helpdeskEmail+'">' + properties.helpdeskEmail +
|
'<p>Please contact us at <a href="mailto:' + properties.helpdeskEmail+'">' + properties.helpdeskEmail +
|
||||||
'</a> if you have any questions or concerns.</p>' +
|
'</a> if you have any questions or concerns.</p>' +
|
||||||
'<p>Kind Regards<br>The OpenAIRE Team</p>' +
|
'<p>Kind Regards<br>The OpenAIRE Team</p>' +
|
||||||
|
|
|
@ -48,6 +48,7 @@ export class SearchResult {
|
||||||
acronym: string;
|
acronym: string;
|
||||||
code: string;
|
code: string;
|
||||||
// callIdentifier?: string; // currently not parsed
|
// callIdentifier?: string; // currently not parsed
|
||||||
|
funderName: string;
|
||||||
funderShortname: string;
|
funderShortname: string;
|
||||||
budget?: string;
|
budget?: string;
|
||||||
contribution?: string;
|
contribution?: string;
|
||||||
|
|
|
@ -237,7 +237,8 @@ private fetch (link,id,oafEntityType,type, properties:EnvProperties ){
|
||||||
|
|
||||||
if(resData['fundingtree'] && resData['fundingtree']['funder']){
|
if(resData['fundingtree'] && resData['fundingtree']['funder']){
|
||||||
value.funderId = (resData['fundingtree']['funder']['id'] )?resData['fundingtree']['funder']['id']:"";
|
value.funderId = (resData['fundingtree']['funder']['id'] )?resData['fundingtree']['funder']['id']:"";
|
||||||
value.funderName = (resData['fundingtree']['funder']['shortname'] )?resData['fundingtree']['funder']['shortname']:"";
|
value.funderName = (resData['fundingtree']['funder']['name'] )?resData['fundingtree']['funder']['name']:"";
|
||||||
|
value.funderShortName = (resData['fundingtree']['funder']['shortname'] )?resData['fundingtree']['funder']['shortname']:"";
|
||||||
value.jurisdiction = (resData['fundingtree']['funder']['jurisdiction'] )?resData['fundingtree']['funder']['jurisdiction']:"";
|
value.jurisdiction = (resData['fundingtree']['funder']['jurisdiction'] )?resData['fundingtree']['funder']['jurisdiction']:"";
|
||||||
if(resData['fundingtree']['funding_level_2']){
|
if(resData['fundingtree']['funding_level_2']){
|
||||||
value.fundingLevel0 = (resData['fundingtree']['funding_level_2'] && resData['fundingtree']['funding_level_2']['parent'] &&
|
value.fundingLevel0 = (resData['fundingtree']['funding_level_2'] && resData['fundingtree']['funding_level_2']['parent'] &&
|
||||||
|
|
|
@ -56,6 +56,7 @@ export class MobileDropdownComponent implements OnInit{
|
||||||
parent.removeChild(this.element.nativeElement);
|
parent.removeChild(this.element.nativeElement);
|
||||||
container.append(this.element.nativeElement);
|
container.append(this.element.nativeElement);
|
||||||
this.opened = true;
|
this.opened = true;
|
||||||
|
this.cdr.markForCheck();
|
||||||
body.setAttribute('style', 'overflow-y: hidden');
|
body.setAttribute('style', 'overflow-y: hidden');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -23,7 +23,7 @@ export let common: EnvProperties = {
|
||||||
rorURL: "https://ror.org/",
|
rorURL: "https://ror.org/",
|
||||||
isniURL: "https://isni.org/isni/",
|
isniURL: "https://isni.org/isni/",
|
||||||
wikiDataURL: "https://www.wikidata.org/wiki/",
|
wikiDataURL: "https://www.wikidata.org/wiki/",
|
||||||
fundRefURL: "https://api.crossref.org/funders/",
|
fundRefURL: "https://data.crossref.org/fundingdata/funder/",
|
||||||
fairSharingURL: "https://fairsharing.org/",
|
fairSharingURL: "https://fairsharing.org/",
|
||||||
eoscMarketplaceURL: "https://marketplace.eosc-portal.eu/services/",
|
eoscMarketplaceURL: "https://marketplace.eosc-portal.eu/services/",
|
||||||
sherpaURL: "http://sherpa.ac.uk/romeo/issn/",
|
sherpaURL: "http://sherpa.ac.uk/romeo/issn/",
|
||||||
|
|
|
@ -797,8 +797,8 @@ export class SearchFieldsBase {
|
||||||
|
|
||||||
//ORGANIZATION
|
//ORGANIZATION
|
||||||
|
|
||||||
public ORGANIZATION_REFINE_FIELDS: string[] = ["country"]
|
public ORGANIZATION_REFINE_FIELDS: string[] = ["countrynojurisdiction"]
|
||||||
public ORGANIZATION_ADVANCED_FIELDS: string[] = ["q", "organizationlegalname", "organizationlegalshortname", "country"];
|
public ORGANIZATION_ADVANCED_FIELDS: string[] = ["q", "organizationlegalname", "organizationlegalshortname", "countrynojurisdiction", "pid"];
|
||||||
|
|
||||||
public ORGANIZATION_FIELDS: { [key: string]: FieldDetails } = {
|
public ORGANIZATION_FIELDS: { [key: string]: FieldDetails } = {
|
||||||
["q"]: {name: "Any field", type: "keyword", param: "q", operator: "op", equalityOperator: "=", filterType: null},
|
["q"]: {name: "Any field", type: "keyword", param: "q", operator: "op", equalityOperator: "=", filterType: null},
|
||||||
|
@ -818,7 +818,7 @@ export class SearchFieldsBase {
|
||||||
equalityOperator: "=",
|
equalityOperator: "=",
|
||||||
filterType: null
|
filterType: null
|
||||||
},
|
},
|
||||||
["country"]: {
|
["countrynojurisdiction"]: {
|
||||||
name: "Country",
|
name: "Country",
|
||||||
type: "vocabulary",
|
type: "vocabulary",
|
||||||
param: "country",
|
param: "country",
|
||||||
|
@ -826,6 +826,7 @@ export class SearchFieldsBase {
|
||||||
equalityOperator: " exact ",
|
equalityOperator: " exact ",
|
||||||
filterType: "checkbox"
|
filterType: "checkbox"
|
||||||
},
|
},
|
||||||
|
["pid"]: {name: "PID", type: "keyword", param: "pid", operator: "pd", equalityOperator: " exact ", filterType: null}
|
||||||
};
|
};
|
||||||
// public ORGANIZATION_INDEX:string[] = ["organizationcountryname"]//,"organizationeclegalbody"];
|
// public ORGANIZATION_INDEX:string[] = ["organizationcountryname"]//,"organizationeclegalbody"];
|
||||||
// public ADVANCED_SEARCH_ORGANIZATION_PARAM:string[] = ["q","contenttype","compatibility","country","type"];
|
// public ADVANCED_SEARCH_ORGANIZATION_PARAM:string[] = ["q","contenttype","compatibility","country","type"];
|
||||||
|
@ -961,7 +962,7 @@ export class SearchFieldsBase {
|
||||||
return "and";
|
return "and";
|
||||||
} else if (fieldId == "instancetypename" || fieldId == "eoscdatasourcetype"
|
} else if (fieldId == "instancetypename" || fieldId == "eoscdatasourcetype"
|
||||||
|| fieldId == "resultlanguagename" || fieldId == "datasourceodlanguages"
|
|| fieldId == "resultlanguagename" || fieldId == "datasourceodlanguages"
|
||||||
|| fieldId == "datasourcecompatibilityname" || fieldId == "country" || fieldId == "datasourceodcontenttypes"
|
|| fieldId == "datasourcecompatibilityname" || fieldId == "country" || fieldId == "countrynojurisdiction" || fieldId == "datasourceodcontenttypes"
|
||||||
|| fieldId == "resulthostingdatasource" || fieldId == "collectedfrom") {
|
|| fieldId == "resulthostingdatasource" || fieldId == "collectedfrom") {
|
||||||
return "or";
|
return "or";
|
||||||
}
|
}
|
||||||
|
|
|
@ -95,12 +95,12 @@
|
||||||
<!-- 2nd section (funders, budget, authors, PIDs, publisher etc.) -->
|
<!-- 2nd section (funders, budget, authors, PIDs, publisher etc.) -->
|
||||||
<div class="uk-text-small uk-margin-small-bottom">
|
<div class="uk-text-small uk-margin-small-bottom">
|
||||||
<!-- Funder -->
|
<!-- Funder -->
|
||||||
<div *ngIf="result.funderShortname || result.code" class="uk-margin-xsmall-bottom">
|
<div *ngIf="(result.funderShortname || result.funderName) || result.code" class="uk-margin-xsmall-bottom">
|
||||||
<span *ngIf="result.funderShortname">
|
<span *ngIf="result.funderShortname || result.funderName">
|
||||||
<span class="uk-text-meta">Funder: </span>
|
<span class="uk-text-meta">Funder: </span>
|
||||||
{{result.funderShortname}}
|
{{result.funderName ? result.funderName : result.funderShortname}}
|
||||||
</span>
|
</span>
|
||||||
<span *ngIf="result.code" [class.uk-margin-left]="result.funderShortname">
|
<span *ngIf="result.code" [class.uk-margin-left]="result.funderShortname || result.funderName">
|
||||||
<span class="uk-text-meta">{{openaireEntities.PROJECT}} Code: </span>
|
<span class="uk-text-meta">{{openaireEntities.PROJECT}} Code: </span>
|
||||||
{{result.code}}
|
{{result.code}}
|
||||||
</span>
|
</span>
|
||||||
|
@ -125,7 +125,7 @@
|
||||||
</div>
|
</div>
|
||||||
<!-- Authors -->
|
<!-- Authors -->
|
||||||
<div *ngIf="result.authors" class="uk-margin-xsmall-bottom">
|
<div *ngIf="result.authors" class="uk-margin-xsmall-bottom">
|
||||||
<showAuthors [authors]="result.authors" [authorsLimit]=4 [modal]="modal" [isMobile]="isMobile" [isModal]="isDeletedByInferenceModal"
|
<showAuthors [authors]="result.authors" [authorsLimit]=4 [modal]="modal" [isMobile]="isMobile"
|
||||||
[showAll]=true [showInline]="showInline"></showAuthors>
|
[showAll]=true [showInline]="showInline"></showAuthors>
|
||||||
</div>
|
</div>
|
||||||
<!-- Identifiers -->
|
<!-- Identifiers -->
|
||||||
|
@ -218,7 +218,7 @@
|
||||||
<div *ngIf="result.oaRoutes" class="uk-first-column">
|
<div *ngIf="result.oaRoutes" class="uk-first-column">
|
||||||
<!-- class="metrics uk-text-xsmall uk-width-auto uk-flex uk-flex-middle uk-flex-right uk-text-meta">-->
|
<!-- class="metrics uk-text-xsmall uk-width-auto uk-flex uk-flex-middle uk-flex-right uk-text-meta">-->
|
||||||
<a class="uk-flex uk-flex-middle uk-link-reset">
|
<a class="uk-flex uk-flex-middle uk-link-reset">
|
||||||
<span #badge class="access-route-badge" [ngClass]="'dots-' + badge.children.length.toString()">
|
<span #badge class="access-route-badge" [ngClass]="'dots-' + countDots">
|
||||||
<span *ngIf="result.oaRoutes.green" class="dot green"></span>
|
<span *ngIf="result.oaRoutes.green" class="dot green"></span>
|
||||||
<span *ngIf="result.oaRoutes.oaColor" class="dot" [ngClass]="result.oaRoutes.oaColor"></span>
|
<span *ngIf="result.oaRoutes.oaColor" class="dot" [ngClass]="result.oaRoutes.oaColor"></span>
|
||||||
<span *ngIf="result.oaRoutes.isInDiamondJournal" class="dot diamond"></span>
|
<span *ngIf="result.oaRoutes.isInDiamondJournal" class="dot diamond"></span>
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
import {Component, Input, OnChanges, OnInit, SimpleChanges} from "@angular/core";
|
import {ChangeDetectionStrategy, Component, Input, OnChanges, OnInit, SimpleChanges} from "@angular/core";
|
||||||
import {ResultPreview} from "./result-preview";
|
import {ResultPreview} from "./result-preview";
|
||||||
import {EnvProperties} from "../properties/env-properties";
|
import {EnvProperties} from "../properties/env-properties";
|
||||||
import {RouterHelper} from "../routerHelper.class";
|
import {RouterHelper} from "../routerHelper.class";
|
||||||
|
@ -12,7 +12,8 @@ import {NumberUtils} from '../number-utils.class';
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'result-preview',
|
selector: 'result-preview',
|
||||||
templateUrl: 'result-preview.component.html',
|
templateUrl: 'result-preview.component.html',
|
||||||
styleUrls: ['result-preview.component.less']
|
styleUrls: ['result-preview.component.less'],
|
||||||
|
changeDetection: ChangeDetectionStrategy.OnPush
|
||||||
})
|
})
|
||||||
export class ResultPreviewComponent implements OnInit, OnChanges {
|
export class ResultPreviewComponent implements OnInit, OnChanges {
|
||||||
@Input() prevPath: string = "";
|
@Input() prevPath: string = "";
|
||||||
|
@ -255,4 +256,8 @@ export class ResultPreviewComponent implements OnInit, OnChanges {
|
||||||
}
|
}
|
||||||
return obj;
|
return obj;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public get countDots() {
|
||||||
|
return (this.result.oaRoutes.green ? 1 : 0) + (this.result.oaRoutes.oaColor ? 1 : 0) + (this.result.oaRoutes.isInDiamondJournal ? 1 : 0);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -123,6 +123,7 @@ export class ResultPreview {
|
||||||
acronym: string;
|
acronym: string;
|
||||||
code: string;
|
code: string;
|
||||||
// callIdentifier: string; // currently not parsed
|
// callIdentifier: string; // currently not parsed
|
||||||
|
funderName: string;
|
||||||
funderShortname: string;
|
funderShortname: string;
|
||||||
budget: string;
|
budget: string;
|
||||||
contribution: string;
|
contribution: string;
|
||||||
|
@ -188,6 +189,7 @@ export class ResultPreview {
|
||||||
resultPreview.acronym = result.acronym;
|
resultPreview.acronym = result.acronym;
|
||||||
resultPreview.code = result.code;
|
resultPreview.code = result.code;
|
||||||
// resultPreview.callIdentifier = result.callIdentifier; // currently not parsed
|
// resultPreview.callIdentifier = result.callIdentifier; // currently not parsed
|
||||||
|
resultPreview.funderName = result.funderName;
|
||||||
resultPreview.funderShortname = result.funderShortname;
|
resultPreview.funderShortname = result.funderShortname;
|
||||||
resultPreview.budget = result.budget;
|
resultPreview.budget = result.budget;
|
||||||
resultPreview.contribution = result.contribution;
|
resultPreview.contribution = result.contribution;
|
||||||
|
|
|
@ -150,7 +150,7 @@ export class DOI {
|
||||||
}
|
}
|
||||||
|
|
||||||
export class Identifier {
|
export class Identifier {
|
||||||
class: "doi" | "pmc" | "pmid" | "handle" | "ORCID" | "re3data" | "swhid" = null;
|
class: "doi" | "pmc" | "pmid" | "handle" | "ORCID" | "re3data" | "swhid" | "ror" | "wikidata" | "fundref" | "isni" = null;
|
||||||
id: string;
|
id: string;
|
||||||
|
|
||||||
public static getDOIsFromString(str: string): string[] {
|
public static getDOIsFromString(str: string): string[] {
|
||||||
|
@ -205,14 +205,22 @@ export class Identifier {
|
||||||
return {"class": "re3data", "id": pid};
|
return {"class": "re3data", "id": pid};
|
||||||
} else if (Identifier.isValidSwhId(pid)) {
|
} else if (Identifier.isValidSwhId(pid)) {
|
||||||
return {"class": "swhid", "id": pid};
|
return {"class": "swhid", "id": pid};
|
||||||
|
} else if (Identifier.isValidRor(pid)) {
|
||||||
|
return {"class": "ror", "id": pid};
|
||||||
|
} else if (Identifier.isValidFundRef(pid)) {
|
||||||
|
return {"class": "fundref", "id": pid};
|
||||||
|
} else if (Identifier.isValidWikidata(pid)) {
|
||||||
|
return {"class": "wikidata", "id": pid};
|
||||||
|
} else if (Identifier.isValidIsni(pid)) {
|
||||||
|
return {"class": "isni", "id": pid};
|
||||||
}
|
}
|
||||||
//set it as a doi, to catch the case that doi has not valid format
|
//set it as a doi, to catch the case that doi has not valid format
|
||||||
return (strict?null:{"class": "doi", "id": pid});
|
return (strict?null:{"class": "doi", "id": pid});
|
||||||
}
|
}
|
||||||
|
|
||||||
public static getPIDFromIdentifiers(identifiers: Map<string, string[]>): Identifier {
|
public static getPIDFromIdentifiers(identifiers: Map<string, string[]>): Identifier {
|
||||||
let classes:string [] = ["doi", "handle", "pmc", "pmid", "re3data", "swhid"];
|
let classes:string [] = ["doi", "handle", "pmc", "pmid", "re3data", "swhid", "ror", "wikidata", "fundref", "isni"];
|
||||||
if(identifiers) {
|
if(identifiers && identifiers.size > 0) {
|
||||||
for (let cl of classes) {
|
for (let cl of classes) {
|
||||||
if (identifiers.get(cl)) {
|
if (identifiers.get(cl)) {
|
||||||
for (let pid of identifiers.get(cl)) {
|
for (let pid of identifiers.get(cl)) {
|
||||||
|
@ -258,6 +266,7 @@ export class Identifier {
|
||||||
}
|
}
|
||||||
|
|
||||||
public static isValidHANDLE(str: string): boolean {
|
public static isValidHANDLE(str: string): boolean {
|
||||||
|
// let exp = /\b[0-9a-zA-Z-]*\/[0-9a-zA-Z-]*$/g; // resolve with url - need to add method for raw value
|
||||||
let exp = /^[0-9a-zA-Z-]*\/[0-9a-zA-Z-]*$/g;
|
let exp = /^[0-9a-zA-Z-]*\/[0-9a-zA-Z-]*$/g;
|
||||||
return str.match(exp) != null;
|
return str.match(exp) != null;
|
||||||
}
|
}
|
||||||
|
@ -272,6 +281,28 @@ export class Identifier {
|
||||||
let exp = /swh:1:snp:[0-9a-f]{40}/g;
|
let exp = /swh:1:snp:[0-9a-f]{40}/g;
|
||||||
return str.match(exp) != null;
|
return str.match(exp) != null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static isValidRor(str: string): boolean {
|
||||||
|
let exp = /0[a-z|0-9]{6}[0-9]{2}\b/g;
|
||||||
|
return str.match(exp) != null;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static isValidIsni(str: string): boolean {
|
||||||
|
let exp = /^[0]{7}[0-9]{8}[0-9X]$/g;
|
||||||
|
return str.match(exp) != null;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static isValidWikidata(str: string): boolean {
|
||||||
|
let exp = /^Q\d+$/g;
|
||||||
|
return str.match(exp) != null;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static isValidFundRef(str: string): boolean {
|
||||||
|
// let exp = /aaa/g;
|
||||||
|
let exp = /^[1-9]\d+$/g;
|
||||||
|
return str.match(exp) != null;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
export class StringUtils {
|
export class StringUtils {
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
import {TransitionGroupItemDirective} from "./transition-group-item.directive";
|
import {TransitionGroupItemDirective} from "./transition-group-item.directive";
|
||||||
import {
|
import {
|
||||||
AfterViewInit,
|
AfterViewInit, ChangeDetectorRef,
|
||||||
Component,
|
Component,
|
||||||
ContentChildren,
|
ContentChildren,
|
||||||
ElementRef, Input,
|
ElementRef, Input,
|
||||||
|
@ -29,15 +29,14 @@ export class TransitionGroupComponent implements AfterViewInit, OnDestroy {
|
||||||
@ContentChildren(TransitionGroupItemDirective) items: QueryList<TransitionGroupItemDirective>;
|
@ContentChildren(TransitionGroupItemDirective) items: QueryList<TransitionGroupItemDirective>;
|
||||||
@Input()
|
@Input()
|
||||||
public id: string;
|
public id: string;
|
||||||
private disabled: boolean = false;
|
public size: number;
|
||||||
private subscription: Subscription;
|
private subscription: Subscription;
|
||||||
|
|
||||||
constructor(public element: ElementRef) {}
|
constructor(public element: ElementRef) {}
|
||||||
|
|
||||||
ngAfterViewInit() {
|
ngAfterViewInit() {
|
||||||
this.init();
|
|
||||||
this.subscription = this.items.changes.subscribe(items => {
|
this.subscription = this.items.changes.subscribe(items => {
|
||||||
if(!this.disabled) {
|
if(items.length === this.size) {
|
||||||
items.forEach(item => item.prevPos = item.newPos || item.prevPos);
|
items.forEach(item => item.prevPos = item.newPos || item.prevPos);
|
||||||
items.forEach(this.runCallback);
|
items.forEach(this.runCallback);
|
||||||
this.refreshPosition('newPos');
|
this.refreshPosition('newPos');
|
||||||
|
@ -80,6 +79,7 @@ export class TransitionGroupComponent implements AfterViewInit, OnDestroy {
|
||||||
init() {
|
init() {
|
||||||
this.refreshPosition('prevPos');
|
this.refreshPosition('prevPos');
|
||||||
this.refreshPosition('newPos');
|
this.refreshPosition('newPos');
|
||||||
|
this.size = this.items.length;
|
||||||
}
|
}
|
||||||
|
|
||||||
runCallback(item: TransitionGroupItemDirective) {
|
runCallback(item: TransitionGroupItemDirective) {
|
||||||
|
@ -126,17 +126,17 @@ export class TransitionGroupComponent implements AfterViewInit, OnDestroy {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Enable transition
|
* Enable transition
|
||||||
*
|
* @deprecated
|
||||||
* */
|
* */
|
||||||
enable() {
|
enable() {
|
||||||
this.disabled = false;
|
console.debug('Deprecated')
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Disable transition
|
* Disable transition
|
||||||
*
|
* @deprecated
|
||||||
* */
|
* */
|
||||||
disable() {
|
disable() {
|
||||||
this.disabled = true;
|
console.debug('Deprecated')
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue