Compare commits
28 Commits
d2cc0b0f33
...
1882ea10fa
Author | SHA1 | Date |
---|---|---|
argirok | 1882ea10fa | |
argirok | f5414efaac | |
argirok | 609f09cc9f | |
argirok | 275b94dec3 | |
argirok | f5850aa781 | |
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 | |
Konstantinos Triantafyllou | 828dfc0671 | |
Konstantinos Triantafyllou | b34f42326c | |
Konstantinos Triantafyllou | e8ec49a69b | |
Konstantinos Triantafyllou | 0c75394621 | |
argirok | d6b924bcaa | |
argirok | 95097beaae |
|
@ -92,6 +92,7 @@ export class ClaimRecord2Insert {
|
||||||
targetAccessRights: string;
|
targetAccessRights: string;
|
||||||
targetEmbargoEndDate: string;
|
targetEmbargoEndDate: string;
|
||||||
claimedInDashboard: string;
|
claimedInDashboard: string;
|
||||||
|
idSuffix:string;
|
||||||
|
|
||||||
constructor() {
|
constructor() {
|
||||||
|
|
||||||
|
|
|
@ -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,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;
|
||||||
|
|
||||||
|
|
|
@ -370,10 +370,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() {
|
||||||
|
|
|
@ -12,10 +12,10 @@ export class PluginOpenAIREProducts extends PluginBaseInfo{
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'plugin-openaire-products',
|
selector: 'plugin-openaire-products',
|
||||||
template: `
|
template: `
|
||||||
<div *ngIf="pluginObject" class="uk-container uk-section">
|
<div *ngIf="pluginObject " class="uk-container uk-section">
|
||||||
<h3>{{pluginObject.title}} </h3>
|
<h3>{{pluginObject.title}} </h3>
|
||||||
|
|
||||||
<div *ngIf="services" uk-slider class="uk-slider">
|
<div *ngIf="services && servicesToShow" uk-slider class="uk-slider">
|
||||||
<ul *ngIf="slides" class="uk-slider-items" uk-height-match="target: .uk-card; row: false">
|
<ul *ngIf="slides" class="uk-slider-items" uk-height-match="target: .uk-card; row: false">
|
||||||
<li *ngFor="let slide of [].constructor(slides); let i=index" class="uk-width-1-1 uk-padding">
|
<li *ngFor="let slide of [].constructor(slides); let i=index" class="uk-width-1-1 uk-padding">
|
||||||
<div class="uk-grid uk-child-width-1-3@m uk-child-width-1-1" uk-grid uk-scrollspy="target: [uk-scrollspy-class]; cls: uk-animation-fade; repeat: true">
|
<div class="uk-grid uk-child-width-1-3@m uk-child-width-1-1" uk-grid uk-scrollspy="target: [uk-scrollspy-class]; cls: uk-animation-fade; repeat: true">
|
||||||
|
@ -51,7 +51,7 @@ export class PluginOpenAIREProducts extends PluginBaseInfo{
|
||||||
export class PluginOpenaireProductsComponent extends PluginBaseComponent<PluginOpenAIREProducts>{
|
export class PluginOpenaireProductsComponent extends PluginBaseComponent<PluginOpenAIREProducts>{
|
||||||
services = null;
|
services = null;
|
||||||
excludedServiceIds = ["openaire_login","research_community_dashboard"]
|
excludedServiceIds = ["openaire_login","research_community_dashboard"]
|
||||||
servicesToShow = [];
|
servicesToShow = null;
|
||||||
slides = 1;
|
slides = 1;
|
||||||
slideItems = 3;
|
slideItems = 3;
|
||||||
api= "https://catalogue.openaire.eu/api/catalogue-resources?from=0&quantity=100&order=asc&orderField=name";
|
api= "https://catalogue.openaire.eu/api/catalogue-resources?from=0&quantity=100&order=asc&orderField=name";
|
||||||
|
@ -64,7 +64,9 @@ export class PluginOpenaireProductsComponent extends PluginBaseComponent<PluginO
|
||||||
if(!this.services) {
|
if(!this.services) {
|
||||||
this.subscriptions.push(this.http.get( this.properties.cacheUrl + encodeURIComponent(this.api)).subscribe(res =>{
|
this.subscriptions.push(this.http.get( this.properties.cacheUrl + encodeURIComponent(this.api)).subscribe(res =>{
|
||||||
this.services = res["results"].map( x=> {
|
this.services = res["results"].map( x=> {
|
||||||
|
if(x.id.indexOf("openaire.")!=-1){
|
||||||
x.id = x.id.split("openaire.")[1]
|
x.id = x.id.split("openaire.")[1]
|
||||||
|
}
|
||||||
return x;
|
return x;
|
||||||
});
|
});
|
||||||
this.services = this.services.filter(x=> this.excludedServiceIds.indexOf(x.id) ==-1);
|
this.services = this.services.filter(x=> this.excludedServiceIds.indexOf(x.id) ==-1);
|
||||||
|
|
|
@ -22,6 +22,7 @@ export class MonitorComponent extends MonitorIndicatorStakeholderBaseComponent {
|
||||||
stakeholder = null;
|
stakeholder = null;
|
||||||
@Input() pluginObject: PluginStats;
|
@Input() pluginObject: PluginStats;
|
||||||
profiles;
|
profiles;
|
||||||
|
public chartsActiveType: Map<string, IndicatorPath> = new Map<string, IndicatorPath>();
|
||||||
constructor(protected _route: ActivatedRoute,
|
constructor(protected _route: ActivatedRoute,
|
||||||
protected _router: Router,
|
protected _router: Router,
|
||||||
protected _meta: Meta,
|
protected _meta: Meta,
|
||||||
|
|
|
@ -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;
|
||||||
|
@ -53,6 +54,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 +89,12 @@ 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();
|
||||||
|
|
||||||
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) {
|
||||||
}
|
}
|
||||||
|
@ -182,7 +185,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 +195,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);
|
||||||
|
@ -242,7 +245,7 @@ export class RoleUsersComponent implements OnInit, OnDestroy, OnChanges {
|
||||||
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');
|
||||||
|
@ -266,9 +269,9 @@ export class RoleUsersComponent implements OnInit, OnDestroy, OnChanges {
|
||||||
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 => {
|
||||||
|
@ -290,7 +293,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);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
@ -310,7 +314,7 @@ export class RoleUsersComponent implements OnInit, OnDestroy, OnChanges {
|
||||||
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');
|
||||||
|
@ -324,6 +328,10 @@ export class RoleUsersComponent implements OnInit, OnDestroy, OnChanges {
|
||||||
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;
|
||||||
}
|
}
|
||||||
|
|
|
@ -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"
|
||||||
|
|
|
@ -14,16 +14,6 @@
|
||||||
(click)="deleteSectionOpen(number, i, 'number', 'delete')">
|
(click)="deleteSectionOpen(number, i, 'number', 'delete')">
|
||||||
<icon name="close" [flex]="true"></icon>
|
<icon name="close" [flex]="true"></icon>
|
||||||
</a>
|
</a>
|
||||||
<!-- <ng-container *ngIf="!stakeholder.defaultId">-->
|
|
||||||
<!-- <button [disabled]="editing || number.defaultId " class="md-btn md-btn-mini"-->
|
|
||||||
<!-- [title]="(number.defaultId?'Default sections cannot be deleted':'Delete all related sections')"-->
|
|
||||||
<!-- (click)="deleteSectionOpen(number, i, 'number', 'delete')"><i class="material-icons">highlight_off</i>-->
|
|
||||||
<!-- </button>-->
|
|
||||||
<!-- <button [disabled]="editing || number.defaultId " class="md-btn md-btn-mini"-->
|
|
||||||
<!-- [title]="(number.defaultId?'Default sections cannot be deleted':'Delete section and disconnect related')"-->
|
|
||||||
<!-- (click)="deleteSectionOpen(number, i, 'number', 'disconnect')"><i class="material-icons">link_off</i>-->
|
|
||||||
<!-- </button>-->
|
|
||||||
<!-- </ng-container>-->
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div *ngIf="numberSections.at(i)" class="uk-margin-medium-bottom">
|
<div *ngIf="numberSections.at(i)" class="uk-margin-medium-bottom">
|
||||||
|
@ -31,7 +21,8 @@
|
||||||
(focusEmitter)="saveSection($event, numberSections.at(i), i, 'number')"
|
(focusEmitter)="saveSection($event, numberSections.at(i), i, 'number')"
|
||||||
class="uk-width-1-3@m uk-width-1-1" placeholder="Title" inputClass="border-bottom"></div>
|
class="uk-width-1-3@m uk-width-1-1" placeholder="Title" inputClass="border-bottom"></div>
|
||||||
</div>
|
</div>
|
||||||
<div [id]="'number-' + number._id" class="uk-grid uk-grid-small uk-grid-match" uk-sortable="group: number" uk-grid>
|
<div [id]="'number-' + number._id" class="uk-grid uk-grid-small uk-grid-match"
|
||||||
|
uk-sortable="group: number" uk-grid>
|
||||||
<ng-template ngFor [ngForOf]="number.indicators" let-indicator let-j="index">
|
<ng-template ngFor [ngForOf]="number.indicators" let-indicator let-j="index">
|
||||||
<div *ngIf="indicator" [id]="indicator._id"
|
<div *ngIf="indicator" [id]="indicator._id"
|
||||||
[ngClass]="getNumberClassBySize(indicator.width)">
|
[ngClass]="getNumberClassBySize(indicator.width)">
|
||||||
|
@ -39,13 +30,18 @@
|
||||||
<div *ngIf="!dragging"
|
<div *ngIf="!dragging"
|
||||||
class="uk-position-top-right uk-margin-small-right uk-margin-small-top">
|
class="uk-position-top-right uk-margin-small-right uk-margin-small-top">
|
||||||
<a class="uk-link-reset uk-flex uk-flex-middle" [class.uk-disabled]="editing">
|
<a class="uk-link-reset uk-flex uk-flex-middle" [class.uk-disabled]="editing">
|
||||||
<icon *ngIf="showVisibility" [flex]="true" [name]="stakeholderUtils.visibilityIcon.get(indicator.visibility)" ratio="0.6"></icon>
|
<icon *ngIf="showVisibility" [flex]="true"
|
||||||
|
[name]="stakeholderUtils.visibilityIcon.get(indicator.visibility)"
|
||||||
|
ratio="0.6"></icon>
|
||||||
<icon [flex]="true" name="more_vert"></icon>
|
<icon [flex]="true" name="more_vert"></icon>
|
||||||
</a>
|
</a>
|
||||||
<div #element class="uk-dropdown" uk-dropdown="mode: click; pos: bottom-left; offset: 5; delay-hide: 0">
|
<div #element class="uk-dropdown"
|
||||||
|
uk-dropdown="mode: click; pos: bottom-left; offset: 5; delay-hide: 0">
|
||||||
<ul class="uk-nav uk-dropdown-nav">
|
<ul class="uk-nav uk-dropdown-nav">
|
||||||
<ng-container *ngIf="isCurator">
|
<ng-container *ngIf="isCurator">
|
||||||
<li><a (click)="editNumberIndicatorOpen(number, indicator._id); hide(element)">Edit</a></li>
|
<li>
|
||||||
|
<a (click)="editNumberIndicatorOpen(number, indicator._id); hide(element)">Edit</a>
|
||||||
|
</li>
|
||||||
</ng-container>
|
</ng-container>
|
||||||
<ng-container *ngIf="showVisibility">
|
<ng-container *ngIf="showVisibility">
|
||||||
<li *ngIf="isCurator" class="uk-nav-divider"></li>
|
<li *ngIf="isCurator" class="uk-nav-divider"></li>
|
||||||
|
@ -53,9 +49,12 @@
|
||||||
<li>
|
<li>
|
||||||
<a (click)="changeIndicatorStatus(number._id, indicator, v.value);hide(element)">
|
<a (click)="changeIndicatorStatus(number._id, indicator, v.value);hide(element)">
|
||||||
<div class="uk-flex uk-flex-middle">
|
<div class="uk-flex uk-flex-middle">
|
||||||
<icon [flex]="true" [name]="v.icon" ratio="0.6"></icon>
|
<icon [flex]="true" [name]="v.icon"
|
||||||
<span class="uk-margin-small-left uk-width-expand">{{v.label}}</span>
|
ratio="0.6"></icon>
|
||||||
<icon *ngIf="indicator.visibility === v.value" [flex]="true" name="done" class="uk-text-secondary" ratio="0.8"></icon>
|
<span class="uk-margin-small-left uk-width-expand">{{ v.label }}</span>
|
||||||
|
<icon *ngIf="indicator.visibility === v.value"
|
||||||
|
[flex]="true" name="done"
|
||||||
|
class="uk-text-secondary" ratio="0.8"></icon>
|
||||||
</div>
|
</div>
|
||||||
</a>
|
</a>
|
||||||
</li>
|
</li>
|
||||||
|
@ -63,15 +62,18 @@
|
||||||
</ng-container>
|
</ng-container>
|
||||||
<ng-container *ngIf="!indicator.defaultId && !editing && isCurator">
|
<ng-container *ngIf="!indicator.defaultId && !editing && isCurator">
|
||||||
<li class="uk-nav-divider">
|
<li class="uk-nav-divider">
|
||||||
<li><a (click)="deleteIndicatorOpen(number, indicator._id, 'number', 'delete');hide(element)">Delete</a></li>
|
<li>
|
||||||
|
<a (click)="deleteIndicatorOpen(number, indicator._id, 'number', 'delete');hide(element)">Delete</a>
|
||||||
|
</li>
|
||||||
</ng-container>
|
</ng-container>
|
||||||
</ul>
|
</ul>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="uk-text-small uk-text-truncate uk-margin-xsmall-bottom uk-margin-right">{{indicator.name}}</div>
|
<div class="uk-text-small uk-text-truncate uk-margin-xsmall-bottom uk-margin-right">{{ indicator.name }}</div>
|
||||||
<div class="number uk-text-small uk-text-bold">
|
<div class="number uk-text-small uk-text-bold">
|
||||||
<span *ngIf="numberResults.get(i + '-' + j)" [innerHTML]="(indicator.indicatorPaths[0].format == 'NUMBER'?(numberResults.get(i + '-' + j) | numberRound: 2:1:stakeholder.locale):(numberResults.get(i + '-' + j) | numberPercentage: stakeholder.locale))"></span>
|
<span *ngIf="numberResults.get(i + '-' + j + '-' + 0)"
|
||||||
<span *ngIf="!numberResults.get(i + '-' + j)">--</span>
|
[innerHTML]="(indicator.indicatorPaths[0].format == 'NUMBER'?(numberResults.get(i + '-' + j + '-' + 0) | numberRound: 2:1:stakeholder.locale):(numberResults.get(i + '-' + j + '-' + 0) | numberPercentage: stakeholder.locale))"></span>
|
||||||
|
<span *ngIf="!numberResults.get(i + '-' + j + '-' + 0)">--</span>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
@ -80,7 +82,8 @@
|
||||||
<div *ngIf="isCurator" class="uk-margin-top">
|
<div *ngIf="isCurator" class="uk-margin-top">
|
||||||
<div class="uk-grid uk-grid-small" uk-grid>
|
<div class="uk-grid uk-grid-small" uk-grid>
|
||||||
<div [ngClass]="getNumberClassBySize('small')">
|
<div [ngClass]="getNumberClassBySize('small')">
|
||||||
<a class="uk-card uk-card-default number-card uk-padding-small uk-flex uk-flex-middle uk-link-reset" (click)="editNumberIndicatorOpen(number)">
|
<a class="uk-card uk-card-default number-card uk-padding-small uk-flex uk-flex-middle uk-link-reset"
|
||||||
|
(click)="editNumberIndicatorOpen(number)">
|
||||||
<div class="uk-text-background uk-margin-right">
|
<div class="uk-text-background uk-margin-right">
|
||||||
<icon name="add" [flex]="true" ratio="1.5"></icon>
|
<icon name="add" [flex]="true" ratio="1.5"></icon>
|
||||||
</div>
|
</div>
|
||||||
|
@ -113,16 +116,6 @@
|
||||||
(click)="deleteSectionOpen(chart, i, 'chart', 'delete')">
|
(click)="deleteSectionOpen(chart, i, 'chart', 'delete')">
|
||||||
<icon name="close" [flex]="true"></icon>
|
<icon name="close" [flex]="true"></icon>
|
||||||
</a>
|
</a>
|
||||||
<!-- <ng-container *ngIf="!stakeholder.defaultId">-->
|
|
||||||
<!-- <button [disabled]="editing || chart.defaultId " class="md-btn md-btn-mini"-->
|
|
||||||
<!-- [title]="(chart.defaultId?'Default sections cannot be deleted':'Delete all related sections')"-->
|
|
||||||
<!-- (click)="deleteSectionOpen(chart, i, 'chart', 'delete')"><i class="material-icons">highlight_off</i>-->
|
|
||||||
<!-- </button>-->
|
|
||||||
<!-- <button [disabled]="editing || chart.defaultId " class="md-btn md-btn-mini"-->
|
|
||||||
<!-- [title]="(chart.defaultId?'Default sections cannot be deleted':'Delete section and disconnect related')"-->
|
|
||||||
<!-- (click)="deleteSectionOpen(chart, i, 'chart', 'disconnect')"><i class="material-icons">link_off</i>-->
|
|
||||||
<!-- </button>-->
|
|
||||||
<!-- </ng-container>-->
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div *ngIf="chartSections.at(i)"
|
<div *ngIf="chartSections.at(i)"
|
||||||
|
@ -131,20 +124,27 @@
|
||||||
(focusEmitter)="saveSection($event, chartSections.at(i), i)"
|
(focusEmitter)="saveSection($event, chartSections.at(i), i)"
|
||||||
class="uk-width-1-3@m uk-width-1-1" placeholder="Title" inputClass="border-bottom"></div>
|
class="uk-width-1-3@m uk-width-1-1" placeholder="Title" inputClass="border-bottom"></div>
|
||||||
</div>
|
</div>
|
||||||
<div [id]="'chart-' + chart._id" class="uk-grid uk-grid-small uk-grid-match" uk-sortable="group: chart" uk-grid>
|
<div [id]="'chart-' + chart._id" class="uk-grid uk-grid-small uk-grid-match"
|
||||||
|
uk-sortable="group: chart" uk-grid>
|
||||||
<ng-template ngFor [ngForOf]="chart.indicators" let-indicator let-j="index">
|
<ng-template ngFor [ngForOf]="chart.indicators" let-indicator let-j="index">
|
||||||
<div *ngIf="indicator" [id]="indicator._id" [ngClass]="getChartClassBySize(indicator.width)">
|
<div *ngIf="indicator" [id]="indicator._id"
|
||||||
|
[ngClass]="getChartClassBySize(indicator.width)">
|
||||||
<div class="uk-card uk-card-default uk-card-body uk-position-relative">
|
<div class="uk-card uk-card-default uk-card-body uk-position-relative">
|
||||||
<div *ngIf="!dragging"
|
<div *ngIf="!dragging"
|
||||||
class="uk-position-top-right uk-margin-small-right uk-margin-small-top">
|
class="uk-position-top-right uk-margin-small-right uk-margin-small-top">
|
||||||
<a class="uk-link-reset uk-flex uk-flex-middle" [class.uk-disabled]="editing">
|
<a class="uk-link-reset uk-flex uk-flex-middle" [class.uk-disabled]="editing">
|
||||||
<icon *ngIf="showVisibility" [flex]="true" [name]="stakeholderUtils.visibilityIcon.get(indicator.visibility)" ratio="0.6"></icon>
|
<icon *ngIf="showVisibility" [flex]="true"
|
||||||
|
[name]="stakeholderUtils.visibilityIcon.get(indicator.visibility)"
|
||||||
|
ratio="0.6"></icon>
|
||||||
<icon [flex]="true" name="more_vert"></icon>
|
<icon [flex]="true" name="more_vert"></icon>
|
||||||
</a>
|
</a>
|
||||||
<div #element class="uk-dropdown" uk-dropdown="mode: click; pos: bottom-left; offset: 5; delay-hide: 0">
|
<div #element class="uk-dropdown"
|
||||||
|
uk-dropdown="mode: click; pos: bottom-left; offset: 5; delay-hide: 0">
|
||||||
<ul class="uk-nav uk-dropdown-nav">
|
<ul class="uk-nav uk-dropdown-nav">
|
||||||
<ng-container *ngIf="isCurator">
|
<ng-container *ngIf="isCurator">
|
||||||
<li><a (click)="editChartIndicatorOpen(chart, indicator._id); hide(element)">Edit</a></li>
|
<li>
|
||||||
|
<a (click)="editChartIndicatorOpen(chart, indicator._id); hide(element)">Edit</a>
|
||||||
|
</li>
|
||||||
</ng-container>
|
</ng-container>
|
||||||
<ng-container *ngIf="showVisibility">
|
<ng-container *ngIf="showVisibility">
|
||||||
<li *ngIf="isCurator" class="uk-nav-divider"></li>
|
<li *ngIf="isCurator" class="uk-nav-divider"></li>
|
||||||
|
@ -152,9 +152,12 @@
|
||||||
<li>
|
<li>
|
||||||
<a (click)="changeIndicatorStatus(chart._id, indicator, v.value);">
|
<a (click)="changeIndicatorStatus(chart._id, indicator, v.value);">
|
||||||
<div class="uk-flex uk-flex-middle">
|
<div class="uk-flex uk-flex-middle">
|
||||||
<icon [flex]="true" [name]="v.icon" ratio="0.6"></icon>
|
<icon [flex]="true" [name]="v.icon"
|
||||||
<span class="uk-margin-small-left uk-width-expand">{{v.label}}</span>
|
ratio="0.6"></icon>
|
||||||
<icon *ngIf="indicator.visibility === v.value" [flex]="true" name="done" class="uk-text-secondary" ratio="0.8"></icon>
|
<span class="uk-margin-small-left uk-width-expand">{{ v.label }}</span>
|
||||||
|
<icon *ngIf="indicator.visibility === v.value"
|
||||||
|
[flex]="true" name="done"
|
||||||
|
class="uk-text-secondary" ratio="0.8"></icon>
|
||||||
</div>
|
</div>
|
||||||
</a>
|
</a>
|
||||||
</li>
|
</li>
|
||||||
|
@ -162,32 +165,50 @@
|
||||||
</ng-container>
|
</ng-container>
|
||||||
<ng-container *ngIf="!indicator.defaultId && !editing && isCurator">
|
<ng-container *ngIf="!indicator.defaultId && !editing && isCurator">
|
||||||
<li class="uk-nav-divider">
|
<li class="uk-nav-divider">
|
||||||
<li><a (click)="deleteIndicatorOpen(chart, indicator._id, 'chart', 'delete');hide(element)">Delete</a></li>
|
<li>
|
||||||
|
<a (click)="deleteIndicatorOpen(chart, indicator._id, 'chart', 'delete');hide(element)">Delete</a>
|
||||||
|
</li>
|
||||||
</ng-container>
|
</ng-container>
|
||||||
</ul>
|
</ul>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div>
|
<div>
|
||||||
<div *ngIf="indicator.name" class="uk-text-center uk-text-bold uk-margin-small-bottom">
|
<div *ngIf="indicator.name"
|
||||||
{{indicator.name}}
|
class="uk-text-center uk-text-bold uk-margin-small-bottom">
|
||||||
|
{{ indicator.name }}
|
||||||
</div>
|
</div>
|
||||||
<iframe *ngIf="!properties.disableFrameLoad && indicator.indicatorPaths[0] && indicator.indicatorPaths[0].source !=='image' &&
|
<div *ngIf="indicator.indicatorPaths.length > 1" class="uk-margin-medium-bottom">
|
||||||
safeUrls.get(indicatorUtils.getFullUrl(stakeholder, indicator.indicatorPaths[0]))"
|
<ul class="uk-subnav uk-subnav-pill uk-subnav-small">
|
||||||
allowfullscreen="true" mozallowfullscreen="true" webkitallowfullscreen="true"
|
<li *ngFor="let indicatorPath of indicator.indicatorPaths; let i=index"
|
||||||
[src]="safeUrls.get(indicatorUtils.getFullUrl(stakeholder, indicator.indicatorPaths[0]))"
|
class="uk-flex uk-margin-small-top"
|
||||||
class="uk-width-1-1" [ngClass]="'uk-height-' + (indicator.height?indicator.height.toLowerCase():'medium')"
|
[class.uk-active]="(!indicator.activePath && i == 0) || indicator.activePath === i">
|
||||||
|
<a (click)="indicator.activePath = i">
|
||||||
|
<span>
|
||||||
|
{{ indicatorPath.parameters.title ? indicatorPath.parameters.title : '--' }}
|
||||||
|
</span>
|
||||||
|
</a>
|
||||||
|
</li>
|
||||||
|
</ul>
|
||||||
|
</div>
|
||||||
|
<iframe *ngIf="!properties.disableFrameLoad && getActiveIndicatorPath(indicator) && getActiveIndicatorPath(indicator).source !=='image' &&
|
||||||
|
safeUrls.get(indicatorUtils.getFullUrl(stakeholder, getActiveIndicatorPath(indicator)))"
|
||||||
|
allowfullscreen="true" mozallowfullscreen="true"
|
||||||
|
webkitallowfullscreen="true"
|
||||||
|
[src]="safeUrls.get(indicatorUtils.getFullUrl(stakeholder, getActiveIndicatorPath(indicator)))"
|
||||||
|
class="uk-width-1-1"
|
||||||
|
[ngClass]="'uk-height-' + (indicator.height?indicator.height.toLowerCase():'medium')"
|
||||||
[class.uk-blend-multiply]="!isFullscreen"></iframe>
|
[class.uk-blend-multiply]="!isFullscreen"></iframe>
|
||||||
<div *ngIf="properties.disableFrameLoad && indicator.indicatorPaths &&
|
<div *ngIf="properties.disableFrameLoad && indicator.indicatorPaths &&
|
||||||
indicator.indicatorPaths.length > 0 && indicator.indicatorPaths[0].source !=='image'">
|
indicator.indicatorPaths.length > 0 && getActiveIndicatorPath(indicator).source !=='image'">
|
||||||
<img class="uk-width-1-1 uk-blend-multiply" [ngClass]="'uk-height-' + (indicator.height?indicator.height.toLowerCase():'medium')"
|
<img class="uk-width-1-1 uk-blend-multiply"
|
||||||
|
[ngClass]="'uk-height-' + (indicator.height?indicator.height.toLowerCase():'medium')"
|
||||||
src="assets/chart-placeholder.png">
|
src="assets/chart-placeholder.png">
|
||||||
</div>
|
</div>
|
||||||
<div *ngIf="indicator.indicatorPaths && indicator.indicatorPaths[0] &&
|
<div *ngIf="indicator.indicatorPaths && getActiveIndicatorPath(indicator) && getActiveIndicatorPath(indicator).source === 'image'">
|
||||||
indicator.indicatorPaths[0].source === 'image'">
|
<img class="uk-width-1-1 uk-blend-multiply"
|
||||||
<img class="uk-width-1-1 uk-blend-multiply" [ngClass]="'uk-height-' + (indicator.height?indicator.height.toLowerCase():'medium')"
|
[ngClass]="'uk-height-' + (indicator.height?indicator.height.toLowerCase():'medium')"
|
||||||
[src]="indicator.indicatorPaths[0].url">
|
[src]="getActiveIndicatorPath(indicator).url">
|
||||||
</div>
|
</div>
|
||||||
<!--<ng-container *ngTemplateOutlet="description; context: {indicator:indicator}"></ng-container>-->
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
@ -196,12 +217,14 @@
|
||||||
<div *ngIf="isCurator" class="uk-margin-top">
|
<div *ngIf="isCurator" class="uk-margin-top">
|
||||||
<div class="uk-grid uk-grid-small uk-grid-match" uk-grid>
|
<div class="uk-grid uk-grid-small uk-grid-match" uk-grid>
|
||||||
<div [ngClass]="getChartClassBySize('small')">
|
<div [ngClass]="getChartClassBySize('small')">
|
||||||
<div class=" uk-card uk-card-default uk-card-body clickable" (click)="editChartIndicatorOpen(chart)">
|
<div class=" uk-card uk-card-default uk-card-body clickable"
|
||||||
|
(click)="editChartIndicatorOpen(chart)">
|
||||||
<h6 class="uk-text-bold uk-text-center">
|
<h6 class="uk-text-bold uk-text-center">
|
||||||
Create a custom indicator
|
Create a custom indicator
|
||||||
</h6>
|
</h6>
|
||||||
<div class="uk-text-muted uk-text-small">
|
<div class="uk-text-muted uk-text-small">
|
||||||
Use our advance tool to create a custom Indicator that suit the needs of your funding
|
Use our advance tool to create a custom Indicator that suit the needs of your
|
||||||
|
funding
|
||||||
KPI's.
|
KPI's.
|
||||||
</div>
|
</div>
|
||||||
<div class="uk-flex uk-flex-center uk-text-background uk-margin-medium-top">
|
<div class="uk-flex uk-flex-center uk-text-background uk-margin-medium-top">
|
||||||
|
@ -219,6 +242,9 @@
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
<div *ngIf="loading" class="uk-position-relative uk-height-large">
|
||||||
|
<loading class="uk-position-center"></loading>
|
||||||
|
</div>
|
||||||
<modal-alert #editNumberModal
|
<modal-alert #editNumberModal
|
||||||
[large]="true" classTitle="uk-background-primary uk-light"
|
[large]="true" classTitle="uk-background-primary uk-light"
|
||||||
(alertOutput)="saveIndicator()"
|
(alertOutput)="saveIndicator()"
|
||||||
|
@ -230,9 +256,11 @@
|
||||||
<div *ngIf="numberIndicatorFb" class="uk-grid" [formGroup]="numberIndicatorFb" uk-grid>
|
<div *ngIf="numberIndicatorFb" class="uk-grid" [formGroup]="numberIndicatorFb" uk-grid>
|
||||||
<div input class="uk-width-1-1" [formInput]="numberIndicatorFb.get('name')" placeholder="Title"></div>
|
<div input class="uk-width-1-1" [formInput]="numberIndicatorFb.get('name')" placeholder="Title"></div>
|
||||||
<div *ngIf="stakeholder.defaultId != '-1' && ( (indicator.description && indicator.description.length > 0) || !stakeholder.defaultId)"
|
<div *ngIf="stakeholder.defaultId != '-1' && ( (indicator.description && indicator.description.length > 0) || !stakeholder.defaultId)"
|
||||||
input class="uk-width-1-1" [formInput]="numberIndicatorFb.get('description')" placeholder="Profile description" type="textarea">
|
input class="uk-width-1-1" [formInput]="numberIndicatorFb.get('description')"
|
||||||
|
placeholder="Profile description" type="textarea">
|
||||||
</div>
|
</div>
|
||||||
<div input class="uk-width-1-1" *ngIf="stakeholder.defaultId" [formInput]="numberIndicatorFb.get('additionalDescription')"
|
<div input class="uk-width-1-1" *ngIf="stakeholder.defaultId"
|
||||||
|
[formInput]="numberIndicatorFb.get('additionalDescription')"
|
||||||
placeholder="Description" type="textarea">
|
placeholder="Description" type="textarea">
|
||||||
</div>
|
</div>
|
||||||
<div *ngIf="showVisibility" input class="uk-width-1-2@m" [formInput]="numberIndicatorFb.get('visibility')"
|
<div *ngIf="showVisibility" input class="uk-width-1-2@m" [formInput]="numberIndicatorFb.get('visibility')"
|
||||||
|
@ -241,29 +269,88 @@
|
||||||
<div input class="uk-width-1-2@m" [formInput]="numberIndicatorFb.get('width')"
|
<div input class="uk-width-1-2@m" [formInput]="numberIndicatorFb.get('width')"
|
||||||
placeholder="Number Size" [options]="indicatorUtils.indicatorSizes" type="select">
|
placeholder="Number Size" [options]="indicatorUtils.indicatorSizes" type="select">
|
||||||
</div>
|
</div>
|
||||||
|
<hr class="uk-width-1-1">
|
||||||
<div *ngIf="numberIndicatorPaths" formArrayName="indicatorPaths">
|
<div *ngIf="numberIndicatorPaths" formArrayName="indicatorPaths">
|
||||||
|
<div *ngIf="stakeholderUtils.hasMultiNumberIndicatorPaths" class="uk-margin-medium-bottom">
|
||||||
|
<ul #transitionGroup class="uk-subnav uk-subnav-pill uk-subnav-small" transition-group>
|
||||||
|
<li *ngFor="let indicatorPath of numberIndicatorPaths.controls; let i=index"
|
||||||
|
class="uk-visible-toggle uk-flex uk-margin-small-top" transition-group-item
|
||||||
|
[class.uk-active]="(!indicator.activePath && i == 0) || indicator.activePath === i">
|
||||||
|
<a (click)="activeNumberIndicatorPath(i)">
|
||||||
|
<span *ngIf="indicatorPath.get('result').valid && indicatorPath.get('result').value !== 0"
|
||||||
|
[innerHTML]="(indicatorPath.get('format').value == 'NUMBER'?(indicatorPath.get('result').value | numberRound: 2:1:stakeholder.locale):(indicatorPath.get('result').value | numberPercentage: stakeholder.locale))">
|
||||||
|
</span>
|
||||||
|
<span *ngIf="!indicatorPath.get('result').valid || indicatorPath.get('result').value === 0">
|
||||||
|
--
|
||||||
|
</span>
|
||||||
|
</a>
|
||||||
|
<span *ngIf="!indicator.defaultId && numberIndicatorPaths.length > 1"
|
||||||
|
class="uk-flex uk-flex-column uk-flex-center uk-margin-small-left"
|
||||||
|
[class.uk-invisible-hover]="indicator.activePath !== i"
|
||||||
|
(click)="$event.stopPropagation();$event.preventDefault()">
|
||||||
|
<a class="uk-link-reset uk-flex uk-flex-middle">
|
||||||
|
<icon [flex]="true" name="more_vert"></icon>
|
||||||
|
</a>
|
||||||
|
<div #element
|
||||||
|
uk-dropdown="mode: click; pos: bottom-left; offset: 5; delay-hide: 0; container: .uk-modal-body">
|
||||||
|
<ul class="uk-nav uk-dropdown-nav">
|
||||||
|
<li *ngIf="i > 0">
|
||||||
|
<a (click)="hide(element);moveIndicatorPath(numberIndicatorFb, numberIndicatorPaths, i)">
|
||||||
|
<div class="uk-flex uk-flex-middle">
|
||||||
|
<icon [flex]="true" name="west" ratio="0.6"></icon>
|
||||||
|
<span class="uk-margin-small-left uk-width-expand">Move Left</span>
|
||||||
|
</div>
|
||||||
|
</a>
|
||||||
|
</li>
|
||||||
|
<li *ngIf="i < numberIndicatorPaths.length - 1">
|
||||||
|
<a (click)="hide(element);moveIndicatorPath(numberIndicatorFb, numberIndicatorPaths, i, i + 1)">
|
||||||
|
<div class="uk-flex uk-flex-middle">
|
||||||
|
<icon [flex]="true" name="east" ratio="0.6"></icon>
|
||||||
|
<span class="uk-margin-small-left uk-width-expand">Move Right</span>
|
||||||
|
</div>
|
||||||
|
</a>
|
||||||
|
</li>
|
||||||
|
<li>
|
||||||
|
<a (click)="removeNumberIndicatorPath(i); hide(element)">
|
||||||
|
<div class="uk-flex uk-flex-middle">
|
||||||
|
<icon [flex]="true" name="delete" ratio="0.6"></icon>
|
||||||
|
<span class="uk-margin-small-left uk-width-expand">Delete</span>
|
||||||
|
</div>
|
||||||
|
</a>
|
||||||
|
</li>
|
||||||
|
</ul>
|
||||||
|
</div>
|
||||||
|
</span>
|
||||||
|
</li>
|
||||||
|
<li class="uk-margin-small-top">
|
||||||
|
<a (click)="activeNumberIndicatorPath(numberIndicatorPaths.length); $event.preventDefault()"
|
||||||
|
class="uk-flex uk-flex-middle">
|
||||||
|
<icon name="add" [flex]="true"></icon>
|
||||||
|
<span class="uk-text-uppercase">Add</span>
|
||||||
|
</a>
|
||||||
|
</li>
|
||||||
|
</ul>
|
||||||
|
</div>
|
||||||
<div *ngFor="let indicatorPath of numberIndicatorPaths.controls; let i=index" [formGroupName]="i">
|
<div *ngFor="let indicatorPath of numberIndicatorPaths.controls; let i=index" [formGroupName]="i">
|
||||||
<div class="uk-grid" uk-grid>
|
<div *ngIf="(!indicator.activePath && i == 0) || indicator.activePath === i" class="uk-grid"
|
||||||
|
uk-grid>
|
||||||
<div class="uk-width-1-1">
|
<div class="uk-width-1-1">
|
||||||
<div class="uk-grid" uk-grid>
|
<div class="uk-grid" uk-grid>
|
||||||
<div class="uk-width-1-1 uk-flex uk-flex-middle">
|
<div class="uk-width-1-1 uk-flex uk-flex-middle">
|
||||||
<div input class="uk-width-expand" [formInput]="indicatorPath.get('url')" placeholder="Number URL">
|
<div input class="uk-width-expand" [formInput]="indicatorPath.get('url')"
|
||||||
<div *ngIf="urlParameterizedMessage" warning>{{urlParameterizedMessage}}</div>
|
placeholder="Number URL">
|
||||||
</div>
|
</div>
|
||||||
<div class='uk-padding-small'>
|
<div class='uk-padding-small'>
|
||||||
<a class="uk-link-reset" (click)="copyToClipboard(indicatorPath.get('url').value)"><icon [flex]="true" name="content_copy"></icon></a>
|
<a class="uk-link-reset"
|
||||||
</div>
|
(click)="copyToClipboard(indicatorPath.get('url').value)">
|
||||||
</div>
|
<icon [flex]="true" name="content_copy"></icon>
|
||||||
<div *ngIf="showCheckForSchemaEnhancements" class="uk-width-1-1">
|
</a>
|
||||||
<div class="uk-alert uk-alert-warning">
|
|
||||||
There are schema enhancements that can be applied in this query.<a
|
|
||||||
(click)="indicatorPath.get('url').setValue(indicatorUtils.applySchemaEnhancements(indicatorPath.get('url').value)); indicatorPath.get('url').markAsDirty()">Apply
|
|
||||||
now</a>
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="uk-width-1-2@m">
|
<div class="uk-width-1-2@m">
|
||||||
<div input [formInput]="indicatorPath.get('source')" placeholder="Source"
|
<div input [formInput]="indicatorPath.get('source')" placeholder="Source"
|
||||||
[options]="isAdministrator?indicatorUtils.allSourceTypes:indicatorUtils.sourceTypes" type="select">
|
[options]="isAdministrator?indicatorUtils.allSourceTypes:indicatorUtils.sourceTypes"
|
||||||
|
type="select">
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="uk-width-1-2@m">
|
<div class="uk-width-1-2@m">
|
||||||
|
@ -272,7 +359,8 @@
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="uk-width-1-2@m" formArrayName="parameters">
|
<div class="uk-width-1-2@m" formArrayName="parameters">
|
||||||
<div *ngIf="getParameter(i, 'statsProfile', 'number') && statsProfiles" input [formInput]="getParameter(i, 'statsProfile', 'number').get('value')"
|
<div *ngIf="getParameter(i, 'statsProfile', 'number') && statsProfiles" input
|
||||||
|
[formInput]="getParameter(i, 'statsProfile', 'number').get('value')"
|
||||||
[type]="'select'"
|
[type]="'select'"
|
||||||
[options]="statsProfiles"
|
[options]="statsProfiles"
|
||||||
placeholder="Stats Profile"></div>
|
placeholder="Stats Profile"></div>
|
||||||
|
@ -283,22 +371,26 @@
|
||||||
<h6 class="uk-text-bold uk-margin-remove-bottom">
|
<h6 class="uk-text-bold uk-margin-remove-bottom">
|
||||||
<span>JSON Path</span>
|
<span>JSON Path</span>
|
||||||
</h6>
|
</h6>
|
||||||
<div *ngIf="numberIndicatorPaths.at(i).get('result').invalid && numberIndicatorPaths.at(i).get('result').errors.required">
|
<div *ngIf="indicatorPath.get('result').invalid && indicatorPath.get('result').errors.required">
|
||||||
<div class="uk-text-danger uk-text-small">
|
<div class="uk-text-danger uk-text-small">
|
||||||
This JSON path is not valid or the result has not been calculated yet.
|
This JSON path is not valid or the result has not been calculated yet.
|
||||||
Please press calculate on box below to see the result.
|
Please press calculate on box below to see the result.
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="uk-grid uk-child-width-1-3@m uk-child-width-1-1 uk-margin-top uk-flex-middle" uk-grid>
|
<div class="uk-grid uk-child-width-1-3@m uk-child-width-1-1 uk-margin-top uk-flex-middle"
|
||||||
<div *ngFor="let jsonPath of getJsonPath(i).controls; let j=index" class="uk-flex uk-flex-middle">
|
uk-grid>
|
||||||
<div input class="uk-width-1-1" [formInput]="jsonPath" [placeholder]="'Level ' + +(j + 1)"></div>
|
<div *ngFor="let jsonPath of getJsonPath(i).controls; let j=index"
|
||||||
|
class="uk-flex uk-flex-middle">
|
||||||
|
<div input class="uk-width-1-1" [formInput]="jsonPath"
|
||||||
|
[placeholder]="'Level ' + +(j + 1)"></div>
|
||||||
<a [class.uk-invisible]="getJsonPath(i).length === 1 || numberIndicatorFb.get('defaultId').value"
|
<a [class.uk-invisible]="getJsonPath(i).length === 1 || numberIndicatorFb.get('defaultId').value"
|
||||||
class="uk-margin-small-left uk-text-danger"
|
class="uk-margin-small-left uk-text-danger"
|
||||||
[class.uk-disabled]="getJsonPath(i).disabled"
|
[class.uk-disabled]="getJsonPath(i).disabled"
|
||||||
(click)="removeJsonPath(i, j)">
|
(click)="removeJsonPath(i, j)">
|
||||||
<icon name="close"></icon>
|
<icon name="close"></icon>
|
||||||
</a>
|
</a>
|
||||||
<span [class.uk-invisible]="getJsonPath(i).disabled || j === (getJsonPath(i).controls.length - 1)" class="uk-text-center uk-margin-small-left">
|
<span [class.uk-invisible]="getJsonPath(i).disabled || j === (getJsonPath(i).controls.length - 1)"
|
||||||
|
class="uk-text-center uk-margin-small-left">
|
||||||
<icon name="east"></icon>
|
<icon name="east"></icon>
|
||||||
</span>
|
</span>
|
||||||
</div>
|
</div>
|
||||||
|
@ -312,24 +404,24 @@
|
||||||
<div class="uk-width-1-1 uk-flex uk-flex-center">
|
<div class="uk-width-1-1 uk-flex uk-flex-center">
|
||||||
<div class="uk-flex uk-position-relative">
|
<div class="uk-flex uk-position-relative">
|
||||||
<span class="uk-padding number number-preview uk-flex uk-flex-column uk-flex-center uk-text-center">
|
<span class="uk-padding number number-preview uk-flex uk-flex-column uk-flex-center uk-text-center">
|
||||||
<span *ngIf="numberIndicatorPaths.at(i).get('result').valid && numberIndicatorPaths.at(i).get('result').value !== 0"
|
<span *ngIf="indicatorPath.get('result').valid && indicatorPath.get('result').value !== 0"
|
||||||
[innerHTML]="(numberIndicatorPaths.at(i).get('format').value == 'NUMBER'?(numberIndicatorPaths.at(i).get('result').value | numberRound: 2:1:stakeholder.locale):(numberIndicatorPaths.at(i).get('result').value | numberPercentage: stakeholder.locale))">
|
[innerHTML]="(indicatorPath.get('format').value == 'NUMBER'?(indicatorPath.get('result').value | numberRound: 2:1:stakeholder.locale):(indicatorPath.get('result').value | numberPercentage: stakeholder.locale))">
|
||||||
</span>
|
</span>
|
||||||
<span *ngIf="numberIndicatorPaths.at(i).get('result').valid && numberIndicatorPaths.at(i).get('result').value === 0">
|
<span *ngIf="indicatorPath.get('result').valid && indicatorPath.get('result').value === 0">
|
||||||
--
|
--
|
||||||
</span>
|
</span>
|
||||||
</span>
|
</span>
|
||||||
<div *ngIf="numberIndicatorPaths.at(i).get('result').invalid"
|
<div *ngIf="indicatorPath.get('result').invalid"
|
||||||
class="uk-width-1-1 uk-height-1-1 refresh-indicator">
|
class="uk-width-1-1 uk-height-1-1 refresh-indicator">
|
||||||
<div class="uk-position-relative uk-height-1-1">
|
<div class="uk-position-relative uk-height-1-1">
|
||||||
<a class="uk-position-center uk-text-center uk-text-small uk-link-reset"
|
<a class="uk-position-center uk-text-center uk-text-small uk-link-reset"
|
||||||
[class.uk-disabled]="numberIndicatorPaths.at(i).get('url').invalid"
|
[class.uk-disabled]="indicatorPath.get('url').invalid"
|
||||||
(click)="validateJsonPath(i, true)">
|
(click)="validateJsonPath(i, true)">
|
||||||
<div>
|
<div>
|
||||||
<icon name="refresh"></icon>
|
<icon name="refresh"></icon>
|
||||||
</div>
|
</div>
|
||||||
<span *ngIf="numberIndicatorPaths.at(i).get('result').errors.required">Calculate</span>
|
<span *ngIf="indicatorPath.get('result').errors.required">Calculate</span>
|
||||||
<span *ngIf="numberIndicatorPaths.at(i).get('result').errors.validating">Calculating...</span>
|
<span *ngIf="indicatorPath.get('result').errors.validating">Calculating...</span>
|
||||||
</a>
|
</a>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
@ -337,13 +429,13 @@
|
||||||
class="uk-width-1-1 uk-height-1-1 refresh-indicator">
|
class="uk-width-1-1 uk-height-1-1 refresh-indicator">
|
||||||
<div class="uk-position-relative uk-height-1-1">
|
<div class="uk-position-relative uk-height-1-1">
|
||||||
<a class="uk-position-center uk-text-center uk-text-small uk-link-reset"
|
<a class="uk-position-center uk-text-center uk-text-small uk-link-reset"
|
||||||
[class.uk-disabled]="numberIndicatorPaths.at(i).get('url').invalid"
|
[class.uk-disabled]="indicatorPath.get('url').invalid"
|
||||||
(click)="refreshIndicator('number')">
|
(click)="refreshIndicator('number')">
|
||||||
<div>
|
<div>
|
||||||
<icon name="refresh"></icon>
|
<icon name="refresh"></icon>
|
||||||
</div>
|
</div>
|
||||||
<span>Calculate</span>
|
<span>Calculate</span>
|
||||||
<span *ngIf="numberIndicatorPaths.at(i).get('result').errors?.validating">Calculating...</span>
|
<span *ngIf="indicatorPath.get('result').errors?.validating">Calculating...</span>
|
||||||
</a>
|
</a>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
@ -365,9 +457,11 @@
|
||||||
<div *ngIf="chartIndicatorFb" [formGroup]="chartIndicatorFb" class="uk-grid" uk-grid>
|
<div *ngIf="chartIndicatorFb" [formGroup]="chartIndicatorFb" class="uk-grid" uk-grid>
|
||||||
<div input class="uk-width-1-1" [formInput]="chartIndicatorFb.get('name')" placeholder="Title"></div>
|
<div input class="uk-width-1-1" [formInput]="chartIndicatorFb.get('name')" placeholder="Title"></div>
|
||||||
<div *ngIf="stakeholder.defaultId != '-1' && ((indicator.description && indicator.description.length > 0) || !stakeholder.defaultId)"
|
<div *ngIf="stakeholder.defaultId != '-1' && ((indicator.description && indicator.description.length > 0) || !stakeholder.defaultId)"
|
||||||
input class="uk-width-1-1" [formInput]="chartIndicatorFb.get('description')" placeholder="Default Description" type="textarea">
|
input class="uk-width-1-1" [formInput]="chartIndicatorFb.get('description')"
|
||||||
|
placeholder="Default Description" type="textarea">
|
||||||
</div>
|
</div>
|
||||||
<div *ngIf="stakeholder.defaultId" input class="uk-width-1-1" [formInput]="chartIndicatorFb.get('additionalDescription')"
|
<div *ngIf="stakeholder.defaultId" input class="uk-width-1-1"
|
||||||
|
[formInput]="chartIndicatorFb.get('additionalDescription')"
|
||||||
placeholder="Description" type="textarea">
|
placeholder="Description" type="textarea">
|
||||||
</div>
|
</div>
|
||||||
<div *ngIf="showVisibility" input class="uk-width-1-2@m" [formInput]="chartIndicatorFb.get('visibility')"
|
<div *ngIf="showVisibility" input class="uk-width-1-2@m" [formInput]="chartIndicatorFb.get('visibility')"
|
||||||
|
@ -380,47 +474,112 @@
|
||||||
[options]="indicatorUtils.indicatorSizes" type="select">
|
[options]="indicatorUtils.indicatorSizes" type="select">
|
||||||
</div>
|
</div>
|
||||||
<div *ngIf="chartIndicatorPaths" formArrayName="indicatorPaths" class="uk-width-1-1">
|
<div *ngIf="chartIndicatorPaths" formArrayName="indicatorPaths" class="uk-width-1-1">
|
||||||
|
<div *ngIf="stakeholderUtils.hasMultiChartIndicatorPaths" class="uk-margin-medium-bottom">
|
||||||
|
<ul #transitionGroup class="uk-subnav uk-subnav-pill uk-subnav-small" transition-group>
|
||||||
|
<li *ngFor="let indicatorPath of chartIndicatorPaths.controls; let i=index"
|
||||||
|
class="uk-visible-toggle uk-flex uk-margin-small-top" transition-group-item
|
||||||
|
[class.uk-active]="(!indicator.activePath && i == 0) || indicator.activePath === i">
|
||||||
|
<a (click)="activeChartIndicatorPath(i)">
|
||||||
|
<span>{{ getParameter(i, 'title')?.get('value')?.value ? getParameter(i, 'title').get('value').value : 'No title yet' }}</span>
|
||||||
|
</a>
|
||||||
|
<span *ngIf="!indicator.defaultId && chartIndicatorPaths.length > 1"
|
||||||
|
class="uk-flex uk-flex-column uk-flex-center uk-margin-small-left"
|
||||||
|
[class.uk-invisible-hover]="indicator.activePath !== i"
|
||||||
|
(click)="$event.stopPropagation();$event.preventDefault()">
|
||||||
|
<a class="uk-link-reset uk-flex uk-flex-middle">
|
||||||
|
<icon [flex]="true" name="more_vert"></icon>
|
||||||
|
</a>
|
||||||
|
<div #element
|
||||||
|
uk-dropdown="mode: click; pos: bottom-left; offset: 5; delay-hide: 0; container: .uk-modal-body">
|
||||||
|
<ul class="uk-nav uk-dropdown-nav">
|
||||||
|
<li *ngIf="i > 0">
|
||||||
|
<a (click)="hide(element);moveIndicatorPath(chartIndicatorFb, chartIndicatorPaths, i)">
|
||||||
|
<div class="uk-flex uk-flex-middle">
|
||||||
|
<icon [flex]="true" name="west" ratio="0.6"></icon>
|
||||||
|
<span class="uk-margin-small-left uk-width-expand">Move Left</span>
|
||||||
|
</div>
|
||||||
|
</a>
|
||||||
|
</li>
|
||||||
|
<li *ngIf="i < chartIndicatorPaths.length - 1">
|
||||||
|
<a (click)="hide(element);moveIndicatorPath(chartIndicatorFb, chartIndicatorPaths, i, i + 1)">
|
||||||
|
<div class="uk-flex uk-flex-middle">
|
||||||
|
<icon [flex]="true" name="east" ratio="0.6"></icon>
|
||||||
|
<span class="uk-margin-small-left uk-width-expand">Move Right</span>
|
||||||
|
</div>
|
||||||
|
</a>
|
||||||
|
</li>
|
||||||
|
<li>
|
||||||
|
<a (click)="removeChartIndicatorPath(i); hide(element)">
|
||||||
|
<div class="uk-flex uk-flex-middle">
|
||||||
|
<icon [flex]="true" name="delete" ratio="0.6"></icon>
|
||||||
|
<span class="uk-margin-small-left uk-width-expand">Delete</span>
|
||||||
|
</div>
|
||||||
|
</a>
|
||||||
|
</li>
|
||||||
|
</ul>
|
||||||
|
</div>
|
||||||
|
</span>
|
||||||
|
</li>
|
||||||
|
<li class="uk-margin-small-top">
|
||||||
|
<a (click)="activeChartIndicatorPath(chartIndicatorPaths.length); $event.preventDefault()"
|
||||||
|
class="uk-flex uk-flex-middle">
|
||||||
|
<icon name="add" [flex]="true"></icon>
|
||||||
|
<span class="uk-text-uppercase">Add</span>
|
||||||
|
</a>
|
||||||
|
</li>
|
||||||
|
</ul>
|
||||||
|
</div>
|
||||||
<div *ngFor="let indicatorPath of chartIndicatorPaths.controls; let i=index;"
|
<div *ngFor="let indicatorPath of chartIndicatorPaths.controls; let i=index;"
|
||||||
[formGroupName]="i" class="uk-grid" uk-grid>
|
[formGroupName]="i">
|
||||||
|
<div *ngIf="(!indicator.activePath && i == 0) || indicator.activePath === i" class="uk-grid"
|
||||||
|
uk-grid>
|
||||||
<div class="uk-width-1-1 uk-flex uk-flex-middle">
|
<div class="uk-width-1-1 uk-flex uk-flex-middle">
|
||||||
<div input class="uk-width-expand" [title]="indicatorPath.get('url').disabled?'Default chart URLs cannot change':''"
|
<div input class="uk-width-expand"
|
||||||
|
[title]="indicatorPath.get('url').disabled?'Default chart URLs cannot change':''"
|
||||||
[formInput]="indicatorPath.get('url')" placeholder="Chart URL">
|
[formInput]="indicatorPath.get('url')" placeholder="Chart URL">
|
||||||
<div *ngIf="urlParameterizedMessage" warning>{{urlParameterizedMessage}}</div>
|
|
||||||
</div>
|
</div>
|
||||||
<div class='uk-padding-small'>
|
<div class='uk-padding-small'>
|
||||||
<a class="uk-link-reset" (click)="copyToClipboard(indicatorPath.get('url').value)"><icon [flex]="true" name="content_copy"></icon></a>
|
<a class="uk-link-reset" (click)="copyToClipboard(indicatorPath.get('url').value)">
|
||||||
</div>
|
<icon [flex]="true" name="content_copy"></icon>
|
||||||
</div>
|
</a>
|
||||||
<div *ngIf="showCheckForSchemaEnhancements" class=" uk-width-1-1 ">
|
|
||||||
<div class="uk-alert uk-alert-warning">
|
|
||||||
There are schema enhancements that can be applied in this query. <a
|
|
||||||
(click)="indicatorPath.get('url').setValue(indicatorUtils.applySchemaEnhancements(indicatorPath.get('url').value)); indicatorPath.get('url').markAsDirty()">Apply
|
|
||||||
now</a>
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="uk-width-1-1" formArrayName="parameters">
|
<div class="uk-width-1-1" formArrayName="parameters">
|
||||||
<div class="uk-grid" uk-grid>
|
<div class="uk-grid" uk-grid>
|
||||||
<div *ngIf="getParameter(i, 'title')" input class="uk-width-1-1" [formInput]="getParameter(i, 'title').get('value')"
|
<div *ngIf="getParameter(i, 'title')" input class="uk-width-1-1"
|
||||||
|
[formInput]="getParameter(i, 'title').get('value')"
|
||||||
placeholder="Chart Title"></div>
|
placeholder="Chart Title"></div>
|
||||||
<div *ngIf="getParameter(i, 'subtitle')" input class="uk-width-1-1" placeholder="Chart Subtitle" [formInput]="getParameter(i, 'subtitle').get('value')" label="Chart Subtitle"></div>
|
<div *ngIf="getParameter(i, 'subtitle')" input class="uk-width-1-1"
|
||||||
<div *ngIf="!getParameter(i, 'type')" input class="uk-width-1-3@s" [formInput]="indicatorPath.get('type')" placeholder="Chart Type"
|
placeholder="Chart Subtitle" [formInput]="getParameter(i, 'subtitle').get('value')"
|
||||||
|
label="Chart Subtitle"></div>
|
||||||
|
<div *ngIf="!getParameter(i, 'type')" input class="uk-width-1-3@s"
|
||||||
|
[formInput]="indicatorPath.get('type')" placeholder="Chart Type"
|
||||||
[options]="(indicatorPath.get('type').value == 'table' && getParameter(i, 'data_title_0'))?indicatorUtils.getChartTypes(indicatorPath.get('type').value):indicatorUtils.allChartTypes"
|
[options]="(indicatorPath.get('type').value == 'table' && getParameter(i, 'data_title_0'))?indicatorUtils.getChartTypes(indicatorPath.get('type').value):indicatorUtils.allChartTypes"
|
||||||
type="select"></div>
|
type="select"></div>
|
||||||
<div *ngIf="getParameter(i, 'type')" input class="uk-width-1-3@s" [formInput]="getParameter(i, 'type').get('value')" placeholder="Chart Type"
|
<div *ngIf="getParameter(i, 'type')" input class="uk-width-1-3@s"
|
||||||
[options]="indicatorUtils.getChartTypes(getParameter(i, 'type').get('value').value)" type="select"></div>
|
[formInput]="getParameter(i, 'type').get('value')" placeholder="Chart Type"
|
||||||
<div *ngIf="getParameter(i, 'xAxisTitle')" input class="uk-width-1-3@s" [formInput]="getParameter(i, 'xAxisTitle').get('value')"
|
[options]="indicatorUtils.getChartTypes(getParameter(i, 'type').get('value').value)"
|
||||||
|
type="select"></div>
|
||||||
|
<div *ngIf="getParameter(i, 'xAxisTitle')" input class="uk-width-1-3@s"
|
||||||
|
[formInput]="getParameter(i, 'xAxisTitle').get('value')"
|
||||||
placeholder="X-Axis Title"></div>
|
placeholder="X-Axis Title"></div>
|
||||||
<div *ngIf="getParameter(i, 'yAxisTitle')" input class="uk-width-1-3@s" [formInput]="getParameter(i, 'yAxisTitle').get('value')"
|
<div *ngIf="getParameter(i, 'yAxisTitle')" input class="uk-width-1-3@s"
|
||||||
|
[formInput]="getParameter(i, 'yAxisTitle').get('value')"
|
||||||
placeholder="Y-Axis Title"></div>
|
placeholder="Y-Axis Title"></div>
|
||||||
<div *ngIf="getParameter(i, 'data_title_0')" input class="uk-width-1-3@s" [formInput]="getParameter(i, 'data_title_0').get('value')"
|
<div *ngIf="getParameter(i, 'data_title_0')" input class="uk-width-1-3@s"
|
||||||
|
[formInput]="getParameter(i, 'data_title_0').get('value')"
|
||||||
placeholder="Data Title"></div>
|
placeholder="Data Title"></div>
|
||||||
<div *ngIf="getParameter(i, 'data_title_1')" input class="uk-width-1-3@s" [formInput]="getParameter(i, 'data_title_1').get('value')"
|
<div *ngIf="getParameter(i, 'data_title_1')" input class="uk-width-1-3@s"
|
||||||
|
[formInput]="getParameter(i, 'data_title_1').get('value')"
|
||||||
placeholder="Data Title"></div>
|
placeholder="Data Title"></div>
|
||||||
<div *ngIf="getParameter(i, 'start_year')" input class="uk-width-1-3@s" [formInput]="getParameter(i, 'start_year').get('value')"
|
<div *ngIf="getParameter(i, 'start_year')" input class="uk-width-1-3@s"
|
||||||
|
[formInput]="getParameter(i, 'start_year').get('value')"
|
||||||
placeholder="Year (From)"></div>
|
placeholder="Year (From)"></div>
|
||||||
<div *ngIf="getParameter(i, 'end_year')" input class="uk-width-1-3@s" [formInput]="getParameter(i, 'end_year').get('value')"
|
<div *ngIf="getParameter(i, 'end_year')" input class="uk-width-1-3@s"
|
||||||
|
[formInput]="getParameter(i, 'end_year').get('value')"
|
||||||
placeholder="Year (To)"></div>
|
placeholder="Year (To)"></div>
|
||||||
<div *ngIf="getParameter(i, 'statsProfile') && statsProfiles" input class="uk-width-1-3@s" [formInput]="getParameter(i, 'statsProfile').get('value')"
|
<div *ngIf="getParameter(i, 'statsProfile') && statsProfiles" input
|
||||||
|
class="uk-width-1-3@s" [formInput]="getParameter(i, 'statsProfile').get('value')"
|
||||||
[type]="'select'" [options]="statsProfiles" placeholder="Stats Profile"></div>
|
[type]="'select'" [options]="statsProfiles" placeholder="Stats Profile"></div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
@ -429,7 +588,8 @@
|
||||||
<div *ngIf="(hasDifference(i)) && !indicatorPath.invalid"
|
<div *ngIf="(hasDifference(i)) && !indicatorPath.invalid"
|
||||||
class="uk-width-1-1 uk-height-large refresh-indicator">
|
class="uk-width-1-1 uk-height-large refresh-indicator">
|
||||||
<div class="uk-position-relative uk-height-1-1">
|
<div class="uk-position-relative uk-height-1-1">
|
||||||
<a class="uk-position-center uk-text-center uk-link-reset" (click)="refreshIndicator()">
|
<a class="uk-position-center uk-text-center uk-link-reset"
|
||||||
|
(click)="refreshIndicator()">
|
||||||
<div>
|
<div>
|
||||||
<icon name="refresh"></icon>
|
<icon name="refresh"></icon>
|
||||||
</div>
|
</div>
|
||||||
|
@ -437,13 +597,15 @@
|
||||||
</a>
|
</a>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<iframe *ngIf="indicator.indicatorPaths[i].source !== 'image'" [class.uk-blend-multiply]="!isFullscreen"
|
<iframe *ngIf="indicator.indicatorPaths[i].source !== 'image'"
|
||||||
[src]="indicator.indicatorPaths[i].safeResourceUrl" allowfullscreen="true" mozallowfullscreen="true" webkitallowfullscreen="true"
|
[class.uk-blend-multiply]="!isFullscreen"
|
||||||
|
[src]="indicator.indicatorPaths[i].safeResourceUrl" allowfullscreen="true"
|
||||||
|
mozallowfullscreen="true" webkitallowfullscreen="true"
|
||||||
class="uk-width-1-1 uk-height-large"></iframe>
|
class="uk-width-1-1 uk-height-large"></iframe>
|
||||||
<!-- <div *ngIf="properties.disableFrameLoad && indicator.indicatorPaths[i].source !== 'image'" class="uk-alert uk-alert-danger uk-text-center">I frames-->
|
|
||||||
<!-- preview is disabled</div>-->
|
|
||||||
<div *ngIf="indicator.indicatorPaths[i].source === 'image'">
|
<div *ngIf="indicator.indicatorPaths[i].source === 'image'">
|
||||||
<img class="uk-width-1-1 uk-height-large uk-blend-multiply" [src]="indicator.indicatorPaths[i].url">
|
<img class="uk-width-1-1 uk-height-large uk-blend-multiply"
|
||||||
|
[src]="indicator.indicatorPaths[i].url">
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
@ -452,36 +614,24 @@
|
||||||
<div #editChartNotify notify-form class="uk-width-1-1 uk-margin-medium-top"></div>
|
<div #editChartNotify notify-form class="uk-width-1-1 uk-margin-medium-top"></div>
|
||||||
</div>
|
</div>
|
||||||
</modal-alert>
|
</modal-alert>
|
||||||
<modal-alert #deleteModal (alertOutput)="deleteIndicator()" [overflowBody]="false" classTitle="uk-background-primary uk-light">
|
<modal-alert #deleteModal (alertOutput)="deleteIndicator()" [overflowBody]="false"
|
||||||
|
classTitle="uk-background-primary uk-light">
|
||||||
<div [class.uk-invisible]="editing" class="uk-position-relative">
|
<div [class.uk-invisible]="editing" class="uk-position-relative">
|
||||||
<div *ngIf="editing">
|
<div *ngIf="editing">
|
||||||
<loading class="uk-position-center"></loading>
|
<loading class="uk-position-center"></loading>
|
||||||
</div>
|
</div>
|
||||||
You are about to delete <span class="uk-text-bold" *ngIf="indicator && index !== -1">
|
You are about to delete <span class="uk-text-bold" *ngIf="indicator && index !== -1">
|
||||||
"{{indicator.name ? indicator.name : (indicator.indicatorPaths[0]?.parameters?.title?indicator.indicatorPaths[0].parameters.title:'')}}"</span> indicator permanently.
|
"{{ indicator.name ? indicator.name : (indicator.indicatorPaths[0]?.parameters?.title ? indicator.indicatorPaths[0].parameters.title : '') }}
|
||||||
|
"</span> indicator permanently.
|
||||||
<div *ngIf="indicatorChildrenActionOnDelete == 'delete'" class="uk-text-bold">
|
<div *ngIf="indicatorChildrenActionOnDelete == 'delete'" class="uk-text-bold">
|
||||||
Indicators of all profiles based on this default indicator, will be deleted as well.
|
Indicators of all profiles based on this default indicator, will be deleted as well.
|
||||||
</div>
|
</div>
|
||||||
<!-- <span *ngIf="indicatorChildrenActionOnDelete == 'disconnect'" class="uk-text-bold">-->
|
|
||||||
<!-- Indicators of all profiles based on this default indicator, will not be marked as copied from default anymore.-->
|
|
||||||
<!-- </span>-->
|
|
||||||
Are you sure you want to proceed?
|
Are you sure you want to proceed?
|
||||||
<div #deleteNotify notify-form class="uk-width-1-1 uk-margin-medium-top"></div>
|
<div #deleteNotify notify-form class="uk-width-1-1 uk-margin-medium-top"></div>
|
||||||
</div>
|
</div>
|
||||||
</modal-alert>
|
</modal-alert>
|
||||||
<!--<modal-alert #deleteAllModal (alertOutput)="deleteIndicator('delete')">
|
<modal-alert #deleteSectionModal (alertOutput)="deleteSection()" [overflowBody]="false"
|
||||||
You are about to delete <span class="uk-text-bold" *ngIf="indicator && index !== -1">
|
classTitle="uk-background-primary uk-light">
|
||||||
"{{indicator.name ? indicator.name : indicator.indicatorPaths[0].parameters.title}}"</span> indicator permanently.
|
|
||||||
<span class="uk-text-bold">Indicators of all profiles based on this default indicator, will be deleted as well.</span>
|
|
||||||
Are you sure you want to proceed?
|
|
||||||
</modal-alert>
|
|
||||||
<modal-alert #deleteAndDisconnectModal (alertOutput)="deleteIndicator('disconnect')">
|
|
||||||
You are about to delete <span class="uk-text-bold" *ngIf="indicator && index !== -1">
|
|
||||||
"{{indicator.name ? indicator.name : indicator.indicatorPaths[0].parameters.title}}"</span> indicator permanently.
|
|
||||||
<span class="uk-text-bold">Indicators of all profiles based on this default indicator, will not be marked as copied from default anymore.</span>
|
|
||||||
Are you sure you want to proceed?
|
|
||||||
</modal-alert>-->
|
|
||||||
<modal-alert #deleteSectionModal (alertOutput)="deleteSection()" [overflowBody]="false" classTitle="uk-background-primary uk-light">
|
|
||||||
<div [class.uk-invisible]="editing" class="uk-position-relative">
|
<div [class.uk-invisible]="editing" class="uk-position-relative">
|
||||||
<div *ngIf="editing">
|
<div *ngIf="editing">
|
||||||
<loading class="uk-position-center"></loading>
|
<loading class="uk-position-center"></loading>
|
||||||
|
@ -490,20 +640,9 @@
|
||||||
<div *ngIf="sectionChildrenActionOnDelete == 'delete' && !stakeholder.defaultId" class="uk-text-bold">
|
<div *ngIf="sectionChildrenActionOnDelete == 'delete' && !stakeholder.defaultId" class="uk-text-bold">
|
||||||
Sections of all profiles based on this default section and their contents, will be deleted as well.
|
Sections of all profiles based on this default section and their contents, will be deleted as well.
|
||||||
</div>
|
</div>
|
||||||
<!-- <span *ngIf="sectionChildrenActionOnDelete == 'disconnect'" class="uk-text-bold">-->
|
|
||||||
<!-- Sections of all profiles based on this default section and their contents, will not be marked as copied from default anymore.-->
|
|
||||||
<!-- </span>-->
|
|
||||||
Are you sure you want to proceed?
|
Are you sure you want to proceed?
|
||||||
</div>
|
</div>
|
||||||
</modal-alert>
|
</modal-alert>
|
||||||
<!--<modal-alert #deleteNumberSectionModal (alertOutput)="deleteSection('number')">
|
|
||||||
You are about to delete this section and its indicators permanently.
|
|
||||||
Are you sure you want to proceed?
|
|
||||||
</modal-alert>
|
|
||||||
<modal-alert #deleteChartSectionModal (alertOutput)="deleteSection()">
|
|
||||||
You are about to delete this section and its indicators permanently.
|
|
||||||
Are you sure you want to proceed?
|
|
||||||
</modal-alert>-->
|
|
||||||
<ng-template #new_section let-type="type">
|
<ng-template #new_section let-type="type">
|
||||||
<div class="section">
|
<div class="section">
|
||||||
<div class="uk-flex uk-flex-center" (click)="createSection(-1, type)">
|
<div class="uk-flex uk-flex-center" (click)="createSection(-1, type)">
|
||||||
|
|
|
@ -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,12 +83,13 @@ 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>();
|
||||||
public numberResults: Map<string, number> = new Map<string, number>();
|
public numberResults: Map<string, number> = new Map<string, number>();
|
||||||
/** Import / Export Indicators */
|
public loading: boolean = false;
|
||||||
importLoading: boolean = false;
|
|
||||||
@ViewChild('editChartModal', {static: true}) editChartModal: AlertModal;
|
@ViewChild('editChartModal', {static: true}) editChartModal: AlertModal;
|
||||||
@ViewChild('editNumberModal', {static: true}) editNumberModal: AlertModal;
|
@ViewChild('editNumberModal', {static: true}) editNumberModal: AlertModal;
|
||||||
@ViewChild('deleteModal', {static: true}) deleteModal: AlertModal;
|
@ViewChild('deleteModal', {static: true}) deleteModal: AlertModal;
|
||||||
|
@ -95,12 +97,12 @@ 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('transitionGroup') transitionGroup: TransitionGroupComponent;
|
||||||
|
|
||||||
public isFullscreen: boolean = false;
|
public isFullscreen: boolean = false;
|
||||||
|
|
||||||
|
@ -125,7 +127,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 = [];
|
||||||
|
@ -187,7 +188,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++) {
|
||||||
|
@ -195,12 +196,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 => {
|
||||||
|
@ -210,24 +206,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');
|
||||||
}));
|
}));
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@ -264,7 +268,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),
|
||||||
|
@ -276,13 +280,15 @@ 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 pair = JSON.stringify([indicatorPath.source, url]);
|
||||||
const indexes = urls.get(pair) ? urls.get(pair) : [];
|
const indexes = urls.get(pair) ? urls.get(pair) : [];
|
||||||
indexes.push([i, j]);
|
indexes.push([i, j, k]);
|
||||||
urls.set(pair, indexes);
|
urls.set(pair, indexes);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
});
|
||||||
this.numberSubscription.forEach(value => {
|
this.numberSubscription.forEach(value => {
|
||||||
if (value instanceof Subscriber) {
|
if (value instanceof Subscriber) {
|
||||||
value.unsubscribe();
|
value.unsubscribe();
|
||||||
|
@ -302,10 +308,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];
|
||||||
}
|
}
|
||||||
|
@ -318,7 +324,7 @@ 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);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -354,7 +360,7 @@ export class IndicatorsComponent extends IndicatorStakeholderBaseComponent imple
|
||||||
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.stakeholder.topics[this.topicIndex].categories[this.categoryIndex].subCategories[this.subcategoryIndex] && !this.loading;
|
||||||
}
|
}
|
||||||
|
|
||||||
public get numberIndicatorPaths(): UntypedFormArray {
|
public get numberIndicatorPaths(): UntypedFormArray {
|
||||||
|
@ -365,6 +371,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';
|
||||||
|
@ -461,7 +475,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;
|
||||||
|
@ -497,24 +511,12 @@ export class IndicatorsComponent extends IndicatorStakeholderBaseComponent imple
|
||||||
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)));
|
||||||
if (!this.isStakeholderParametersValid(indicatorPath)) {
|
|
||||||
// default profile
|
|
||||||
if (this.stakeholder.defaultId == null) {
|
|
||||||
this.urlParameterizedMessage = "This indicator couldn't be generated properly. Stakeholders based on this profile may not inherit the data correctly."
|
|
||||||
} else {
|
|
||||||
this.urlParameterizedMessage = "This indicator couldn't be generated properly. Please make sure chart data is for the current stakeholder."
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
this.urlParameterizedMessage = null;
|
|
||||||
}
|
|
||||||
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 {
|
||||||
|
@ -533,8 +535,6 @@ export class IndicatorsComponent extends IndicatorStakeholderBaseComponent imple
|
||||||
}
|
}
|
||||||
this.getJsonPath(index).setValue(paths)
|
this.getJsonPath(index).setValue(paths)
|
||||||
}
|
}
|
||||||
} else {
|
|
||||||
this.urlParameterizedMessage = null;
|
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
);
|
);
|
||||||
|
@ -570,21 +570,9 @@ export class IndicatorsComponent extends IndicatorStakeholderBaseComponent imple
|
||||||
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);
|
||||||
if (!this.isStakeholderParametersValid(indicatorPath)) {
|
|
||||||
// default profile
|
|
||||||
if (this.stakeholder.defaultId == null) {
|
|
||||||
this.urlParameterizedMessage = "This chart couldn't be generated properly. Stakeholders based on this profile may not inherit the data correctly."
|
|
||||||
} else {
|
|
||||||
this.urlParameterizedMessage = "This chart couldn't be generated properly. Please make sure chart data is for the current stakeholder."
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
this.urlParameterizedMessage = null;
|
|
||||||
}
|
|
||||||
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]) {
|
||||||
|
@ -594,17 +582,68 @@ 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;
|
|
||||||
}
|
}
|
||||||
}));
|
}));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private isStakeholderParametersValid(indicatorPath: IndicatorPath) {
|
public removeNumberIndicatorPath(index: number) {
|
||||||
return !((indicatorPath.chartObject && Object.keys(indicatorPath.parameters).indexOf("index_id") == -1 && Object.keys(indicatorPath.parameters).indexOf("index_name") == -1 && Object.keys(indicatorPath.parameters).indexOf("index_shortName") == -1)
|
this.numberIndicatorPaths.removeAt(index);
|
||||||
|| (!indicatorPath.chartObject && indicatorPath.url.indexOf("index_id") == -1 && indicatorPath.url.indexOf("index_name") == -1 && (indicatorPath.url).indexOf("index_shortName") == -1));
|
this.indicator.indicatorPaths.splice(index, 1);
|
||||||
|
this.transitionGroup.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.transitionGroup.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,
|
||||||
|
indicatorPaths: FormArray, index: number,
|
||||||
|
newIndex: number = index - 1) {
|
||||||
|
this.transitionGroup.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.transitionGroup.init();
|
||||||
|
}
|
||||||
|
this.indicator.activePath = index;
|
||||||
|
}
|
||||||
|
|
||||||
|
public activeChartIndicatorPath(index: number) {
|
||||||
|
let paths = this.chartIndicatorPaths;
|
||||||
|
if (index == paths.length) {
|
||||||
|
this.addChartIndicatorPath();
|
||||||
|
this.transitionGroup.init();
|
||||||
|
}
|
||||||
|
this.indicator.activePath = index;
|
||||||
}
|
}
|
||||||
|
|
||||||
private getJsonPathAsFormArray(indicatorPath: IndicatorPath): UntypedFormArray {
|
private getJsonPathAsFormArray(indicatorPath: IndicatorPath): UntypedFormArray {
|
||||||
|
@ -620,6 +659,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)) {
|
||||||
|
@ -640,7 +682,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) {
|
||||||
|
@ -682,26 +738,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();
|
||||||
|
@ -748,22 +804,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();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -863,7 +903,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;
|
||||||
|
@ -900,20 +940,39 @@ export class IndicatorsComponent extends IndicatorStakeholderBaseComponent imple
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
this.editing = false;
|
this.finish();
|
||||||
this.importLoading = false;
|
|
||||||
NotificationHandler.rise('Indicators have been <b>imported</b> successfully!');
|
NotificationHandler.rise('Indicators have been <b>imported</b> successfully!');
|
||||||
}, error => {
|
}, error => {
|
||||||
this.chartIndicatorFb = null;
|
this.chartIndicatorFb = null;
|
||||||
NotificationHandler.rise('An error has occurred. Please try again later', 'danger');
|
NotificationHandler.rise('An error has occurred. Please try again later', 'danger');
|
||||||
this.editing = false;
|
this.finish();
|
||||||
this.importLoading = false;
|
|
||||||
}));
|
}));
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
reorderIndicators(sectionId: string, type: IndicatorType, reorder: Reorder) {
|
finish() {
|
||||||
|
this.editing = false;
|
||||||
|
this.loading = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
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,
|
||||||
|
@ -922,7 +981,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();
|
||||||
|
@ -936,7 +995,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;
|
||||||
|
@ -945,7 +1004,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]) {
|
||||||
|
@ -966,12 +1025,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);
|
||||||
|
@ -1159,24 +1218,6 @@ export class IndicatorsComponent extends IndicatorStakeholderBaseComponent imple
|
||||||
}));
|
}));
|
||||||
}
|
}
|
||||||
|
|
||||||
// deleteNumberSectionOpen(section: Section, index: number) {
|
|
||||||
// this.section = section;
|
|
||||||
// this.index = index;
|
|
||||||
// this.deleteNumberSectionModal.alertTitle = 'Delete Section';
|
|
||||||
// this.deleteNumberSectionModal.cancelButtonText = 'No';
|
|
||||||
// this.deleteNumberSectionModal.okButtonText = 'Yes';
|
|
||||||
// this.deleteNumberSectionModal.open();
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// deleteChartSectionOpen(section: Section, index: number) {
|
|
||||||
// this.section = section;
|
|
||||||
// this.index = index;
|
|
||||||
// this.deleteChartSectionModal.alertTitle = 'Delete Section';
|
|
||||||
// this.deleteChartSectionModal.cancelButtonText = 'No';
|
|
||||||
// this.deleteChartSectionModal.okButtonText = 'Yes';
|
|
||||||
// this.deleteChartSectionModal.open();
|
|
||||||
// }
|
|
||||||
|
|
||||||
deleteSectionOpen(section: Section, index: number, type: IndicatorType, childrenAction: string = null) {
|
deleteSectionOpen(section: Section, index: number, type: IndicatorType, childrenAction: string = null) {
|
||||||
if (!this.editing && !section.defaultId) {
|
if (!this.editing && !section.defaultId) {
|
||||||
this.sectionTypeToDelete = type;
|
this.sectionTypeToDelete = type;
|
||||||
|
@ -1233,10 +1274,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
|
||||||
|
@ -1252,35 +1289,50 @@ 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;
|
||||||
}
|
}
|
||||||
|
|
||||||
importIndicatorsAndSave(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) {
|
||||||
|
UIkit.notification("The type of this profile is not the same with the file's one!", {
|
||||||
|
status: 'warning',
|
||||||
|
timeout: 6000,
|
||||||
|
pos: 'bottom-right'
|
||||||
|
});
|
||||||
|
this.finish();
|
||||||
|
return;
|
||||||
|
}
|
||||||
// name description additionalDescription, height, width, visibility
|
// name description additionalDescription, height, width, visibility
|
||||||
let noValidParams = 0;
|
|
||||||
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.";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1290,46 +1342,47 @@ export class IndicatorsComponent extends IndicatorStakeholderBaseComponent imple
|
||||||
timeout: 6000,
|
timeout: 6000,
|
||||||
pos: 'bottom-right'
|
pos: 'bottom-right'
|
||||||
});
|
});
|
||||||
this.editing = false;
|
this.finish();
|
||||||
this.importLoading = false;
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (chart.type == "chart") {
|
if (chart.type == "chart") {
|
||||||
indicatorPath = this.indicatorUtils.generateIndicatorByChartUrl(this.indicatorUtils.getChartSource(chart.url), chart.url, chart.type, this.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;
|
||||||
|
indicatorPaths = indicatorPaths.filter(indicatorPath => JSON.stringify(path.chartObject) !== JSON.stringify(indicatorPath.chartObject))
|
||||||
|
if (indicatorPaths.length < size) {
|
||||||
|
duplicates = duplicates + (size - indicatorPaths.length);
|
||||||
exists = true;
|
exists = true;
|
||||||
}
|
}
|
||||||
}
|
});
|
||||||
|
});
|
||||||
}
|
});
|
||||||
} else if (chart.type == "number") {
|
} else if (chart.type == "number") {
|
||||||
indicatorPath = this.indicatorUtils.generateIndicatorByNumberUrl(this.indicatorUtils.getNumberSource(chart.url), chart.url, this.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 => {
|
||||||
|
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;
|
exists = true;
|
||||||
}
|
}
|
||||||
|
});
|
||||||
|
});
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
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), indicatorPaths);
|
||||||
}
|
|
||||||
if (!this.isStakeholderParametersValid(indicatorPath)) {
|
|
||||||
noValidParams++;
|
|
||||||
}
|
|
||||||
if (!exists) {
|
|
||||||
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]);
|
|
||||||
sectionsToSave[chart['sectionIndex']].indicators.push(i);
|
sectionsToSave[chart['sectionIndex']].indicators.push(i);
|
||||||
countIndicators++;
|
countIndicators++;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (duplicates > 0) {
|
if (duplicates > 0) {
|
||||||
UIkit.notification(duplicates + " urls already exist and will not be imported!", {
|
UIkit.notification(duplicates + " urls already exist and will not be imported!", {
|
||||||
status: 'warning',
|
status: 'warning',
|
||||||
|
@ -1337,19 +1390,7 @@ export class IndicatorsComponent extends IndicatorStakeholderBaseComponent imple
|
||||||
pos: 'bottom-right'
|
pos: 'bottom-right'
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
if (noValidParams > 0 && !(this.stakeholder.type == 'country')) {
|
if (sectionsToSave.length > 0 && countIndicators > 0) {
|
||||||
let noValidMessage = "Some indicators couldn't be generated properly. Please make sure chart data is for the current stakeholder.";
|
|
||||||
if (this.stakeholder.defaultId == null) {
|
|
||||||
noValidMessage = "Some indicators couldn't be generated properly. Stakeholders based on this profile may not inherit the data correctly.";
|
|
||||||
}
|
|
||||||
UIkit.notification(noValidMessage, {
|
|
||||||
status: 'danger',
|
|
||||||
timeout: 6000,
|
|
||||||
pos: 'bottom-right'
|
|
||||||
});
|
|
||||||
this.editing = false;
|
|
||||||
this.importLoading = false;
|
|
||||||
} else if (sectionsToSave.length > 0 && countIndicators > 0) {
|
|
||||||
this.saveIndicators(sectionsToSave.filter(section => !!section));
|
this.saveIndicators(sectionsToSave.filter(section => !!section));
|
||||||
}
|
}
|
||||||
if (sectionsToSave.length == 0 || countIndicators == 0) {
|
if (sectionsToSave.length == 0 || countIndicators == 0) {
|
||||||
|
@ -1358,8 +1399,7 @@ export class IndicatorsComponent extends IndicatorStakeholderBaseComponent imple
|
||||||
timeout: 6000,
|
timeout: 6000,
|
||||||
pos: 'bottom-right'
|
pos: 'bottom-right'
|
||||||
});
|
});
|
||||||
this.editing = false;
|
this.finish();
|
||||||
this.importLoading = false;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1370,37 +1410,42 @@ 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] = {
|
||||||
"type": indicator.type, "name": indicator.name, "jsonPath": indicatorPath.jsonPath,
|
"indicatorPaths": indicator.indicatorPaths.map(path => {
|
||||||
|
return {
|
||||||
|
jsonPath: path.jsonPath,
|
||||||
|
url: this.indicatorUtils.getNumberUrl(path.source, this.indicatorUtils.getFullUrl(this.stakeholder, path))
|
||||||
|
}
|
||||||
|
}),
|
||||||
|
"type": indicator.type, "name": indicator.name,
|
||||||
"description": indicator.description, "additionalDescription": indicator.additionalDescription,
|
"description": indicator.description, "additionalDescription": indicator.additionalDescription,
|
||||||
"visibility": indicator.visibility, "width": indicator.width, "height": indicator.height,
|
"visibility": indicator.visibility, "width": indicator.width, "height": indicator.height,
|
||||||
"url": this.indicatorUtils.getNumberUrl(indicatorPath.source, this.indicatorUtils.getFullUrl(this.stakeholder, indicatorPath)),
|
|
||||||
"sectionTitle": section.title,
|
"sectionTitle": section.title,
|
||||||
"sectionType": section.type,
|
"sectionType": section.type,
|
||||||
"sectionIndex": index
|
"sectionIndex": index
|
||||||
};
|
};
|
||||||
indexIndicator++;
|
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 => {
|
||||||
|
return {
|
||||||
|
url: this.getUrlByStakeHolder(path)
|
||||||
|
}
|
||||||
|
}),
|
||||||
"type": indicator.type, "name": indicator.name,
|
"type": indicator.type, "name": indicator.name,
|
||||||
"description": indicator.description, "additionalDescription": indicator.additionalDescription,
|
"description": indicator.description, "additionalDescription": indicator.additionalDescription,
|
||||||
"visibility": indicator.visibility, "width": indicator.width, "height": indicator.height,
|
"visibility": indicator.visibility, "width": indicator.width, "height": indicator.height,
|
||||||
"url": this.getUrlByStakeHolder(indicatorPath),
|
|
||||||
"sectionTitle": section.title,
|
"sectionTitle": section.title,
|
||||||
"sectionType": section.type,
|
"sectionType": section.type,
|
||||||
"sectionIndex": index
|
"sectionIndex": index
|
||||||
};
|
};
|
||||||
indexIndicator++;
|
indexIndicator++;
|
||||||
});
|
});
|
||||||
});
|
|
||||||
index++;
|
index++;
|
||||||
|
|
||||||
});
|
});
|
||||||
|
@ -1408,8 +1453,12 @@ export class IndicatorsComponent extends IndicatorStakeholderBaseComponent imple
|
||||||
let topic = this.stakeholder ? this.stakeholder.topics[this.topicIndex] : null;
|
let topic = this.stakeholder ? this.stakeholder.topics[this.topicIndex] : null;
|
||||||
let category = topic ? topic.categories[this.categoryIndex] : null;
|
let category = topic ? topic.categories[this.categoryIndex] : null;
|
||||||
let subCategory = category ? category.subCategories[subcategoryIndex] : null;
|
let subCategory = category ? category.subCategories[subcategoryIndex] : null;
|
||||||
|
let json = {
|
||||||
var jsonFileUrl = window.URL.createObjectURL(new Blob([JSON.stringify(indicators)], {type: 'application/json'}));
|
stakeholder: HelperFunctions.copy(this.stakeholder),
|
||||||
|
indicators: indicators
|
||||||
|
}
|
||||||
|
delete json.stakeholder.topics;
|
||||||
|
var jsonFileUrl = window.URL.createObjectURL(new Blob([JSON.stringify(json)], {type: 'application/json'}));
|
||||||
var a = window.document.createElement('a');
|
var a = window.document.createElement('a');
|
||||||
window.document.body.appendChild(a);
|
window.document.body.appendChild(a);
|
||||||
a.setAttribute('style', 'display: none');
|
a.setAttribute('style', 'display: none');
|
||||||
|
@ -1418,14 +1467,13 @@ export class IndicatorsComponent extends IndicatorStakeholderBaseComponent imple
|
||||||
a.click();
|
a.click();
|
||||||
window.URL.revokeObjectURL(jsonFileUrl);
|
window.URL.revokeObjectURL(jsonFileUrl);
|
||||||
a.remove(); // remove the element
|
a.remove(); // remove the element
|
||||||
|
this.finish();
|
||||||
this.editing = false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
fileChangeEvent(fileInput: any, index) {
|
fileChangeEvent(fileInput: any, index) {
|
||||||
this.index = index;
|
this.index = index;
|
||||||
this.editing = true;
|
this.editing = true;
|
||||||
this.importLoading = true;
|
this.loading = true;
|
||||||
this.filesToUpload = <Array<File>>fileInput.target.files;
|
this.filesToUpload = <Array<File>>fileInput.target.files;
|
||||||
this.upload();
|
this.upload();
|
||||||
}
|
}
|
||||||
|
@ -1438,8 +1486,7 @@ export class IndicatorsComponent extends IndicatorStakeholderBaseComponent imple
|
||||||
timeout: 6000,
|
timeout: 6000,
|
||||||
pos: 'bottom-right'
|
pos: 'bottom-right'
|
||||||
});
|
});
|
||||||
this.editing = false;
|
this.finish();
|
||||||
this.importLoading = false;
|
|
||||||
return;
|
return;
|
||||||
} else {
|
} else {
|
||||||
if (this.filesToUpload[0].name.indexOf(".json") == -1 || (this.filesToUpload[0].type != "application/json")) {
|
if (this.filesToUpload[0].name.indexOf(".json") == -1 || (this.filesToUpload[0].type != "application/json")) {
|
||||||
|
@ -1449,27 +1496,30 @@ export class IndicatorsComponent extends IndicatorStakeholderBaseComponent imple
|
||||||
timeout: 6000,
|
timeout: 6000,
|
||||||
pos: 'bottom-right'
|
pos: 'bottom-right'
|
||||||
});
|
});
|
||||||
this.editing = false;
|
this.finish();
|
||||||
this.importLoading = false;
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
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_result = JSON.parse(result);
|
|
||||||
|
|
||||||
// validate file
|
// validate file
|
||||||
if (!json_result || json_result.length == 0) {
|
if (json && Array.isArray(json)) {
|
||||||
|
UIkit.notification("This file is not supported any more. Please export indicators and try again!", {
|
||||||
|
status: 'danger',
|
||||||
|
timeout: 6000,
|
||||||
|
pos: 'bottom-right'
|
||||||
|
});
|
||||||
|
this.finish();
|
||||||
|
} else if (!json || json?.indicators.length == 0) {
|
||||||
UIkit.notification("Importing file is empty", {
|
UIkit.notification("Importing file is empty", {
|
||||||
status: 'danger',
|
status: 'danger',
|
||||||
timeout: 6000,
|
timeout: 6000,
|
||||||
pos: 'bottom-right'
|
pos: 'bottom-right'
|
||||||
});
|
});
|
||||||
this.editing = false;
|
this.finish();
|
||||||
this.importLoading = false;
|
|
||||||
} else {
|
} else {
|
||||||
this.importIndicatorsAndSave(json_result);
|
this.importIndicatorsAndSave(json.stakeholder, json.indicators);
|
||||||
}
|
}
|
||||||
}, (error) => {
|
}, (error) => {
|
||||||
console.error("Error importing files", error);
|
console.error("Error importing files", error);
|
||||||
|
@ -1478,8 +1528,7 @@ export class IndicatorsComponent extends IndicatorStakeholderBaseComponent imple
|
||||||
timeout: 6000,
|
timeout: 6000,
|
||||||
pos: 'bottom-right'
|
pos: 'bottom-right'
|
||||||
});
|
});
|
||||||
this.editing = false;
|
this.finish();
|
||||||
this.importLoading = false;
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -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);
|
||||||
};
|
};
|
||||||
|
|
|
@ -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[]) {
|
||||||
|
|
|
@ -183,6 +183,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) {
|
||||||
|
|
|
@ -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 pair = JSON.stringify([indicatorPath.source, url]);
|
||||||
const indexes = urls.get(pair) ? urls.get(pair) : [];
|
const indexes = urls.get(pair) ? urls.get(pair) : [];
|
||||||
indexes.push([i, j]);
|
indexes.push([i, j, k]);
|
||||||
urls.set(pair, indexes);
|
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({
|
||||||
|
@ -128,7 +133,6 @@ export class StakeholderService {
|
||||||
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', element, CustomOptions.registryOptions()).pipe(map(element => {
|
||||||
if (path.length === 0) {
|
if (path.length === 0) {
|
||||||
|
@ -140,7 +144,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 +155,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 +162,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 +170,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();
|
||||||
}
|
}
|
||||||
|
|
|
@ -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>
|
||||||
You have been invited to join <span class="uk-text-bold">{{name}}</span> Monitor Dashboard as a member.
|
<div>
|
||||||
|
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>
|
||||||
|
@ -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,7 +97,7 @@ 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,
|
||||||
|
@ -123,12 +115,17 @@ export class RoleVerificationComponent extends BaseComponent implements OnInit,
|
||||||
}
|
}
|
||||||
|
|
||||||
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,11 +152,8 @@ 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();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
@ -179,23 +173,18 @@ export class RoleVerificationComponent extends BaseComponent implements OnInit,
|
||||||
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 = false;
|
|
||||||
this.memberModal.okButtonText = 'Close';
|
|
||||||
} else {
|
|
||||||
this.memberModal.cancelButton = true;
|
this.memberModal.cancelButton = true;
|
||||||
this.memberModal.okButtonText = 'Accept';
|
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();
|
||||||
}
|
}
|
||||||
|
@ -214,16 +203,9 @@ export class RoleVerificationComponent extends BaseComponent implements OnInit,
|
||||||
// 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.paramsSubscription.unsubscribe();
|
|
||||||
}
|
|
||||||
if(this.service === "irish") {
|
|
||||||
this.loading = false;
|
this.loading = false;
|
||||||
this.userManagementService.login(properties.domain + '/admin/' + this.verification.entity);
|
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 {
|
} else {
|
||||||
this.subscriptions.push(this.emailService.notifyManagers(this.id, 'manager',
|
this.subscriptions.push(this.emailService.notifyManagers(this.id, 'manager',
|
||||||
Composer.composeEmailToInformOldManagersForTheNewOnes(this.name, this.id)).subscribe(() => {
|
Composer.composeEmailToInformOldManagersForTheNewOnes(this.name, this.id)).subscribe(() => {
|
||||||
|
@ -244,7 +226,6 @@ export class RoleVerificationComponent extends BaseComponent implements OnInit,
|
||||||
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';
|
||||||
|
@ -253,25 +234,16 @@ export class RoleVerificationComponent extends BaseComponent implements OnInit,
|
||||||
|
|
||||||
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() {
|
||||||
|
@ -279,7 +251,6 @@ export class RoleVerificationComponent extends BaseComponent implements OnInit,
|
||||||
}
|
}
|
||||||
|
|
||||||
cancel() {
|
cancel() {
|
||||||
this.isMember = false;
|
|
||||||
this._router.navigate([]);
|
this._router.navigate([]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -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-primary 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-primary 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-primary 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-primary 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,9 @@
|
||||||
</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))) "
|
(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,10 +310,31 @@
|
||||||
[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-flex-wrap 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"
|
||||||
|
@ -319,17 +342,12 @@
|
||||||
</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-margin-medium-left 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>
|
||||||
|
@ -353,12 +371,19 @@
|
||||||
</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")
|
||||||
) {
|
) {
|
||||||
|
|
|
@ -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>' +
|
||||||
|
|
|
@ -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/",
|
||||||
|
|
|
@ -805,8 +805,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},
|
||||||
|
@ -826,7 +826,7 @@ export class SearchFieldsBase {
|
||||||
equalityOperator: "=",
|
equalityOperator: "=",
|
||||||
filterType: null
|
filterType: null
|
||||||
},
|
},
|
||||||
["country"]: {
|
["countrynojurisdiction"]: {
|
||||||
name: "Country",
|
name: "Country",
|
||||||
type: "vocabulary",
|
type: "vocabulary",
|
||||||
param: "country",
|
param: "country",
|
||||||
|
@ -834,6 +834,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"];
|
||||||
|
@ -969,7 +970,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";
|
||||||
}
|
}
|
||||||
|
|
|
@ -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