Import/ Exprort: add the links in the topic component - subcategory actions dropdown
This commit is contained in:
parent
e009a7526f
commit
73172be0a8
|
@ -1,17 +1,4 @@
|
|||
<div *ngIf="stakeholder && canEdit">
|
||||
<div *ngIf="isCurator" class="uk-text-right uk-width-expand">
|
||||
<a class="uk-margin-bottom uk-margin-right " [attr.uk-icon]="export_loading ? null : 'icon:download'" title="Export indicators (JSON file)"
|
||||
(click)="export_indicators()">
|
||||
<span class="">Export</span>
|
||||
<span *ngIf="export_loading" class="uk-margin-small-left uk-icon icon-button"><loading [top_margin]="false"></loading></span>
|
||||
</a>
|
||||
<div uk-form-custom class="js-upload uk-margin-top">
|
||||
<input id="exampleInputFile" type="file" class="uk-width-medium" (change)="fileChangeEvent($event)"/>
|
||||
<a class=" uk-margin-bottom" [attr.uk-icon]="import_loading ? null : 'icon:upload'" title="Import indicators (JSON file)"> Import</a>
|
||||
<span *ngIf="import_loading" class="uk-margin-small-left uk-icon icon-button"><loading [top_margin]="false"></loading></span>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div *ngIf="numberSections">
|
||||
<h6 class="uk-text-bold">Number Indicators</h6>
|
||||
<ng-template ngFor [ngForOf]="displayNumbers" let-number let-i="index">
|
||||
|
@ -593,3 +580,16 @@
|
|||
+'</div>'">
|
||||
</span>
|
||||
</ng-template>
|
||||
|
||||
<modal-alert #importModal
|
||||
[large]="true" >
|
||||
<div class="uk-padding-small">
|
||||
<div>Select a json file to import indicators: </div>
|
||||
<div uk-form-custom class="js-upload uk-margin-top">
|
||||
<input id="exampleInputFile" type="file" class="uk-width-medium" (change)="fileChangeEvent($event)"/>
|
||||
<a class=" uk-button uk-button-default"
|
||||
title="Import indicators (JSON file)">
|
||||
Select file</a>
|
||||
</div>
|
||||
</div>
|
||||
</modal-alert>
|
||||
|
|
|
@ -95,6 +95,7 @@ export class IndicatorsComponent implements OnInit, OnDestroy, OnChanges, AfterV
|
|||
//@ViewChild('deleteChartSectionModal') deleteChartSectionModal: AlertModal;
|
||||
//@ViewChild('deleteNumberSectionModal') deleteNumberSectionModal: AlertModal;
|
||||
@ViewChild('deleteSectionModal', { static: true }) deleteSectionModal: AlertModal;
|
||||
@ViewChild('importModal', { static: true }) importModal: AlertModal;
|
||||
public sectionTypeToDelete: string;
|
||||
public sectionChildrenActionOnDelete: string;
|
||||
public indicatorChildrenActionOnDelete: string;
|
||||
|
@ -1324,7 +1325,14 @@ export class IndicatorsComponent implements OnInit, OnDestroy, OnChanges, AfterV
|
|||
this.import_loading = false;
|
||||
}
|
||||
}
|
||||
|
||||
public clickImportIndicators(){
|
||||
this.importModal.cancelButton = false;
|
||||
this.importModal.okButtonLeft = false;
|
||||
this.importModal.alertMessage = false;
|
||||
this.importModal.alertTitle = 'Import Indicators';
|
||||
this.importModal.okButtonText = 'Cancel';
|
||||
this.importModal.open();
|
||||
}
|
||||
public export_indicators() {
|
||||
this.editing = true;
|
||||
this.export_loading = true;
|
||||
|
@ -1383,9 +1391,9 @@ export class IndicatorsComponent implements OnInit, OnDestroy, OnChanges, AfterV
|
|||
fileChangeEvent(fileInput: any) {
|
||||
this.editing = true;
|
||||
this.import_loading = true;
|
||||
|
||||
this.filesToUpload = <Array<File>>fileInput.target.files;
|
||||
this.upload();
|
||||
this.importModal.cancel();
|
||||
}
|
||||
|
||||
upload() {
|
||||
|
|
|
@ -177,6 +177,10 @@
|
|||
{{'Make ' + v.label.toLowerCase()}}</a>
|
||||
</li>
|
||||
</ng-template>
|
||||
<li *ngIf="indicators && indicators.isCurator"><a (click)=" indicators.export_indicators();
|
||||
hide(element)">Export
|
||||
indicators</a></li>
|
||||
<li *ngIf="indicators && indicators.isCurator"><a (click)=" indicators.clickImportIndicators(); hide(element)">Import indicators</a></li>
|
||||
<hr *ngIf="!stakeholder.topics[topicIndex].categories[categoryIndex].subCategories[i].defaultId"
|
||||
class="uk-nav-divider">
|
||||
<li *ngIf="!stakeholder.topics[topicIndex].categories[categoryIndex].subCategories[i].defaultId"><a
|
||||
|
@ -221,7 +225,7 @@
|
|||
</div>-->
|
||||
</div>
|
||||
<div inner>
|
||||
<indicators [properties]="properties"
|
||||
<indicators #indicators [properties]="properties"
|
||||
[topicIndex]="topicIndex"
|
||||
[categoryIndex]="categoryIndex"
|
||||
[filters]="filters"
|
||||
|
|
|
@ -20,6 +20,8 @@ import {IDeactivateComponent} from "../openaireLibrary/utils/can-exit.guard";
|
|||
import {LayoutService} from "../openaireLibrary/dashboard/sharedComponents/sidebar/layout.service";
|
||||
import {Option} from "../openaireLibrary/sharedComponents/input/input.component";
|
||||
import {properties} from "../../environments/environment";
|
||||
import {IndicatorsComponent} from "./indicators.component";
|
||||
import {Session} from "../openaireLibrary/login/utils/helper.class";
|
||||
|
||||
declare var UIkit;
|
||||
|
||||
|
@ -61,6 +63,8 @@ export class TopicComponent implements OnInit, OnDestroy, IDeactivateComponent {
|
|||
|
||||
@ViewChild('deleteModal', { static: true }) deleteModal: AlertModal;
|
||||
@ViewChild('editModal', { static: true }) editModal: AlertModal;
|
||||
@ViewChild('indicators', { static: true }) indicators: IndicatorsComponent;
|
||||
|
||||
public elementChildrenActionOnDelete: string;
|
||||
public filters: FormGroup;
|
||||
public all: Option = {
|
||||
|
@ -80,6 +84,7 @@ export class TopicComponent implements OnInit, OnDestroy, IDeactivateComponent {
|
|||
public ngOnInit() {
|
||||
this.properties = properties;
|
||||
let subscription: Subscription;
|
||||
|
||||
this.paramsSub = this.route.params.subscribe(params => {
|
||||
if (subscription) {
|
||||
subscription.unsubscribe();
|
||||
|
|
|
@ -547,7 +547,7 @@ export class IndicatorUtils {
|
|||
this.parameterizeDefaultQuery(chart, indicatorPath, stakeholder);
|
||||
this.extractStakeHolders(chart, indicatorPath, stakeholder);
|
||||
indicatorPath.chartObject = JSON.stringify(chart);
|
||||
if(!jsonPath || jsonPath.length == 0 ) {
|
||||
if(!jsonPath || jsonPath.length == 0 || (jsonPath.length == 1 && jsonPath[0]=="")) {
|
||||
indicatorPath.jsonPath = ["data", "0", "0", "0"];
|
||||
}
|
||||
// this.addResultFilters(chart, indicatorPath);
|
||||
|
|
Loading…
Reference in New Issue