Project

General

Profile

« Previous | Next » 

Revision 57719

[Monitor Dashboard]: Add home page. Fix a bug when edit indicator and filter is on

View differences:

modules/uoa-monitor-portal/trunk/monitor_dashboard/src/app/services/stakeholder.service.ts
29 29
  }
30 30

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

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

  
43 43
  getDefaultStakeholders(url: string, type: string = null): Observable<Stakeholder[]> {
44
    return this.http.get<Stakeholder[]>(url + '/stakeholder/default' + (type)?('?type=' + type):'').pipe(map(stakeholders => {
44
    return this.http.get<Stakeholder[]>(url + '/stakeholder/default' + ((type)?('?type=' + type):'')).pipe(map(stakeholders => {
45 45
      return this.formalize(stakeholders);
46 46
    }));
47 47
  }
modules/uoa-monitor-portal/trunk/monitor_dashboard/src/app/topic/indicators.component.html
54 54
    <div [class.uk-child-width-1-3@m]="grid"
55 55
         [class.uk-child-width-1-2@s]="grid"
56 56
         [class.uk-child-width-1-1]="!grid"
57
         [class.list]="!grid" id="number"
57
         [class.max-width-large]="!grid" id="number"
58 58
         class="uk-grid-match uk-grid-small"
59 59
         uk-sortable uk-grid>
60 60
      <ng-template ngFor [ngForOf]="displayNumbers" let-indicator let-i="index">
......
76 76
                  <i class="md-icon material-icons">more_vert</i>
77 77
                  <div uk-dropdown="mode: click; pos: bottom-right" class="uk-padding-remove-horizontal">
78 78
                    <ul class="uk-nav uk-dropdown-nav">
79
                      <li><a (click)="editIndicatorOpen(i)">Edit</a></li>
80
                      <li><a (click)="deleteIndicatorOpen(i, 'number')">Delete</a></li>
79
                      <li><a (click)="editIndicatorOpen(indicator._id)">Edit</a></li>
80
                      <li><a (click)="deleteIndicatorOpen(indicator._id, 'number')">Delete</a></li>
81 81
                    </ul>
82 82
                  </div>
83 83
                </div>
......
108 108
    <div [class.uk-child-width-1-3@m]="grid"
109 109
         [class.uk-child-width-1-2@s]="grid"
110 110
         [class.uk-child-width-1-1]="!grid"
111
         [class.list]="!grid" id="chart"
111
         [class.max-width-large]="!grid" id="chart"
112 112
         class="uk-grid-match uk-grid-small uk-grid"
113 113
         uk-sortable uk-grid>
114 114
      <ng-template ngFor [ngForOf]="displayCharts" let-indicator let-i="index">
......
143 143
                  <i class="md-icon material-icons">more_vert</i>
144 144
                  <div uk-dropdown="mode: click; pos: bottom-right" class="uk-padding-remove-horizontal">
145 145
                    <ul class="uk-nav uk-dropdown-nav">
146
                      <li><a (click)="editIndicatorOpen(i)">Edit</a></li>
147
                      <li><a (click)="deleteIndicatorOpen(i)">Delete</a></li>
146
                      <li><a (click)="editIndicatorOpen(indicator._id)">Edit</a></li>
147
                      <li><a (click)="deleteIndicatorOpen(indicator._id)">Delete</a></li>
148 148
                    </ul>
149 149
                  </div>
150 150
                </div>
modules/uoa-monitor-portal/trunk/monitor_dashboard/src/app/topic/indicators.component.ts
97 97

  
98 98
  ngOnChanges(changes: SimpleChanges): void {
99 99
    if (this.canEdit) {
100
      this.buildFilters();
100
      if(changes.topicIndex || changes.categoryIndex || changes.subcategoryIndex) {
101
        this.buildFilters();
102
      }
101 103
      this.filterCharts();
102 104
      this.filterNumbers();
103 105
    }
......
157 159
  }
158 160

  
159 161
  onPrivacyChange(value) {
160
    console.log(value);
161 162
    this.displayCharts = this.filterPrivacy(this.charts, value);
162 163
    this.displayNumbers = this.filterPrivacy(this.numbers, value);
163 164
  }
......
308 309
    this.editIndicatorOpen();
309 310
  }
310 311

  
311
  public editIndicatorOpen(index: number = -1) {
312
    this.index = index;
312
  public editIndicatorOpen(id = null) {
313
    this.index = this.charts.findIndex(value => value._id === id);
313 314
    if (this.index !== -1) {
314
      this.indicator = HelperFunctions.copy(this.charts[index]);
315
      this.indicator = HelperFunctions.copy(this.charts[this.index]);
315 316
    }
316 317
    let indicatorPaths = this.fb.array([]);
317 318
    this.indicator.indicatorPaths.forEach(indicatorPath => {
......
346 347
      indicatorPaths: indicatorPaths,
347 348
      width: this.fb.control(this.indicator.width, Validators.required),
348 349
    });
349
    if(index === -1) {
350
    if(this.index === -1) {
350 351
      this.editIndicatorModal.okButtonText = 'Save';
351 352
      this.editIndicatorModal.stayOpen = false;
352 353
    } else {
......
414 415
    this.indicatorPaths.at(index).markAsPristine({onlySelf: true});
415 416
  }
416 417

  
417
  deleteIndicatorOpen(index: number, type: string = 'chart') {
418
    this.index = index;
418
  deleteIndicatorOpen(id: string, type: string = 'chart') {
419 419
    if(type === 'chart') {
420
      this.indicator = this.charts[index];
420
      this.indicator = this.charts.find(value => value._id == id);
421 421
    } else {
422
      this.indicator = this.numbers[index];
422
      this.indicator = this.numbers.find(value => value._id == id);
423 423
    }
424 424
    this.deleteIndicatorModal.alertTitle = 'Delete ' + this.indicator.name;
425 425
    this.deleteIndicatorModal.cancelButtonText = 'No';
modules/uoa-monitor-portal/trunk/monitor_dashboard/src/app/app-routing.module.ts
24 24
    data: {hasSidebar: false}
25 25
  },
26 26
  {
27
    path: 'admin',
28
    loadChildren: './home/home.module#HomeModule',
29
    resolve: {envSpecific: EnvironmentSpecificResolver}
30
  },
31
  {
27 32
    path: 'admin/:stakeholder',
28 33
    loadChildren: './stakeholder/stakeholder.module#StakeholderModule',
29 34
    resolve: {envSpecific: EnvironmentSpecificResolver}
modules/uoa-monitor-portal/trunk/monitor_dashboard/src/assets/theme-assets/dashboard-custom.css
99 99
  float: none;
100 100
}
101 101

  
102
.dashboard .list {
102
.dashboard .max-width-large {
103 103
  max-width: 1220px;
104 104
}
105 105

  

Also available in: Unified diff