move Connect helper in the library| change help service to get communityId by parameter/domain (for connect or properties for explore) | add helper before/after option in search/advanced/table pages
git-svn-id: https://svn.driver.research-infrastructures.eu/driver/dnet40/modules/uoa-services-library/trunk/ng-openaire-library/src/app@51565 d315682c-612b-4755-9ff5-7f18f6832af3
This commit is contained in:
parent
4bd5470468
commit
f8f2270a78
|
@ -0,0 +1,34 @@
|
|||
export class ConnectHelper{
|
||||
|
||||
public static getCommunityFromDomain(domain:string):string{
|
||||
// domain = "beta.egi.openaire.eu"; for testing
|
||||
if(domain.indexOf("di.uoa.gr")!=-1){
|
||||
return null;
|
||||
}
|
||||
if(domain.indexOf("beta")!=-1){
|
||||
domain = domain.substr(domain.indexOf(".")+1,domain.length);
|
||||
domain = domain.substr(0,domain.indexOf("."));
|
||||
}else{
|
||||
domain = domain.substr(0,domain.indexOf("."));
|
||||
}
|
||||
if(domain == "connect"){
|
||||
return null;
|
||||
}
|
||||
return domain;
|
||||
}
|
||||
public static isProduction(domain:string):boolean{
|
||||
console.log("Domain:"+domain);
|
||||
if(domain.indexOf(".di.uoa.gr")!=-1){
|
||||
return false;
|
||||
}else if(domain.indexOf(".openaire.eu")!=-1){
|
||||
return true;
|
||||
}
|
||||
}
|
||||
public static getProductionPrefix(domain:string):string{
|
||||
if(domain.indexOf("beta.")!=-1){
|
||||
return "beta.";
|
||||
}else{
|
||||
return "";
|
||||
}
|
||||
}
|
||||
}
|
|
@ -50,8 +50,9 @@
|
|||
<helper class="uk-hidden@m" position="right" styleName="uk-width-1-1@s"></helper>
|
||||
</div>
|
||||
<div *ngIf="searchUtils.totalResults <= csvLimit" class="uk-visible@m helper-left-right">
|
||||
<helper position="right" before="true"></helper>
|
||||
<search-download [type]="csvPath" [csvParams]="csvParams" [totalResults]="searchUtils.totalResults" ></search-download>
|
||||
<helper position="right"></helper>
|
||||
<helper position="right" before="false"></helper>
|
||||
</div>
|
||||
<helper *ngIf="searchUtils.totalResults > csvLimit" class="helper-left-right uk-visible@m" position="right"></helper>
|
||||
</div>
|
||||
|
|
|
@ -107,6 +107,7 @@
|
|||
</div>
|
||||
|
||||
<div *ngIf="tableViewLink || searchUtils.totalResults <= csvLimit" class="helper-left-right uk-visible@m">
|
||||
<helper position="right" before="true"></helper>
|
||||
<span *ngIf="tableViewLink" class="uk-margin-medium-right">
|
||||
<a routerLinkActive="router-link-active" [class]="(disableForms)?'uk-disabled uk-link-muted':''" [routerLink]=tableViewLink >
|
||||
<span class="uk-margin-small-right uk-icon"><svg width="20" height="20" viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg" ratio="1"><rect x="2" y="2" width="3" height="3"></rect><rect x="8" y="2" width="3" height="3"></rect><rect x="14" y="2" width="3" height="3"></rect><rect x="2" y="8" width="3" height="3"></rect><rect x="8" y="8" width="3" height="3"></rect><rect x="14" y="8" width="3" height="3"></rect><rect x="2" y="14" width="3" height="3"></rect><rect x="8" y="14" width="3" height="3"></rect><rect x="14" y="14" width="3" height="3"></rect></svg></span>
|
||||
|
@ -115,7 +116,7 @@
|
|||
<span class="uk-icon"><svg width="20" height="20" viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg" icon="table" ratio="1"><rect x="1" y="3" width="18" height="1"></rect><rect x="1" y="7" width="18" height="1"></rect><rect x="1" y="11" width="18" height="1"></rect><rect x="1" y="15" width="18" height="1"></rect></svg></span>
|
||||
</span>
|
||||
<search-download [type]="csvPath" [csvParams]="csvParams" [totalResults]="searchUtils.totalResults"></search-download>
|
||||
<helper position="right"></helper>
|
||||
<helper position="right" before="false"></helper>
|
||||
</div>
|
||||
<helper *ngIf="!tableViewLink && searchUtils.totalResults > csvLimit" class="helper-left-right uk-visible@m" position="right"></helper>
|
||||
</div>
|
||||
|
|
|
@ -49,8 +49,9 @@
|
|||
|
||||
<div class="uk-grid uk-width-1-1">
|
||||
<div *ngIf="filters.length > 0" class="helper-left-right search-filters uk-width-1-6@m uk-visible@m">
|
||||
<helper position="left"></helper>
|
||||
<helper position="left" before="true"></helper>
|
||||
<search-filter *ngFor="let filter of filters " [isDisabled]="disableForms" [filter]="filter" [showResultCount]=showResultCount (change)="filterChanged($event)" (toggleModal)="toggleModal($event)"></search-filter>
|
||||
<helper position="left" before="false"></helper>
|
||||
</div>
|
||||
|
||||
<div class="uk-width-expand@m uk-width-1-1@s uk-first-column custom-dataTable-content" >
|
||||
|
@ -196,16 +197,18 @@
|
|||
<helper class="uk-hidden@m" position="right" styleName="uk-width-1-1@s"></helper>
|
||||
</div>
|
||||
|
||||
<div *ngIf="searchViewLink" class="helper-left-right uk-width-1-6@m uk-visible@m">
|
||||
<p>
|
||||
<div class="helper-left-right uk-width-1-6@m uk-visible@m">
|
||||
<p *ngIf="searchViewLink">
|
||||
<helper position="right" before="true"></helper>
|
||||
<span class="uk-margin-small-right uk-icon"><svg width="20" height="20" viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg" ratio="1"><rect x="2" y="2" width="3" height="3"></rect><rect x="8" y="2" width="3" height="3"></rect><rect x="14" y="2" width="3" height="3"></rect><rect x="2" y="8" width="3" height="3"></rect><rect x="8" y="8" width="3" height="3"></rect><rect x="14" y="8" width="3" height="3"></rect><rect x="2" y="14" width="3" height="3"></rect><rect x="8" y="14" width="3" height="3"></rect><rect x="14" y="14" width="3" height="3"></rect></svg></span>
|
||||
|
||||
<a routerLinkActive="router-link-active" [class]="(disableForms)?'uk-disabled uk-link-muted':''" [routerLink]=searchViewLink >
|
||||
<span class="uk-icon"><svg width="20" height="20" viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg" icon="table" ratio="1"><rect x="1" y="3" width="18" height="1"></rect><rect x="1" y="7" width="18" height="1"></rect><rect x="1" y="11" width="18" height="1"></rect><rect x="1" y="15" width="18" height="1"></rect></svg></span>
|
||||
</a>
|
||||
<helper position="right" before="false"></helper>
|
||||
</p>
|
||||
|
||||
<helper position="right"></helper>
|
||||
<helper *ngIf="!searchViewLink" position="right"></helper>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
|
|
@ -3,7 +3,7 @@ import {ActivatedRoute} from '@angular/router';
|
|||
import 'rxjs/Rx';
|
||||
import {HelperService} from './helper.service';
|
||||
import{EnvProperties} from '../properties/env-properties';
|
||||
|
||||
import {ConnectHelper} from '../../connect/connectHelper';
|
||||
@Component({
|
||||
selector: 'helper',
|
||||
template: `
|
||||
|
@ -22,27 +22,36 @@ export class HelperComponent {
|
|||
@Input() styleName:string = '';
|
||||
sub:any;
|
||||
properties:EnvProperties;
|
||||
|
||||
communityId = null;
|
||||
constructor (private _service: HelperService, private route: ActivatedRoute,) {}
|
||||
|
||||
ngOnInit() {
|
||||
this.route.data
|
||||
.subscribe((data: { envSpecific: EnvProperties }) => {
|
||||
this.properties = data.envSpecific;
|
||||
this.route.queryParams.subscribe(
|
||||
params => {
|
||||
this.communityId = params['communityId'];
|
||||
if(!this.communityId){
|
||||
this.communityId = ConnectHelper.getCommunityFromDomain(document.location.hostname);
|
||||
}
|
||||
if(!this.communityId){
|
||||
this.communityId = this.properties.adminToolsCommunity;
|
||||
}
|
||||
if(this.properties.enableHelper && location){
|
||||
//this.sub = this._service.getHelper(location.pathname, this.properties).subscribe(
|
||||
this.sub = this._service.getHelper(location.pathname, this.position, this.before, this.div, this.properties, this.communityId).subscribe(
|
||||
data => {
|
||||
//this.texts =(data && data.content && data.content[this.position] )? data.content[this.position]:[];
|
||||
this.texts = data;
|
||||
},
|
||||
err => {
|
||||
console.log(err);
|
||||
|
||||
if(this.properties.enableHelper && location){
|
||||
//this.sub = this._service.getHelper(location.pathname, this.properties).subscribe(
|
||||
this.sub = this._service.getHelper(location.pathname, this.position, this.before, this.div, this.properties).subscribe(
|
||||
data => {
|
||||
//this.texts =(data && data.content && data.content[this.position] )? data.content[this.position]:[];
|
||||
this.texts = data;
|
||||
},
|
||||
err => {
|
||||
console.log(err);
|
||||
|
||||
}
|
||||
);
|
||||
}
|
||||
}
|
||||
);
|
||||
}
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
|
|
|
@ -10,14 +10,14 @@ import{EnvProperties} from '../properties/env-properties';
|
|||
export class HelperService {
|
||||
constructor(private http: Http) {}
|
||||
|
||||
getHelper (router: string, position: string, before: boolean, div: string, properties:EnvProperties):any {
|
||||
getHelper (router: string, position: string, before: boolean, div: string, properties:EnvProperties,communityId:string ):any {
|
||||
console.info("get router helpText for : "+router+" - position="+position+" - before="+before + " - div="+div);
|
||||
|
||||
let url = properties.adminToolsAPIURL;
|
||||
if(div) {
|
||||
url += '/divhelpcontent?active=true&community='+properties.adminToolsCommunity+'&page='+router+'&div=' + div;
|
||||
url += '/divhelpcontent?active=true&community='+communityId+'&page='+router+'&div=' + div;
|
||||
} else {
|
||||
url += '/pagehelpcontent?active=true&community='+properties.adminToolsCommunity+'&page='+router+'&position=' + position;
|
||||
url += '/pagehelpcontent?active=true&community='+communityId+'&page='+router+'&position=' + position;
|
||||
if(before) {
|
||||
url += '&before='+before;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue