[ACA-19] Search libraries improvements (#792)

* [ACA-19][ACA-1967] set Libraries columns

according to updated requirement

* [ACA-19] search term length hint & singular result translation

fixes also [ACA-1933]
This commit is contained in:
Suzana Dirla
2018-11-09 17:55:08 +02:00
committed by Denys Vuika
parent 4a420cc9f9
commit aeb8ddd1f2
9 changed files with 46 additions and 24 deletions

View File

@@ -13,9 +13,9 @@
[(ngModel)]="searchTerm" [(ngModel)]="searchTerm"
(ngModelChange)="inputChange($event)" (ngModelChange)="inputChange($event)"
(keyup.enter)="searchSubmit($event)"> (keyup.enter)="searchSubmit($event)">
<mat-placeholder class="placeholder" *ngIf="!searchTerm.length">{{ 'SEARCH.INPUT.PLACEHOLDER' | translate }}</mat-placeholder> <mat-placeholder class="placeholder" *ngIf="!searchTerm.length">{{ 'SEARCH.INPUT.PLACEHOLDER' | translate }}</mat-placeholder>
<div matSuffix class="app-suffix-search-icon-wrapper"> <div matSuffix class="app-suffix-search-icon-wrapper">
<mat-icon>arrow_drop_down</mat-icon> <mat-icon>arrow_drop_down</mat-icon>
</div> </div>
</mat-form-field> </mat-form-field>

View File

@@ -85,4 +85,10 @@ export class SearchInputControlComponent implements OnDestroy {
this.searchTerm = ''; this.searchTerm = '';
this.searchChange.emit(''); this.searchChange.emit('');
} }
isTermTooShort() {
const alphanumericTerm = this.searchTerm.replace(/[^0-9a-z]/gi, '');
return this.searchTerm.length && alphanumericTerm.length < 2;
}
} }

View File

@@ -2,7 +2,7 @@
<button mat-icon-button <button mat-icon-button
class="app-search-button" class="app-search-button"
[title]="'SEARCH.BUTTON.TOOLTIP' | translate"> [title]="'SEARCH.BUTTON.TOOLTIP' | translate">
<mat-icon [attr.aria-label]="'SEARCH.BUTTON.ARIA-LABEL' | translate">search</mat-icon> <mat-icon [attr.aria-label]="'SEARCH.BUTTON.ARIA-LABEL' | translate">search</mat-icon>
</button> </button>
<mat-form-field class="app-input-form-field"> <mat-form-field class="app-input-form-field">
<input matInput <input matInput
@@ -10,11 +10,11 @@
[type]="'text'" [type]="'text'"
[disabled]="true" [disabled]="true"
[value]="searchedWord"> [value]="searchedWord">
<mat-placeholder class="placeholder" *ngIf="!searchedWord.length">{{ 'SEARCH.INPUT.PLACEHOLDER' | translate }}</mat-placeholder> <mat-placeholder class="placeholder" *ngIf="!searchedWord.length">{{ 'SEARCH.INPUT.PLACEHOLDER' | translate }}</mat-placeholder>
<div matSuffix class="app-suffix-search-icon-wrapper"> <div matSuffix class="app-suffix-search-icon-wrapper">
<mat-icon>arrow_drop_down</mat-icon> <mat-icon>arrow_drop_down</mat-icon>
</div> </div>
</mat-form-field> </mat-form-field>
</div> </div>
@@ -24,14 +24,16 @@
(submit)="onSearchSubmit($event)" (submit)="onSearchSubmit($event)"
(searchChange)="onSearchChange($event)"> (searchChange)="onSearchChange($event)">
</app-search-input-control> </app-search-input-control>
<mat-hint *ngIf="hasLibraryConstraint()" class="app-search-hint">{{ 'SEARCH.INPUT.HINT' | translate }}</mat-hint>
<div id="search-options"> <div id="search-options">
<mat-checkbox *ngFor="let option of searchOptions" <mat-checkbox *ngFor="let option of searchOptions"
id="{{ option.id }}" id="{{ option.id }}"
[(ngModel)]="option.value" [(ngModel)]="option.value"
[disabled]="option.shouldDisable()" [disabled]="option.shouldDisable()"
(change)="onOptionChange()" (change)="onOptionChange()"
(click)="$event.stopPropagation()"> (click)="$event.stopPropagation()">
{{ option.key | translate }} {{ option.key | translate }}
</mat-checkbox> </mat-checkbox>
</div> </div>
</mat-menu> </mat-menu>

View File

@@ -88,3 +88,9 @@ $top-margin: 12px;
} }
} }
} }
.app-search-hint {
position: absolute;
font-size: 12px;
padding-left: 17px;
}

View File

@@ -210,4 +210,11 @@ export class SearchInputComponent implements OnInit {
isContentChecked(): boolean { isContentChecked(): boolean {
return this.isFilesChecked() || this.isFoldersChecked(); return this.isFilesChecked() || this.isFoldersChecked();
} }
hasLibraryConstraint(): boolean {
if (this.isLibrariesChecked()) {
return this.searchInputControl.isTermTooShort();
}
return false;
}
} }

View File

@@ -21,7 +21,10 @@
</mat-progress-bar> </mat-progress-bar>
<div class="adf-search-results__content-header content" *ngIf="data?.list.entries.length"> <div class="adf-search-results__content-header content" *ngIf="data?.list.entries.length">
<div class="content__side--left"> <div class="content__side--left">
<div class="adf-search-results--info-text">{{ 'APP.BROWSE.SEARCH_LIBRARIES.FOUND_RESULTS' | translate: { number: totalResults } }}</div> <div class="adf-search-results--info-text"
*ngIf="totalResults !== 1">{{ 'APP.BROWSE.SEARCH_LIBRARIES.FOUND_RESULTS' | translate: { number: totalResults } }}</div>
<div class="adf-search-results--info-text"
*ngIf="totalResults === 1">{{ 'APP.BROWSE.SEARCH_LIBRARIES.FOUND_ONE_RESULT' | translate: { number: totalResults } }}</div>
</div> </div>
</div> </div>

View File

@@ -24,7 +24,10 @@
</mat-progress-bar> </mat-progress-bar>
<div class="adf-search-results__content-header content" *ngIf="data?.list.entries.length"> <div class="adf-search-results__content-header content" *ngIf="data?.list.entries.length">
<div class="content__side--left"> <div class="content__side--left">
<div class="adf-search-results--info-text">{{ 'APP.BROWSE.SEARCH.FOUND_RESULTS' | translate: { number: totalResults } }}</div> <div class="adf-search-results--info-text"
*ngIf="totalResults !== 1">{{ 'APP.BROWSE.SEARCH.FOUND_RESULTS' | translate: { number: totalResults } }}</div>
<div class="adf-search-results--info-text"
*ngIf="totalResults === 1">{{ 'APP.BROWSE.SEARCH.FOUND_ONE_RESULT' | translate: { number: totalResults } }}</div>
<div class="adf-search-results__facets"> <div class="adf-search-results__facets">
<adf-search-chip-list [searchFilter]="searchFilter"></adf-search-chip-list> <adf-search-chip-list [searchFilter]="searchFilter"></adf-search-chip-list>

View File

@@ -1272,9 +1272,9 @@
"desktopOnly": false "desktopOnly": false
}, },
{ {
"id": "app.libraries.id", "id": "app.libraries.role",
"key": "id", "key": "role",
"title": "APP.DOCUMENT_LIST.COLUMNS.ID", "title": "APP.DOCUMENT_LIST.COLUMNS.ROLE",
"type": "text", "type": "text",
"sortable": true, "sortable": true,
"desktopOnly": true "desktopOnly": true
@@ -1287,14 +1287,6 @@
"sortable": true, "sortable": true,
"template": "app.columns.libraryStatus", "template": "app.columns.libraryStatus",
"desktopOnly": true "desktopOnly": true
},
{
"id": "app.libraries.role",
"key": "role",
"title": "APP.DOCUMENT_LIST.COLUMNS.ROLE",
"type": "text",
"sortable": true,
"desktopOnly": true
} }
] ]
} }

View File

@@ -128,6 +128,7 @@
"SEARCH": { "SEARCH": {
"TITLE": "Search Results", "TITLE": "Search Results",
"FOUND_RESULTS": "{{ number }} results found", "FOUND_RESULTS": "{{ number }} results found",
"FOUND_ONE_RESULT": "{{ number }} result found",
"CUSTOM_ROW": { "CUSTOM_ROW": {
"MODIFIED": "Modified", "MODIFIED": "Modified",
"LOCATION": "Location", "LOCATION": "Location",
@@ -137,7 +138,8 @@
}, },
"SEARCH_LIBRARIES": { "SEARCH_LIBRARIES": {
"TITLE": "Libraries found...", "TITLE": "Libraries found...",
"FOUND_RESULTS": "{{ number }} results" "FOUND_RESULTS": "{{ number }} results",
"FOUND_ONE_RESULT": "{{ number }} result"
} }
}, },
"ACTIONS": { "ACTIONS": {
@@ -357,7 +359,8 @@
"PLACEHOLDER": "Search everywhere", "PLACEHOLDER": "Search everywhere",
"FILES": "Files", "FILES": "Files",
"FOLDERS": "Folders", "FOLDERS": "Folders",
"LIBRARIES": "Libraries" "LIBRARIES": "Libraries",
"HINT": "Query term is too short. Must have at least 2 alphanumeric chars"
}, },
"SORT": { "SORT": {
"RELEVANCE": "Relevance", "RELEVANCE": "Relevance",