Project

General

Profile

« Previous | Next » 

Revision 58985

[Monitor Dashboard | Trunk]: Fix bug with number indicators and with subcategory content while is recreated

View differences:

modules/uoa-monitor-portal/trunk/monitor_dashboard/angular.json
76 76
            "production": {
77 77
              "browserTarget": "ng-universal-demo:build:production"
78 78
            },
79
            "production": {
79
            "beta": {
80 80
              "browserTarget": "ng-universal-demo:build:beta"
81 81
            }
82 82
          }
modules/uoa-monitor-portal/trunk/monitor_dashboard/src/app/topic/topic.component.html
143 143
  </div>
144 144
</aside>
145 145
<indicators *ngIf="stakeholder" [properties]="properties"
146
            [stakeholder]="stakeholder"
147 146
            [topicIndex]="topicIndex"
148 147
            [categoryIndex]="categoryIndex"
149 148
            [subcategoryIndex]="subCategoryIndex"></indicators>
modules/uoa-monitor-portal/trunk/monitor_dashboard/src/app/topic/indicators.component.html
72 72
            <div class="md-btn-group">
73 73
              <button [disabled]="editing" class="md-btn md-btn-mini" (click)="createSection(i, 'number')"
74 74
                      title="Create a new section"><i
75
                class="material-icons">add</i></button>
75
                  class="material-icons">add</i></button>
76 76
              <!--<button class="md-btn md-btn-mini"><i class="material-icons rotate-90">drag_indicator</i></button>-->
77
              <button   [disabled]="editing || number.defaultId  " class="md-btn md-btn-mini"
78
                        [title]="(number.defaultId?'Default sections cannot be deleted':'Delete section')"
79
                       (click)="deleteSectionOpen(number, i, 'number', 'delete')"><i class="material-icons">clear</i>
77
              <button [disabled]="editing || number.defaultId  " class="md-btn md-btn-mini"
78
                      [title]="(number.defaultId?'Default sections cannot be deleted':'Delete section')"
79
                      (click)="deleteSectionOpen(number, i, 'number', 'delete')"><i class="material-icons">clear</i>
80 80
              </button>
81
<!--              <ng-container *ngIf="!stakeholder.defaultId">-->
82
<!--                <button   [disabled]="editing || number.defaultId  " class="md-btn md-btn-mini"-->
83
<!--                          [title]="(number.defaultId?'Default sections cannot be deleted':'Delete all related sections')"-->
84
<!--                          (click)="deleteSectionOpen(number, i, 'number', 'delete')"><i class="material-icons">highlight_off</i>-->
85
<!--                </button>-->
86
<!--                <button   [disabled]="editing || number.defaultId  " class="md-btn md-btn-mini"-->
87
<!--                          [title]="(number.defaultId?'Default sections cannot be deleted':'Delete section and disconnect related')"-->
88
<!--                          (click)="deleteSectionOpen(number, i, 'number', 'disconnect')"><i class="material-icons">link_off</i>-->
89
<!--                </button>-->
90
<!--              </ng-container>-->
81
              <!--              <ng-container *ngIf="!stakeholder.defaultId">-->
82
              <!--                <button   [disabled]="editing || number.defaultId  " class="md-btn md-btn-mini"-->
83
              <!--                          [title]="(number.defaultId?'Default sections cannot be deleted':'Delete all related sections')"-->
84
              <!--                          (click)="deleteSectionOpen(number, i, 'number', 'delete')"><i class="material-icons">highlight_off</i>-->
85
              <!--                </button>-->
86
              <!--                <button   [disabled]="editing || number.defaultId  " class="md-btn md-btn-mini"-->
87
              <!--                          [title]="(number.defaultId?'Default sections cannot be deleted':'Delete section and disconnect related')"-->
88
              <!--                          (click)="deleteSectionOpen(number, i, 'number', 'disconnect')"><i class="material-icons">link_off</i>-->
89
              <!--                </button>-->
90
              <!--              </ng-container>-->
91 91
            </div>
92 92
          </div>
93 93
          <div *ngIf="grid && numberSections.at(i)"
......
142 142
                          <hr *ngIf="isAdministrator && !indicator.defaultId" class="uk-nav-divider">
143 143
                          <li *ngIf="isAdministrator && !indicator.defaultId && !editing"><a
144 144
                              (click)="deleteIndicatorOpen(number, indicator._id, 'number', 'delete');hide(element)">Delete</a>
145
<!--                            <ng-container *ngIf="!stakeholder.defaultId">-->
146
<!--                              <a (click)="deleteIndicatorOpen(number, indicator._id, 'number', 'delete');hide(element)">Delete from all profiles</a>-->
147
<!--                              <a (click)="deleteIndicatorOpen(number, indicator._id, 'number', 'disconnect');hide(element)">Delete and disconnect from all profiles</a>-->
148
<!--                            </ng-container>-->
145
                            <!--                            <ng-container *ngIf="!stakeholder.defaultId">-->
146
                            <!--                              <a (click)="deleteIndicatorOpen(number, indicator._id, 'number', 'delete');hide(element)">Delete from all profiles</a>-->
147
                            <!--                              <a (click)="deleteIndicatorOpen(number, indicator._id, 'number', 'disconnect');hide(element)">Delete and disconnect from all profiles</a>-->
148
                            <!--                            </ng-container>-->
149 149
                          </li>
150 150
                        </ul>
151 151
                      </div>
......
222 222
            <div class="md-btn-group">
223 223
              <button [disabled]="editing" class="md-btn md-btn-mini" (click)="createSection(i)"
224 224
                      title="Create a new section"><i
225
                class="material-icons">add</i></button>
225
                  class="material-icons">add</i></button>
226 226
              <!--<button class="md-btn md-btn-mini"><i class="material-icons rotate-90">drag_indicator</i></button>-->
227 227
              <button [disabled]="editing || chart.defaultId  "
228 228
                      [title]="(chart.defaultId?'Default sections cannot be deleted':'Delete section')"
229
                      class="md-btn md-btn-mini" (click)="deleteSectionOpen(chart, i, 'chart', 'delete')"><i class="material-icons">clear</i>
229
                      class="md-btn md-btn-mini" (click)="deleteSectionOpen(chart, i, 'chart', 'delete')"><i
230
                  class="material-icons">clear</i>
230 231
              </button>
231
<!--              <ng-container *ngIf="!stakeholder.defaultId">-->
232
<!--                <button   [disabled]="editing || chart.defaultId  " class="md-btn md-btn-mini"-->
233
<!--                          [title]="(chart.defaultId?'Default sections cannot be deleted':'Delete all related sections')"-->
234
<!--                          (click)="deleteSectionOpen(chart, i, 'chart', 'delete')"><i class="material-icons">highlight_off</i>-->
235
<!--                </button>-->
236
<!--                <button   [disabled]="editing || chart.defaultId  " class="md-btn md-btn-mini"-->
237
<!--                          [title]="(chart.defaultId?'Default sections cannot be deleted':'Delete section and disconnect related')"-->
238
<!--                          (click)="deleteSectionOpen(chart, i, 'chart', 'disconnect')"><i class="material-icons">link_off</i>-->
239
<!--                </button>-->
240
<!--              </ng-container>-->
232
              <!--              <ng-container *ngIf="!stakeholder.defaultId">-->
233
              <!--                <button   [disabled]="editing || chart.defaultId  " class="md-btn md-btn-mini"-->
234
              <!--                          [title]="(chart.defaultId?'Default sections cannot be deleted':'Delete all related sections')"-->
235
              <!--                          (click)="deleteSectionOpen(chart, i, 'chart', 'delete')"><i class="material-icons">highlight_off</i>-->
236
              <!--                </button>-->
237
              <!--                <button   [disabled]="editing || chart.defaultId  " class="md-btn md-btn-mini"-->
238
              <!--                          [title]="(chart.defaultId?'Default sections cannot be deleted':'Delete section and disconnect related')"-->
239
              <!--                          (click)="deleteSectionOpen(chart, i, 'chart', 'disconnect')"><i class="material-icons">link_off</i>-->
240
              <!--                </button>-->
241
              <!--              </ng-container>-->
241 242
            </div>
242 243
          </div>
243 244
          <div *ngIf="grid && chartSections.at(i)"
......
294 295
                      <div #element uk-dropdown="mode: click; pos: bottom-right; delay-hide: 0; flip: false"
295 296
                           class="uk-padding-remove-horizontal">
296 297
                        <ul class="uk-nav uk-dropdown-nav">
297
                          <li *ngIf="!editing"><a (click)="editChartIndicatorOpen(chart, indicator._id);hide(element)">Edit</a></li>
298
                          <li *ngIf="!editing"><a (click)="editChartIndicatorOpen(chart, indicator._id);hide(element)">Edit</a>
299
                          </li>
298 300
                          <li *ngIf="!editing"><a (click)="toggleIndicatorStatus(chart._id, indicator);hide(element)">
299 301
                            {{indicator.isActive ? 'Inactive' : 'Active'}}</a>
300 302
                          </li>
......
302 304
                            {{indicator.isPublic ? 'Private' : 'Public'}}</a>
303 305
                          </li>
304 306
                          <hr *ngIf="!indicator.defaultId " class="uk-nav-divider">
305
                          <li *ngIf="!editing && !indicator.defaultId "><a (click)="deleteIndicatorOpen(chart, indicator._id, 'chart', 'delete');hide(element)">
307
                          <li *ngIf="!editing && !indicator.defaultId "><a
308
                              (click)="deleteIndicatorOpen(chart, indicator._id, 'chart', 'delete');hide(element)">
306 309
                            Delete</a>
307
<!--                            <a (click)="deleteIndicatorOpen(chart, indicator._id, 'chart', 'delete');hide(element)">Delete from all profiles</a>-->
308
<!--                            <a (click)="deleteIndicatorOpen(chart, indicator._id, 'chart', 'disconnect');hide(element)">Delete and disconnect from all profiles</a>-->
310
                            <!--                            <a (click)="deleteIndicatorOpen(chart, indicator._id, 'chart', 'delete');hide(element)">Delete from all profiles</a>-->
311
                            <!--                            <a (click)="deleteIndicatorOpen(chart, indicator._id, 'chart', 'disconnect');hide(element)">Delete and disconnect from all profiles</a>-->
309 312
                          </li>
310 313
                        </ul>
311 314
                      </div>
......
348 351
                            [src]="safeUrls.get(indicatorUtils.getFullUrl(stakeholder, indicator.indicatorPaths[0]))"
349 352
                            class="uk-width-1-1 uk-height-medium"></iframe>
350 353
                    <div *ngIf="indicator.indicatorPaths[0] && indicator.indicatorPaths[0].source === 'image'">
351
                      <img class="uk-width-1-1 uk-height-medium" [src]="indicator.indicatorPaths[i].url">
354
                      <img class="uk-width-1-1 uk-height-medium" [src]="indicator.indicatorPaths[0].url">
352 355
                    </div>
353 356
                  </div>
354 357
                </div>
......
568 571
  <div *ngIf="indicatorChildrenActionOnDelete == 'delete'" class="uk-text-bold">
569 572
    Indicators of all profiles based on this default indicator, will be deleted as well.
570 573
  </div>
571
<!--  <span *ngIf="indicatorChildrenActionOnDelete == 'disconnect'" class="uk-text-bold">-->
572
<!--    Indicators of all profiles based on this default indicator, will not be marked as copied from default anymore.-->
573
<!--  </span>-->
574
  <!--  <span *ngIf="indicatorChildrenActionOnDelete == 'disconnect'" class="uk-text-bold">-->
575
  <!--    Indicators of all profiles based on this default indicator, will not be marked as copied from default anymore.-->
576
  <!--  </span>-->
574 577
  Are you sure you want to proceed?
575 578
</modal-alert>
576 579
<!--<modal-alert #deleteAllModal (alertOutput)="deleteIndicator('delete')">-->
......
590 593
  <div *ngIf="sectionChildrenActionOnDelete == 'delete'" class="uk-text-bold">
591 594
    Sections of all profiles based on this default section and their contents, will be deleted as well.
592 595
  </div>
593
<!--  <span *ngIf="sectionChildrenActionOnDelete == 'disconnect'" class="uk-text-bold">-->
594
<!--    Sections of all profiles based on this default section and their contents, will not be marked as copied from default anymore.-->
595
<!--  </span>-->
596
  <!--  <span *ngIf="sectionChildrenActionOnDelete == 'disconnect'" class="uk-text-bold">-->
597
  <!--    Sections of all profiles based on this default section and their contents, will not be marked as copied from default anymore.-->
598
  <!--  </span>-->
596 599
  Are you sure you want to proceed?
597 600
</modal-alert>
598 601
<!--<modal-alert #deleteNumberSectionModal (alertOutput)="deleteSection('number')">-->
modules/uoa-monitor-portal/trunk/monitor_dashboard/src/app/topic/topic.component.ts
459 459
  private save(message: string, path: string[], saveElement: any, callback: Function, redirect = false) {
460 460
    this.stakeholderService.saveElement(this.properties.monitorServiceAPIURL, saveElement, path).subscribe(saveElement => {
461 461
      callback(saveElement);
462
      this.stakeholderService.setStakeholder(this.stakeholder);
462 463
      UIkit.notification(message, {
463 464
        status: 'success',
464 465
        timeout: 3000,
......
481 482
  private delete(message: string, path: string[], callback: Function, redirect = false) {
482 483
    this.stakeholderService.deleteElement(this.properties.monitorServiceAPIURL, path, this.elementChildrenActionOnDelete).subscribe(() => {
483 484
      callback();
485
      this.stakeholderService.setStakeholder(this.stakeholder);
484 486
      UIkit.notification(message, {
485 487
        status: 'success',
486 488
        timeout: 3000,
......
501 503
  private toggleStatus(element: Topic | Category | SubCategory, path: string[]) {
502 504
    this.stakeholderService.toggleStatus(this.properties.monitorServiceAPIURL, path).subscribe(isActive => {
503 505
      element.isActive = isActive;
506
      this.stakeholderService.setStakeholder(this.stakeholder);
504 507
      UIkit.notification(StringUtils.capitalize(this.type) + ' has been successfully changed to ' + (isActive ? 'active' : 'inactive'), {
505 508
        status: 'success',
506 509
        timeout: 3000,
......
518 521
  private toggleAccess(element: Topic | Category | SubCategory, path: string[]) {
519 522
    this.stakeholderService.toggleAccess(this.properties.monitorServiceAPIURL, path).subscribe(isPublic => {
520 523
      element.isPublic = isPublic;
524
      this.stakeholderService.setStakeholder(this.stakeholder);
521 525
      UIkit.notification(StringUtils.capitalize(this.type) + ' has been successfully changed to ' + (isPublic ? 'public' : 'private'), {
522 526
        status: 'success',
523 527
        timeout: 3000,
modules/uoa-monitor-portal/trunk/monitor_dashboard/src/app/topic/indicators.component.ts
41 41
  public categoryIndex: number = 0;
42 42
  @Input()
43 43
  public subcategoryIndex: number = 0;
44
  @Input()
45 44
  public stakeholder: Stakeholder = null;
46 45
  public user = null;
47 46
  public preview: string;
......
106 105
    this.userManagementService.getUserInfo().subscribe(user => {
107 106
      this.user = user;
108 107
    });
109
    this.buildFilters();
110
    this.buildSections();
108
    this.stakeholderService.getStakeholderAsObservable().subscribe(stakeholder => {
109
      this.stakeholder = stakeholder;
110
      if(this.stakeholder) {
111
        this.buildFilters();
112
        this.buildSections();
113
        this.filterCharts();
114
        this.filterNumbers();
115
      }
116
    });
111 117
  }
112 118
  
113 119
  ngOnDestroy(): void {
......
133 139
      this.filterCharts();
134 140
      this.filterNumbers();
135 141
    }
136
    this.preview = '/' + this.stakeholder.alias + '/' + this.stakeholder.topics[this.topicIndex].alias;
137
    if(this.stakeholder.topics[this.topicIndex].categories[this.categoryIndex]) {
138
      this.preview += '/' + this.stakeholder.topics[this.topicIndex].categories[this.categoryIndex].alias;
139
      if(this.stakeholder.topics[this.topicIndex].categories[this.categoryIndex].subCategories[this.subcategoryIndex]) {
140
        this.preview += '/' + this.stakeholder.topics[this.topicIndex].categories[this.categoryIndex].subCategories[this.subcategoryIndex].alias;
142
    this.setPreview();
143
  }
144
  
145
  setPreview() {
146
    if(this.stakeholder && this.stakeholder.topics[this.topicIndex]) {
147
      this.preview = '/' + this.stakeholder.alias + '/' + this.stakeholder.topics[this.topicIndex].alias;
148
      if (this.stakeholder.topics[this.topicIndex].categories[this.categoryIndex]) {
149
        this.preview += '/' + this.stakeholder.topics[this.topicIndex].categories[this.categoryIndex].alias;
150
        if (this.stakeholder.topics[this.topicIndex].categories[this.categoryIndex].subCategories[this.subcategoryIndex]) {
151
          this.preview += '/' + this.stakeholder.topics[this.topicIndex].categories[this.categoryIndex].subCategories[this.subcategoryIndex].alias;
152
        }
141 153
      }
142 154
    }
143 155
  }
......
264 276
      this.filterByKeyword(HelperFunctions.copy(this.numbers), this.filters.value.keyword),
265 277
      this.filters.value.status),
266 278
      this.filters.value.privacy);
267
    console.log(this.numbers);
268 279
    this.buildSections();
269 280
  }
270 281
  
......
519 530
      this.indicator = HelperFunctions.copy(this.section.indicators[this.index]);
520 531
      this.numberIndicatorFb = this.fb.group({
521 532
        _id: this.fb.control(this.indicator._id),
522
        name: this.fb.control(this.indicator.name),
533
        name: this.fb.control(this.indicator.name, Validators.required),
523 534
        description: this.fb.control(this.indicator.description),
524 535
        isPublic: this.fb.control(this.indicator.isPublic),
525 536
        isActive: this.fb.control(this.indicator.isActive),
......
535 546
      this.indicator = new Indicator('', '', 'number', 'small', true, true, []);
536 547
      this.numberIndicatorFb = this.fb.group({
537 548
        _id: this.fb.control(this.indicator._id),
538
        name: this.fb.control(this.indicator.name),
549
        name: this.fb.control(this.indicator.name, Validators.required),
539 550
        description: this.fb.control(this.indicator.description),
540 551
        isPublic: this.fb.control(this.indicator.isPublic),
541 552
        isActive: this.fb.control(this.indicator.isActive),
......
619 630
      this.section = this.charts.find(section => section._id === this.section._id);
620 631
    } else {
621 632
      this.indicator = this.numberIndicatorFb.value;
633
      this.section = this.numbers.find(section => section._id === this.section._id);
622 634
    }
623 635
    let path = [
624 636
      this.stakeholder._id,
......
633 645
      } else {
634 646
        this.section.indicators.push(indicator);
635 647
      }
636
      this.filterCharts();
637
      this.chartIndicatorFb = null;
648
      if(this.indicator.type === "chart") {
649
        this.filterCharts();
650
        this.chartIndicatorFb = null;
651
      } else {
652
        this.filterNumbers();
653
        this.numberIndicatorFb = null;
654
      }
638 655
      UIkit.notification('Indicator has been successfully saved', {
639 656
        status: 'success',
640 657
        timeout: 3000,
modules/uoa-monitor-portal/trunk/monitor_dashboard/src/assets/theme-assets/dashboard-custom.css
436 436

  
437 437
.dashboard .section:hover .tools .md-btn-group::before {
438 438
  content: "";
439
  border-bottom: 23px solid var(--secondary-color);
439
  border-bottom: 24px solid var(--secondary-color);
440 440
  border-left:solid 12px transparent;
441 441
  width: 0;
442
  margin-left: -1px;
443
  padding-bottom: 2px;
442
  position: absolute;
443
  top: 0;
444
  bottom: 0;
445
  left: -12px;
444 446
}
445 447

  
446 448
.dashboard .section:hover .tools .md-btn-group::after {
447 449
  content: "";
448
  border-bottom: 23px solid var(--secondary-color);
450
  border-bottom: 24px solid var(--secondary-color);
449 451
  border-right: solid 12px transparent;
450 452
  width: 0;
451
  margin-left: -1px;
452
  padding-bottom: 2px;
453
  position: absolute;
454
  top: 0;
455
  bottom: 0;
456
  right: -11px;
453 457
}
454 458

  
455 459
/* New section*/

Also available in: Unified diff