Project

General

Profile

« Previous | Next » 

Revision 57735

[Monitor Dashboard]: Customize loading component. Make input pristine if the value is equal to initial value

View differences:

modules/uoa-monitor-portal/trunk/monitor_dashboard/src/app/home/home.component.html
34 34
         [class.max-width-large]="!grid"
35 35
         class="uk-grid-match uk-grid-small"
36 36
         uk-grid>
37
      <loading *ngIf="loading" [loading]="loading"></loading>
37
      <loading *ngIf="loading"></loading>
38 38
      <ng-template ngFor [ngForOf]="displayDefaultStakeholders" let-stakeholder let-i="index">
39 39
        <div *ngIf="stakeholder">
40 40
          <div class="md-card">
......
85 85
         [class.max-width-large]="!grid"
86 86
         class="uk-grid-match uk-grid-small"
87 87
         uk-grid>
88
      <loading *ngIf="loading" [loading]="loading"></loading>
88
      <loading *ngIf="loading"></loading>
89 89
      <ng-template ngFor [ngForOf]="displayStakeholders" let-stakeholder let-i="index">
90 90
        <a *ngIf="stakeholder" [routerLink]="stakeholder.alias">
91 91
          <div class="md-card">
modules/uoa-monitor-portal/trunk/monitor_dashboard/src/app/utils/indicator-utils.ts
40 40
    ['table', 'table_chart'],
41 41
    ['line', 'show_chart'],
42 42
    ['column', 'bar_chart'],
43
    ['bar', 'bar_chart'],
43
    ['bar', 'notes'],
44 44
    ['other', 'perm_media']
45 45
  ]);
46 46

  
47
  chartTypesIconsClasses: Map<string, string> = new Map([
48
    ['bar', 'rotate-90']
49
  ]);
50

  
51 47
  isPublicIcon: Map<boolean, string> = new Map([
52 48
    [true, 'public'],
53 49
    [false, 'lock']
modules/uoa-monitor-portal/trunk/monitor_dashboard/src/app/library/sharedComponents/input/input.component.ts
1 1
import {Component, Input, OnDestroy, OnInit} from "@angular/core";
2 2
import {Option} from "../../../utils/indicator-utils";
3
import {FormControl} from "@angular/forms";
4
import {HelperFunctions} from "../../../openaireLibrary/utils/HelperFunctions.class";
3 5

  
4 6
@Component({
5 7
  selector: '[dashboard-input]',
......
18 20
  `
19 21
})
20 22
export class InputComponent implements OnInit, OnDestroy {
21
  @Input('formInput') formControl: any;
23
  @Input('formInput') formControl: FormControl;
22 24
  @Input('type') type: string = 'text';
23 25
  @Input('label') label: string;
24 26
  @Input('rows') rows: number = 3;
25 27
  @Input('options') options: Option[];
28
  private initValue: any;
26 29

  
27 30
  constructor() {
28 31
  }
29 32

  
30 33
  ngOnInit(): void {
34
    this.initValue = HelperFunctions.copy(this.formControl.value);
35
    this.formControl.valueChanges.subscribe(value => {
36
      if(this.initValue.toString() === value.toString()) {
37
        this.formControl.markAsPristine();
38
      }
39
    });
31 40
  }
32 41

  
33 42
  ngOnDestroy(): void {
modules/uoa-monitor-portal/trunk/monitor_dashboard/src/app/library/sharedComponents/loading/loading.component.ts
3 3
@Component({
4 4
  selector: 'loading',
5 5
  template: `
6
    <div *ngIf="loading" class="uk-flex uk-flex-center uk-margin-small-top">
7
      <div class="md-preloader" [ngClass]="'md-preloader-' + color">
6
    <div class="uk-flex uk-flex-center uk-margin-small-top">
7
      <div class="md-preloader" [ngClass]="(color)?('md-preloader-' + color):''">
8 8
        <svg xmlns="http://www.w3.org/2000/svg" version="1.1" height="48" width="48" viewBox="0 0 75 75">
9 9
          <circle cx="37.5" cy="37.5" r="33.5" stroke-width="4"></circle>
10 10
        </svg>
......
12 12
    </div>`
13 13
})
14 14
export class LoadingComponent {
15
  @Input()
16
  public loading: boolean = false;
17

  
18 15
  /**
19 16
   * Possible values '': blue, 'success': green, 'warning': orange and 'danger': red
20 17
   */
21
  @Input() color: string = '';
18
  @Input() color: 'success' | 'warning' | 'danger' = null;
22 19

  
23 20
  constructor() {
24 21
  }
modules/uoa-monitor-portal/trunk/monitor_dashboard/src/app/topic/indicators.component.html
119 119
                <ng-template [ngIf]="!grid">
120 120
                  <span *ngFor="let indicatorPath of indicator.indicatorPaths"
121 121
                        class="uk-margin-medium-right uk-text-capitalize uk-flex uk-flex-middle">
122
                    <i class="material-icons md-24 uk-margin-small-right"
123
                       [ngClass]="indicatorUtils.chartTypesIconsClasses.get(indicatorPath.type)">
122
                    <i class="material-icons md-24 uk-margin-small-right">
124 123
                      {{indicatorUtils.chartTypesIcons.get(indicatorPath.type)}}
125 124
                    </i>
126 125
                    {{indicatorPath.type + ' Chart'}}
......
159 158
                <div class="uk-width-1-3 uk-text-center"
160 159
                     [ngClass]="'uk-child-width-1-' + indicator.indicatorPaths.length" uk-grid>
161 160
                  <div *ngFor="let indicatorPath of indicator.indicatorPaths">
162
                    <i class="material-icons md-24"
163
                       [ngClass]="indicatorUtils.chartTypesIconsClasses.get(indicatorPath.type)">
161
                    <i class="material-icons md-24">
164 162
                      {{indicatorUtils.chartTypesIcons.get(indicatorPath.type)}}
165 163
                    </i>
166 164
                    <div class="uk-text-capitalize">{{indicatorPath.type + ' Chart'}}</div>
......
270 268
          </div>
271 269
        </div>
272 270
        <div *ngIf="indicator.indicatorPaths[i].safeResourceUrl" class="uk-margin-medium-top uk-position-relative">
273
          <div *ngIf="!indicatorPath.pristine && !indicatorPath.invalid"
271
          <div *ngIf="hasDifference(i) && !indicatorPath.invalid"
274 272
               class="uk-width-1-1 uk-height-medium refresh-iframe">
275 273
            <div class="uk-position-relative uk-height-1-1">
276
              <div class="uk-position-center md-color-white uk-text-center clickable" (click)="refreshIndicator(i)">
274
              <div class="uk-position-center md-color-white uk-text-center clickable" (click)="refreshIndicator()">
277 275
                <div><i class="material-icons md-color-white">refresh</i></div>
278 276
                <span>Click to refresh the graph view</span>
279 277
              </div>
modules/uoa-monitor-portal/trunk/monitor_dashboard/src/app/topic/indicators.component.ts
407 407
    });
408 408
  }
409 409

  
410
  refreshIndicator(index: number) {
410
  hasDifference(index: number): boolean {
411
    let hasDifference = false;
412
    this.indicatorPaths.at(index).value.parameters.forEach((parameter) => {
413
      if(parameter.value !== this.indicator.indicatorPaths[index].parameters[parameter.key]) {
414
        hasDifference = true;
415
        return;
416
      }
417
    });
418
    return hasDifference;
419
  }
420

  
421
  refreshIndicator() {
411 422
    this.indicator = this.indicatorUtils.generateIndicatorByForm(this.indicatorFb.value, this.indicator.indicatorPaths);
412 423
    this.indicator.indicatorPaths.forEach(indicatorPath => {
413 424
      indicatorPath.safeResourceUrl = this.getUrlByStakeHolder(indicatorPath)
414 425
    });
415
    this.indicatorPaths.at(index).markAsPristine({onlySelf: true});
416 426
  }
417 427

  
418 428
  deleteIndicatorOpen(id: string, type: string = 'chart') {
modules/uoa-monitor-portal/trunk/monitor_dashboard/src/assets/theme-assets/css/themes/my_theme.min.css
1
.app_my_theme .uk-alert{background:#0d47a1}.app_my_theme .md-btn-primary,.app_my_theme .md-btn-primary:active,.app_my_theme .md-btn-primary:focus,.app_my_theme .md-btn-primary:hover{background:#0d47a1;color:#fff}.app_my_theme .md-btn-flat-primary,.app_my_theme .md-btn-flat-primary:active,.app_my_theme .md-btn-flat-primary:focus,.app_my_theme .md-btn-flat-primary:hover{color:#0d47a1}.app_my_theme .md-btn-flat-primary:active,.app_my_theme .md-btn-flat-primary:focus,.app_my_theme .md-btn-flat-primary:hover{background:#85b1f5}.app_my_theme .uk-badge-primary{background:#0d47a1}.app_my_theme .md-card-list-wrapper .md-card-list>ul>li.item-shown.md-card-list-item-selected:before{background:#e8eaf6}.app_my_theme .md-card-list-wrapper .md-card-list .md-card-list-item-selected{background:#e8eaf6}.app_my_theme .md-card-list-wrapper .md-card-list .md-card-list-item-selected.item-shown{background:#fff}.app_my_theme .md-card-list-wrapper .md-card-list .md-card-list-item-selected.item-shown:before{background:#e8eaf6}.app_my_theme .md-fab.md-fab-accent{background:#0d47a1}.app_my_theme .md-list .uk-nestable-list>li.md-list-item-active,.app_my_theme .md-list>li.md-list-item-active{color:#0d47a1}.app_my_theme .md-list-addon>li.md-list-item-active .md-list-addon-element,.app_my_theme .md-list-addon>li.md-list-item-active .md-list-addon-element .material-icons{color:#0d47a1}.app_my_theme .uk-pagination>li>a:hover{background:#5693f1}.app_my_theme .uk-pagination>li.uk-active>a,.app_my_theme .uk-pagination>li.uk-active>span{background:#0d47a1;color:#fff}.app_my_theme .uk-subnav-pill>.uk-active>*{background:#0d47a1}.app_my_theme .uk-tab>li>a:focus,.app_my_theme .uk-tab>li>a:hover{border-bottom-color:#5693f1}.app_my_theme .uk-tab>li.uk-active>a{border-bottom-color:#0d47a1}.app_my_theme .uk-tab-bottom li>a:focus,.app_my_theme .uk-tab-bottom li>a:hover{border-top-color:#5693f1}.app_my_theme .uk-tab-bottom li.uk-active>a{border-top-color:#0d47a1}.app_my_theme .uk-tab-left li>a:focus,.app_my_theme .uk-tab-left li>a:hover{border-right-color:#5693f1}.app_my_theme .uk-tab-left li.uk-active>a{border-right-color:#0d47a1}.app_my_theme .uk-tab-right li>a:focus,.app_my_theme .uk-tab-right li>a:hover{border-left-color:#5693f1}.app_my_theme .uk-tab-right li.uk-active>a{border-left-color:#0d47a1}.app_my_theme .uk-tab-double-header li a:focus,.app_my_theme .uk-tab-double-header li a:hover{border-bottom-color:#115cd0}.app_my_theme .uk-tab-double-header li.uk-active>a{border-bottom-color:#0d47a1}.app_my_theme #header_main{background:#0d47a1}.app_my_theme.header_double_height:after{background:#0d47a1}.app_my_theme #top_bar .top_bar_nav>li>a:hover{-webkit-box-shadow:inset 0 -3px 0 #0d47a1;box-shadow:inset 0 -3px 0 #0d47a1}.app_my_theme #top_bar .top_bar_nav>li.uk-active a{-webkit-box-shadow:inset 0 -3px 0 #0d47a1;box-shadow:inset 0 -3px 0 #0d47a1}.app_my_theme .user_heading{background:#0d47a1}.app_my_theme #sidebar_main .menu_section>ul>li ul li.act_item a{color:#0d47a1}.app_my_theme #sidebar_main .menu_section>ul>li.current_section>a>.menu_icon .material-icons{color:#0d47a1}.app_my_theme #sidebar_main .menu_section>ul>li.current_section>a .menu_title{color:#0d47a1}.app_my_theme.sidebar_mini #sidebar_main .menu_section>ul>li>a>.menu_title{background:#0d47a1;color:#fff}.app_my_theme.sidebar_mini #sidebar_main .menu_section>ul>li:hover.sidebar_submenu{background:#0d47a1}.app_my_theme.sidebar_mini #sidebar_main .menu_section>ul>li:hover.sidebar_submenu>a .menu_icon .material-icons{color:#fff}.app_my_theme.sidebar_mini #sidebar_main .menu_section>ul>li:hover.sidebar_submenu ul{border-left-color:#0d47a1}.app_my_theme.sidebar_mini #sidebar_main .menu_section>ul>li.current_section>a>.menu_icon .material-icons{color:#0d47a1}.app_my_theme .clndr .clndr_days .clndr_days_grid .day.today>span{background:#0d47a1}.app_my_theme .DTTT_print_info h6{color:#0d47a1}.app_my_theme .fc-unthemed .fc-button.fc-state-active:after{color:#0d47a1}.app_my_theme .fc-unthemed .fc-highlight{-webkit-box-shadow:inset 0 0 0 2px #0d47a1,inset 0 -1px 0 2px #0d47a1;box-shadow:inset 0 0 0 2px #0d47a1,inset 0 -1px 0 2px #0d47a1}.app_my_theme .tablesorter-altair tbody>tr.row_highlighted>td{background:#e8eaf6}.app_my_theme .tablesorter-altair .headerSortDown,.app_my_theme .tablesorter-altair .headerSortUp,.app_my_theme .tablesorter-altair .tablesorter-headerAsc,.app_my_theme .tablesorter-altair .tablesorter-headerDesc,.app_my_theme .tablesorter-altair .tablesorter-headerSortDown,.app_my_theme .tablesorter-altair .tablesorter-headerSortUp{color:#0d47a1}.app_my_theme .wizard>.steps{background:#0d47a1}.app_my_theme .wizard>.steps>ul>li.current a,.app_my_theme .wizard>.steps>ul>li.current a:active,.app_my_theme .wizard>.steps>ul>li.current a:hover{background:#115cd0}.app_my_theme .wizard>.steps>ul>li.done a,.app_my_theme .wizard>.steps>ul>li.done a:active,.app_my_theme .wizard>.steps>ul>li.done a:hover{background:#0d47a1}.app_my_theme .md-card-primary{border-left-color:#0d47a1}.app_my_theme .waves-effect.md-btn-flat-primary{background:0 0}.app_my_theme .waves-effect.md-btn-flat-primary .waves-ripple{background:rgba(13,71,161,.4)}.app_my_theme .search_list_link{color:#0d47a1}.app_my_theme .chatbox.cb_active .chatbox_header{background:#0d47a1}.app_my_theme .chatbox_content .chatbox_message.own .chatbox_message_content li>span{background:#0d47a1}.app_my_theme .uk-table tr.row_checked td,.app_my_theme .uk-table-hover tbody tr:hover{background:#e8eaf6}
1
.app_my_theme .uk-alert{background:#0d47a1}.app_my_theme .md-btn-primary,.app_my_theme .md-btn-primary:active,.app_my_theme .md-btn-primary:focus,.app_my_theme .md-btn-primary:hover{background:#0d47a1;color:#fff}.app_my_theme .md-btn-flat-primary,.app_my_theme .md-btn-flat-primary:active,.app_my_theme .md-btn-flat-primary:focus,.app_my_theme .md-btn-flat-primary:hover{color:#0d47a1}.app_my_theme .md-btn-flat-primary:active,.app_my_theme .md-btn-flat-primary:focus,.app_my_theme .md-btn-flat-primary:hover{background:#85b1f5}.app_my_theme .uk-badge-primary{background:#0d47a1}.app_my_theme .md-card-list-wrapper .md-card-list>ul>li.item-shown.md-card-list-item-selected:before{background:#e8eaf6}.app_my_theme .md-card-list-wrapper .md-card-list .md-card-list-item-selected{background:#e8eaf6}.app_my_theme .md-card-list-wrapper .md-card-list .md-card-list-item-selected.item-shown{background:#fff}.app_my_theme .md-card-list-wrapper .md-card-list .md-card-list-item-selected.item-shown:before{background:#e8eaf6}.app_my_theme .md-fab.md-fab-accent{background:#0d47a1}.app_my_theme .md-list .uk-nestable-list>li.md-list-item-active,.app_my_theme .md-list>li.md-list-item-active{color:#0d47a1}.app_my_theme .md-list-addon>li.md-list-item-active .md-list-addon-element,.app_my_theme .md-list-addon>li.md-list-item-active .md-list-addon-element .material-icons{color:#0d47a1}.app_my_theme .uk-pagination>li>a:hover{background:#5693f1}.app_my_theme .uk-pagination>li.uk-active>a,.app_my_theme .uk-pagination>li.uk-active>span{background:#0d47a1;color:#fff}.app_my_theme .uk-subnav-pill>.uk-active>*{background:#0d47a1}.app_my_theme .uk-tab>li>a:focus,.app_my_theme .uk-tab>li>a:hover{border-bottom-color:#5693f1}.app_my_theme .uk-tab>li.uk-active>a{border-bottom-color:#0d47a1}.app_my_theme .uk-tab-bottom li>a:focus,.app_my_theme .uk-tab-bottom li>a:hover{border-top-color:#5693f1}.app_my_theme .uk-tab-bottom li.uk-active>a{border-top-color:#0d47a1}.app_my_theme .uk-tab-left li>a:focus,.app_my_theme .uk-tab-left li>a:hover{border-right-color:#5693f1}.app_my_theme .uk-tab-left li.uk-active>a{border-right-color:#0d47a1}.app_my_theme .uk-tab-right li>a:focus,.app_my_theme .uk-tab-right li>a:hover{border-left-color:#5693f1}.app_my_theme .uk-tab-right li.uk-active>a{border-left-color:#0d47a1}.app_my_theme .uk-tab-double-header li a:focus,.app_my_theme .uk-tab-double-header li a:hover{border-bottom-color:#115cd0}.app_my_theme .uk-tab-double-header li.uk-active>a{border-bottom-color:#0d47a1}.app_my_theme #header_main{background:#0d47a1}.app_my_theme.header_double_height:after{background:#0d47a1}.app_my_theme #top_bar .top_bar_nav>li>a:hover{-webkit-box-shadow:inset 0 -3px 0 #0d47a1;box-shadow:inset 0 -3px 0 #0d47a1}.app_my_theme #top_bar .top_bar_nav>li.uk-active a{-webkit-box-shadow:inset 0 -3px 0 #0d47a1;box-shadow:inset 0 -3px 0 #0d47a1}.app_my_theme .user_heading{background:#0d47a1}.app_my_theme #sidebar_main .menu_section>ul>li ul li.act_item a{color:#0d47a1}.app_my_theme #sidebar_main .menu_section>ul>li.current_section>a>.menu_icon .material-icons{color:#0d47a1}.app_my_theme #sidebar_main .menu_section>ul>li.current_section>a .menu_title{color:#0d47a1}.app_my_theme.sidebar_mini #sidebar_main .menu_section>ul>li>a>.menu_title{background:#0d47a1;color:#fff}.app_my_theme.sidebar_mini #sidebar_main .menu_section>ul>li:hover.sidebar_submenu{background:#0d47a1}.app_my_theme.sidebar_mini #sidebar_main .menu_section>ul>li:hover.sidebar_submenu>a .menu_icon .material-icons{color:#fff}.app_my_theme.sidebar_mini #sidebar_main .menu_section>ul>li:hover.sidebar_submenu ul{border-left-color:#0d47a1}.app_my_theme.sidebar_mini #sidebar_main .menu_section>ul>li.current_section>a>.menu_icon .material-icons{color:#0d47a1}.app_my_theme .clndr .clndr_days .clndr_days_grid .day.today>span{background:#0d47a1}.app_my_theme .DTTT_print_info h6{color:#0d47a1}.app_my_theme .fc-unthemed .fc-button.fc-state-active:after{color:#0d47a1}.app_my_theme .fc-unthemed .fc-highlight{-webkit-box-shadow:inset 0 0 0 2px #0d47a1,inset 0 -1px 0 2px #0d47a1;box-shadow:inset 0 0 0 2px #0d47a1,inset 0 -1px 0 2px #0d47a1}.app_my_theme .tablesorter-altair tbody>tr.row_highlighted>td{background:#e8eaf6}.app_my_theme .tablesorter-altair .headerSortDown,.app_my_theme .tablesorter-altair .headerSortUp,.app_my_theme .tablesorter-altair .tablesorter-headerAsc,.app_my_theme .tablesorter-altair .tablesorter-headerDesc,.app_my_theme .tablesorter-altair .tablesorter-headerSortDown,.app_my_theme .tablesorter-altair .tablesorter-headerSortUp{color:#0d47a1}.app_my_theme .wizard>.steps{background:#0d47a1}.app_my_theme .wizard>.steps>ul>li.current a,.app_my_theme .wizard>.steps>ul>li.current a:active,.app_my_theme .wizard>.steps>ul>li.current a:hover{background:#115cd0}.app_my_theme .wizard>.steps>ul>li.done a,.app_my_theme .wizard>.steps>ul>li.done a:active,.app_my_theme .wizard>.steps>ul>li.done a:hover{background:#0d47a1}.app_my_theme .md-card-primary{border-left-color:#0d47a1}.app_my_theme .md-preloader:not(.md-preloader-success):not(.md-preloader-warning):not(.md-preloader-danger) svg circle{stroke:#0d47a1}.app_my_theme .waves-effect.md-btn-flat-primary{background:0 0}.app_my_theme .waves-effect.md-btn-flat-primary .waves-ripple{background:rgba(13,71,161,.4)}.app_my_theme .search_list_link{color:#0d47a1}.app_my_theme .chatbox.cb_active .chatbox_header{background:#0d47a1}.app_my_theme .chatbox_content .chatbox_message.own .chatbox_message_content li>span{background:#0d47a1}.app_my_theme .uk-table tr.row_checked td,.app_my_theme .uk-table-hover tbody tr:hover{background:#e8eaf6}
modules/uoa-monitor-portal/trunk/monitor_dashboard/src/assets/theme-assets/css/themes/my_theme.css
173 173
.app_my_theme .md-card-primary {
174 174
  border-left-color: #0d47a1;
175 175
}
176
.app_my_theme .md-preloader:not(.md-preloader-success):not(.md-preloader-warning):not(.md-preloader-danger) svg circle {
177
  stroke: #0d47a1;
178
}
176 179
.app_my_theme .waves-effect.md-btn-flat-primary {
177 180
  background: none;
178 181
}

Also available in: Unified diff