Project

General

Profile

« Previous | Next » 

Revision 59163

[Trunk | Library]:
1. cache-interceptor.service.ts: Added query for refine projects with hidden filters as cachable (to be removed when bug with hidden filters is solved).
2. searchResearchResults.component.ts & searchProjects.component.ts & searchDataProviders.component.ts & searchOrganizations.component.ts:
a. [Bug fix - r59155] Update checks for refine query - Do not call refine query when page, results per page, sortBy change.
b. Set refineStatus to DONE when no refine query.
c. Set new field "searchPage.hideFilters" to false when results return - used only for 1st load (do not show filters, until results return).
3. newSearchPage.component:
a. Show "Filters" label always.
b. Check if there are filters with method "get existingFiltersWithValues()" instead of "filters.length" (cases where filters > 0, but values = 0).
c. Show filters column when "!hideFilters" and there are filters (refine or selected) or when there are results.
d. Add in url parameters for "page" and "resultsPerPageChanged" even when they are set to default value (need to separate navigation via menu with no params).
4. searchFilter.component.html: Add "<ng-template #input_label>" for checkboxes and radio buttons in filters (used also in view all part).

View differences:

modules/uoa-services-library/trunk/ng-openaire-library/src/app/cache-interceptor.service.ts
8 8
})
9 9
export class CacheInterceptorService implements HttpInterceptor {
10 10
  cachingRequests = [
11
    // Remove 2 following lines when bug with hidden refine filters is solved.
11 12
    "/resources2/?format=json&refine=true&fields=resultbestaccessright&fields=relfunder&fields=relfundinglevel0_id&fields=relproject&fields=instancetypename&fields=resultlanguagename&fields=community&fields=resulthostingdatasource&&fq=resultbestaccessright exact \"Open Access\"&type=results&page=0&size=0",
13
    "/resources2/?format=json&refine=true&fields=funder&fields=fundinglevel0_id&fields=projectstartyear&fields=projectendyear&fields=projectecsc39&&type=projects&page=0&size=0",
14

  
12 15
    "/resources2/?format=json&refine=true&fields=resultbestaccessright&fields=relfunder&fields=instancetypename&fields=resultlanguagename&fields=community&fields=resulthostingdatasource&&type=results&page=0&size=0",
13 16
    "/resources2/?format=json&refine=true&fields=resultbestaccessright&fields=relfunder&fields=relfundinglevel0_id&fields=relproject&fields=instancetypename&fields=resultlanguagename&fields=community&fields=resulthostingdatasource&&fq=resultbestaccessright%20exact%20%22Open%20Access%22&fq=relfunder%20exact%20%22ec__________%3A%3AEC%7C%7CEuropean%20Commission%7C%7CEC%22&type=results&page=0&size=0",
14 17

  
modules/uoa-services-library/trunk/ng-openaire-library/src/app/searchPages/searchDataProviders.component.ts
120 120
       this.oldTotalResults = this.searchUtils.totalResults;
121 121
     }
122 122
     var refine = true;
123
     if (
124
       (this.searchUtils.page != ((params['page'] === undefined) ? 1 : +params['page'])
125
         && (this.searchUtils.page == 1 || params['page']))
126
       && this.filters && !firstLoad
127
     ) {
128
       refine = false;
129
     }
130
      if (
131
        (
132
          this.searchUtils.size != ((params['size'] === undefined) ? 10 : +params['size'])
133
          && (this.searchUtils.size == 10 || params['size'])
134
        )
135
        && this.filters && !firstLoad) {
123
      if (params['page'] != undefined && this.filters && !firstLoad && this.searchUtils.page != +params['page']) {
136 124
        refine = false;
137
        this.searchUtils.status = this.errorCodes.DONE;
138 125
      }
139 126

  
140
    let page = (params['page']=== undefined)?0:+params['page'];
141
    this.searchUtils.page = ( page < 1 ) ? 1 : page;
127
      if (params['size'] != undefined && this.filters && !firstLoad && this.searchUtils.size != params['size']) {
128
        refine = false;
129
      }
142 130

  
143
    this.searchUtils.size = (params['size']=== undefined)?10:+params['size'];
144
    if(this.searchUtils.size != 5 && this.searchUtils.size != 10 && this.searchUtils.size != 20 && this.searchUtils.size != 50) {
145
      this.searchUtils.size = 10;
146
    }
131
      let page = (params['page']=== undefined)?0:+params['page'];
132
      this.searchUtils.page = ( page < 1 ) ? 1 : page;
147 133

  
148
    this.searchPage.fieldIds = this.fieldIds;
149
    this.selectedFields =[];
150
    if(this.type == "deposit"){
151
      this.searchPage.keywordFields = this.searchFields.DEPOSIT_DATASOURCE_KEYWORD_FIELDS;
152
      this.searchPage.usedBy = "deposit";
153
    }
154
    // console.log(this.refineFields)
155
    this.searchPage.prepareSearchPage(this.fieldIds, this.selectedFields, this.refineFields, [], this.fieldIdsMap,this.customFilter,params, "dataprovider");
156
    if(refine && (this.type == "all" || this.type == "deposit")) {
157
      this._getFilters(this.searchPage.getSearchAPIQueryForAdvancedSearhFields(), this.searchUtils.page, 0, true, this.searchPage.getSearchAPIQueryForRefineFields(params, firstLoad));
158
    } else if(refine) { // static filters
159
      this.searchUtils.refineStatus = this.errorCodes.LOADING;
160
    }
161
    this.getResults(this.searchPage.getSearchAPIQueryForAdvancedSearhFields(),  this.searchUtils.page, this.searchUtils.size, refine, this.searchPage.getSearchAPIQueryForRefineFields(params, firstLoad));
162
    firstLoad = false;
134
      this.searchUtils.size = (params['size']=== undefined)?10:+params['size'];
135
      if(this.searchUtils.size != 5 && this.searchUtils.size != 10 && this.searchUtils.size != 20 && this.searchUtils.size != 50) {
136
        this.searchUtils.size = 10;
137
      }
138

  
139
      this.searchPage.fieldIds = this.fieldIds;
140
      this.selectedFields =[];
141
      if(this.type == "deposit"){
142
        this.searchPage.keywordFields = this.searchFields.DEPOSIT_DATASOURCE_KEYWORD_FIELDS;
143
        this.searchPage.usedBy = "deposit";
144
      }
145
      // console.log(this.refineFields)
146
      this.searchPage.prepareSearchPage(this.fieldIds, this.selectedFields, this.refineFields, [], this.fieldIdsMap,this.customFilter,params, "dataprovider");
147
      if(refine && (this.type == "all" || this.type == "deposit")) {
148
        this._getFilters(this.searchPage.getSearchAPIQueryForAdvancedSearhFields(), this.searchUtils.page, 0, true, this.searchPage.getSearchAPIQueryForRefineFields(params, firstLoad));
149
      } else if(refine) { // static filters
150
        this.searchUtils.refineStatus = this.errorCodes.LOADING;
151
      } else {
152
        this.searchUtils.refineStatus = this.errorCodes.DONE;
153
      }
154
      this.getResults(this.searchPage.getSearchAPIQueryForAdvancedSearhFields(),  this.searchUtils.page, this.searchUtils.size, refine, this.searchPage.getSearchAPIQueryForRefineFields(params, firstLoad));
155
      firstLoad = false;
163 156
    }));
164 157
  }
165 158
  ngOnDestroy() {
......
244 237
             this.filters = this.searchPage.prepareFiltersToShow(this.filters, this.searchUtils.totalResults);
245 238
             this.searchUtils.refineStatus = this.errorCodes.DONE;
246 239
           }
247
            // this.searchPage.updateBaseUrlWithParameters();
240

  
241
          this.searchPage.hideFilters = false;
242

  
243
          // this.searchPage.updateBaseUrlWithParameters();
248 244
            //var errorCodes:ErrorCodes = new ErrorCodes();
249 245
            this.searchUtils.status = this.errorCodes.DONE;
250 246
            if(this.searchUtils.totalResults == 0 ){
......
287 283
              //this.searchPage.closeLoading();
288 284
              this.disableForms = false;
289 285
            this.searchPageUpdates.emit({disableForms: this.disableForms, disableRefineForms: this.disableRefineForms, searchUtils: this.searchUtils});
290

  
286
            this.searchPage.hideFilters = false;
291 287
          }
292 288
        ));
293 289
      }
modules/uoa-services-library/trunk/ng-openaire-library/src/app/searchPages/searchOrganizations.component.ts
110 110
        this.oldTotalResults = this.searchUtils.totalResults;
111 111
      }
112 112
      var refine = true;
113
      if (
114
        (
115
          this.searchUtils.page != ((params['page'] === undefined) ? 1 : +params['page'])
116
          && (this.searchUtils.page == 1 || params['page'])
117
        )
118
        && this.filters && !firstLoad) {
113
      if (params['page'] != undefined && this.filters && !firstLoad && this.searchUtils.page != +params['page']) {
119 114
        refine = false;
120 115
      }
121 116

  
122
      if (
123
        (
124
          this.searchUtils.size != ((params['size'] === undefined) ? 10 : +params['size'])
125
          && (this.searchUtils.size == 10 || params['size'])
126
        )
127
        && this.filters && !firstLoad) {
117
      if (params['size'] != undefined && this.filters && !firstLoad && this.searchUtils.size != params['size']) {
128 118
        refine = false;
129
        this.searchUtils.status = this.errorCodes.DONE;
130 119
      }
131 120

  
132 121
      let page = (params['page']=== undefined)?1:+params['page'];
......
146 135
      this.searchPage.prepareSearchPage(this.fieldIds, this.selectedFields, this.refineFields, [], this.fieldIdsMap,this.customFilter,params, "organization");
147 136
      if(refine) {
148 137
        this._getFilters(this.searchPage.getSearchAPIQueryForAdvancedSearhFields(),  this.searchUtils.page, 0, true, this.searchPage.getSearchAPIQueryForRefineFields(params, firstLoad));
138
      } else {
139
        this.searchUtils.refineStatus = this.errorCodes.DONE;
149 140
      }
150 141
      this.getResults(this.searchPage.getSearchAPIQueryForAdvancedSearhFields(),  this.searchUtils.page, this.searchUtils.size, refine, this.searchPage.getSearchAPIQueryForRefineFields(params, firstLoad));
151 142
      firstLoad = false;
......
223 214
          if(!refine) {
224 215
            this.searchPage.buildPageURLParameters(this.filters, [],false);
225 216
          }
226
            // this.searchPage.updateBaseUrlWithParameters();
217

  
218
          this.searchPage.hideFilters = false;
219

  
220
          // this.searchPage.updateBaseUrlWithParameters();
227 221
            //var errorCodes:ErrorCodes = new ErrorCodes();
228 222
            this.searchUtils.status = this.errorCodes.DONE;
229 223
            if(this.searchUtils.totalResults == 0 ){
......
267 261
            //this.searchPage.closeLoading();
268 262
            this.disableForms = false;
269 263
          this.searchPageUpdates.emit({disableForms: this.disableForms, disableRefineForms: this.disableRefineForms, searchUtils: this.searchUtils});
270

  
264
          this.searchPage.hideFilters = false;
271 265
        }
272 266
      ));
273 267
    }
modules/uoa-services-library/trunk/ng-openaire-library/src/app/searchPages/searchProjects.component.ts
113 113
        this.oldTotalResults = this.searchUtils.totalResults;
114 114
      }
115 115
      var refine = true;
116
      if (
117
        (
118
          this.searchUtils.page != ((params['page'] === undefined) ? 1 : +params['page'])
119
          && (this.searchUtils.page == 1 || params['page'])
120
        )
121
        && this.filters && !firstLoad
122
      ) {
116
      if (params['page'] != undefined && this.filters && !firstLoad && this.searchUtils.page != +params['page']) {
123 117
        refine = false;
124
        this.searchUtils.status = this.errorCodes.DONE;
125 118
      }
126 119

  
127
      if (
128
        (
129
          this.searchUtils.sortBy != ((params['sortBy'] === undefined) ? "" : params['sortBy'])
130
          && (this.searchUtils.sortBy == "" || params['sortBy'])
131
        )
132
        && this.filters && !firstLoad
133
      ) {
120
      if (params['size'] != undefined && this.filters && !firstLoad && this.searchUtils.size != params['size']) {
134 121
        refine = false;
135

  
136
        this.searchUtils.status = this.errorCodes.DONE;
137 122
      }
138 123

  
139
      if (
140
        (
141
          this.searchUtils.size != ((params['size'] === undefined) ? 10 : +params['size'])
142
          && (this.searchUtils.size == 10 || params['size'])
143
        )
144
        && this.filters && !firstLoad
145
      ) {
146
        refine = false;
147
        this.searchUtils.status = this.errorCodes.DONE;
148
      }
149

  
150 124
      let page = (params['page']=== undefined)?1:+params['page'];
151 125
      this.searchUtils.page = ( page <= 0 ) ? 1 : page;
152 126

  
......
160 134
      this.searchPage.prepareSearchPage(this.fieldIds, this.selectedFields, this.refineFields, this.rangeFields, this.fieldIdsMap,this.customFilter,params, "project");
161 135
      if(refine) {
162 136
        this._getFilters(this.searchPage.getSearchAPIQueryForAdvancedSearhFields(), this.searchUtils.page, 0, "", true, this.searchPage.getSearchAPIQueryForRangeFields(params)+this.searchPage.getSearchAPIQueryForRefineFields(params, firstLoad));
137
      } else {
138
        this.searchUtils.refineStatus = this.errorCodes.DONE;
163 139
      }
164 140
      this.getResults(this.searchPage.getSearchAPIQueryForAdvancedSearhFields(),  this.searchUtils.page, this.searchUtils.size, refine, this.searchPage.getSearchAPIQueryForRangeFields(params)+this.searchPage.getSearchAPIQueryForRefineFields(params, firstLoad));
165 141
      firstLoad = false;
......
242 218
                this.searchPage.buildPageURLParameters(this.filters, this.rangeFilters, false);
243 219
              }
244 220

  
221
            this.searchPage.hideFilters = false;
222

  
245 223
            //var errorCodes:ErrorCodes = new ErrorCodes();
246 224
              this.searchUtils.status = this.errorCodes.DONE;
247 225
              if(this.searchUtils.totalResults == 0 ){
......
285 263
              //this.searchPage.closeLoading();
286 264
              this.disableForms = false;
287 265
            this.searchPageUpdates.emit({disableForms: this.disableForms, disableRefineForms: this.disableRefineForms, searchUtils: this.searchUtils})
288

  
266
            this.searchPage.hideFilters = false;
289 267
          }
290 268
      ));
291 269
    }
modules/uoa-services-library/trunk/ng-openaire-library/src/app/searchPages/searchUtils/searchFilter.component.html
9 9
    <div  aria-expanded="false">
10 10
      <div>
11 11
        <ng-container>
12
<!--          <div *ngFor = "let value of getSelectedValues(filter,'num')"  class="uk-animation-fade filterItem searchFilterItem uk-text-small">-->
13
<!--                <div title = "{{value.name}}">-->
14
<!--                  <ng-container *ngIf="filter.filterType == 'checkbox' || filter.filterType == 'radio'">-->
15
<!--                    <input *ngIf="filter.filterType == 'checkbox'" [(ngModel)]="value.selected" type="checkbox" (ngModelChange)="filterChange(value.selected)" />-->
16
<!--                    <input *ngIf="filter.filterType == 'radio'" type="radio" (click)="uniqueFilterChange(value)"-->
17
<!--                           [name]=filter.filterId checked/>-->
18
<!--                    {{' '+_formatName(value)}}-->
19
<!--                    <span *ngIf = "showResultCount === true" >-->
20
<!--                      {{' ('+(value.number|number)+')'}}</span>-->
21
<!--                  </ng-container>-->
22
<!--                </div>-->
23
<!--          </div>-->
24

  
25
<!--          <div *ngFor = "let value of getNotSelectedValues(filter,'num').slice(0,(!addShowMore?getNotSelectedValues(filter,'num').length:filterValuesNum-getSelectedValues(filter,'num').length))" class = "uk-animation-fade filterItem searchFilterItem uk-text-small">-->
26
<!--                <div title = "{{value.name}}" [class]="(isDisabled || (showResultCount && value.number === 0))?'uk-text-muted':''" >-->
27
<!--                  <input *ngIf="filter.filterType == 'checkbox'" [disabled]="isDisabled || (showResultCount && value.number === 0)" [(ngModel)]="value.selected" type="checkbox" (ngModelChange)="filterChange(value.selected)" />-->
28
<!--                  <input *ngIf="filter.filterType == 'radio'" [disabled]="isDisabled || (showResultCount && value.number === 0)" type="radio" (click)="uniqueFilterChange(value)"-->
29
<!--                         [name]=filter.filterId value=false  />-->
30
<!--                  {{' '+ _formatName(value) }}-->
31
<!--                  <span *ngIf = "showResultCount === true" [class]="(isDisabled || value.number === 0)?'uk-text-muted':''" >-->
32
<!--                   {{' ('+(value.number|number)+')'}}-->
33
<!--                  </span>-->
34
<!--                </div>-->
35
<!--          </div>-->
36

  
37 12
          <div *ngFor="let value of getSelectedAndTopValues(filter, filterValuesNum)"
38 13
               class="uk-animation-fade filterItem searchFilterItem uk-text-small">
39 14
            <div title = "{{value.name}}">
40
              <label *ngIf="filter.filterType == 'checkbox' || filter.filterType == 'radio'"
41
                     [class]="(isDisabled || (showResultCount && value.number === 0)) ? 'uk-disabled' : ''">
42
<!--                [disabled]="isDisabled || (showResultCount && value.number === 0)"-->
43
                <input *ngIf="filter.filterType == 'checkbox'" type="checkbox" class="uk-checkbox"
44
                       [(ngModel)]="value.selected" (ngModelChange)="filterChange(value.selected)" />
45
                <input *ngIf="filter.filterType == 'radio'" type="radio" class="uk-radio"
46
                       [name]="filter.filterId"  [value]="value.id" [(ngModel)]="filter.radioValue"
47
                       (ngModelChange)="uniqueFilterChange(value)"/>
48
                {{' '+_formatName(value)}}
49
                <span *ngIf = "showResultCount === true" >
50
                  {{' ('+(value.number|number)+')'}}
51
                </span>
52
              </label>
15
              <ng-container *ngTemplateOutlet="input_label; context: {filter: filter, value: value}"></ng-container>
53 16
            </div>
54 17
          </div>
55 18
        </ng-container>
......
93 56

  
94 57
            <div   class="uk-overflow-auto uk-height-max-small uk-padding-remove
95 58
                      uk-margin-small-left uk-margin-small-right uk-margin-small-top uk-width-1-1">
96
<!--              <ng-container *ngFor = "let value of getSelectedValues(filter, sortBy)">-->
97
<!--                <div *ngIf="filterKeywords(value.name)"  class = "uk-animation-fade filterItem searchFilterItem">-->
98

  
99
<!--                      <div title = "{{value.name}}">-->
100
<!--                        <input *ngIf="filter.filterType == 'checkbox'" [disabled]="isDisabled" [(ngModel)]="value.selected" type="checkbox" (ngModelChange)="filterChange(value.selected)" />-->
101
<!--                        <input *ngIf="filter.filterType == 'radio'" [disabled]="isDisabled" type="radio" (click)="uniqueFilterChange(value)"-->
102
<!--                               [name]=filter.filterId checked/>-->
103
<!--                        {{' ' + _formatName(value) + ' '}}-->
104
<!--                        <span class="filterNumber" *ngIf = "showResultCount === true" > ({{value.number|number}})</span>-->
105
<!--                      </div>-->
106

  
107
<!--                </div>-->
108
<!--              </ng-container>-->
109

  
110
<!--              <ng-container *ngFor = "let value of getNotSelectedValues(filter, sortBy)">-->
111
<!--                <div *ngIf="filterKeywords(value.name)"  class = "uk-animation-fade filterItem searchFilterItem">-->
112

  
113
<!--                      <div title = "{{value.name}}">-->
114
<!--                        <input *ngIf="filter.filterType == 'checkbox'" [disabled]="isDisabled" [(ngModel)]="value.selected" type="checkbox" (ngModelChange)="filterChange(value.selected)" />-->
115
<!--                        <input *ngIf="filter.filterType == 'radio'" [disabled]="isDisabled" type="radio" (click)="uniqueFilterChange(value)"-->
116
<!--                               [name]=filter.filterId value=false  />-->
117
<!--                        {{' ' + _formatName(value) + ' '}}-->
118
<!--                        <span   *ngIf = "showResultCount === true" > ({{value.number|number}})</span>-->
119
<!--                      </div>-->
120
<!--                </div>-->
121
<!--              </ng-container>-->
122 59
              <ng-container *ngFor="let value of sort(filter.values)">
123 60
                <div *ngIf="filterKeywords(value.name)" title = "{{value.name}}"
124 61
                     class="uk-animation-fade filterItem searchFilterItem uk-text-small">
125
                  <label *ngIf="filter.filterType == 'checkbox' || filter.filterType == 'radio'">
126
                    <input *ngIf="filter.filterType == 'checkbox'" type="checkbox" class="uk-checkbox"
127
                           [(ngModel)]="value.selected" (ngModelChange)="filterChange(value.selected)" />
128
                    <input *ngIf="filter.filterType == 'radio'" type="radio" class="uk-radio"
129
                           [disabled]="isDisabled || (showResultCount && value.number === 0)"
130
                           [name]="value.id"  [value]="true" [(ngModel)]="value.selected" (click)="uniqueFilterChange(value)"/>
131
                    {{' '+_formatName(value)}}
132
                    <span *ngIf = "showResultCount === true" >
133
                      {{' ('+(value.number|number)+')'}}</span>
134
                  </label>
62
                  <ng-container *ngTemplateOutlet="input_label; context: {filter: filter, value: value}"></ng-container>
135 63
                </div>
136 64
              </ng-container>
137 65
            </div>
......
144 72
   </div>
145 73
  </div>
146 74
</div>
75

  
76
<ng-template #input_label let-filter="filter" let-value="value">
77
  <label *ngIf="filter.filterType == 'checkbox' || filter.filterType == 'radio'"
78
         [class]="(isDisabled || (showResultCount && value.number === 0)) ? 'uk-disabled' : ''">
79
    <input *ngIf="filter.filterType == 'checkbox'" type="checkbox" class="uk-checkbox"
80
           [disabled]="isDisabled || (showResultCount && value.number === 0)"
81
           [(ngModel)]="value.selected" (ngModelChange)="filterChange(value.selected)" />
82
    <input *ngIf="filter.filterType == 'radio'" type="radio" class="uk-radio"
83
           [disabled]="isDisabled || (showResultCount && value.number === 0)"
84
           [name]="filter.filterId" [value]="value.id" [(ngModel)]="filter.radioValue"
85
           (ngModelChange)="uniqueFilterChange(value)"/>
86
    {{' '+_formatName(value)}}
87
    <span *ngIf = "showResultCount === true" >
88
      {{' ('+(value.number|number)+')'}}
89
    </span>
90
  </label>
91
</ng-template>
modules/uoa-services-library/trunk/ng-openaire-library/src/app/searchPages/searchUtils/newSearchPage.component.html
83 83
<ng-template #filters_column>
84 84
  <div class="uk-width-1-1 uk-margin-top">
85 85
    <div class="uk-grid uk-flex uk-flex-bottom">
86
      <h5 *ngIf="(selectedRangeFilters+selectedFilters + selectedTypesNum  > 0) || (filters.length > 0 && (results.length > 0 || disableForms))"
87
          class="uk-text-bold">
86
<!--      *ngIf="(selectedRangeFilters+selectedFilters + selectedTypesNum  > 0)
87
|| (filters.length > 0 && (results.length > 0 || disableForms))"-->
88
      <h5 class="uk-text-bold">
88 89
        Filters
89 90
      </h5>
90 91
      <a *ngIf="(selectedRangeFilters+selectedFilters + selectedTypesNum)>1" (click)="clearFilters()"
......
97 98
      <ng-container *ngTemplateOutlet="selected_filters_pills; context: {}"></ng-container>
98 99
    </div>
99 100
  </div>
100
  <div *ngIf="searchUtils.refineStatus == errorCodes.LOADING && filters.length === 0"
101
  <div *ngIf="searchUtils.refineStatus == errorCodes.LOADING && existingFiltersWithValues === 0"
101 102
       class="'uk-animation-fade uk-margin-top  uk-width-1-1" role="alert">
102 103
    <span class="loading-gif  uk-align-center" ></span>
103 104
  </div>
104

  
105
  <div *ngIf="searchUtils.refineStatus == errorCodes.DONE && filters.length === 0 && results.length > 0" class="uk-margin-top">
105
  <div *ngIf="searchUtils.refineStatus != errorCodes.LOADING && existingFiltersWithValues === 0 && results.length > 0" class="uk-margin-top">
106 106
    <span class="uk-text-meta">No filters available</span>
107 107
  </div>
108 108
  <ul *ngIf="!showUnknownFilters"
......
260 260

  
261 261
          </div>
262 262
          <div class="uk-grid helper-grid uk-padding-small uk-padding-remove-vertical uk-margin-large-bottom">
263
<!--            && searchUtils.refineStatus == errorCodes.LOADING-->
264
            <div *ngIf="searchUtils.status == errorCodes.LOADING && filters.length == 0;
265
                        else elseGridBlock"
266
                 class="'uk-animation-fade uk-margin-top  uk-width-1-1" role="alert">
267
              <span class="loading-gif  uk-align-center" ></span>
268
            </div>
269
            <div>
270
              <ng-template #elseGridBlock>
271

  
272
                <div *ngIf="showRefine && !properties.isDashboard" class="uk-width-1-4@m search-filters uk-visible@m">
263
<!--            <div *ngIf="searchUtils.status == errorCodes.LOADING && filters.length == 0;-->
264
<!--                        else elseGridBlock"-->
265
<!--                 class="'uk-animation-fade uk-margin-top  uk-width-1-1" role="alert">-->
266
<!--              <span class="loading-gif  uk-align-center" ></span>-->
267
<!--            </div>-->
268
<!--            <div>-->
269
<!--              <ng-template #elseGridBlock>-->
270
                <div *ngIf="showRefine && !properties.isDashboard
271
                            && (results.length > 0
272
                              || (!hideFilters &&
273
                                (existingFiltersWithValues > 0 || (selectedRangeFilters + selectedFilters + selectedTypesNum) > 0)
274
                              )
275
                            )"
276
                     class="uk-width-1-4@m search-filters uk-visible@m">
273 277
                  <ng-container *ngTemplateOutlet="filters_column; context: {}"></ng-container>
274 278
                </div>
275 279
                <div class="uk-width-expand@m uk-with-1-1@s">
......
381 385
                      Last index information
382 386
                    </a>
383 387
                  </div>
384
              </ng-template>
388
<!--              </ng-template>-->
385 389
            <!--            <div class="uk-visible@m uk-margin-top uk-width-1-5">-->
386 390
            <!--              <search-download [type]="csvPath" [csvParams]="csvParams" [totalResults]="searchUtils.totalResults" ></search-download>-->
387 391
            <!--            </div>-->
388 392
            <!-- <helper *ngIf="searchUtils.totalResults > csvLimit" class="uk-margin-top helper-left-right uk-visible@m" position="right"></helper> -->
389
            </div>
393
<!--            </div>-->
390 394

  
391 395
            <helper *ngIf="pageContents && pageContents['bottom'] && pageContents['bottom'].length > 0"
392 396
                  [texts]="pageContents['bottom']"></helper>
......
420 424
    </div>
421 425
  </div>
422 426
</div>
427
</div>
modules/uoa-services-library/trunk/ng-openaire-library/src/app/searchPages/searchUtils/newSearchPage.component.ts
30 30
})
31 31
export class NewSearchPageComponent {
32 32
  @ViewChild('offcanvas_element') offcanvasElement: ElementRef;
33

  
34 33
  @Input() piwikSiteId = null;
35 34
  @Input() hasPrefix: boolean = true;
36 35
  @Input() pageTitle = "";
......
108 107
  @Input() entitiesSelection:boolean = true;
109 108
  @Input() showAdvancedSearchLink:boolean = true;
110 109

  
110
  // on 1st load, do not show filters until results query returns.
111
  public hideFilters: boolean = true;
112

  
111 113
  //Dashboard
112 114
  filterToggle = false;
113 115
  customFilterEnabled:boolean =  false;
......
485 487
    return this.rangeFilters;
486 488
  }
487 489

  
490
  get existingFiltersWithValues() {
491
    if(this.filters.length == 0) {
492
      return 0;
493
    }
494
    return this.filters.some(filter => (filter.values && filter.values.length > 0));
495
  }
496

  
488 497
  /*
489 498
  * For Funder filters - if funder selected
490 499
  */
......
1165 1174
        this.parameterValues.push(StringUtils.URIEncode(this.selectedFields[i].value));
1166 1175
      }
1167 1176
    }
1168
    if (includePage && this.searchUtils.page != 1) {
1177
    if (includePage) {
1169 1178
      this.parameterNames.push("page");
1170 1179
      this.parameterValues.push("" + this.searchUtils.page);
1171 1180
    }
1172 1181

  
1173 1182
    //if (this.searchUtils.size != this.resultsPerPage) {
1174
    if (this.resultsPerPageChanged && this.resultsPerPageChanged != this.resultsPerPage) {
1183
    if (this.resultsPerPageChanged) {
1175 1184
      this.parameterNames.push("size");
1176 1185
      //this.parameterValues.push("" + this.searchUtils.size);
1177 1186
      this.parameterValues.push("" + this.resultsPerPageChanged);
modules/uoa-services-library/trunk/ng-openaire-library/src/app/searchPages/searchResearchResults.component.ts
118 118
        this.oldTotalResults = this.searchUtils.totalResults;
119 119
      }
120 120
      var refine = true;
121
      if (
122
        (
123
          this.searchUtils.page != ((params['page'] === undefined) ? 1 : +params['page'])
124
          && (this.searchUtils.page == 1 || params['page'])
125
        )
126
        && this.filters && !firstLoad
127
      ) {
121
      if (params['page'] != undefined && this.filters && !firstLoad && this.searchUtils.page != +params['page']) {
128 122
        refine = false;
129
        this.searchUtils.status = this.errorCodes.DONE;
130 123
      }
131 124

  
132
      if (
133
        (
134
          this.searchUtils.sortBy != ((params['sortBy'] === undefined) ? "" : params['sortBy'])
135
          && (this.searchUtils.sortBy == "" || params['sortBy'])
136
        )
137
        && this.filters && !firstLoad
138
      ) {
125
      if (params['sortBy'] != undefined && this.filters && !firstLoad && this.searchUtils.sortBy != params['sortBy']) {
139 126
        refine = false;
140
        this.searchUtils.status = this.errorCodes.DONE;
141 127
      }
142 128

  
143
      if (
144
        (
145
          this.searchUtils.size != ((params['size'] === undefined) ? 10 : +params['size'])
146
          && (this.searchUtils.size == 10 || params['size'])
147
        )
148
        && this.filters && !firstLoad
149
      ) {
129
      if (params['size'] != undefined && this.filters && !firstLoad && this.searchUtils.size != params['size']) {
150 130
        refine = false;
151
        this.searchUtils.status = this.errorCodes.DONE;
152 131
      }
153 132

  
154 133
      let page = (params['page'] === undefined) ? 1 : +params['page'];
......
167 146
      this.searchPage.prepareSearchPage(this.fieldIds, this.selectedFields, this.refineFields, this.rangeFields, this.fieldIdsMap,this.customFilter,params, this.resultType, this.quickFilter);
168 147
      if(refine) {
169 148
        this._getFilters(this.searchPage.getSearchAPIQueryForAdvancedSearhFields(), this.searchUtils.page, 0, "", true, this.searchPage.getSearchAPIQueryForRangeFields(params)+this.searchPage.getSearchAPIQueryForRefineFields(params, firstLoad));
149
      } else {
150
        this.searchUtils.refineStatus = this.errorCodes.DONE;
170 151
      }
171 152
      this._getResults(this.searchPage.getSearchAPIQueryForAdvancedSearhFields(), this.searchUtils.page, this.searchUtils.size, this.searchUtils.sortBy, refine, this.searchPage.getSearchAPIQueryForRangeFields(params) + this.searchPage.getSearchAPIQueryForRefineFields(params, firstLoad));
172 153
      firstLoad = false;
......
243 224
            this.searchPage.buildPageURLParameters(this.filters, this.rangeFilters, false);
244 225
          }
245 226

  
227
          this.searchPage.hideFilters = false;
228

  
246 229
          this.searchUtils.status = this.errorCodes.DONE;
247 230
          if (this.searchUtils.totalResults == 0) {
248 231
            this.searchUtils.status = this.errorCodes.NONE;
......
283 266
          //this.searchPage.closeLoading();
284 267
          this.disableForms = false;
285 268
          this.searchPageUpdates.emit({disableForms: this.disableForms, disableRefineForms: this.disableRefineForms, searchUtils: this.searchUtils})
286

  
269
          this.searchPage.hideFilters = false;
287 270
        }
288 271
      ));
289 272
    }

Also available in: Unified diff