[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.layoutService.setOpen(true);
|
||||
this.stakeHolder = stakeholder;
|
||||
}, error => {
|
||||
this.navigateToError();
|
||||
});
|
||||
}
|
||||
} 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() {
|
||||
return this.layoutService.open;
|
||||
}
|
||||
|
|
|
@ -142,10 +142,10 @@
|
|||
(click)="$event.stopPropagation();editStakeholder(stakeholder);hide(element);$event.preventDefault()">Edit</a>
|
||||
</li>
|
||||
<li><a (click)="$event.stopPropagation();toggleStakeholderStatus(stakeholder);hide(element);$event.preventDefault()">
|
||||
{{stakeholder.isActive ? 'Deactivate' : 'Activate'}}</a>
|
||||
{{stakeholder.isActive ? 'Inactive' : 'Active'}}</a>
|
||||
</li>
|
||||
<li><a (click)="$event.stopPropagation();toggleStakeholderAccess(stakeholder);hide(element);$event.preventDefault()">
|
||||
{{stakeholder.isPublic ? 'Unpublish' : 'Publish'}}</a>
|
||||
{{stakeholder.isPublic ? 'Private' : 'Public'}}</a>
|
||||
</li>
|
||||
<hr class="uk-nav-divider">
|
||||
<li><a
|
||||
|
|
|
@ -113,28 +113,9 @@ export class MonitorComponent implements OnInit, OnDestroy, IDeactivateComponent
|
|||
this.numberResults = new Map<string, number>();
|
||||
this.chartsActiveType = new Map<string, IndicatorPath>();
|
||||
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) {
|
||||
this.stakeholder = stakeholder;
|
||||
console.info(this.stakeholder);
|
||||
|
||||
if(stakeholder.isActive && (stakeholder.isPublic || this.isAdmin())) {
|
||||
this.seoService.createLinkForCanonicalURL(url, false);
|
||||
this._meta.updateTag({content: url}, "property='og:url'");
|
||||
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.setView(params);
|
||||
this.layoutService.setOpen(true);
|
||||
}
|
||||
}, error => {
|
||||
} else {
|
||||
this.navigateToError();
|
||||
subscription.unsubscribe();
|
||||
}
|
||||
}
|
||||
});
|
||||
this.subscriptions.push(subscription);
|
||||
} else {
|
||||
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.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.filterNumbers();
|
||||
}
|
||||
if (this.topicIndex && this.categoryIndex && this.subcategoryIndex) {
|
||||
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].subCategories[this.subcategoryIndex].alias;
|
||||
}
|
||||
}
|
||||
|
||||
initReorder() {
|
||||
this.subscriptions.forEach(value => {
|
||||
|
|
Loading…
Reference in New Issue