[Monitor Dashboard | Trunk]: 1. Fix preview link 2. if stakeholder doesnt exist go to error page. 3. If stakeholder is inactive or private and user no admin go to error page
git-svn-id: https://svn.driver.research-infrastructures.eu/driver/dnet40/modules/uoa-monitor-portal/trunk/monitor_dashboard@58875 d315682c-612b-4755-9ff5-7f18f6832af3
This commit is contained in:
parent
e7d906c691
commit
bf58c1b7d5
|
@ -84,6 +84,8 @@ export class AppComponent implements OnInit, OnDestroy {
|
||||||
this.stakeholderService.setStakeholder(stakeholder);
|
this.stakeholderService.setStakeholder(stakeholder);
|
||||||
this.layoutService.setOpen(true);
|
this.layoutService.setOpen(true);
|
||||||
this.stakeHolder = stakeholder;
|
this.stakeHolder = stakeholder;
|
||||||
|
}, error => {
|
||||||
|
this.navigateToError();
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
@ -110,6 +112,10 @@ export class AppComponent implements OnInit, OnDestroy {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private navigateToError() {
|
||||||
|
this.router.navigate(['/error'], {queryParams: {'page': this.router.url}});
|
||||||
|
}
|
||||||
|
|
||||||
public get open() {
|
public get open() {
|
||||||
return this.layoutService.open;
|
return this.layoutService.open;
|
||||||
}
|
}
|
||||||
|
|
|
@ -142,10 +142,10 @@
|
||||||
(click)="$event.stopPropagation();editStakeholder(stakeholder);hide(element);$event.preventDefault()">Edit</a>
|
(click)="$event.stopPropagation();editStakeholder(stakeholder);hide(element);$event.preventDefault()">Edit</a>
|
||||||
</li>
|
</li>
|
||||||
<li><a (click)="$event.stopPropagation();toggleStakeholderStatus(stakeholder);hide(element);$event.preventDefault()">
|
<li><a (click)="$event.stopPropagation();toggleStakeholderStatus(stakeholder);hide(element);$event.preventDefault()">
|
||||||
{{stakeholder.isActive ? 'Deactivate' : 'Activate'}}</a>
|
{{stakeholder.isActive ? 'Inactive' : 'Active'}}</a>
|
||||||
</li>
|
</li>
|
||||||
<li><a (click)="$event.stopPropagation();toggleStakeholderAccess(stakeholder);hide(element);$event.preventDefault()">
|
<li><a (click)="$event.stopPropagation();toggleStakeholderAccess(stakeholder);hide(element);$event.preventDefault()">
|
||||||
{{stakeholder.isPublic ? 'Unpublish' : 'Publish'}}</a>
|
{{stakeholder.isPublic ? 'Private' : 'Public'}}</a>
|
||||||
</li>
|
</li>
|
||||||
<hr class="uk-nav-divider">
|
<hr class="uk-nav-divider">
|
||||||
<li><a
|
<li><a
|
||||||
|
|
|
@ -113,28 +113,9 @@ export class MonitorComponent implements OnInit, OnDestroy, IDeactivateComponent
|
||||||
this.numberResults = new Map<string, number>();
|
this.numberResults = new Map<string, number>();
|
||||||
this.chartsActiveType = new Map<string, IndicatorPath>();
|
this.chartsActiveType = new Map<string, IndicatorPath>();
|
||||||
subscription = this.stakeholderService.getStakeholderAsObservable().subscribe(stakeholder => {
|
subscription = this.stakeholderService.getStakeholderAsObservable().subscribe(stakeholder => {
|
||||||
// let stakeholder: Stakeholder = null;
|
|
||||||
// if (params['stakeholder'] == "fwf") {
|
|
||||||
// stakeholder = new Stakeholder(null, "funder", "fwf_________::FWF", "Austrian Science Fund (FWF)", "FWF",
|
|
||||||
// "fwf", true, true, null);
|
|
||||||
// stakeholder = this.stakeholderUtils.createFunderFromDefaultProfile(stakeholder, StakeholderCreator.createFunderDefaultProfile(stakeholder).topics);
|
|
||||||
// stakeholder.logoUrl = "./assets/fwf.png";
|
|
||||||
// } else if (params['stakeholder'] == "arc") {
|
|
||||||
// stakeholder = new Stakeholder(null, "funder", "arc_________::ARC",
|
|
||||||
// "Australian Research Council (ARC)", "ARC", "arc", true, true, null);
|
|
||||||
// stakeholder = this.stakeholderUtils.createFunderFromDefaultProfile(stakeholder, StakeholderCreator.createFunderDefaultProfile(stakeholder).topics);
|
|
||||||
// stakeholder.logoUrl = "./assets/arc1.gif";
|
|
||||||
// } else if (params['stakeholder'] == "ec") {
|
|
||||||
// stakeholder = new Stakeholder(null, "funder", "ec__________::EC",
|
|
||||||
// "European Commission", "EC",
|
|
||||||
// "ec", true, true, null);
|
|
||||||
// stakeholder = this.stakeholderUtils.createFunderFromDefaultProfile(stakeholder, StakeholderCreator.createFunderDefaultProfile(stakeholder).topics);
|
|
||||||
// stakeholder.logoUrl = "./assets/ec.png";
|
|
||||||
// }
|
|
||||||
if (stakeholder) {
|
if (stakeholder) {
|
||||||
this.stakeholder = stakeholder;
|
this.stakeholder = stakeholder;
|
||||||
console.info(this.stakeholder);
|
if(stakeholder.isActive && (stakeholder.isPublic || this.isAdmin())) {
|
||||||
|
|
||||||
this.seoService.createLinkForCanonicalURL(url, false);
|
this.seoService.createLinkForCanonicalURL(url, false);
|
||||||
this._meta.updateTag({content: url}, "property='og:url'");
|
this._meta.updateTag({content: url}, "property='og:url'");
|
||||||
var description = "Monitor Dashboard | " + this.stakeholder.index_name;
|
var description = "Monitor Dashboard | " + this.stakeholder.index_name;
|
||||||
|
@ -151,21 +132,16 @@ export class MonitorComponent implements OnInit, OnDestroy, IDeactivateComponent
|
||||||
this.status = this.errorCodes.DONE;
|
this.status = this.errorCodes.DONE;
|
||||||
this.setView(params);
|
this.setView(params);
|
||||||
this.layoutService.setOpen(true);
|
this.layoutService.setOpen(true);
|
||||||
}
|
} else {
|
||||||
}, error => {
|
|
||||||
this.navigateToError();
|
this.navigateToError();
|
||||||
|
subscription.unsubscribe();
|
||||||
|
}
|
||||||
|
}
|
||||||
});
|
});
|
||||||
this.subscriptions.push(subscription);
|
this.subscriptions.push(subscription);
|
||||||
} else {
|
} else {
|
||||||
this.setView(params);
|
this.setView(params);
|
||||||
}
|
}
|
||||||
// this.subscriptions.push(this.userManagementService.getUserInfo().subscribe(user => {
|
|
||||||
// this.user = user;
|
|
||||||
// this.buildMenu();
|
|
||||||
// }, error => {
|
|
||||||
// console.log("App couldn't fetch properties");
|
|
||||||
// console.log(error);
|
|
||||||
// }));
|
|
||||||
});
|
});
|
||||||
}));
|
}));
|
||||||
});
|
});
|
||||||
|
|
|
@ -57,14 +57,6 @@ export class StakeholderComponent implements OnInit, OnDestroy, IDeactivateCompo
|
||||||
this.form = null;
|
this.form = null;
|
||||||
this.title.setTitle(stakeholder.index_name);
|
this.title.setTitle(stakeholder.index_name);
|
||||||
}
|
}
|
||||||
},
|
|
||||||
err => {
|
|
||||||
console.error("Error getting stakeholder: ", err);
|
|
||||||
if(err.status == 404) {
|
|
||||||
//{queryParams: {"page": this.location.path(true), "page_type": "dataprovider"}}
|
|
||||||
this.router.navigate(['/error'], );
|
|
||||||
}
|
|
||||||
|
|
||||||
}));
|
}));
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
|
@ -125,12 +125,10 @@ export class IndicatorsComponent implements OnInit, OnDestroy, OnChanges, AfterV
|
||||||
this.filterCharts();
|
this.filterCharts();
|
||||||
this.filterNumbers();
|
this.filterNumbers();
|
||||||
}
|
}
|
||||||
if (this.topicIndex && this.categoryIndex && this.subcategoryIndex) {
|
|
||||||
this.preview = '/' + this.stakeholder.alias + '/' + this.stakeholder.topics[this.topicIndex].alias +
|
this.preview = '/' + this.stakeholder.alias + '/' + this.stakeholder.topics[this.topicIndex].alias +
|
||||||
'/' + this.stakeholder.topics[this.topicIndex].categories[this.categoryIndex].alias +
|
'/' + this.stakeholder.topics[this.topicIndex].categories[this.categoryIndex].alias +
|
||||||
'/' + this.stakeholder.topics[this.topicIndex].categories[this.categoryIndex].subCategories[this.subcategoryIndex].alias;
|
'/' + this.stakeholder.topics[this.topicIndex].categories[this.categoryIndex].subCategories[this.subcategoryIndex].alias;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
initReorder() {
|
initReorder() {
|
||||||
this.subscriptions.forEach(value => {
|
this.subscriptions.forEach(value => {
|
||||||
|
|
Loading…
Reference in New Issue