1. Bug fix: when filtering has no results in table view pages do not crash - enableSearchView input parameter added in searchPageTableView.component.

(When status is not DONE, all forms and search view are disabled. When status is not LOADING or DONE, hide datatable and disable all forms but allow search view)


git-svn-id: https://svn.driver.research-infrastructures.eu/driver/dnet40/modules/uoa-services-library/trunk/ng-openaire-library/src/app@52163 d315682c-612b-4755-9ff5-7f18f6832af3
This commit is contained in:
konstantina.galouni 2018-05-23 13:24:13 +00:00
parent 45725b69e4
commit 98aeab207b
5 changed files with 37 additions and 23 deletions

View File

@ -20,6 +20,7 @@ import{EnvProperties} from '../../utils/properties/env-properties';
[columnNames]="columnNames"
[showResultCount]=false
[disableForms]="disableForms"
[enableSearchView]="enableSearchView"
[searchViewLink]="'/search/content-providers'"
searchFormClass="compatibleDatasourcesTableSearchForm"
formPlaceholderText="Search for OpenAIRE Content Providers">
@ -48,6 +49,7 @@ export class SearchCompatibleDataprovidersTableComponent {
public resourcesQuery = "&query=((oaftype exact datasource) not(datasourcecompatibilityid = UNKNOWN) not(datasourcecompatibilityid = notCompatible) not(datasourcetypeuiid = other))";*/
public disableForms: boolean = false;
public enableSearchView: boolean = true;
properties:EnvProperties;
@ViewChild (SearchPageTableViewComponent) searchPage : SearchPageTableViewComponent ;
@ -86,6 +88,7 @@ properties:EnvProperties;
//var errorCodes:ErrorCodes = new ErrorCodes();
this.searchUtils.status = this.errorCodes.LOADING;
this.disableForms = true;
this.enableSearchView = false;
this.results = [];
this.searchUtils.totalResults = 0;
@ -106,10 +109,12 @@ properties:EnvProperties;
this.searchUtils.status = this.errorCodes.DONE;
if(this.searchUtils.totalResults == 0 ){
this.searchUtils.status = this.errorCodes.NONE;
}
this.disableForms = false;
} else {
this.searchPage.triggerInitialLoad();
this.searchPage.transform(this.results);
this.disableForms = false;
}
this.enableSearchView = true;
},
err => {
console.log(err);
@ -126,9 +131,7 @@ properties:EnvProperties;
} else {
this.searchUtils.status = this.errorCodes.NOT_AVAILABLE;
}
this.disableForms = false;
this.enableSearchView = true;
}
);
} else {
@ -136,7 +139,7 @@ properties:EnvProperties;
//var errorCodes:ErrorCodes = new ErrorCodes();
this.searchUtils.status = this.errorCodes.NONE;
this.disableForms = false;
this.enableSearchView = true;
}
},
err => {
@ -154,6 +157,7 @@ properties:EnvProperties;
} else {
this.searchUtils.status = this.errorCodes.NOT_AVAILABLE;
}
this.enableSearchView = true;
}
);

View File

@ -19,6 +19,7 @@ import{EnvProperties} from '../../utils/properties/env-properties';
[columnNames]="columnNames"
[showResultCount]=false
[disableForms]="disableForms"
[enableSearchView]="enableSearchView"
[searchViewLink]="'/search/entity-registries'"
searchFormClass="entityRegistriesTableSearchForm"
formPlaceholderText="Search for Registries/ Databases">
@ -40,6 +41,7 @@ export class SearchEntityRegistriesTableComponent {
public searchFields:SearchFields = new SearchFields();
public refineFields: string[] = this.searchFields.ENTITY_REGISTRIES_FIELDS;
public disableForms: boolean = false;
public enableSearchView: boolean = true;
properties:EnvProperties;
@ViewChild (SearchPageTableViewComponent) searchPage : SearchPageTableViewComponent ;
@ -77,6 +79,7 @@ properties:EnvProperties;
//var errorCodes:ErrorCodes = new ErrorCodes();
this.searchUtils.status = this.errorCodes.LOADING;
this.disableForms = true;
this.enableSearchView = false;
this.results = [];
this.searchUtils.totalResults = 0;
@ -96,10 +99,12 @@ properties:EnvProperties;
this.searchUtils.status = this.errorCodes.DONE;
if(this.searchUtils.totalResults == 0 ){
this.searchUtils.status = this.errorCodes.NONE;
}
this.disableForms = false;
} else {
this.searchPage.triggerInitialLoad();
this.searchPage.transform(this.results);
this.disableForms = false;
}
this.enableSearchView = true;
},
err => {
console.log(err);
@ -116,9 +121,7 @@ properties:EnvProperties;
} else {
this.searchUtils.status = this.errorCodes.NOT_AVAILABLE;
}
this.disableForms = false;
this.enableSearchView = true;
}
);
} else {
@ -126,7 +129,7 @@ properties:EnvProperties;
//var errorCodes:ErrorCodes = new ErrorCodes();
this.searchUtils.status = this.errorCodes.NONE;
this.disableForms = false;
this.enableSearchView = true;
}
},
err => {
@ -144,6 +147,7 @@ properties:EnvProperties;
} else {
this.searchUtils.status = this.errorCodes.NOT_AVAILABLE;
}
this.enableSearchView = true;
}
);
/*

View File

@ -21,6 +21,7 @@ import{EnvProperties} from '../../utils/properties/env-properties';
[columnNames]="columnNames"
[showResultCount]=false
[disableForms]="disableForms"
[enableSearchView]="enableSearchView"
[searchViewLink]="'/search/journals'"
searchFormClass="journalsTableSearchForm"
formPlaceholderText="Search for Journals">
@ -49,6 +50,7 @@ properties:EnvProperties;
public resourcesQuery = "&query=((oaftype exact datasource) not(datasourcecompatibilityid = UNKNOWN) not(datasourcecompatibilityid = notCompatible) not(datasourcetypeuiid = other))";*/
public disableForms: boolean = false;
public enableSearchView: boolean = true;
@ViewChild (SearchPageTableViewComponent) searchPage : SearchPageTableViewComponent ;
@ -88,6 +90,7 @@ properties:EnvProperties;
//var errorCodes:ErrorCodes = new ErrorCodes();
this.searchUtils.status = this.errorCodes.LOADING;
this.disableForms = true;
this.enableSearchView = false;
this.results = [];
this.searchUtils.totalResults = 0;
@ -108,10 +111,12 @@ properties:EnvProperties;
this.searchUtils.status = this.errorCodes.DONE;
if(this.searchUtils.totalResults == 0 ){
this.searchUtils.status = this.errorCodes.NONE;
}
this.disableForms = false;
} else {
this.searchPage.triggerInitialLoad();
this.searchPage.transform(this.results);
this.disableForms = false;
}
this.enableSearchView = true;
},
err => {
console.log(err);
@ -129,8 +134,7 @@ properties:EnvProperties;
this.searchUtils.status = this.errorCodes.NOT_AVAILABLE;
}
this.disableForms = false;
this.enableSearchView = true;
}
);
} else {
@ -138,7 +142,7 @@ properties:EnvProperties;
//var errorCodes:ErrorCodes = new ErrorCodes();
this.searchUtils.status = this.errorCodes.NONE;
this.disableForms = false;
this.enableSearchView = true;
}
},
err => {
@ -156,6 +160,7 @@ properties:EnvProperties;
} else {
this.searchUtils.status = this.errorCodes.NOT_AVAILABLE;
}
this.enableSearchView = true;
}
);

View File

@ -71,7 +71,7 @@
<p>
<span class="uk-margin-small-right uk-icon"><svg width="20" height="20" viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg" ratio="1"><rect x="2" y="2" width="3" height="3"></rect><rect x="8" y="2" width="3" height="3"></rect><rect x="14" y="2" width="3" height="3"></rect><rect x="2" y="8" width="3" height="3"></rect><rect x="8" y="8" width="3" height="3"></rect><rect x="14" y="8" width="3" height="3"></rect><rect x="2" y="14" width="3" height="3"></rect><rect x="8" y="14" width="3" height="3"></rect><rect x="14" y="14" width="3" height="3"></rect></svg></span>
<a routerLinkActive="router-link-active" [class]="(disableForms)?'uk-disabled uk-link-muted':''" [routerLink]=searchViewLink >
<a routerLinkActive="router-link-active" [class]="(disableForms && !enableSearchView)?'uk-disabled uk-link-muted':''" [routerLink]=searchViewLink >
<span class="uk-icon"><svg width="20" height="20" viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg" icon="table" ratio="1"><rect x="1" y="3" width="18" height="1"></rect><rect x="1" y="7" width="18" height="1"></rect><rect x="1" y="11" width="18" height="1"></rect><rect x="1" y="15" width="18" height="1"></rect></svg></span>
</a>
</p>
@ -81,7 +81,7 @@
<errorMessages [status]="[searchUtils.status]" [type]="'results'"></errorMessages>
</div>
<div *ngIf="searchUtils.totalResults > 0" class="uk-overflow-auto">
<div *ngIf="searchUtils.status == errorCodes.LOADING || searchUtils.status == errorCodes.DONE" class="uk-overflow-auto">
<!-- #mf="mfDataTable" [mfRowsOnPage]="rowsOnPage"
[mfData]="results | contentProvidersDatatable : [searchUtils, filters, triggerPipe, cd]"
@ -186,7 +186,7 @@
<helper position="right" before="true"></helper>
<span class="uk-margin-small-right uk-icon"><svg width="20" height="20" viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg" ratio="1"><rect x="2" y="2" width="3" height="3"></rect><rect x="8" y="2" width="3" height="3"></rect><rect x="14" y="2" width="3" height="3"></rect><rect x="2" y="8" width="3" height="3"></rect><rect x="8" y="8" width="3" height="3"></rect><rect x="14" y="8" width="3" height="3"></rect><rect x="2" y="14" width="3" height="3"></rect><rect x="8" y="14" width="3" height="3"></rect><rect x="14" y="14" width="3" height="3"></rect></svg></span>
<a routerLinkActive="router-link-active" [class]="(disableForms)?'uk-disabled uk-link-muted':''" [routerLink]=searchViewLink >
<a routerLinkActive="router-link-active" [class]="(disableForms && !enableSearchView)?'uk-disabled uk-link-muted':''" [routerLink]=searchViewLink >
<span class="uk-icon"><svg width="20" height="20" viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg" icon="table" ratio="1"><rect x="1" y="3" width="18" height="1"></rect><rect x="1" y="7" width="18" height="1"></rect><rect x="1" y="11" width="18" height="1"></rect><rect x="1" y="15" width="18" height="1"></rect></svg></span>
</a>
<helper position="right" before="false"></helper>

View File

@ -54,6 +54,7 @@ export class SearchPageTableViewComponent implements OnInit, AfterViewInit {
//@Input() csvPath: string;
@Input() searchViewLink: string;
@Input() disableForms: boolean = false;
@Input() enableSearchView: boolean = true;
@Input() searchFormClass: string = "searchForm";
@Input() formPlaceholderText = "Type Keywords...";
@ViewChild (ModalLoading) loading : ModalLoading ;