[Monitor| dashboard]

add filtering  fl0 for  parameterized named queries



git-svn-id: https://svn.driver.research-infrastructures.eu/driver/dnet40/modules/uoa-monitor-portal/trunk/monitor_dashboard@59122 d315682c-612b-4755-9ff5-7f18f6832af3
This commit is contained in:
Argiro Kokogiannaki 2020-07-15 10:06:15 +00:00
parent 7c9230c658
commit 60c74f8176
4 changed files with 39 additions and 43 deletions

View File

@ -2,7 +2,7 @@
<!-- <div class="uk-grid uk-grid-small uk-text-small" uk-grid>-->
<span *ngIf="periodFilter.selectedFromAndToValues.length > 0" class="uk-grid-margin" >
<span class="selectedFilterLabel" [class.uk-margin-small-left]="margin" title="Remove {{periodFilter.selectedFromAndToValues}}">
<a (click)="clearPeriodFilter()" [class]="((disableForms)?' uk-disabled':' ')+' uk-link-text '"> <i
<a (click)="clearPeriodFilter()" [class]="((loading)?' uk-disabled':' ')+' uk-link-text '"> <i
class=" material-icons"></i>
<span class="uk-margin-small-left">{{periodFilter.selectedFromAndToValues}}</span>
@ -18,7 +18,7 @@
(click)="value.selected = false; filter.radioValue=''; filter.countSelectedValues=
filter.countSelectedValues -1;
filterChanged({value:filter}) ">
<a [class]="((disableForms)?' uk-disabled':' ')+' uk-link-text '">
<a [class]="((loading)?' uk-disabled':' ')+' uk-link-text '">
<span class=" clickable" aria-hidden="true">
<span class="uk-icon">
<svg width="16" height="16" viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"

View File

@ -92,7 +92,7 @@ export class MonitorComponent implements OnInit, OnDestroy {
this.activeTopic = null;
this.activeCategory = null;
this.activeSubCategory = null;
this.filterToggle = false;
if (subscription) {
subscription.unsubscribe();
}
@ -166,6 +166,8 @@ export class MonitorComponent implements OnInit, OnDestroy {
break;
}
}
}else{
this.clearfFilter(filter);
}
}
@ -197,21 +199,24 @@ export class MonitorComponent implements OnInit, OnDestroy {
}
clearAll(){
for(let filter of this.filters) {
filter.countSelectedValues = 0;
filter.radioValue = "";
for (let value of filter.values) {
if (value.selected) {
value.selected = false;
}
}
if (this.queryParams[filter.filterId]) {
delete this.queryParams[filter.filterId];
}
this.clearfFilter(filter);
}
this.periodFilter.selectedFromValue = "";
this.periodFilter.selectedToValue = "";
this.validateYearRange(true)
}
clearfFilter(filter:Filter){
filter.countSelectedValues = 0;
filter.radioValue = "";
for (let value of filter.values) {
if (value.selected) {
value.selected = false;
}
}
if (this.queryParams[filter.filterId]) {
delete this.queryParams[filter.filterId];
}
}
countSelectedFilters():number{
let count = 0;
if(this.periodFilter.selectedFromAndToValues.length > 0){
@ -316,12 +321,6 @@ export class MonitorComponent implements OnInit, OnDestroy {
delete this.queryParams[$event.value.filterId];
}
if(navigate) {
// this.router.navigate(
// [],
// {
// relativeTo: this.route,
// queryParams: this.queryParams,
// });
this.location.go(location.pathname, this.routerHelper.createQueryParamsString( Object.keys(this.queryParams), Object.values(this.queryParams)));
this.setIndicators();
}
@ -342,7 +341,6 @@ export class MonitorComponent implements OnInit, OnDestroy {
}
private setIndicators() {
console.debug("Set Indicators")
this.periodFilter.selectedFromAndToValues = (this.periodFilter.selectedFromValue || this.periodFilter.selectedToValue?((this.periodFilter.selectedFromValue && !this.periodFilter.selectedToValue?"From ":"")+(!this.periodFilter.selectedFromValue && this.periodFilter.selectedToValue?"Until ":"")+ (this.periodFilter.selectedFromValue?this.periodFilter.selectedFromValue:"") +
(this.periodFilter.selectedFromValue && this.periodFilter.selectedToValue?" - ":"")+ (this.periodFilter.selectedToValue?this.periodFilter.selectedToValue:"")):"");
//clear numbers when filters change

View File

@ -364,35 +364,33 @@ export class IndicatorUtils {
if(queries["query"]["name"] && !queries["query"]["select"]){
//Uncomment when the named queries filters are defined
//monitor.stakeholderType.name.id.type.fl0
if(queries["query"]["name"].indexOf("monitor.")==-1 ){
continue;
}
filterApplied = true;
if(filterType == 'fundingL0') {
let filterPosition = queries["query"]["name"].split(".").indexOf(filterType == "fundingL0" ? 'fl0' : filterType);
/*if (filterType == "fundingL0") {*/
filterApplied = true;
if (filterPosition != -1) {
queries["query"]["parameters"][filterPosition - 3] = filterValue;
} else {
queries["query"]["name"] = queries["query"]["name"] + ".fl0";
queries["query"]["parameters"].push(filterValue);
let paramFields = queries["query"]["name"].split(".").slice(3);
let filterPosition = queries["query"]["name"].split(".").indexOf(filterType == "fundingL0" ? 'fl0' : filterType) ;
if (filterPosition != -1) {
//TODO double check if we need to override if the fl0 is already filtered
filterPosition -=3;
if(paramFields.length == queries["query"]["parameters"].length ){
//ok
queries["query"]["parameters"][filterPosition] = filterValue;
}else if((paramFields.length + 2) == queries["query"]["parameters"].length || (paramFields.length*2 + 4) == queries["query"]["parameters"].length){
queries["query"]["parameters"][filterPosition + 2]=filterValue;
filterApplied = true;
}
/*} else {
filterApplied = true;
//start_year end_year
if (filterPosition != -1) {
queries["query"]["parameters"][filterPosition - 3] = filterValue;
} else {
queries["query"]["name"] = queries["query"]["name"] + ".start_year.end_year";
filterPosition = queries["query"]["name"].split(".").indexOf(filterType);
queries["query"]["parameters"].push("0");
queries["query"]["parameters"].push("9999");
queries["query"]["parameters"][filterPosition - 3] = filterValue
if((paramFields.length*2 + 4) == queries["query"]["parameters"].length){
queries["query"]["parameters"][(2* filterPosition) + 5]=filterValue;
}
}*/
} else {
if((paramFields.length*2 + 4) == queries["query"]["parameters"].length){
queries["query"]["parameters"].splice(paramFields.length + 1, 0, filterValue);
}
queries["query"]["name"] = queries["query"]["name"] + ".fl0";
queries["query"]["parameters"].push(filterValue);
}
}else{
let paramFields = queries["query"]["name"].split(".").slice(3);
// console.debug("Field Params length:" + paramFields.length)

View File

@ -192,6 +192,6 @@ bottom a:not(.license), bottom a > :not(svg) {
overflow: hidden;
}
.stakeholderPage:not(.sidebar_mini) #sidebar_main .menu_section > ul > li .menu_mini_title{
.stakeholderPage:not(.sidebar_mini) #sidebar_main .menu_section > ul > li .menu_mini_title, .dashboard:not(.sidebar_mini) #sidebar_main .menu_section > ul > li .menu_mini_title{
display: none;
}