@ -1228,7 +1228,6 @@ export class IndicatorsComponent implements OnInit, OnDestroy, OnChanges, AfterV
this . showCheckForSchemaEnhancements = this . isAdministrator && url && ! this . properties . useOldStatisticsSchema && this . indicatorUtils . checkForSchemaEnhancements ( url ) ;
}
importIndicatorsAndSave ( charts :any [ ] ) {
let indicators :Indicator [ ] = [ ] ;
// name description additionalDescription, height, width, visibility
let noValidParams = 0 ;
@ -1236,12 +1235,11 @@ export class IndicatorsComponent implements OnInit, OnDestroy, OnChanges, AfterV
for ( let chart of charts ) {
let exists = false ;
let indicatorPath ;
// validate indicators' schema from file
let invalid_file_message = "" ;
if ( ! chart . type ) {
invalid_file_message = "No indicator type is specified. Type should be chart or number." ;
} else if ( chart . type != "chart" || chart . type != "number" ) {
} else if ( chart . type != "chart" && chart . type != "number" ) {
invalid_file_message = "Invalid indicator type. Type should be chart or number." ;
} else if ( chart . type == "number" && ! chart . jsonPath ) {
invalid_file_message = "No jsonPath is specified for number indicator."
@ -1250,7 +1248,7 @@ export class IndicatorsComponent implements OnInit, OnDestroy, OnChanges, AfterV
}
if ( invalid_file_message ) {
UIkit . notification ( "Error on indicators' schema. Type should be chart or number, url is needed and for number indicators, jsonPath is needed as well." , {
UIkit . notification ( invalid_file_message , {
status : 'danger' ,
timeout : 6000 ,
pos : 'bottom-right'
@ -1288,7 +1286,7 @@ export class IndicatorsComponent implements OnInit, OnDestroy, OnChanges, AfterV
noValidParams ++ ;
}
if ( ! exists ) {
let i : Indicator = new Indicator ( chart . name , chart . description , chart . additionalDescription , chart . type , chart . width , chart . height , chart . visibility , [ indicatorPath ] ) ;
let i : Indicator = new Indicator ( chart . name , chart . description , chart . additionalDescription , chart . type , chart . width , chart . height , "RESTRICTED" , [ indicatorPath ] ) ;
indicators . push ( i ) ;
}
@ -1301,11 +1299,11 @@ export class IndicatorsComponent implements OnInit, OnDestroy, OnChanges, AfterV
} ) ;
}
if ( noValidParams > 0 ) {
let noValidMess e age = "Some indicators couldn't be generated properly. Please make sure chart data is for the current stakeholder." ;
let noValidMess age = "Some indicators couldn't be generated properly. Please make sure chart data is for the current stakeholder." ;
if ( this . stakeholder . defaultId == null ) {
noValidMess e age = "Some indicators couldn't be generated properly. Stakeholders based on this profile may not inherit the data correctly." ;
noValidMess age = "Some indicators couldn't be generated properly. Stakeholders based on this profile may not inherit the data correctly." ;
}
UIkit . notification ( noValidMess e age, {
UIkit . notification ( noValidMess age, {
status : 'danger' ,
timeout : 6000 ,
pos : 'bottom-right'
@ -1328,8 +1326,6 @@ export class IndicatorsComponent implements OnInit, OnDestroy, OnChanges, AfterV
}
public export_indicators() {
console . debug ( "Export indicators" ) ;
this . editing = true ;
this . export_loading = true ;
@ -1339,7 +1335,7 @@ export class IndicatorsComponent implements OnInit, OnDestroy, OnChanges, AfterV
this . displayNumbers . forEach ( section = > {
section . indicators . forEach ( indicator = > {
indicator . indicatorPaths . forEach ( indicatorPath = > {
console . debug ( "export number: " , this . statisticsService . getNumberUrl ( indicatorPath . source , this . indicatorUtils . getFullUrl ( this . stakeholder , indicatorPath ) ) ) ;
// console.debug("export number: ", this.statisticsService.getNumberUrl(indicatorPath.source, this.indicatorUtils.getFullUrl(this.stakeholder, indicatorPath)));
indicators [ index ] = {
"type" : indicator . type , "name" : indicator . name , "jsonPath" : indicatorPath . jsonPath ,
"description" : indicator . description , "additionalDescription" : indicator . additionalDescription ,
@ -1354,7 +1350,7 @@ export class IndicatorsComponent implements OnInit, OnDestroy, OnChanges, AfterV
this . displayCharts . forEach ( section = > {
section . indicators . forEach ( indicator = > {
indicator . indicatorPaths . forEach ( indicatorPath = > {
console . debug ( "export chart: " + this . getUrlByStakeHolder ( indicatorPath ) ) ;
// console.debug("export chart: " + this.getUrlByStakeHolder(indicatorPath));
indicators [ index ] = {
"type" : indicator . type , "name" : indicator . name ,
"description" : indicator . description , "additionalDescription" : indicator . additionalDescription ,
@ -1393,7 +1389,6 @@ export class IndicatorsComponent implements OnInit, OnDestroy, OnChanges, AfterV
}
upload() {
console . debug ( this . filesToUpload ) ;
if ( this . filesToUpload . length == 0 ) {
console . error ( "There is no selected file to upload." ) ;
UIkit . notification ( "There is no selected file to upload." , {