Project

General

Profile

« Previous | Next » 

Revision 57673

[Monitor Dashboard]: Complete indicator save and reorder.

View differences:

modules/uoa-monitor-portal/trunk/monitor_dashboard/src/app/services/stakeholder.service.ts
1 1
import {Injectable} from "@angular/core";
2 2
import {HttpClient} from "@angular/common/http";
3 3
import {BehaviorSubject, Observable} from "rxjs";
4
import {Indicator, Stakeholder} from "../utils/entities/stakeholder";
4
import {Indicator, IndicatorPath, Stakeholder} from "../utils/entities/stakeholder";
5 5
import {HelperFunctions} from "../openaireLibrary/utils/HelperFunctions.class";
6 6
import {map} from "rxjs/operators";
7 7

  
8
let maps: string[] = ['parameters', 'filters'];
9

  
8 10
@Injectable({
9 11
  providedIn: "root"
10 12
})
......
17 19
  }
18 20

  
19 21
  getStakeholder(url: string, alias:string): Observable<Stakeholder> {
20
    return new BehaviorSubject<Stakeholder>(Stakeholder.createECStakeholder()).asObservable();
21
    // return this.http.get<Stakeholder>(url + '/stakeholder/' + encodeURIComponent(alias)).pipe(map(stakeholder => {
22
    //   return this.formalizeStakeholder([stakeholder])[0];
23
    // }));
22
    /*return new BehaviorSubject<Stakeholder>(
23
      StakeholderCreator.createFunderFromDefaultProfile("ec","funder","ec__________::EC",
24
        "European Commission","EC",
25
        false,"ec",true,true)).asObservable();*/
26
    return this.http.get<Stakeholder>(url + '/stakeholder/' + encodeURIComponent(alias)).pipe(map(stakeholder => {
27
      return this.formalize(stakeholder);
28
    }));
24 29
  }
25 30

  
26 31
  getAllStakeholders(url: string, type: string = null): Observable<Stakeholder[]> {
27 32
    return this.http.get<Stakeholder[]>(url + '/stakeholder/all' + (type)?('?type=' + type):'').pipe(map(stakeholders => {
28
      return this.formalizeStakeholder(stakeholders);
33
      return this.formalize(stakeholders);
29 34
    }));
30 35
  }
31 36

  
32 37
  getStakeholders(url: string, type: string = null): Observable<Stakeholder[]> {
33 38
    return this.http.get<Stakeholder[]>(url + '/stakeholder' + (type)?('?type=' + type):'').pipe(map(stakeholders => {
34
      return this.formalizeStakeholder(stakeholders);
39
      return this.formalize(stakeholders);
35 40
    }));
36 41
  }
37 42

  
38 43
  getDefaultStakeholders(url: string, type: string = null): Observable<Stakeholder[]> {
39 44
    return this.http.get<Stakeholder[]>(url + '/stakeholder/default' + (type)?('?type=' + type):'').pipe(map(stakeholders => {
40
      return this.formalizeStakeholder(stakeholders);
45
      return this.formalize(stakeholders);
41 46
    }));
42 47
  }
43 48

  
49
  buildStakeholder(url: string, stakeholder: Stakeholder): Observable<Stakeholder> {
50
    return this.http.post<Stakeholder>(url + '/build-stakeholder', stakeholder).pipe(map(stakeholder => {
51
      return this.formalize(stakeholder);
52
    }));
53
  }
54

  
44 55
  saveStakeholder(url: string, stakeholder: Stakeholder): Observable<Stakeholder> {
45 56
    return this.http.post<Stakeholder>(url + '/stakeholder/save', stakeholder).pipe(map(stakeholder => {
46
      return this.formalizeStakeholder([stakeholder])[0];
57
      return this.formalize(stakeholder);
47 58
    }));
48 59
  }
49 60

  
50
  saveIndicator(url: string, path: string[], indicator: Indicator): Observable<Indicator> {
61
  saveElement(url: string, element: any, path: string[] = []): Observable<any> {
51 62
    path = HelperFunctions.encodeArray(path);
52
    return this.http.post<Indicator>(url + '/' + path.join('/') +
53
      '/indicator/save', indicator);
63
    return this.http.post<any>(url + ((path.length > 0)?'/':'') + path.join('/') +
64
      '/save', element).pipe(map(element => {
65
        return this.formalize(element);
66
    }));
54 67
  }
55 68

  
56 69
  deleteElement(url: string, path: string[]): Observable<any> {
57 70
    path = HelperFunctions.encodeArray(path);
58
    return this.http.delete<any>(url + '/' + path.join('/'))
71
    return this.http.delete<any>(url + '/' + path.join('/') + '/delete');
59 72
  }
60 73

  
74
  reorderIndicators(url: string, path: string[], indicators: Indicator[], type: string = 'chart'): Observable<boolean> {
75
    path = HelperFunctions.encodeArray(path);
76
    return this.http.post<boolean>(url + '/' + path.join('/') + '/' + type + '/reorder', indicators);
77
  }
78

  
61 79
  getStakeholderAsObservable(): Observable<Stakeholder> {
62 80
    return this.stakeholderSubject.asObservable();
63 81
  }
......
70 88
    this.stakeholderSubject.next(stakeholder);
71 89
  }
72 90

  
73
  private formalizeStakeholder(stakeholders: Stakeholder[]): Stakeholder[] {
74
    stakeholders.forEach( stakeholder => {
75
      stakeholder.topics.forEach( topic => {
76
        topic.categories.forEach( category => {
77
          category.subCategories.forEach(subcategory => {
78
            subcategory.charts.forEach(indicator => {
79
              indicator.indicatorPaths.forEach(indicatorPath => {
80
                if(indicatorPath.parameters) {
81
                  indicatorPath.parameters = new Map<string, string>(Object.entries(indicatorPath.parameters));
82
                }
83
                if(indicatorPath.filters) {
84
                  // let filters = new Map<string, Map<string, string>>();
85
                  // Object.entries(indicatorPath.filters).forEach(([key, value]) => {
86
                  //   filters.set(key, new Map<string, string>(Object.entries(value)));
87
                  // });
88
                  indicatorPath.filters =  new Map<string, string>(Object.entries(indicatorPath.filters));
89
                }
90
              });
91
            });
92
          });
93
        });
94
      });
95
    });
96
    return stakeholders;
91
  private formalize(element: any) {
92
    return HelperFunctions.copy(element);
97 93
  }
98 94
}
modules/uoa-monitor-portal/trunk/monitor_dashboard/src/app/monitor/monitor.component.html
25 25
  </div>
26 26
  <dashboard-sidebar *ngIf="sideBar && stakeholder" [items]="sideBar.items" [name]="stakeholder.index_name"></dashboard-sidebar>
27 27
  <div *ngIf="activeSubCategory"
28
       id="page_content" click-outside-or-esc targetId="page_content" (clickOutside)="toggleOpen($event)">
28
       id="page_content" click-outside-or-esc targetId="page_content" [escClose]="false" (clickOutside)="toggleOpen($event)">
29 29
    <div id="page_content_inner">
30 30
<!--      <div>
31 31
        Filters
modules/uoa-monitor-portal/trunk/monitor_dashboard/src/app/home/home.component.html
138 138
    </ul>
139 139
  </div>
140 140
</aside>
141
<div id="page_content" click-outside-or-esc targetId="page_content" (clickOutside)="toggleOpen($event)">
141
<div id="page_content" click-outside-or-esc targetId="page_content" [escClose]="false" (clickOutside)="toggleOpen($event)">
142 142
  <div id="page_content_inner">
143 143
    <h4 class="uk-text-bold">
144 144
      Customise your Monitor Dashboard!
modules/uoa-monitor-portal/trunk/monitor_dashboard/src/app/home/home.component.ts
58 58
  }
59 59

  
60 60
  public ngOnDestroy() {
61
    this.subscriptions.forEach( value => {
62
      if(value instanceof Subscriber) {
61
    this.subscriptions.forEach(value => {
62
      if (value instanceof Subscriber) {
63 63
        value.unsubscribe();
64 64
      }
65 65
    });
......
87 87
  }
88 88

  
89 89
  public saveTopicOpen(element, index = -1) {
90
    if(element.className.indexOf('uk-open') !== -1) {
90
    if (element.className.indexOf('uk-open') !== -1) {
91 91
      this.hide(element);
92 92
    } else {
93 93
      if (index === -1) {
......
100 100
  }
101 101

  
102 102
  public saveTopic(element, index = -1) {
103
    if(this.copyTopic.name && this.copyTopic.name !== '') {
104
      if(!this.copyTopic.alias) {
103
    if (this.copyTopic.name && this.copyTopic.name !== '') {
104
      if (!this.copyTopic.alias) {
105 105
        this.copyTopic.alias = this.copyTopic.name.toLowerCase().trim();
106 106
      }
107
      if(index === -1) {
108
        this.stakeholder.topics.push(this.copyTopic);
107
      if (index === -1) {
109 108
        this.save('Topic has been successfully created', element);
110 109
      } else {
111
        this.stakeholder.topics[index] = HelperFunctions.copy(this.copyTopic);
112
        this.save('Topic has been successfully saved', element);
110
        this.save('Topic has been successfully saved', element, index);
113 111
      }
114 112
    } else {
115 113
      this.valid = false;
......
126 124
    this.deleteTopicModal.open();
127 125
  }
128 126

  
129
  private save(message: string, element) {
130
    this.stakeholderService.saveStakeholder(this.properties.monitorServiceAPIURL, this.stakeholder).subscribe(stakeholder => {
131
      this.stakeholderService.setStakeholder(stakeholder);
127
  private save(message: string, element, index: number = -1) {
128
    let path = [this.stakeholder._id];
129
    this.stakeholderService.saveElement(this.properties.monitorServiceAPIURL, this.copyTopic, path).subscribe(topic => {
130
      if (index === -1) {
131
        this.stakeholder.topics.push(topic);
132
      } else {
133
        this.stakeholder.topics[index] = topic;
134
      }
135
      this.stakeholderService.setStakeholder(this.stakeholder);
132 136
      UIkit.notification(message, {
133 137
        status: 'success',
134 138
        timeout: 3000,
......
147 151

  
148 152
  deleteTopic() {
149 153
    let path = [
150
      this.stakeholder.alias,
151
      this.stakeholder.topics[this.index].alias
154
      this.stakeholder._id,
155
      this.stakeholder.topics[this.index]._id
152 156
    ];
153
    this.stakeholderService.deleteElement(this.properties.monitorServiceAPIURL, path).subscribe(stakeholder => {
154
      this.stakeholderService.setStakeholder(stakeholder);
157
    this.stakeholderService.deleteElement(this.properties.monitorServiceAPIURL, path).subscribe(() => {
158
      this.stakeholder.topics.splice(this.index, 1);
159
      this.stakeholderService.setStakeholder(this.stakeholder);
155 160
      UIkit.notification('Topic has been successfully deleted', {
156 161
        status: 'success',
157 162
        timeout: 3000,
modules/uoa-monitor-portal/trunk/monitor_dashboard/src/app/utils/indicator-utils.ts
1
import {ChartHelper, IndicatorPath, Stakeholder} from "./entities/stakeholder";
1
import {ChartHelper, Indicator, IndicatorPath} from "./entities/stakeholder";
2
import {Validators} from "@angular/forms";
2 3

  
4
export interface Option {
5
  icon?: string,
6
  iconClass?: string,
7
  value: any,
8
  label: string
9
}
10

  
3 11
export class IndicatorUtils {
4 12

  
5
  chartTypes: Map<string, string> = new Map([
13
  chartTypes: Option[] = [
14
    {value: 'pie', label: 'Pie'},
15
    {value: 'table', label: 'Table'},
16
    {value: 'line', label: 'Line'},
17
    {value: 'column', label: 'Column'},
18
    {value: 'bar', label: 'Bar'},
19
    {value: 'other', label: 'Other'}
20
  ];
21

  
22
  chartSizes: Option[] = [
23
    {value: 'small', label: 'Small'},
24
    {value: 'medium', label: 'Medium'},
25
    {value: 'large', label: 'Large'}
26
  ];
27

  
28
  isPublic: Option[]  = [
29
    {icon: 'public', value: true, label: 'Public'},
30
    {icon: 'lock', value: false, label: 'Private'},
31
  ];
32

  
33
  isActive: Option[]  = [
34
    {icon: 'brightness_1', iconClass: '', value: true, label: 'Active'},
35
    {icon: 'brightness_1', value: false, label: 'Inactive'},
36
  ];
37

  
38
  chartTypesIcons: Map<string, string> = new Map([
6 39
    ['pie', 'pie_chart'],
7 40
    ['table', 'table_chart'],
8 41
    ['line', 'show_chart'],
9 42
    ['column', 'bar_chart'],
10 43
    ['bar', 'bar_chart'],
11
    ['image', 'perm_media']
44
    ['other', 'perm_media']
12 45
  ]);
13 46

  
14 47
  isPublicIcon: Map<boolean, string> = new Map([
......
20 53

  
21 54
  ignoredParameters = ['funder_name'];
22 55

  
23
  public getFullUrl(indicatorPath: IndicatorPath, fundingL0:string = null, startDate:string = null, endDate:string = null):string{
56
  parametersValidators: Map<string, any> = new Map<string, any>([
57
    ['start_year', [Validators.required, Validators.pattern('^\\d+$')]],
58
    ['end_year', [Validators.required, Validators.pattern('^\\d+$')]]
59
  ]);
24 60

  
61
  public getFullUrl(indicatorPath: IndicatorPath, fundingL0: string = null, startDate: string = null, endDate: string = null): string {
62

  
25 63
    let replacedUrl = indicatorPath.chartObject;
26 64
    if (indicatorPath.parameters) {
27
      indicatorPath.parameters.forEach((value, key) => {
28
        let replacedValue = value.toString();
29
        if( startDate && key == "start_year" && indicatorPath.filters.get("start_year")){
30
          replacedValue = (replacedValue < startDate)?startDate:replacedValue;
65
      Object.keys(indicatorPath.parameters).forEach(key => {
66
        let replacedValue = indicatorPath.parameters[key];
67
        if (startDate && key == "start_year" && indicatorPath.filters["start_year"]) {
68
          replacedValue = (replacedValue < startDate) ? startDate : replacedValue;
31 69
        }
32
        if( endDate && key == "end_year" && indicatorPath.filters.get("end_year")){
33
          replacedValue = (replacedValue > endDate)?endDate:replacedValue;
70
        if (endDate && key == "end_year" && indicatorPath.filters["end_year"]) {
71
          replacedValue = (replacedValue > endDate) ? endDate : replacedValue;
34 72
        }
35 73
        replacedUrl = replacedUrl.replace(ChartHelper.prefix + key + ChartHelper.suffix, replacedValue);
36 74
      });
37 75
    }
38
    if(indicatorPath.chartObject){
39
      if(fundingL0  && indicatorPath.filters.get("fundingL0")){
76
    if (indicatorPath.chartObject) {
77
      if (fundingL0 && indicatorPath.filters["fundingL0"]) {
40 78
        let newJsonObject = JSON.parse(replacedUrl);
41
        for(let queries of newJsonObject["chartDescription"]["queries"]){
42
          if(!queries["query"]["filters"] || queries["query"]["filters"].length ==0) {
79
        for (let queries of newJsonObject["chartDescription"]["queries"]) {
80
          if (!queries["query"]["filters"] || queries["query"]["filters"].length == 0) {
43 81
            queries["query"]["filters"] = [];
44 82
          }
45 83
          //TODO check how it works if the query already has a filter
46
            queries["query"]["filters"].push(JSON.parse(indicatorPath.filters.get("fundingL0").replace(ChartHelper.prefix + "fundingL0" + ChartHelper.suffix,fundingL0)));
84
          queries["query"]["filters"].push(JSON.parse(indicatorPath.filters["fundingL0"].
85
          replace(ChartHelper.prefix + "fundingL0" + ChartHelper.suffix, fundingL0)));
47 86
        }
48 87
        replacedUrl = JSON.stringify(newJsonObject);
49

  
50 88
      }
51 89
    }
52 90
    return indicatorPath.url + encodeURIComponent(replacedUrl);
53 91
  }
54 92

  
93
  generateIndicatorByForm(form: any, indicatorPaths: IndicatorPath[]): Indicator {
94
    let indicator: Indicator = new Indicator(form.name, form.description, 'chart',
95
      form.width, form.isActive, form.isPublic, indicatorPaths);
96
    indicator._id = form.id;
97
    form.indicatorPaths.forEach((indicatorPath, index) => {
98
      indicatorPath.parameters.forEach(parameter => {
99
        indicator.indicatorPaths[index].parameters[parameter.key] = parameter.value;
100
        if(parameter.key === 'type') {
101
          indicator.indicatorPaths[index].type = parameter.value;
102
        }
103
      });
104
    });
105
    return indicator;
106
  }
107

  
55 108
  generateIndicatorByChartUrl(source: string, url: string, type: string = null): IndicatorPath {
56 109
    let indicatorPath = new IndicatorPath("", source, "", "", []);
57 110
    if (source === 'stats-tool') {
......
67 120
      this.extractStartYear(chart, indicatorPath);
68 121
      this.extractEndYear(chart, indicatorPath);
69 122
      indicatorPath.chartObject = JSON.stringify(chart);
70
      this.addResultFilters(chart,indicatorPath);
123
      this.addResultFilters(chart, indicatorPath);
71 124
    } else if (source === 'old') {
72 125
      indicatorPath.url = url.split("data=")[0].split("/stats/")[1] + "data=";
73 126
      indicatorPath.chartObject = decodeURIComponent(url.split("data=")[1].split("&")[0]);
74 127
      let chart = JSON.parse(indicatorPath.chartObject);
75
      this.extractOldToolTitle(chart,indicatorPath);
76
      this.extractOldToolXTitle(chart,indicatorPath);
77
      this.extractOldToolYTitle(chart,indicatorPath);
128
      this.extractOldToolTitle(chart, indicatorPath);
129
      this.extractOldToolXTitle(chart, indicatorPath);
130
      this.extractOldToolYTitle(chart, indicatorPath);
78 131
      indicatorPath.chartObject = JSON.stringify(chart);
79 132
    } else {
80 133
      indicatorPath.url = url;
......
90 143
      type = defaultTypes [0];
91 144
    } else {
92 145
      obj["chartDescription"]["queries"][0]["type"] = ChartHelper.prefix + "type" + ChartHelper.suffix;
93
      indicatorPath.parameters.set("type", type);
146
      indicatorPath.parameters['type'] = type;
94 147
    }
95 148
    return type;
96 149
  }
......
98 151
  private extractFunder(obj, indicatorPath: IndicatorPath) {
99 152
    let funderName;
100 153
    for (let query of obj["chartDescription"]["queries"]) {
101
      if(!query["query"]["filters"]){
154
      if (!query["query"]["filters"]) {
102 155
        return;
103 156
      }
104 157
      for (let filter of query["query"]["filters"]) {
105 158
        if (filter["groupFilters"][0]["field"].indexOf(".funder") != -1) {
106 159
          funderName = filter["groupFilters"][0]["values"][0];
107 160
          filter["groupFilters"][0]["values"][0] = ChartHelper.prefix + "funder_name" + ChartHelper.suffix;
108
          indicatorPath.parameters.set("funder_name", funderName);
161
          indicatorPath.parameters["funder_name"]  = funderName;
109 162
        }
110 163
      }
111 164
    }
......
114 167
  private extractStartYear(obj, indicatorPath: IndicatorPath) {
115 168
    let start_year;
116 169
    for (let query of obj["chartDescription"]["queries"]) {
117
      if(!query["query"]["filters"]){
170
      if (!query["query"]["filters"]) {
118 171
        return;
119 172
      }
120 173
      for (let filter of query["query"]["filters"]) {
......
122 175
          if (gfilter["field"].indexOf(".year") != -1 && gfilter["type"].indexOf(">") != -1) {
123 176
            start_year = gfilter["values"][0];
124 177
            gfilter["values"][0] = ChartHelper.prefix + "start_year" + ChartHelper.suffix;
125
            indicatorPath.parameters.set("start_year", start_year);
178
            indicatorPath.parameters["start_year"] =  start_year;
126 179
          }
127 180
        }
128 181
      }
......
132 185
  private extractEndYear(obj, indicatorPath: IndicatorPath) {
133 186
    let end_year;
134 187
    for (let query of obj["chartDescription"]["queries"]) {
135
      if(!query["query"]["filters"]){
188
      if (!query["query"]["filters"]) {
136 189
        return;
137 190
      }
138 191
      for (let filter of query["query"]["filters"]) {
......
140 193
          if (gfilter["field"].indexOf(".year") != -1 && gfilter["type"].indexOf("<") != -1) {
141 194
            end_year = gfilter["values"][0];
142 195
            gfilter["values"][0] = ChartHelper.prefix + "end_year" + ChartHelper.suffix;
143
            indicatorPath.parameters.set("end_year", end_year);
196
            indicatorPath.parameters["end_year"] =  end_year;
144 197
          }
145 198
        }
146 199
      }
......
152 205
    if (obj["chartDescription"]["title"]) {
153 206
      title = obj["chartDescription"]["title"]["text"];
154 207
      obj["chartDescription"]["title"]["text"] = ChartHelper.prefix + "title" + ChartHelper.suffix;
155
      indicatorPath.parameters.set("title", title);
208
      indicatorPath.parameters["title"] =  title;
156 209

  
157 210
    }
158 211
  }
......
162 215
    if (obj["chartDescription"]["xAxis"]["title"]) {
163 216
      title = obj["chartDescription"]["xAxis"]["title"]["text"];
164 217
      obj["chartDescription"]["xAxis"]["title"]["text"] = ChartHelper.prefix + "xAxisTitle" + ChartHelper.suffix;
165
      indicatorPath.parameters.set("xAxisTitle", title);
218
      indicatorPath.parameters["xAxisTitle"] = title;
166 219
    }
167 220
  }
168 221

  
......
171 224
    if (obj["chartDescription"]["yAxis"]["title"]) {
172 225
      title = obj["chartDescription"]["yAxis"]["title"]["text"];
173 226
      obj["chartDescription"]["yAxis"]["title"]["text"] = ChartHelper.prefix + "yAxisTitle" + ChartHelper.suffix;
174
      indicatorPath.parameters.set("yAxisTitle", title);
227
      indicatorPath.parameters["yAxisTitle"] = title;
175 228
    }
176 229
  }
230

  
177 231
  private addResultFilters(obj, indicatorPath: IndicatorPath) {
178
  let resultTypes  = ["publication","software","dataset","other"];
179
  let index = -1;
232
    let resultTypes = ["publication", "software", "dataset", "other"];
233
    let index = -1;
180 234
    for (let query of obj["chartDescription"]["queries"]) {
181 235
      if (!query["query"]["select"]) {
182 236
        return;
183 237
      }
184 238
      for (let select of query["query"]["select"]) {
185
        for (var i=0; i < resultTypes.length; i++) {
186
          if(select.field.startsWith(resultTypes[i]) ) {
239
        for (var i = 0; i < resultTypes.length; i++) {
240
          if (select.field.startsWith(resultTypes[i])) {
187 241
            index = i;
188 242
          }
189 243
        }
190 244
      }
191 245

  
192 246
    }
193
    if(index != -1){
247
    if (index != -1) {
194 248
      indicatorPath.filters = IndicatorPath.createResultFilters(resultTypes[index]);
195 249
    }
196 250
  }
......
201 255
    if (obj["title"]) {
202 256
      title = obj["title"];
203 257
      obj["title"] = ChartHelper.prefix + "title" + ChartHelper.suffix;
204
      indicatorPath.parameters.set("title", title);
258
      indicatorPath.parameters["title"] = title;
205 259

  
206 260
    }
207 261
  }
......
211 265
    if (obj["xaxistitle"]) {
212 266
      title = obj["xaxistitle"];
213 267
      obj["xaxistitle"] = ChartHelper.prefix + "xAxisTitle" + ChartHelper.suffix;
214
      indicatorPath.parameters.set("xAxisTitle", title);
268
      indicatorPath.parameters["xAxisTitle"] = title;
215 269
    }
216 270
  }
217 271

  
218 272
  private extractOldToolYTitle(obj, indicatorPath: IndicatorPath) {
219 273
    let title = "";
220
    if (obj["fieldsheaders"] ) {
274
    if (obj["fieldsheaders"]) {
221 275
      title = obj["fieldsheaders"];
222
      obj["fieldsheaders"]  = ChartHelper.prefix + "yAxisTitle" + ChartHelper.suffix;
223
      indicatorPath.parameters.set("yAxisTitle", title);
276
      obj["fieldsheaders"] = ChartHelper.prefix + "yAxisTitle" + ChartHelper.suffix;
277
      indicatorPath.parameters["yAxisTitle"] = title;
224 278
    }
225 279
  }
226 280

  
227 281
}
282

  
228 283
/*
229 284
custom query
230 285
http://88.197.53.71:8080/stats-api/chart?json=%7B%22library%22%3A%22HighCharts%22%2C%22chartDescription%22%3A%7B%22queries%22%3A%5B%7B%22name%22%3A%22Publications%22%2C%22type%22%3A%22bar%22%2C%22query%22%3A%7B%22name%22%3A%22monitor.ec.publications.datasources%22%7D%7D%5D%2C%22chart%22%3A%7B%22backgroundColor%22%3A%22%23FFFFFFFF%22%2C%22borderColor%22%3A%22%23335cadff%22%2C%22borderRadius%22%3A0%2C%22borderWidth%22%3A0%2C%22plotBorderColor%22%3A%22%23ccccccff%22%2C%22plotBorderWidth%22%3A0%7D%2C%22title%22%3A%7B%22text%22%3A%22Publication%20content%20provider%22%7D%2C%22subtitle%22%3A%7B%7D%2C%22yAxis%22%3A%7B%22title%22%3A%7B%22text%22%3A%22Publications%22%7D%7D%2C%22xAxis%22%3A%7B%22title%22%3A%7B%22text%22%3A%22Content%20provider%22%7D%7D%2C%22lang%22%3A%7B%22noData%22%3A%22No%20Data%20available%20for%20the%20Query%22%7D%2C%22exporting%22%3A%7B%22enabled%22%3Atrue%7D%2C%22plotOptions%22%3A%7B%22series%22%3A%7B%22dataLabels%22%3A%7B%22enabled%22%3Afalse%7D%7D%7D%2C%22legend%22%3A%7B%22enabled%22%3Atrue%2C%22align%22%3A%22center%22%2C%22verticalAlign%22%3A%22bottom%22%2C%22layout%22%3A%22horizontal%22%7D%2C%22credits%22%3A%7B%22href%22%3Anull%2C%22enabled%22%3Atrue%2C%22text%22%3A%22Created%20by%20OpenAIRE%20via%20HighCharts%22%7D%7D%7D
modules/uoa-monitor-portal/trunk/monitor_dashboard/src/app/utils/services/statistics.service.ts
20 20
            this.chartSources.set('stats-tool', properties.statisticsFrameNewAPIURL);
21 21
            this.chartSources.set('old', properties.statisticsFrameAPIURL);
22 22
            this.chartSources.set('metrics', properties.metricsAPIURL);
23
            this.chartSources.set('fake', '');
23
            this.chartSources.set('image', '');
24 24
        })
25 25
    }
26 26

  
......
33 33
    }
34 34

  
35 35
    getChartSource(url: string): string {
36
        let source = 'fake';
36
        let source = 'image';
37 37
        this.chartSources.forEach((value, key) => {
38 38
            if(value !== '' && url.indexOf(value) !== -1) {
39 39
                source = key;
modules/uoa-monitor-portal/trunk/monitor_dashboard/src/app/utils/entities/stakeholder.ts
1 1
import {SafeResourceUrl} from "@angular/platform-browser";
2 2
import {IndicatorUtils} from "../indicator-utils";
3
export const ChartHelper={
4
  prefix : "((__",
5
  suffix : "__))"
3

  
4
export const ChartHelper = {
5
  prefix: "((__",
6
  suffix: "__))"
6 7
};
8

  
7 9
export class Stakeholder {
8
  id: string;
10
  _id: string;
9 11
  type: string;
10 12
  index_id;
11 13
  index_name: string;
12
  index_shortName:string;
14
  index_shortName: string;
13 15
  alias: string;
14 16
  isDefaultProfile: boolean;
15 17
  isActive: boolean;
......
17 19
  creationDate: string;
18 20
  updateDate: string;
19 21
  managers: string[];
20
  topics:Topic[];
21
  constructor( id: string, type: string, index_id, index_name: string, index_shortName:string , isDefaultProfile: boolean, alias:string , isActive: boolean, isPublic: boolean){
22
    this.initializeFunder(id,type, index_id, index_name, index_shortName, isDefaultProfile, alias, isActive, isPublic);
23
    this.topics =[];
24
    this.managers =[];
22
  topics: Topic[];
23

  
24
  constructor(id: string, type: string, index_id, index_name: string, index_shortName: string, isDefaultProfile: boolean, alias: string, isActive: boolean, isPublic: boolean) {
25
    this.initializeFunder(id, type, index_id, index_name, index_shortName, isDefaultProfile, alias, isActive, isPublic);
26
    this.topics = [];
27
    this.managers = [];
25 28
  }
26
  initializeFunder( id: string, type: string, index_id, index_name: string, index_shortName:string , isDefaultProfile: boolean, alias:string , isActive: boolean, isPublic: boolean){
27
    this.id = id;
29

  
30
  initializeFunder(id: string, type: string, index_id, index_name: string, index_shortName: string, isDefaultProfile: boolean, alias: string, isActive: boolean, isPublic: boolean) {
31
    this._id = id;
28 32
    this.type = type;
29 33
    this.index_id = index_id;
30 34
    this.index_name = index_name;
......
34 38
    this.isActive = isActive;
35 39
    this.isPublic = isPublic;
36 40
  }
37
  static createECStakeholder():Stakeholder{
38
    let ec:Stakeholder = new Stakeholder("ec","funder","ec__________::EC","European Commission","EC",false,"ec",true,true);
41

  
42
  static createECStakeholder(): Stakeholder {
43
    let ec: Stakeholder = new Stakeholder("ec", "funder", "ec__________::EC", "European Commission", "EC", false, "ec", true, true);
39 44
    //  new Stakeholder('wt','funder','wt__________::WT','Wellcome Trust','WT',false, 'wt',true,true);
40 45
    ec.topics.push(ec.createOSTopic(ec));
41 46
    ec.topics.push(ec.createImpactTopic());
42 47
    ec.topics.push(ec.createCollaborationTopic());
43 48
    return ec;
44 49
  }
45
  createOSTopic(stakeholder:Stakeholder):Topic{
46
    let topic = new Topic("OpenScience","Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do...","open-science",true,true);
47 50

  
48
/*    let overview:Category =  new Category("Overview","","overview",true,true);
49
    topic.categories.push(overview);
50
    let overviewDefSub = new SubCategory(null, null,null,true, true);
51
    overview.subCategories.push(overviewDefSub);*/
51
  createOSTopic(stakeholder: Stakeholder): Topic {
52
    let topic = new Topic("OpenScience", "Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do...", "open-science", true, true);
52 53

  
54
    /*    let overview:Category =  new Category("Overview","","overview",true,true);
55
        topic.categories.push(overview);
56
        let overviewDefSub = new SubCategory(null, null,null,true, true);
57
        overview.subCategories.push(overviewDefSub);*/
53 58

  
54 59

  
55
    let pubCategory:Category =  new Category("Publications","","publications",true,true);
60
    let pubCategory: Category = new Category("Publications", "", "publications", true, true);
56 61
    topic.categories.push(pubCategory);
57
    let pubDefSub = new SubCategory(null, null,null,true, true);
62
    let pubDefSub = new SubCategory(null, null, null, true, true);
58 63
    pubCategory.subCategories.push(pubDefSub);
59
/*    let pubOpenSub = new SubCategory("Openess","","openness",true,true);
60
    pubCategory.subCategories.push(pubOpenSub);
61
    let pubFundingSub = new SubCategory("Funding","","funding",true,true);
62
    pubCategory.subCategories.push(pubFundingSub);
63
    let pubDatasourceSub = new SubCategory("Content Providers","","content-providers",true,true);
64
    pubCategory.subCategories.push(pubDatasourceSub);
65
    let pubDocTypeSub = new SubCategory("Document Type","","doc-type",true,true);
66
    pubCategory.subCategories.push(pubDocTypeSub);
67
    let pubFindSub = new SubCategory("Findability","","dindability",true,true);
68
    pubCategory.subCategories.push(pubFindSub);*/
64
    /*    let pubOpenSub = new SubCategory("Openess","","openness",true,true);
65
        pubCategory.subCategories.push(pubOpenSub);
66
        let pubFundingSub = new SubCategory("Funding","","funding",true,true);
67
        pubCategory.subCategories.push(pubFundingSub);
68
        let pubDatasourceSub = new SubCategory("Content Providers","","content-providers",true,true);
69
        pubCategory.subCategories.push(pubDatasourceSub);
70
        let pubDocTypeSub = new SubCategory("Document Type","","doc-type",true,true);
71
        pubCategory.subCategories.push(pubDocTypeSub);
72
        let pubFindSub = new SubCategory("Findability","","dindability",true,true);
73
        pubCategory.subCategories.push(pubFindSub);*/
69 74

  
70 75

  
71
    let dataCategory:Category =  new Category("Research data","","data",true,true);
76
    let dataCategory: Category = new Category("Research data", "", "data", true, true);
72 77
    topic.categories.push(dataCategory);
73
    let dataDefSub = new SubCategory(null, null,null,true, true);
78
    let dataDefSub = new SubCategory(null, null, null, true, true);
74 79
    dataCategory.subCategories.push(dataDefSub);
75 80

  
76
    let softwareCategory:Category =  new Category("Software","","software",true,true);
81
    let softwareCategory: Category = new Category("Software", "", "software", true, true);
77 82
    topic.categories.push(softwareCategory);
78
    let softDefSub = new SubCategory(null, null,null,true, true);
83
    let softDefSub = new SubCategory(null, null, null, true, true);
79 84
    softwareCategory.subCategories.push(softDefSub);
80 85

  
81
    let otherCategory:Category =  new Category("Other research products","","other",true,true);
86
    let otherCategory: Category = new Category("Other research products", "", "other", true, true);
82 87
    topic.categories.push(otherCategory);
83
    let otherDefSub = new SubCategory(null, null,null,true, true);
88
    let otherDefSub = new SubCategory(null, null, null, true, true);
84 89
    otherCategory.subCategories.push(otherDefSub);
85 90

  
86
/*    let datasourceCategory:Category =  new Category("Content Providers","","content-providers",true,true);
87
    topic.categories.push(datasourceCategory);
88
    let datasourceDefSub = new SubCategory(null, null,null,true, true);
89
    datasourceCategory.subCategories.push(datasourceDefSub);*/
91
    /*    let datasourceCategory:Category =  new Category("Content Providers","","content-providers",true,true);
92
        topic.categories.push(datasourceCategory);
93
        let datasourceDefSub = new SubCategory(null, null,null,true, true);
94
        datasourceCategory.subCategories.push(datasourceDefSub);*/
90 95

  
91
    let projectCategory:Category =  new Category("Projects","","projects",true,true);
96
    let projectCategory: Category = new Category("Projects", "", "projects", true, true);
92 97
    topic.categories.push(projectCategory);
93
    let projectDefSub = new SubCategory(null, null,null,true, true);
98
    let projectDefSub = new SubCategory(null, null, null, true, true);
94 99
    projectCategory.subCategories.push(projectDefSub);
95 100

  
96 101
    //Numbers
97 102

  
98
    let n_total_pubs = new Indicator("Publications",'Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do...', "number","small",true, true, [new IndicatorPath(null, "statistics","/funders/"+stakeholder.id, null, ["statistics","publications"])]);
99
    let n_open_pubs = new Indicator("OA Publications",'Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do...', "number","small",true, true, [new IndicatorPath(null, "statistics","/funders/"+stakeholder.id, null,["statistics","open_access"])]);
100
    let n_total_projects = new Indicator("Projects",null, "number","small",true, true, [new IndicatorPath(null, "statistics","/funders/"+stakeholder.id, null, ["statistics","total_projects"])]);
101
    let n_total_data = new Indicator("Reserach data",null, "number","small",true, true, [new IndicatorPath(null, "search",
102
      "/datasets/count?fq="+(encodeURIComponent("relfunderid exact "+stakeholder.index_id))+"&format=json", null, ["total"])]);
103
    let n_total_soft = new Indicator("Software",null, "number","small",true, true, [new IndicatorPath(null, "search",
104
      "/software/count?fq="+(encodeURIComponent("relfunderid exact "+stakeholder.index_id))+"&format=json", null,["total"])]);
105
    let n_total_other = new Indicator("Other research products",null, "number","small",true, true, [new IndicatorPath(null, "search",
106
      "/other/count?fq="+(encodeURIComponent("relfunderid exact "+stakeholder.index_id))+"&format=json", null,["total"])]);
103
    let n_total_pubs = new Indicator("Publications", 'Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do...', "number", "small", true, true, [new IndicatorPath(null, "statistics", "/funders/" + stakeholder._id, null, ["statistics", "publications"])]);
104
    let n_open_pubs = new Indicator("OA Publications", 'Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do...', "number", "small", true, true, [new IndicatorPath(null, "statistics", "/funders/" + stakeholder._id, null, ["statistics", "open_access"])]);
105
    let n_total_projects = new Indicator("Projects", null, "number", "small", true, true, [new IndicatorPath(null, "statistics", "/funders/" + stakeholder._id, null, ["statistics", "total_projects"])]);
106
    let n_total_data = new Indicator("Reserach data", null, "number", "small", true, true, [new IndicatorPath(null, "search",
107
      "/datasets/count?fq=" + (encodeURIComponent("relfunderid exact " + stakeholder.index_id)) + "&format=json", null, ["total"])]);
108
    let n_total_soft = new Indicator("Software", null, "number", "small", true, true, [new IndicatorPath(null, "search",
109
      "/software/count?fq=" + (encodeURIComponent("relfunderid exact " + stakeholder.index_id)) + "&format=json", null, ["total"])]);
110
    let n_total_other = new Indicator("Other research products", null, "number", "small", true, true, [new IndicatorPath(null, "search",
111
      "/other/count?fq=" + (encodeURIComponent("relfunderid exact " + stakeholder.index_id)) + "&format=json", null, ["total"])]);
107 112

  
108 113
    /*overviewDefSub.numbers.push(n_total_pubs);
109 114
    overviewDefSub.numbers.push(n_open_pubs);
......
122 127

  
123 128
    //Charts
124 129

  
125
    let c_pubs_per_project = new Indicator("Which are the top "+stakeholder.index_shortName+" projects?",'Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do...', "chart","large",true, true, [
126
      new IndicatorPath("bar", "old","chart.php?com=query&data=",'{"table":"result","fields":[{"fld":"number","agg":"count","type":"'+ChartHelper.prefix+'type'+ChartHelper.suffix+'","yaxis":1,"c":false}],"xaxis":{"name":"result_projects-project-acronym","agg":"avg"},"group":"","color":"","type":"chart","size":30,"sort":"count-number","yaxisheaders":[""],"fieldsheaders":["publications"],"in":[],"filters":[{"name":"result_projects-project-funder","values":["'+ChartHelper.prefix+'funder_name'+ChartHelper.suffix+'"],"to":"-1"},{"name":"type","values":["publication"],"to":"-1"}],"having":[],"xStyle":{"r":"-","s":"-","l":"-","ft":"-","wt":"-"},"title":"'+ChartHelper.prefix+'title'+ChartHelper.suffix+'","subtitle":"","xaxistitle":"project","order":"d"}', null )]);
127
    c_pubs_per_project.indicatorPaths[0].parameters = IndicatorPath.createParameters(stakeholder.index_name,"Publications per project (top 30)","bar");
130
    let c_pubs_per_project = new Indicator("Which are the top " + stakeholder.index_shortName + " projects?", 'Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do...', "chart", "large", true, true, [
131
      new IndicatorPath("bar", "old", "chart.php?com=query&data=", '{"table":"result","fields":[{"fld":"number","agg":"count","type":"' + ChartHelper.prefix + 'type' + ChartHelper.suffix + '","yaxis":1,"c":false}],"xaxis":{"name":"result_projects-project-acronym","agg":"avg"},"group":"","color":"","type":"chart","size":30,"sort":"count-number","yaxisheaders":[""],"fieldsheaders":["publications"],"in":[],"filters":[{"name":"result_projects-project-funder","values":["' + ChartHelper.prefix + 'funder_name' + ChartHelper.suffix + '"],"to":"-1"},{"name":"type","values":["publication"],"to":"-1"}],"having":[],"xStyle":{"r":"-","s":"-","l":"-","ft":"-","wt":"-"},"title":"' + ChartHelper.prefix + 'title' + ChartHelper.suffix + '","subtitle":"","xaxistitle":"project","order":"d"}', null)]);
132
    c_pubs_per_project.indicatorPaths[0].parameters = IndicatorPath.createParameters(stakeholder.index_name, "Publications per project (top 30)", "bar");
128 133
    pubDefSub.charts.push(c_pubs_per_project);
129 134

  
130 135
//TO check
......
140 145
       true, [new IndicatorPath("bar", "stats-tool", "chart?json="+encodeURIComponent('{"library":"HighCharts","chartDescription":{"colors":["#42a5f5","#26a69a","#90ed7d","#607d8b","#00838f","#689f38","#e4d354","#2b908f","#546e7a","#01579"],"queries":[{"name":"Open Access","type":"bar","query":{"select":[{"field":"result","aggregate":"count"},{"field":"result.project.funding level 1","aggregate":null}],"filters":[{"groupFilters":[{"field":"result.project.funder","type":"=","values":["'+ChartHelper.prefix+'funder_name'+ChartHelper.suffix+'"]},{"field":"result.project.funding level 0","type":"=","values":["H2020"]},{"field":"result.type","type":"=","values":["publication"]},{"field":"result.access mode","type":"=","values":["Open Access"]}],"op":"AND"}],"entity":"result","profile":"OpenAIRE original","limit":"0"}},{"name":"Total","type":"bar","query":{"select":[{"field":"result","aggregate":"count"},{"field":"result.project.funding level 1","aggregate":null}],"filters":[{"groupFilters":[{"field":"result.project.funder","type":"=","values":["'+ChartHelper.prefix+'funder_name'+ChartHelper.suffix+'"]},{"field":"result.type","type":"=","values":["publication"]}],"op":"AND"}],"entity":"result","profile":"OpenAIRE original","limit":"0"}}],"chart":{"backgroundColor":"#FFFFFFFF","borderColor":"#335cadff","borderRadius":0,"borderWidth":0,"plotBorderColor":"#ccccccff","plotBorderWidth":0},"title":{"text":"Publications"},"subtitle":{"text":"by funding scheme"},"yAxis":{"title":{"text":"Publications"}},"xAxis":{"title":{"text":"Funding scheme"}},"lang":{"noData":"No Data available for the Query"},"exporting":{"enabled":true},"plotOptions":{"series":{"dataLabels":{"enabled":false}}},"legend":{"enabled":true,"align":"center","verticalAlign":"bottom","layout":"horizontal"},"credits":{"href":null,"enabled":true,"text":"Created by OpenAIRE via HighCharts"}}}'), null)]);
141 146
     pubDefSub.charts.push(c_pubs_funding_scheme);
142 147
*/
143
 /*    //TODO check why doesn't load
144
       let c_pubs_gg_funding_scheme = new Indicator("What is the percentage of green and gold publications by funding scheme / programme?",null, "chart","medium",true,
145
       true, [new IndicatorPath("bar", "stats-tool", "chart?json="+encodeURIComponent('{"library":"HighCharts","chartDescription":{"colors":["#42a5f5","#26a69a","#90ed7d","#607d8b","#00838f","#689f38","#e4d354","#2b908f","#546e7a","#01579"],"queries":[{"name":"Gold","color":"#f8b500","type":"bar","query":{"select":[{"field":"result","aggregate":"count"},{"field":"result.project.funding level 1","aggregate":null}],"filters":[{"groupFilters":[{"field":"result.project.funder","type":"=","values":["'+ChartHelper.prefix+'funder_name'+ChartHelper.suffix+'"]},,{"field":"result.type","type":"=","values":["publication"]},{"field":"result.access mode","type":"=","values":["Open Access"]}],"op":"AND"},{"groupFilters":[{"field":"result.datasource.type","type":"=","values":["Journal"]},{"field":"result.datasource.type","type":"=","values":["Journal Aggregator/Publisher"]}],"op":"OR"}],"entity":"result","profile":"OpenAIRE original","limit":"0"}},{"name":"Green","color":"#239d60","type":"bar","query":{"select":[{"field":"result","aggregate":"count"},{"field":"result.project.funding level 1","aggregate":null}],"filters":[{"groupFilters":[{"field":"result.project.funder","type":"=","values":["'+ChartHelper.prefix+'funder_name'+ChartHelper.suffix+'"]},{"field":"result.project.funding level 0","type":"=","values":["H2020"]},{"field":"result.type","type":"=","values":["publication"]},{"field":"result.access mode","type":"=","values":["Open Access"]}],"op":"AND"},{"groupFilters":[{"field":"result.datasource.type","type":"=","values":["Institutional Repository"]},{"field":"result.datasource.type","type":"=","values":["Thematic Repository"]}],"op":"OR"}],"entity":"result","profile":"OpenAIRE original","limit":"0"}}],"chart":{"backgroundColor":"#FFFFFFFF","borderColor":"#335cadff","borderRadius":0,"borderWidth":0,"plotBorderColor":"#ccccccff","plotBorderWidth":0},"title":{"text":"H2020 green and gold publications"},"subtitle":{"text":"by funding scheme"},"yAxis":{"title":{"text":"Publications"}},"xAxis":{"title":{"text":"Funding scheme"}},"lang":{"noData":"No Data available for the Query"},"exporting":{"enabled":true},"plotOptions":{"series":{"dataLabels":{"enabled":false}}},"legend":{"enabled":true,"align":"center","verticalAlign":"bottom","layout":"horizontal"},"credits":{"href":null,"enabled":true,"text":"Created by OpenAIRE via HighCharts"}}}'), null)]);
146
     //pubDefSub.charts.push(c_pubs_gg_funding_scheme);
147
 */
148
    /*    //TODO check why doesn't load
149
          let c_pubs_gg_funding_scheme = new Indicator("What is the percentage of green and gold publications by funding scheme / programme?",null, "chart","medium",true,
150
          true, [new IndicatorPath("bar", "stats-tool", "chart?json="+encodeURIComponent('{"library":"HighCharts","chartDescription":{"colors":["#42a5f5","#26a69a","#90ed7d","#607d8b","#00838f","#689f38","#e4d354","#2b908f","#546e7a","#01579"],"queries":[{"name":"Gold","color":"#f8b500","type":"bar","query":{"select":[{"field":"result","aggregate":"count"},{"field":"result.project.funding level 1","aggregate":null}],"filters":[{"groupFilters":[{"field":"result.project.funder","type":"=","values":["'+ChartHelper.prefix+'funder_name'+ChartHelper.suffix+'"]},,{"field":"result.type","type":"=","values":["publication"]},{"field":"result.access mode","type":"=","values":["Open Access"]}],"op":"AND"},{"groupFilters":[{"field":"result.datasource.type","type":"=","values":["Journal"]},{"field":"result.datasource.type","type":"=","values":["Journal Aggregator/Publisher"]}],"op":"OR"}],"entity":"result","profile":"OpenAIRE original","limit":"0"}},{"name":"Green","color":"#239d60","type":"bar","query":{"select":[{"field":"result","aggregate":"count"},{"field":"result.project.funding level 1","aggregate":null}],"filters":[{"groupFilters":[{"field":"result.project.funder","type":"=","values":["'+ChartHelper.prefix+'funder_name'+ChartHelper.suffix+'"]},{"field":"result.project.funding level 0","type":"=","values":["H2020"]},{"field":"result.type","type":"=","values":["publication"]},{"field":"result.access mode","type":"=","values":["Open Access"]}],"op":"AND"},{"groupFilters":[{"field":"result.datasource.type","type":"=","values":["Institutional Repository"]},{"field":"result.datasource.type","type":"=","values":["Thematic Repository"]}],"op":"OR"}],"entity":"result","profile":"OpenAIRE original","limit":"0"}}],"chart":{"backgroundColor":"#FFFFFFFF","borderColor":"#335cadff","borderRadius":0,"borderWidth":0,"plotBorderColor":"#ccccccff","plotBorderWidth":0},"title":{"text":"H2020 green and gold publications"},"subtitle":{"text":"by funding scheme"},"yAxis":{"title":{"text":"Publications"}},"xAxis":{"title":{"text":"Funding scheme"}},"lang":{"noData":"No Data available for the Query"},"exporting":{"enabled":true},"plotOptions":{"series":{"dataLabels":{"enabled":false}}},"legend":{"enabled":true,"align":"center","verticalAlign":"bottom","layout":"horizontal"},"credits":{"href":null,"enabled":true,"text":"Created by OpenAIRE via HighCharts"}}}'), null)]);
151
        //pubDefSub.charts.push(c_pubs_gg_funding_scheme);
152
    */
148 153

  
149 154
    /* let c_pubs_open = new Indicator("Open Access publications timeline",null, "chart","small",true, true,
150 155
       [new IndicatorPath("column", "stats-tool", "chart?json="+encodeURIComponent('{"library":"HighCharts","chartDescription":{"queries":[{"name":"OA publications","type":"column","query":{"select":[{"field":"publication","aggregate":"count"},{"field":"publication.year","aggregate":null}],"filters":[{"groupFilters":[{"field":"publication.access mode","type":"=","values":["Open Access"]}],"op":"AND"},{"groupFilters":[{"field":"publication.year","type":">=","values":["2000"]},{"field":"publication.year","type":"<=","values":["2019"]}],"op":"AND"},{"groupFilters":[{"field":"publication.project.funder","type":"=","values":["'+ChartHelper.prefix+'funder_name'+ChartHelper.suffix+'"]}],"op":"AND"}],"entity":"publication","profile":"OpenAIRE All-inclusive","limit":"30"}}],"chart":{"backgroundColor":"#FFFFFFFF","borderColor":"#335cadff","borderRadius":0,"borderWidth":0,"plotBorderColor":"#ccccccff","plotBorderWidth":0},"title":{"text":"Open Access Publications"},"subtitle":{},"yAxis":{"title":{"text":"publications"}},"xAxis":{"title":{"text":"year"}},"lang":{"noData":"No Data available for the Query"},"exporting":{"enabled":false},"plotOptions":{"series":{"dataLabels":{"enabled":false}}},"legend":{"enabled":true,"align":"center","verticalAlign":"bottom","layout":"horizontal"},"credits":{"href":null,"enabled":true,"text":"Created by OpenAIRE via HighCharts"}}}'), null)]);
......
209 214

  
210 215
    return topic;
211 216
  }
212
  createImpactTopic():Topic{
213
    let topic = new Topic("Impact/Correlation","Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do...","impact",true,true);
214 217

  
215
    let pubCategory:Category =  new Category("Publications","","publications",true,true);
218
  createImpactTopic(): Topic {
219
    let topic = new Topic("Impact/Correlation", "Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do...", "impact", true, true);
220

  
221
    let pubCategory: Category = new Category("Publications", "", "publications", true, true);
216 222
    topic.categories.push(pubCategory);
217
    let pubDefSub = new SubCategory(null, null,null,true, true);
223
    let pubDefSub = new SubCategory(null, null, null, true, true);
218 224
    pubCategory.subCategories.push(pubDefSub);
219 225

  
220
    let dataCategory:Category =  new Category("Research data","","data",true,true);
226
    let dataCategory: Category = new Category("Research data", "", "data", true, true);
221 227
    topic.categories.push(dataCategory);
222
    let dataDefSub = new SubCategory(null, null,null,true, true);
228
    let dataDefSub = new SubCategory(null, null, null, true, true);
223 229
    dataCategory.subCategories.push(dataDefSub);
224 230

  
225
    let softwareCategory:Category =  new Category("Software","","software",true,true);
231
    let softwareCategory: Category = new Category("Software", "", "software", true, true);
226 232
    topic.categories.push(softwareCategory);
227
    let softDefSub = new SubCategory(null, null,null,true, true);
233
    let softDefSub = new SubCategory(null, null, null, true, true);
228 234
    softwareCategory.subCategories.push(softDefSub);
229 235

  
230
  /*  let otherCategory:Category =  new Category("Other research products","","other",true,true);
231
    topic.categories.push(otherCategory);
232
    let otherDefSub = new SubCategory(null, null,null,true, true);
233
    otherCategory.subCategories.push(otherDefSub);*/
236
    /*  let otherCategory:Category =  new Category("Other research products","","other",true,true);
237
      topic.categories.push(otherCategory);
238
      let otherDefSub = new SubCategory(null, null,null,true, true);
239
      otherCategory.subCategories.push(otherDefSub);*/
234 240

  
235 241

  
236 242
    return topic;
237 243
  }
238
  createCollaborationTopic():Topic{
239
    let topic = new Topic("Demo Topic","This is a demo topic","demo-topic",true,true);
240 244

  
241
    let category1:Category =  new Category("Category 1","This is ","cat-1",true,true);
245
  createCollaborationTopic(): Topic {
246
    let topic = new Topic("Demo Topic", "This is a demo topic", "demo-topic", true, true);
247

  
248
    let category1: Category = new Category("Category 1", "This is ", "cat-1", true, true);
242 249
    topic.categories.push(category1);
243 250

  
244 251

  
245
    let subCat1 = new SubCategory("Sub-category 1","","sub-cat-1",true,true);
252
    let subCat1 = new SubCategory("Sub-category 1", "", "sub-cat-1", true, true);
246 253
    category1.subCategories.push(subCat1);
247 254

  
248 255

  
249
    let subCat2 = new SubCategory("Sub-category 2","","sub-cat-2",true,true);
256
    let subCat2 = new SubCategory("Sub-category 2", "", "sub-cat-2", true, true);
250 257
    category1.subCategories.push(subCat2);
251 258

  
252 259

  
253

  
254
    let category2:Category =  new Category("Category 2 - no subcategories","","cat-2",true,true);
260
    let category2: Category = new Category("Category 2 - no subcategories", "", "cat-2", true, true);
255 261
    topic.categories.push(category2);
256
    let defSub = new SubCategory(null, null,null,true, true);
262
    let defSub = new SubCategory(null, null, null, true, true);
257 263
    category2.subCategories.push(defSub);
258 264

  
259 265
    let chart1 = new Indicator(
260
      "Chart title goes here","Chart description goes here", "chart","medium",true, true,
261
      [new IndicatorPath("?", "fake","https://visme.co/blog/wp-content/uploads/2017/03/Dogs-vs-Cats-How-much-they-miss-you-relative-to-the-time-you-are-gone.png", null, null)]);
262
    let chart2 = new Indicator("Chart title goes here","Chart description goes here", "chart","medium",true, true, [new IndicatorPath("?", "fake","https://static.boredpanda.com/blog/wp-content/uuuploads/funny-graphs-2/funny-graphs-legs.jpg", null, null)]);
266
      "Chart title goes here", "Chart description goes here", "chart", "medium", true, true,
267
      [new IndicatorPath("?", "fake", "https://visme.co/blog/wp-content/uploads/2017/03/Dogs-vs-Cats-How-much-they-miss-you-relative-to-the-time-you-are-gone.png", null, null)]);
268
    let chart2 = new Indicator("Chart title goes here", "Chart description goes here", "chart", "medium", true, true, [new IndicatorPath("?", "fake", "https://static.boredpanda.com/blog/wp-content/uuuploads/funny-graphs-2/funny-graphs-legs.jpg", null, null)]);
263 269
    subCat1.charts.push(chart1);
264 270
    subCat2.charts.push(chart2);
265 271

  
......
267 273
    defSub.charts.push(chart2);
268 274
    let utils = new IndicatorUtils();
269 275
    let url = "https://beta.openaire.eu/stats/chart.php?com=query&data={%22table%22:%22result%22,%22fields%22:[{%22fld%22:%22number%22,%22agg%22:%22count%22,%22type%22:%22bar%22,%22yaxis%22:1,%22c%22:false}],%22xaxis%22:{%22name%22:%22result_datasources-datasource-name%22,%22agg%22:%22avg%22},%22group%22:%22%22,%22color%22:%22%22,%22type%22:%22chart%22,%22size%22:%2220%22,%22sort%22:%22count-number%22,%22yaxisheaders%22:[%22%22],%22fieldsheaders%22:[%22publications%22],%22in%22:[],%22filters%22:[{%22name%22:%22result_projects-project-funding_lvl0%22,%22values%22:[%22H2020%22],%22to%22:%22-1%22},{%22name%22:%22type%22,%22values%22:[%22publication%22],%22to%22:%22-1%22},{%22name%22:%22result_datasources-datasource-type%22,%22exvalues%22:[%22Publication%20Catalogue%22]}],%22having%22:[],%22xStyle%22:{%22r%22:%22-%22,%22s%22:%22-%22,%22l%22:%22-%22,%22ft%22:%22-%22,%22wt%22:%22-%22},%22title%22:%22H2020%20Publications%20by%20datasource%20%28top%2020%29%22,%22subtitle%22:%22%22,%22xaxistitle%22:%22datasource%22,%22order%22:%22d%22}&w=90%";
270
    defSub.charts.push(new Indicator("Old tool graph","","chart","large",true,true,[utils.generateIndicatorByChartUrl("old",url,"bar")]))
276
    defSub.charts.push(new Indicator("Old tool graph", "", "chart", "large", true, true, [utils.generateIndicatorByChartUrl("old", url, "bar")]))
271 277
    url = "http://88.197.53.71:8080/stats-api/chart?json=%7B%22library%22%3A%22HighCharts%22%2C%22chartDescription%22%3A%7B%22queries%22%3A%5B%7B%22name%22%3A%22Research%20data%22%2C%22type%22%3A%22column%22%2C%22query%22%3A%7B%22select%22%3A%5B%7B%22field%22%3A%22dataset%22%2C%22aggregate%22%3A%22count%22%7D%2C%7B%22field%22%3A%22dataset.year%22%2C%22aggregate%22%3Anull%7D%5D%2C%22filters%22%3A%5B%7B%22groupFilters%22%3A%5B%7B%22field%22%3A%22dataset.project.funder%22%2C%22type%22%3A%22%3D%22%2C%22values%22%3A%5B%22European%20Commission%22%5D%7D%5D%2C%22op%22%3A%22AND%22%7D%2C%7B%22groupFilters%22%3A%5B%7B%22field%22%3A%22dataset.year%22%2C%22type%22%3A%22%3E%3D%22%2C%22values%22%3A%5B%222008%22%5D%7D%2C%7B%22field%22%3A%22dataset.year%22%2C%22type%22%3A%22%3C%3D%22%2C%22values%22%3A%5B%222020%22%5D%7D%5D%2C%22op%22%3A%22AND%22%7D%5D%2C%22entity%22%3A%22dataset%22%2C%22profile%22%3A%22OpenAIRE%20All-inclusive%22%2C%22limit%22%3A%220%22%7D%7D%5D%2C%22chart%22%3A%7B%22backgroundColor%22%3A%22%23FFFFFFFF%22%2C%22borderColor%22%3A%22%23335cadff%22%2C%22borderRadius%22%3A0%2C%22borderWidth%22%3A0%2C%22plotBorderColor%22%3A%22%23ccccccff%22%2C%22plotBorderWidth%22%3A0%7D%2C%22title%22%3A%7B%22text%22%3A%22Research%20data%20timeline%22%7D%2C%22subtitle%22%3A%7B%7D%2C%22yAxis%22%3A%7B%22title%22%3A%7B%22text%22%3A%22Research%20data%22%7D%7D%2C%22xAxis%22%3A%7B%22title%22%3A%7B%22text%22%3A%22Year%22%7D%7D%2C%22lang%22%3A%7B%22noData%22%3A%22No%20Data%20available%20for%20the%20Query%22%7D%2C%22exporting%22%3A%7B%22enabled%22%3Atrue%7D%2C%22plotOptions%22%3A%7B%22series%22%3A%7B%22dataLabels%22%3A%7B%22enabled%22%3Afalse%7D%7D%7D%2C%22legend%22%3A%7B%22enabled%22%3Atrue%2C%22align%22%3A%22center%22%2C%22verticalAlign%22%3A%22bottom%22%2C%22layout%22%3A%22horizontal%22%7D%2C%22credits%22%3A%7B%22href%22%3Anull%2C%22enabled%22%3Atrue%2C%22text%22%3A%22Created%20by%20OpenAIRE%20via%20HighCharts%22%7D%7D%7D";
272
    defSub.charts.push(new Indicator("","","chart","large",true,true,[utils.generateIndicatorByChartUrl("stats-tool",url,"bar")]))
278
    defSub.charts.push(new Indicator("", "", "chart", "large", true, true, [utils.generateIndicatorByChartUrl("stats-tool", url, "bar")]))
273 279
    return topic;
274 280
  }
275 281
}
276 282

  
277 283
export class Topic {
278
  id:string;
284
  _id: string;
279 285
  name: string;
280 286
  alias: string;
281 287
  description: string;
......
283 289
  isPublic: boolean;
284 290
  isDefault: boolean;
285 291
  categories: Category[];
286
  constructor(name: string, description: string, alias:string , isActive: boolean, isPublic: boolean) {
287
    this.id = null;
288
    this.name =  name;
292

  
293
  constructor(name: string, description: string, alias: string, isActive: boolean, isPublic: boolean) {
294
    this._id = null;
295
    this.name = name;
289 296
    this.description = description;
290 297
    this.alias = alias;
291 298
    this.isActive = isActive;
......
293 300
    this.categories = [];
294 301
  }
295 302
}
303

  
296 304
export class Category {
297
  id:string;
305
  _id: string;
298 306
  name: string;
299 307
  alias: string;
300 308
  description: string;
......
303 311
  isOverview: boolean;
304 312
  isDefault: boolean;
305 313
  subCategories: SubCategory[];
306
  constructor(name: string, description: string, alias:string , isActive: boolean, isPublic: boolean) {
307
    this.id = null;
308
    this.name =  name;
314

  
315
  constructor(name: string, description: string, alias: string, isActive: boolean, isPublic: boolean) {
316
    this._id = null;
317
    this.name = name;
309 318
    this.description = description;
310 319
    this.alias = alias;
311 320
    this.isActive = isActive;
......
315 324
}
316 325

  
317 326
export class SubCategory {
318
  id:string;
327
  _id: string;
319 328
  name: string;
320 329
  alias: string;
321 330
  description: string;
......
324 333
  isDefault: boolean;
325 334
  charts: Indicator[];
326 335
  numbers: Indicator[];
327
  constructor(name: string, description: string, alias:string , isActive: boolean, isPublic: boolean) {
328
    this.id = null;
329
    this.name =  name;
336

  
337
  constructor(name: string, description: string, alias: string, isActive: boolean, isPublic: boolean) {
338
    this._id = null;
339
    this.name = name;
330 340
    this.description = description;
331 341
    this.alias = alias;
332 342
    this.isActive = isActive;
......
336 346
  }
337 347

  
338 348
}
349

  
339 350
export class Indicator {
340
  id:string;
351
  _id: string;
341 352
  name: string;
342 353
  description: string;
343
  type:string; //number,chart
344
  width:string; //small,medium,large
345
  tags:string[];
354
  type: string; //number,chart
355
  width: string; //small,medium,large
356
  tags: string[];
346 357
  isActive: boolean;
347 358
  isPublic: boolean;
348 359
  isDefault: boolean;
349
  indicatorPaths:IndicatorPath[];
350
  constructor(name: string, description: string, type:string , width:string,  isActive: boolean, isPublic: boolean, indicatorPaths:IndicatorPath[]){
351
    this.id = null;
352
    this.name =  name;
360
  indicatorPaths: IndicatorPath[];
361

  
362
  constructor(name: string, description: string, type: string, width: string, isActive: boolean, isPublic: boolean, indicatorPaths: IndicatorPath[]) {
363
    this._id = null;
364
    this.name = name;
353 365
    this.description = description;
354
    this.type =  type;
366
    this.type = type;
355 367
    this.width = width;
356 368
    this.isActive = isActive;
357 369
    this.isPublic = isPublic;
......
362 374

  
363 375
export class IndicatorPath {
364 376
  type: string;  // for charts is type of chart {table, bar, column, etc}
365
  source:string;// for numbers is the service {statistics, search, metrics} for charts is the tool {stats-tool,old,metrics, fake}
377
  source: string;// for numbers is the service {statistics, search, metrics} for charts is the tool {stats-tool,old,metrics, fake}
366 378
  url: string;
367 379
  safeResourceUrl: SafeResourceUrl; // initialize on front end
368
  jsonPath:string[];
369
  chartObject:string;
370
  parameters:Map<string,string>;
371
  filters:Map<string, string>;
372
  constructor(type: string,  source:string, url: string, chartObject:string, jsonPath:string[]){
373
    this.type =  type;
380
  jsonPath: string[];
381
  chartObject: string;
382
  parameters: any;
383
  filters: any;
384

  
385
  constructor(type: string, source: string, url: string, chartObject: string, jsonPath: string[]) {
386
    this.type = type;
374 387
    this.url = url;
375 388
    this.source = source;
376 389
    this.jsonPath = jsonPath;
377
    this.chartObject =chartObject;
378
    this.parameters = new Map<string, string>();
379
    this.filters = new Map<string, string>();
390
    this.chartObject = chartObject;
391
    this.parameters = {};
392
    this.filters = {};
380 393
  }
381 394

  
382
  static createParameters(funderName:string=null, title:string=null, chartType:string=null):Map<string, string>{
383
    let parameters = new Map<string, string>();
384
    parameters.set("funder_name",funderName);
385
    parameters.set("title",title);
386
    parameters.set("type",chartType);
387
    return parameters;
395
  static createParameters(funderName: string = null, title: string = null, chartType: string = null): any {
396
    return {
397
      funder_name: funderName,
398
      title: title,
399
      type: chartType
400
    };
388 401
  }
389
  static createResultFilters(dbType:string=null):Map<string, string>{
390
    let filters = new Map<string, string>();
391
    filters.set("fundingL0",'{"groupFilters":[{"field":"'+dbType+'.project.funding level 0","type":"=","values":["'+ChartHelper.prefix+'fundingL0'+ChartHelper.suffix+'"]}],"op":"AND"}');
392
    filters.set("start_year",'{"groupFilters":[{"field":"'+dbType+'.year","type":">=","values":["'+ChartHelper.prefix+'start_year'+ChartHelper.suffix+'"]}],"op":"AND"}');
393
    filters.set("end_year",'{"groupFilters":[{"field":"'+dbType+'.year","type":"<=","values":["'+ChartHelper.prefix+'end_year'+ChartHelper.suffix+'"]}],"op":"AND"}');
394
    return filters;
402

  
403
  static createResultFilters(dbType: string = null): any {
404
    return {
405
      fundingL0: '{"groupFilters":[{"field":"' + dbType + '.project.funding level 0","type":"=","values":["' + ChartHelper.prefix + 'fundingL0' + ChartHelper.suffix + '"]}],"op":"AND"}',
406
      start_year: '{"groupFilters":[{"field":"' + dbType + '.year","type":">=","values":["' + ChartHelper.prefix + 'start_year' + ChartHelper.suffix + '"]}],"op":"AND"}',
407
      end_year: '{"groupFilters":[{"field":"' + dbType + '.year","type":"<=","values":["' + ChartHelper.prefix + 'end_year' + ChartHelper.suffix + '"]}],"op":"AND"}'
408
    };
395 409
  }
396 410
}
modules/uoa-monitor-portal/trunk/monitor_dashboard/src/app/utils/entities/stakeholderCreator.ts
21 21
          for (let indicator of subCategory.charts) {
22 22
            for (let indicatorPath of indicator.indicatorPaths) {
23 23
              if(indicatorPath.parameters) {
24
                indicatorPath.parameters.forEach((value: string, key: string) => {
25
                  if (value.indexOf("_funder_name_")!=-1) {
26
                    indicatorPath.parameters.set(key,value.toString().replace("_funder_name_", funder.index_name));
27
                  }else if (value.indexOf("_fsn_")!=-1) {
28
                    indicatorPath.parameters.set(key,value.toString().replace("_fsn_", funder.index_shortName.toLowerCase()));
24
                Object.keys(indicatorPath.parameters).forEach(key => {
25
                  if (indicatorPath.parameters[key].indexOf("_funder_name_")!=-1) {
26
                    indicatorPath.parameters[key].replace("_funder_name_", funder.index_name);
27
                  } else if (indicatorPath.parameters[key].indexOf("_fsn_")!=-1) {
28
                    indicatorPath.parameters[key].toString().replace("_fsn_", funder.index_shortName.toLowerCase());
29 29
                  }
30 30
                });
31 31
              }
......
87 87

  
88 88
    let n_total = new Indicator("Total "+typePlural,null, "number","small",true, true, [new IndicatorPath(null, "search",
89 89
      "/"+dbTypePlural+"/count?fq="+(encodeURIComponent("relfunderid exact "+stakeholder.index_id))+"&format=json", null,["total"])]);
90
    n_total.indicatorPaths[0].filters.set("fundingL0","&fq=relfundinglevel0_name exact "+ChartHelper.prefix+'fundingL0'+ChartHelper.suffix);
90
    n_total.indicatorPaths[0].filters["fundingL0"] = "&fq=relfundinglevel0_name exact "+ChartHelper.prefix+'fundingL0'+ChartHelper.suffix;
91 91

  
92 92
    pubDefSub.numbers.push(n_total);
93 93
    if( dbType != "publication") {
......
100 100

  
101 101
    let res_timeline = new Indicator("",null, "chart","small",true, true,[new IndicatorPath("column", "stats-tool", "chart?json=", '{"library":"HighCharts","chartDescription":{"queries":[{"name":"'+typePlural+'","type":"'+ChartHelper.prefix+'type'+ChartHelper.suffix+'","query":{"select":[{"field":"'+dbType+'","aggregate":"count"},{"field":"'+dbType+'.year","aggregate":null}],"filters":[{"groupFilters":[{"field":"'+dbType+'.project.funder","type":"=","values":["'+ChartHelper.prefix+'funder_name'+ChartHelper.suffix+'"]}],"op":"AND"},{"groupFilters":[{"field":"'+dbType+'.year","type":">=","values":["'+ChartHelper.prefix+'start_year'+ChartHelper.suffix+'"]},{"field":"'+dbType+'.year","type":"<=","values":["'+ChartHelper.prefix+'end_year'+ChartHelper.suffix+'"]}],"op":"AND"}],"entity":"'+dbType+'","profile":"OpenAIRE All-inclusive","limit":"0"}}],"chart":{"backgroundColor":"#FFFFFFFF","borderColor":"#335cadff","borderRadius":0,"borderWidth":0,"plotBorderColor":"#ccccccff","plotBorderWidth":0},"title":{"text":"'+ChartHelper.prefix+'title'+ChartHelper.suffix+'"},"subtitle":{},"yAxis":{"title":{"text":"'+typePlural+'"}},"xAxis":{"title":{"text":"Year"}},"lang":{"noData":"No Data available for the Query"},"exporting":{"enabled":true},"plotOptions":{"series":{"dataLabels":{"enabled":false}}},"legend":{"enabled":true,"align":"center","verticalAlign":"bottom","layout":"horizontal"},"credits":{"href":null,"enabled":true,"text":"Created by OpenAIRE via HighCharts"}}}', null)]);
102 102
    res_timeline.indicatorPaths[0].parameters = IndicatorPath.createParameters(stakeholder.index_name,typePlural+" timeline","column");
103
    res_timeline.indicatorPaths[0].parameters.set("start_year","2008");
104
    res_timeline.indicatorPaths[0].parameters.set("end_year","2020");
103
    res_timeline.indicatorPaths[0].parameters["start_year"] = "2008";
104
    res_timeline.indicatorPaths[0].parameters["end_year"] = "2020";
105 105
    res_timeline.indicatorPaths[0].filters = IndicatorPath.createResultFilters(dbType);
106 106
    pubDefSub.charts.push(res_timeline);
107 107

  
......
138 138
    let datasource = new Indicator("",null, "chart","small",true, true,[new IndicatorPath("bar", "stats-tool", "chart?json=",
139 139
      '{"library":"HighCharts","chartDescription":{"queries":[{"name":"'+typePlural+'","type":"'+ChartHelper.prefix+'type'+ChartHelper.suffix+'","query":{"name":"monitor.'+ChartHelper.prefix+'id'+ChartHelper.suffix+'.'+dbTypePlural+'.datasources"}}],"chart":{"backgroundColor":"#FFFFFFFF","borderColor":"#335cadff","borderRadius":0,"borderWidth":0,"plotBorderColor":"#ccccccff","plotBorderWidth":0},"title":{"text":"'+ChartHelper.prefix+'title'+ChartHelper.suffix+'"},"subtitle":{},"yAxis":{"title":{"text":"'+typePlural+'"}},"xAxis":{"title":{"text":"Content provider"}},"lang":{"noData":"No Data available for the Query"},"exporting":{"enabled":true},"plotOptions":{"series":{"dataLabels":{"enabled":false}}},"legend":{"enabled":true,"align":"center","verticalAlign":"bottom","layout":"horizontal"},"credits":{"href":null,"enabled":true,"text":"Created by OpenAIRE via HighCharts"}}}', null)]);
140 140
    datasource.indicatorPaths[0].parameters = IndicatorPath.createParameters(stakeholder.index_name,typeSingl+" content provider","bar");
141
    datasource.indicatorPaths[0].parameters.set("id",stakeholder.index_shortName.toLowerCase());
141
    datasource.indicatorPaths[0].parameters["id"] = stakeholder.index_shortName.toLowerCase();
142 142
    pubDefSub.charts.push(datasource);
143 143
    if(dbType == "publication") {
144 144
      let journal = new Indicator("", null, "chart", "small", true, true, [new IndicatorPath("bar", "stats-tool", "chart?json=",
145 145
        '{"library":"HighCharts","chartDescription":{"queries":[{"name":"' + typePlural + '","type":"' + ChartHelper.prefix + 'type' + ChartHelper.suffix + '","query":{"name":"monitor.' + ChartHelper.prefix + 'id' + ChartHelper.suffix + '.' + dbTypePlural + '.journals"}}],"chart":{"backgroundColor":"#FFFFFFFF","borderColor":"#335cadff","borderRadius":0,"borderWidth":0,"plotBorderColor":"#ccccccff","plotBorderWidth":0},"title":{"text":"' + ChartHelper.prefix + 'title' + ChartHelper.suffix + '"},"subtitle":{},"yAxis":{"title":{"text":"' + typePlural + '"}},"xAxis":{"title":{"text":"Journal"}},"lang":{"noData":"No Data available for the Query"},"exporting":{"enabled":true},"plotOptions":{"series":{"dataLabels":{"enabled":false}}},"legend":{"enabled":true,"align":"center","verticalAlign":"bottom","layout":"horizontal"},"credits":{"href":null,"enabled":true,"text":"Created by OpenAIRE via HighCharts"}}}', null)]);
146 146
      journal.indicatorPaths[0].parameters = IndicatorPath.createParameters(stakeholder.index_name, typeSingl + " journal", "bar");
147
      journal.indicatorPaths[0].parameters.set("id", stakeholder.index_shortName.toLowerCase());
147
      journal.indicatorPaths[0].parameters["id"] = stakeholder.index_shortName.toLowerCase();
148 148
      pubDefSub.charts.push(journal);
149 149

  
150 150
      let repo = new Indicator("", null, "chart", "small", true, true, [new IndicatorPath("bar", "stats-tool", "chart?json=",
151 151
        '{"library":"HighCharts","chartDescription":{"queries":[{"name":"' + typePlural + '","type":"' + ChartHelper.prefix + 'type' + ChartHelper.suffix + '","query":{"name":"monitor.' + ChartHelper.prefix + 'id' + ChartHelper.suffix + '.' + dbTypePlural + '.repositories"}}],"chart":{"backgroundColor":"#FFFFFFFF","borderColor":"#335cadff","borderRadius":0,"borderWidth":0,"plotBorderColor":"#ccccccff","plotBorderWidth":0},"title":{"text":"' + ChartHelper.prefix + 'title' + ChartHelper.suffix + '"},"subtitle":{},"yAxis":{"title":{"text":"' + typePlural + '"}},"xAxis":{"title":{"text":"Repositories"}},"lang":{"noData":"No Data available for the Query"},"exporting":{"enabled":true},"plotOptions":{"series":{"dataLabels":{"enabled":false}}},"legend":{"enabled":true,"align":"center","verticalAlign":"bottom","layout":"horizontal"},"credits":{"href":null,"enabled":true,"text":"Created by OpenAIRE via HighCharts"}}}', null)]);
152 152
      repo.indicatorPaths[0].parameters = IndicatorPath.createParameters(stakeholder.index_name, typeSingl + " repositories", "bar");
153
      repo.indicatorPaths[0].parameters.set("id", stakeholder.index_shortName.toLowerCase());
153
      repo.indicatorPaths[0].parameters["id"] = stakeholder.index_shortName.toLowerCase();
154 154
      pubDefSub.charts.push(repo);
155 155
    }
156 156
    if(dbType == "dataset") {
157 157
      let repo = new Indicator("", null, "chart", "small", true, true, [new IndicatorPath("bar", "stats-tool", "chart?json=",
158 158
        '{"library":"HighCharts","chartDescription":{"queries":[{"name":"' + typePlural + '","type":"' + ChartHelper.prefix + 'type' + ChartHelper.suffix + '","query":{"name":"monitor.' + ChartHelper.prefix + 'id' + ChartHelper.suffix + '.' + dbTypePlural + '.drepositories"}}],"chart":{"backgroundColor":"#FFFFFFFF","borderColor":"#335cadff","borderRadius":0,"borderWidth":0,"plotBorderColor":"#ccccccff","plotBorderWidth":0},"title":{"text":"' + ChartHelper.prefix + 'title' + ChartHelper.suffix + '"},"subtitle":{},"yAxis":{"title":{"text":"' + typePlural + '"}},"xAxis":{"title":{"text":"Data Repositories"}},"lang":{"noData":"No Data available for the Query"},"exporting":{"enabled":true},"plotOptions":{"series":{"dataLabels":{"enabled":false}}},"legend":{"enabled":true,"align":"center","verticalAlign":"bottom","layout":"horizontal"},"credits":{"href":null,"enabled":true,"text":"Created by OpenAIRE via HighCharts"}}}', null)]);
159 159
      repo.indicatorPaths[0].parameters = IndicatorPath.createParameters(stakeholder.index_name, typeSingl + " repositories", "bar");
160
      repo.indicatorPaths[0].parameters.set("id", stakeholder.index_shortName.toLowerCase());
160
      repo.indicatorPaths[0].parameters["id"] =  stakeholder.index_shortName.toLowerCase();
161 161
      pubDefSub.charts.push(repo);
162 162

  
163 163
      let irepo = new Indicator("", null, "chart", "small", true, true, [new IndicatorPath("bar", "stats-tool", "chart?json=",
164 164
        '{"library":"HighCharts","chartDescription":{"queries":[{"name":"' + typePlural + '","type":"' + ChartHelper.prefix + 'type' + ChartHelper.suffix + '","query":{"name":"monitor.' + ChartHelper.prefix + 'id' + ChartHelper.suffix + '.' + dbTypePlural + '.irepositories"}}],"chart":{"backgroundColor":"#FFFFFFFF","borderColor":"#335cadff","borderRadius":0,"borderWidth":0,"plotBorderColor":"#ccccccff","plotBorderWidth":0},"title":{"text":"' + ChartHelper.prefix + 'title' + ChartHelper.suffix + '"},"subtitle":{},"yAxis":{"title":{"text":"' + typePlural + '"}},"xAxis":{"title":{"text":"Institutional repositories"}},"lang":{"noData":"No Data available for the Query"},"exporting":{"enabled":true},"plotOptions":{"series":{"dataLabels":{"enabled":false}}},"legend":{"enabled":true,"align":"center","verticalAlign":"bottom","layout":"horizontal"},"credits":{"href":null,"enabled":true,"text":"Created by OpenAIRE via HighCharts"}}}', null)]);
165 165
      irepo.indicatorPaths[0].parameters = IndicatorPath.createParameters(stakeholder.index_name, typeSingl + " institutional repositories", "bar");
166
      irepo.indicatorPaths[0].parameters.set("id", stakeholder.index_shortName.toLowerCase());
166
      irepo.indicatorPaths[0].parameters["id"] =  stakeholder.index_shortName.toLowerCase();
167 167
      pubDefSub.charts.push(irepo);
168 168
    }
169 169

  
......
171 171
    let pid = new Indicator("",null, "chart","small",true, true,[new IndicatorPath("pie", "stats-tool", "chart?json=",
172 172
      '{"library":"HighCharts","chartDescription":{"queries":[{"name":"'+typePlural+'","type":"'+ChartHelper.prefix+'type'+ChartHelper.suffix+'","query":{"name":"monitor.'+ChartHelper.prefix+'id'+ChartHelper.suffix+'.'+dbTypePlural+'.pidtypes"}}],"chart":{"backgroundColor":"#FFFFFFFF","borderColor":"#335cadff","borderRadius":0,"borderWidth":0,"plotBorderColor":"#ccccccff","plotBorderWidth":0},"title":{"text":"'+ChartHelper.prefix+'title'+ChartHelper.suffix+'"},"subtitle":{},"lang":{"noData":"No Data available for the Query"},"exporting":{"enabled":true},"plotOptions":{"series":{"dataLabels":{"enabled":false}}},"legend":{"enabled":true,"align":"center","verticalAlign":"bottom","layout":"horizontal"},"credits":{"href":null,"enabled":true,"text":"Created by OpenAIRE via HighCharts"}}}', null)]);
173 173
    pid.indicatorPaths[0].parameters = IndicatorPath.createParameters(stakeholder.index_name,typeSingl+" PIDs","pie");
174
    pid.indicatorPaths[0].parameters.set("id",stakeholder.index_shortName.toLowerCase());
174
    pid.indicatorPaths[0].parameters["id"] = stakeholder.index_shortName.toLowerCase();
175 175
    pid.indicatorPaths[0].filters = IndicatorPath.createResultFilters(dbType);
176 176
    pubDefSub.charts.push(pid);
177 177
    return pubDefSub;
......
246 246
  static createLinkToIndicator(stakeholder:Stakeholder,typePlural, typeSingl, dbType, linkedToName,linkedToType ):Indicator {
247 247
      let n_linkedPubs = new Indicator(typePlural+" linked to "+linkedToName, null, "number", "small", true, true, [new IndicatorPath(null, "search",
248 248
        "/resources?query=" + encodeURIComponent(" ( (oaftype exact result) and (resulttypeid exact " + dbType + ") and (relresulttype="+linkedToType+")  )") + "&fq=" + (encodeURIComponent("relfunderid exact " + stakeholder.index_id)) + "&page=0&size=0&format=json", null, ["meta", "total"])]);
249
      n_linkedPubs.indicatorPaths[0].filters.set("fundingL0","&fq=relfundinglevel0_name exact "+ChartHelper.prefix+'fundingL0'+ChartHelper.suffix);
249
      n_linkedPubs.indicatorPaths[0].filters["fundingL0"] = "&fq=relfundinglevel0_name exact "+ChartHelper.prefix+'fundingL0'+ChartHelper.suffix;
250 250
      /*
251 251
    filters.set("start_year",'{"groupFilters":[{"field":"'+dbType+'.year","type":">=","values":["'+ChartHelper.prefix+'start_year'+ChartHelper.suffix+'"]}],"op":"AND"}');
252 252
    filters.set("end_year",'{"groupFilters":[{"field":"'+dbType+'.year","type":"<=","values":["'+ChartHelper.prefix+'end_year'+ChartHelper.suffix+'"]}],"op":"AND"}');
modules/uoa-monitor-portal/trunk/monitor_dashboard/src/app/library/sharedComponents/input/focus.directive.ts
1
import {Directive, HostListener, Input} from "@angular/core";
2

  
3
@Directive({
4
  selector: '[focus-directive]',
5
})
6
export class FocusDirective {
7
  @Input('formInput') formControl: any;
8

  
9
  constructor() { }
10

  
11
  @HostListener
12
  ('focus', ['$event.target'])
13
  onFocus(target) {
14
    this.formControl.markAsTouched({onlySelf: true});
15
  }
16

  
17
  @HostListener('blur', ['$event.target'])
18
  onBlur(target) {
19
    this.formControl.markAsUntouched({onlySelf: true});
20
  }
21

  
22
}
modules/uoa-monitor-portal/trunk/monitor_dashboard/src/app/library/sharedComponents/input/input.component.ts
1
import {Component, Input, OnDestroy, OnInit} from "@angular/core";
2
import {Option} from "../../../utils/indicator-utils";
3

  
4
@Component({
5
  selector: '[dashboard-input]',
6
  template: `
7
    <div class="md-input-wrapper"
8
         [class.md-input-filled]="formControl.value !== ''"
9
         [class.md-input-focus]="formControl.touched"
10
         [class.md-input-wrapper-danger]="formControl.invalid && formControl.dirty">
11
      <label>{{label}}</label>
12
      <input *ngIf="type === 'text' || type === 'number'" [type]="type" class="md-input"
13
             focus-directive [formInput]="formControl"
14
             [formControl]="formControl"
15
             [class.md-input-danger]="formControl.invalid && formControl.dirty">
16
      <textarea *ngIf="type === 'textarea'" type="text" class="md-input no_autosize"
17
                focus-directive [formInput]="formControl"
18
                [rows]="rows" [formControl]="formControl"></textarea>
19
      <span class="md-input-bar"></span>
20
      <select *ngIf="type === 'select'" class="md-input uk-select"
21
             focus-directive [formInput]="formControl"
22
             [formControl]="formControl"
23
             [class.md-input-danger]="formControl.invalid && formControl.dirty">
24
        <option [value]="option.value" *ngFor="let option of options">
25
          {{option.label}}
26
        </option>
27
      </select>
28
    </div>`
29
})
30
export class InputComponent implements OnInit, OnDestroy {
31
  @Input('formInput') formControl: any;
32
  @Input('type') type: string = 'text';
33
  @Input('label') label: string;
34
  @Input('rows') rows: number = 3;
35
  @Input('options') options: Option[];
36

  
37
  constructor() {
38
  }
39

  
40
  ngOnInit(): void {
41
  }
42

  
43
  ngOnDestroy(): void {
44
  }
45
}
modules/uoa-monitor-portal/trunk/monitor_dashboard/src/app/library/sharedComponents/input/input.module.ts
1
import {NgModule} from '@angular/core';
2
import {CommonModule} from '@angular/common';
3
import {FocusDirective} from "./focus.directive";
4
import {InputComponent} from "./input.component";
5
import {SharedModule} from "../../../shared/shared.module";
6

  
7
@NgModule({
8
  imports: [
9
    CommonModule,
10
    SharedModule,
11
  ],
12
  exports: [
13
    InputComponent
14
  ],
15
  declarations: [
16
    FocusDirective,
17
    InputComponent
18
  ]
19
})
20
export class InputModule {
21
}
modules/uoa-monitor-portal/trunk/monitor_dashboard/src/app/app.component.ts
8 8
import {SideBarService} from "./library/sharedComponents/sidebar/sideBar.service";
9 9
import {StakeholderService} from "./services/stakeholder.service";
10 10
import {Subscriber} from "rxjs";
11
import {StakeholderCreator} from "./utils/entities/stakeholderCreator";
12 11

  
12

  
13 13
@Component({
14 14
  selector: 'app-root',
15 15
  templateUrl: './app.component.html'
16 16
})
17
export class AppComponent implements OnInit, OnDestroy{
17
export class AppComponent implements OnInit, OnDestroy {
18 18
  properties: EnvProperties;
19 19
  user: User;
20 20
  loginCheck: boolean = false;
......
41 41
              r = r.firstChild;
42 42
            }
43 43
            r.params.subscribe(params => {
44
              if(params['stakeholder']) {
45
                if(!this.stakeholderService.stakeholder ||
44
              if (params['stakeholder']) {
45
                if (!this.stakeholderService.stakeholder ||
46 46
                  this.stakeholderService.stakeholder.alias !== params['stakeholder']) {
47
                  // this.stakeholderService.getStakeholder(this.properties.monitorServiceAPIURL, params['stakeholder']).subscribe(stakeholder => {
48
                    // stakeholder = Stakeholder.createECStakeholder();
49
                   let  stakeHolder = StakeholderCreator.createFunderFromDefaultProfile("ec","funder","ec__________::EC","European Commission","EC",false,"ec",true,true);
50
                  this.stakeholderService.setStakeholder(stakeHolder);
47
                  this.stakeholderService.getStakeholder(this.properties.monitorServiceAPIURL, params['stakeholder']).subscribe(stakeholder => {
48
                    this.stakeholderService.setStakeholder(stakeholder);
49
                    console.log(stakeholder);
51 50
                    this.sidebarService.setOpen(true);
52
                  // });
51
                  });
53 52
                }
54 53
              } else {
55 54
                this.stakeholderService.setStakeholder(null);
......
72 71
  }
73 72

  
74 73
  public ngOnDestroy() {
75
    this.subscriptions.forEach( value => {
76
      if(value instanceof Subscriber) {
74
    this.subscriptions.forEach(value => {
75
      if (value instanceof Subscriber) {
77 76
        value.unsubscribe();
78 77
      }
79 78
    });
......
84 83
  }
85 84

  
86 85
  public toggleOpen(event = null) {
87
    if(!event) {
86
    if (!event) {
88 87
      this.sidebarService.setOpen(!this.open);
89
    } else if(event && event['value'] === true) {
88
    } else if (event && event['value'] === true) {
90 89
      this.sidebarService.setOpen(false);
91 90
    }
92 91
  }
modules/uoa-monitor-portal/trunk/monitor_dashboard/src/app/topic/topic.component.html
114 114
                  <hr>
115 115
                  <div class="uk-grid-small uk-child-width-1-2" uk-grid>
116 116
                    <div>
117
                      <button class="md-btn md-btn-small" (click)="deleteCategoryOpen(copyCategory.name, editCategory, i)">Delete</button>
117
                      <button class="md-btn md-btn-small"
118
                              (click)="deleteCategoryOpen(copyCategory.name, editCategory, i)">Delete
119
                      </button>
118 120
                    </div>
119 121
                    <div>
120 122
                      <button class="md-btn md-btn-small md-btn-primary uk-float-right"
......
137 139
                    {{subcategory.name}}
138 140
                    <button class="uk-position-center-right-out uk-margin-right uk-button uk-button-link onHover"
139 141
                            (click)="$event.stopPropagation();editSubCategoryOpen(editSubCategory, j);$event.preventDefault()">
140
                    <i class="material-icons">more_horiz</i>
141
                  </button>
142
                      <i class="material-icons">more_horiz</i>
143
                    </button>
142 144
                  </div>
143 145
                </a>
144 146
                <div uk-drop="mode: none; offset: -2; delay-hide: 0" #editSubCategory
......
171 173
                        <hr>
172 174
                        <div class="uk-grid-small uk-child-width-1-2" uk-grid>
173 175
                          <div>
174
                            <button class="md-btn md-btn-small" (click)="deleteSubcategoryOpen(copySubCategory.name, editSubCategory, j)">Delete</button>
176
                            <button class="md-btn md-btn-small"
177
                                    (click)="deleteSubcategoryOpen(copySubCategory.name, editSubCategory, j)">Delete
178
                            </button>
175 179
                          </div>
176 180
                          <div>
177 181
                            <button class="md-btn md-btn-small md-btn-primary uk-float-right"
......
287 291
    </ul>
288 292
  </div>
289 293
</aside>
290
<indicators [stakeholder]="stakeholder"
294
<indicators [properties]="properties"
295
            [stakeholder]="stakeholder"
291 296
            [topicIndex]="topicIndex"
292 297
            [categoryIndex]="categoryIndex"
293 298
            [subcategoryIndex]="subCategoryIndex"></indicators>
modules/uoa-monitor-portal/trunk/monitor_dashboard/src/app/topic/indicators.component.html
1
<div id="page_content" click-outside-or-esc targetId="page_content" (clickOutside)="toggleOpen($event)">
1
<div id="page_content" click-outside-or-esc targetId="page_content" [escClose]="false"
2
     (clickOutside)="toggleOpen($event)">
2 3
  <div class="uk-padding-small md-bg-white" uk-grid>
3 4
    <div class="uk-width-2-3@m uk-width-1-1 uk-child-width-1-3@m uk-child-width-1-1" uk-grid>
4 5
      <div class="uk-flex uk-flex-middle">
......
73 74
    <div [class.uk-child-width-1-3@m]="grid"
74 75
         [class.uk-child-width-1-2@s]="grid"
75 76
         [class.uk-child-width-1-1]="!grid"
77
         [class.list]="!grid" id="numbers"
76 78
         class="uk-grid-match uk-grid-small"
77
         [class.list]="!grid"
78
         uk-grid>
79
         uk-sortable uk-grid>
79 80
      <ng-template ngFor [ngForOf]="displayNumbers" let-indicator let-i="index">
80
        <div>
81
          <div class="md-card">
81
        <div *ngIf="indicator" [id]="i">
82
          <div class="md-card" [class.uk-sortable-nodrag]="!canNumbersReorder">
82 83
            <div class="md-card-toolbar">
83 84
              <div class="md-card-toolbar-actions" [class.uk-flex-middle]="!grid" [class.uk-flex]="!grid">
84 85
                <span *ngIf="!grid" class="uk-margin-medium-right uk-flex uk-flex-middle">
......
119 120
    <div [class.uk-child-width-1-3@m]="grid"
120 121
         [class.uk-child-width-1-2@s]="grid"
121 122
         [class.uk-child-width-1-1]="!grid"
122
         [class.list]="!grid"
123
         class="uk-grid-match uk-grid-small"
124
         uk-grid>
123
         [class.list]="!grid" id="charts"
124
         class="uk-grid-match uk-grid-small uk-grid"
125
         uk-sortable uk-grid>
125 126
      <ng-template ngFor [ngForOf]="displayCharts" let-indicator let-i="index">
126
        <div>
127
          <div class="md-card">
127
        <div *ngIf="indicator" [id]="i">
128
          <div class="md-card" [class.uk-sortable-nodrag]="!canChartsReorder">
128 129
            <div class="md-card-toolbar">
129 130
              <div class="md-card-toolbar-actions" [class.uk-flex-middle]="!grid" [class.uk-flex]="!grid">
130 131
                <ng-template [ngIf]="!grid">
131 132
                  <span *ngFor="let indicatorPath of indicator.indicatorPaths"
132 133
                        class="uk-margin-medium-right uk-text-capitalize uk-flex uk-flex-middle">
133 134
                    <i class="material-icons md-24 uk-margin-small-right">
134
                      {{indicatorUtils.chartTypes.get(indicatorPath.type)}}
135
                      {{indicatorUtils.chartTypesIcons.get(indicatorPath.type)}}
135 136
                    </i>
136 137
                    {{indicatorPath.type + ' Chart'}}
137 138
                  </span>
......
162 163
                     [ngClass]="'uk-child-width-1-' + indicator.indicatorPaths.length" uk-grid>
163 164
                  <div *ngFor="let indicatorPath of indicator.indicatorPaths">
164 165
                    <i class="material-icons md-24">
165
                      {{indicatorUtils.chartTypes.get(indicatorPath.type)}}
166
                      {{indicatorUtils.chartTypesIcons.get(indicatorPath.type)}}
166 167
                    </i>
167 168
                    <div class="uk-text-capitalize">{{indicatorPath.type + ' Chart'}}</div>
168 169
                  </div>
......
185 186
        </div>
186 187
      </ng-template>
187 188
      <div>
188
        <div class="md-card clickable" (click)="createIndicatorOpen()">
189
        <div class="md-card clickable uk-sortable-nodrag" (click)="createIndicatorOpen()">
189 190
          <div class="md-card-toolbar">
190 191
            <div class="md-card-toolbar-heading-text"
191 192
                 [class.uk-flex-middle]="!grid"
......
196 197
            </div>
197 198
          </div>
198 199
          <div *ngIf="grid" class="md-card-content">
199
            <div class="uk-flex uk-flex-center" uk-grid>
200
            <div uk-grid>
200 201
              <div class="uk-width-1-1">
201 202
                Use our advance tool to create a custom Indicator that suit the needs of your funding KPI's.
202 203
              </div>
204
              <div class="uk-width-1-1 uk-flex uk-flex-center">
205
                <i class="material-icons md-48">add</i>
206
              </div>
203 207
            </div>
204
            <div class="uk-flex uk-flex-center uk-margin-top">
205
              <i class="material-icons md-48">add</i>
206
            </div>
207 208
          </div>
208 209
        </div>
209 210
      </div>
......
214 215
             (alertOutput)="createIndicator()"
215 216
             [okDisabled]="indicatorFb && indicatorFb.invalid">
216 217
  <div *ngIf="indicatorFb" class="uk-form-stacked" [formGroup]="indicatorFb">
217
    <label class="uk-form-label">Name</label>
218
    <div class="uk-form-controls">
219
      <input class="uk-input"
220
             [class.uk-form-danger]="indicatorFb.get('name').invalid && indicatorFb.get('name').dirty"
221
             [formControl]="indicatorFb.get('name')">
222
    </div>
223
    <label class="uk-form-label">Description</label>
224
    <div class="uk-form-controls">
225
      <textarea class="uk-textarea" rows="3"
226
                [formControl]="indicatorFb.get('description')"></textarea>
227
    </div>
228
    <label class="uk-form-label">Chart url</label>
229
    <div class="uk-form-controls" formArrayName="urls">
230
      <input class="uk-input"
231
             [class.uk-form-danger]="chartUrl.invalid && chartUrl.dirty"
232
             *ngFor="let chartUrl of urls.controls;"
233
             [formControl]="chartUrl">
234
    </div>
218
    <div dashboard-input class="uk-form-row" [formInput]="indicatorFb.get('name')" label="Title"></div>
219
    <div dashboard-input class="uk-form-row" [formInput]="indicatorFb.get('description')"
220
         label="Description" type="textarea"></div>
221
    <div dashboard-input class="uk-form-row" *ngFor="let chartUrl of urls.controls;"
222
         [formInput]="chartUrl"
223
         label="Chart Url"></div>
235 224
  </div>
236 225
</modal-alert>
237 226
<modal-alert #editIndicatorModal
227
             [classBody]="'large-modal'"
238 228
             (alertOutput)="saveIndicator()"
239
             [okDisabled]="editIndicatorFb && (editIndicatorFb.invalid || !editIndicatorFb.dirty)">
240
  <div *ngIf="editIndicatorFb" class="uk-form-stacked" [formGroup]="editIndicatorFb">
241
    <div class="md-input-wrapper">
242
      <label>Name</label>
243
      <input type="text" class="md-input" (focus)="focus($event)">
244
      <span class="md-input-bar "></span>
229
             [okDisabled]="editIndicatorFb && (editIndicatorFb.invalid ||(!editIndicatorFb.dirty && index !==-1))">
230
  <div *ngIf="editIndicatorFb" class="uk-padding-small" [formGroup]="editIndicatorFb">
231
    <div dashboard-input class="uk-form-row" [formInput]="editIndicatorFb.get('name')" label="Title"></div>
232
    <div dashboard-input class="uk-form-row" [formInput]="editIndicatorFb.get('description')"
233
         label="Description" type="textarea">
245 234
    </div>
246
    <label class="uk-form-label">Name</label>
247
    <div class="uk-form-controls">
248
      <input class="uk-input"
249
             [class.uk-form-danger]="editIndicatorFb.get('name').status === 'INVALID' && editIndicatorFb.get('name').dirty"
250
             [formControl]="editIndicatorFb.get('name')">
235
    <div class="uk-form-row uk-flex uk-flex-middle">
236
      <div dashboard-input class="uk-width-small" [formInput]="editIndicatorFb.get('isPublic')"
237
           label="Accessibility" [options]="indicatorUtils.isPublic" type="select">
238
      </div>
239
      <div dashboard-input class="uk-margin-small-left uk-width-small" [formInput]="editIndicatorFb.get('isActive')"
240
           label="Visibility" [options]="indicatorUtils.isActive" type="select">
241
      </div>
242
      <div dashboard-input class="uk-margin-small-left uk-width-small" [formInput]="editIndicatorFb.get('width')"
243
           type="select" [options]="indicatorUtils.chartSizes"
244
           label="Chart Size">
245
      </div>
251 246
    </div>
252
    <!--<label class="uk-form-label">Description</label>
253
    <div class="uk-form-controls">
254
      <textarea class="uk-textarea" rows="3"
255
                [formControl]="indicatorFb.get('description')"></textarea>
247
    <hr class="uk-margin-large-top uk-margin-large-bottom">
248
    <div formArrayName="indicatorPaths">
249
      <div *ngFor="let indicatorPath of indicatorPaths.controls; let i=index"
250
           [formGroup]="indicatorPath">
251
        <div formArrayName="parameters">
252
          <div *ngIf="getParameter(i, 'title')" class="uk-form-row">
253
            <div dashboard-input
254
                 [formInput]="getParameter(i, 'title').get('value')"
255
                 label="Chart Title"></div>
256
          </div>
257
          <div class="uk-grid-medium uk-form-row" uk-grid>
258
            <div *ngIf="getParameter(i, 'type')" class="uk-width-1-3@s">
259
              <div dashboard-input [formInput]="getParameter(i, 'type').get('value')"
260
                   type="select" [options]="indicatorUtils.chartTypes"
261
                   label="Chart Type"></div>
262
            </div>
263
            <div *ngIf="getParameter(i, 'xAxisTitle')" class="uk-width-1-3@s">
264
              <div dashboard-input [formInput]="getParameter(i, 'xAxisTitle').get('value')"
265
                   label="X-Axis Title"></div>
266
            </div>
... This diff was truncated because it exceeds the maximum size that can be displayed.

Also available in: Unified diff