Project

General

Profile

« Previous | Next » 

Revision 59971

[Library|Trunk]

- Filters issue with quick filter: revert to previous code, value should be url encoded
- Custom Filter: always Show the value of the custom filter
- update message for link in explore portal
- Search pages - add indexUpdateDate, update link to index info

View differences:

modules/uoa-services-library/trunk/ng-openaire-library/src/app/searchPages/searchUtils/newSearchPage.component.html
1 1
<ng-template #selected_filters_pills>
2 2
  <div class="uk-grid uk-grid-small uk-text-small" uk-grid>
3
    <ng-container *ngIf="customFilterEnabled && customFilter && refineFields.indexOf(customFilter.queryFieldName) ==
4
    -1 ">
3
    <ng-container *ngIf="customFilter && ((customFilterEnabled &&
4
    refineFields.indexOf(customFilter.queryFieldName) ==
5
    -1) ||customFilter.isHiddenFilter)">
5 6
     <span class="uk-grid-margin">
6
        <span class="selectedFilterLabel uk-disabled ">
7
        <span class="selectedFilterLabel customFilterLabel">
7 8
            <span class="">{{customFilter.valueName}}</span>
8 9
        </span>
9 10
      </span>
......
55 56
    </ng-container>
56 57
    <ng-container *ngFor="let filter of filters ">
57 58
      <ng-container *ngIf="filter.countSelectedValues > 0">
58
        <span *ngFor="let value of getSelectedValues(filter); let i = index;  let end = last; "
59
              [title]="'Remove '+value.name" (click)="removeFilter(value, filter) "
59
        <ng-container *ngFor="let value of getSelectedValues(filter); let i = index;  let end = last; ">
60
              <span *ngIf="!customFilter || (customFilter.isHiddenFilter && customFilter.valueId != value.id)"
61
                    [title]="'Remove '+value.name"
62
                    (click)="removeFilter(value, filter) "
60 63
              [class]="((disableForms || disableRefineForms) ? 'uk-disabled' : 'clickable') + ' uk-grid-margin'">
61 64
                        <!-- if no grid on the div above, remove it and move class 'selectedFilterLabel' on top span -->
62 65
                        <span class="selectedFilterLabel ">
......
76 79
                          </a>
77 80
                        </span>
78 81
                      </span>
82
          </ng-container>
79 83
      </ng-container>
80 84
    </ng-container>
81 85
  </div>
......
95 99
      </a>
96 100
    </div>
97 101
    <div *ngIf="selectedRangeFilters+selectedFilters + selectedTypesNum  > 0 || (customFilter && customFilter.selected
98
     == true)"
102
     == true || customFilter.isHiddenFilter)"
99 103
         class="uk-margin-small-top  uk-margin-medium-bottom">
100 104
      <ng-container *ngTemplateOutlet="selected_filters_pills; context: {}"></ng-container>
101 105
    </div>
......
291 295
                    Do you want to see results only for {{customFilter.valueName}}? <a
292 296
                    (click)="addCustomFilter();">Click here</a>.
293 297
                  </div>
294
                  <div *ngIf="openaireLink && (searchUtils.totalResults > 0 || !loadPaging )"><a
295
                        class="uk-margin-top   uk-button uk-button-text"
298
                  <div *ngIf="openaireLink && (searchUtils.totalResults > 0 || !loadPaging )" class="uk-alert uk-text-center ">
299
                    <span *ngIf="customFilter">The following results are related to <span class="portal-color"
300
                    >{{customFilter.valueName}}</span>.</span>
301
                      Are you interested to view more results? Visit
302
                    <a
303
                        class="uk-margin-top   uk-link"
296 304
                        [href]="openaireLink+this.routerHelper.createQueryParamsString(this.parameterNames, this.parameterValues)"
297
                        target="_blank">Results in OpenAIRE</a></div>
305
                        target="_blank"> OpenAIRE - Explore</a>.
306
                  </div>
298 307
                    <div class="uk-align-center uk-margin-remove-bottom">
299 308
                      <div
300 309
                        *ngIf="(results && searchUtils.totalResults > 0) || (!loadPaging && oldTotalResults > 0 && searchUtils.status == errorCodes.LOADING)"
......
384 393
                                     [isDisabled]="disableForms || disableRefineForms">
385 394
                      </search-paging>
386 395
                    </div>
396
                    <div  *ngIf=" searchUtils.status !==
397
                    errorCodes.LOADING" class="uk-margin-small-top uk-grid uk-child-width-1-2">
398
                      <!-- Last Index Info-->
399
                      <div class="">
400
                        <img src="assets/common-assets/graph.svg" style="opacity: 0.4">
401
                        <span class="uk-margin-small-left uk-text-baseline uk-text-muted">Powered by <a href="https://graph.openaire.eu" class="graph-color">OpenAIRE Research Graph</a></span>
402
                      </div>
403
                      <div class="uk-text-right">
404
                        <span *ngIf="indexUpdateDate" class="uk-text-baseline uk-text-muted">
405
                           <a *ngIf="properties.showLastIndexInformationLink && lastIndex"
406
                               class="uk-link"
407
                               [href]="properties.lastIndexInformationLink" target="_blank">
387 408

  
388
                    <a *ngIf="properties.showLastIndexInformationLink && lastIndex && searchUtils.status !== errorCodes.LOADING"
389
                       class="last_index_info uk-button-text uk-button"
390
                       [href]="properties.lastIndexInformationLink" target="_blank">
391
                      Last index information
392
                    </a>
409
                                  Last update
410
                                </a><span *ngIf="!(properties.showLastIndexInformationLink && lastIndex) ">
411
                                  Last update
412
                                </span>
413
                                  of records in OpenAIRE: {{indexUpdateDate | date: 'MMM dd, yyyy'}}
414
                        </span>
415
                      </div>
416
                    </div>
417

  
393 418
                  </div>
394 419
<!--              </ng-template>-->
395 420
            <!--            <div class="uk-visible@m uk-margin-top uk-width-1-5">-->
modules/uoa-services-library/trunk/ng-openaire-library/src/app/searchPages/searchUtils/searchFilter.component.ts
244 244
  }
245 245
  getParams(filter:Filter, value:Value){
246 246
      let params = Object.assign({}, this.queryParams);
247
      let isValueSelected = true;
248
      if(params[filter.filterId] && this.checkIfValueIndexOf(params[filter.filterId].split(','),value.id)==-1) {
247
      let qf=false;
248
      if(this.quickFilter && this.quickFilter.filterId == filter.filterId && this.quickFilter.selected && value.id == this.quickFilter.value){
249
        params['qf']="false";
250
        qf=true;
251
      }
252
      if(params[filter.filterId] && this.checkIfValueIndexOf(params[filter.filterId].split(','),value.id)==-1 && !qf) {
249 253
        //has other values of this filter --> add this value
250 254
        params[filter.filterId] = params[filter.filterId] + ',' + '"' + encodeURIComponent(value.id) + '"';
251 255
      }else if(params[filter.filterId] && this.checkIfValueIndexOf(params[filter.filterId].split(','),value.id)!=-1) {
......
257 261
        if(values.length == 0){
258 262
          delete params[filter.filterId];
259 263
        }
260
        isValueSelected = false;
261
      } else{
264
      } else if(!qf){
262 265
        //has no filter, no value --> add the value
263
          params[filter.filterId] = '"' + encodeURIComponent(value.id) + '"' ;
266
        params[filter.filterId] = '"' + encodeURIComponent(value.id) + '"' ;
264 267
      }
265
      //if it is the Quick filter set the if selected or not
266
      if(this.quickFilter && this.quickFilter.filterId == filter.filterId && value.id == this.quickFilter.value){
267
        params['qf']=isValueSelected;
268
      }
269 268
      delete params['page'];
270 269
      return params;
271 270
  }
modules/uoa-services-library/trunk/ng-openaire-library/src/app/searchPages/searchUtils/newSearchPage.component.ts
23 23
import {properties} from "../../../../environments/environment";
24 24
import {AlertModal} from "../../utils/modal/alert";
25 25
import {Subscriber} from "rxjs";
26
import {IndexInfoService} from "../../utils/indexInfo.service";
26 27

  
27 28
declare var UIkit: any;
28 29

  
......
123 124
  @ViewChild('removeCustomFilter') removeCustomFilter: AlertModal;
124 125
  currentValueToRemove;
125 126
  currentFilterToRemove;
127
  public indexUpdateDate: Date;
126 128
  constructor(private route: ActivatedRoute,
127 129
              private location: Location,
128 130
              private _meta: Meta,
......
131 133
              private router: Router,
132 134
              private seoService: SEOService,
133 135
              private helper: HelperService,
134
              private cdr:ChangeDetectorRef) {
136
              private cdr:ChangeDetectorRef, private indexInfoService: IndexInfoService) {
135 137
  }
136 138

  
137 139
  ngOnInit() {
......
179 181
      this.breadcrumbs.push({name: "Advanced Search", route: null});
180 182
    }
181 183
    //console.log(this.filters)
184
    if (typeof document !== 'undefined') {
185
      this.subscriptions.push(this.indexInfoService.getLastIndexDate(this.properties).subscribe(lastIndexUpdate => {
186
        if (lastIndexUpdate) {
187
          this.indexUpdateDate = new Date(lastIndexUpdate);
188
        }
189
      }));
190
    }
182 191
  }
183 192

  
184 193
  private getPageContents() {
......
1297 1306
      if (filter.countSelectedValues > 0) {
1298 1307
        for (let value of filter.values) {
1299 1308
          if (value.selected == true) {
1300
            filterLimits += ((filterLimits.length == 0) ? '' : ',') + '"' + (value.id) + '"';
1309
            filterLimits += ((filterLimits.length == 0) ? '' : ',') + '"' + StringUtils.URIEncode(value.id) + '"';
1301 1310
          }
1302 1311
        }
1303 1312
        if (filterLimits.length > 0) {

Also available in: Unified diff