[Library | develop & Eosc Explore | develop]: metrics.component.ts & metrics.module.ts & metrics.service.ts: [Bug fix] Keep id, not url in parsing and build url of data source in component to use route instead of href | CHANGELOG.md: Updated format of contents & Added changes before production release v.2.0.2. | package.json: Updated version from 2.0.1 to 2.0.2.
This commit is contained in:
parent
46b9543ae7
commit
d11a409f09
|
@ -9,6 +9,8 @@ import {ClickEvent} from "../../../utils/click/click-outside-or-esc.directive";
|
|||
import {NumberUtils} from "../../../utils/number-utils.class";
|
||||
import {OpenaireEntities} from "../../../utils/properties/searchFields";
|
||||
import {StringUtils} from "../../../utils/string-utils.class";
|
||||
import {properties} from "../../../../../environments/environment";
|
||||
import {RouterHelper} from "../../../utils/routerHelper.class";
|
||||
|
||||
@Component({
|
||||
selector: 'metrics',
|
||||
|
@ -78,7 +80,7 @@ import {StringUtils} from "../../../utils/string-utils.class";
|
|||
<tbody>
|
||||
<tr *ngFor="let key of getKeys(metrics.infos)">
|
||||
<td class="uk-width-1-3 uk-text-center uk-text-truncate" uk-tooltip [title]="metrics.infos.get(key).name">
|
||||
<a [href]="metrics.infos.get(key).url + getEoscParams()">
|
||||
<a [queryParams]="addEoscPrevInParams({datasourceId: metrics.infos.get(key).url})" [routerLink]="properties.searchLinkToDataProvider.split('?')[0]">
|
||||
{{metrics.infos.get(key).name}}
|
||||
</a>
|
||||
</td>
|
||||
|
@ -152,6 +154,7 @@ export class MetricsComponent {
|
|||
public status: number;
|
||||
public state: number = -1;
|
||||
public openaireEntities = OpenaireEntities;
|
||||
public routerHelper:RouterHelper = new RouterHelper();
|
||||
|
||||
constructor(private metricsService: MetricsService, private cdr: ChangeDetectorRef) {
|
||||
}
|
||||
|
@ -315,15 +318,14 @@ export class MetricsComponent {
|
|||
return formatted.number + formatted.size;
|
||||
}
|
||||
|
||||
public getEoscParams() {
|
||||
let params = "";
|
||||
if(this.prevPath) {
|
||||
public addEoscPrevInParams(obj) {
|
||||
if(properties.adminToolsPortalType == "eosc" && this.prevPath) {
|
||||
let splitted: string[] = this.prevPath.split("?");
|
||||
params = "&return_path="+StringUtils.URIEncode(splitted[0]);
|
||||
obj = this.routerHelper.addQueryParam("return_path", splitted[0], obj);
|
||||
if(splitted.length > 0) {
|
||||
params += "&search_params="+StringUtils.URIEncode(splitted[1]);
|
||||
obj = this.routerHelper.addQueryParam("search_params", splitted[1], obj);
|
||||
}
|
||||
}
|
||||
return params;
|
||||
return obj;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -10,10 +10,11 @@ import {MetricsService} from '../../../services/metrics.service';
|
|||
import {ErrorMessagesModule} from '../../../utils/errorMessages.module';
|
||||
import {IFrameModule} from "../../../utils/iframe.module";
|
||||
import {IconsModule} from "../../../utils/icons/icons.module";
|
||||
import {RouterModule} from "@angular/router";
|
||||
|
||||
@NgModule({
|
||||
imports: [
|
||||
CommonModule, FormsModule, ErrorMessagesModule, IFrameModule, IconsModule
|
||||
CommonModule, FormsModule, RouterModule, ErrorMessagesModule, IFrameModule, IconsModule
|
||||
],
|
||||
declarations: [
|
||||
MetricsComponent
|
||||
|
|
|
@ -58,7 +58,7 @@ export class MetricsService {
|
|||
info = {};
|
||||
|
||||
info.name = result[2];
|
||||
info.url = properties.searchLinkToDataProvider+id;
|
||||
info.url = id;
|
||||
info.numOfDownloads = "0";
|
||||
info.openaireDownloads = "0";
|
||||
info.numOfViews = "0";
|
||||
|
|
Loading…
Reference in New Issue