mirror of
https://github.com/Alfresco/alfresco-content-app.git
synced 2026-09-09 18:02:54 +00:00
[ACA-3541] show error message on empty search (#2164)
* [ACA-3541] User is not able to reset the search to be able to display the entire list of results * * fixed lint
This commit is contained in:
@@ -28,7 +28,7 @@ import { TestBed, ComponentFixture } from '@angular/core/testing';
|
|||||||
import { SearchInputComponent } from './search-input.component';
|
import { SearchInputComponent } from './search-input.component';
|
||||||
import { AppTestingModule } from '../../../testing/app-testing.module';
|
import { AppTestingModule } from '../../../testing/app-testing.module';
|
||||||
import { Actions, ofType } from '@ngrx/effects';
|
import { Actions, ofType } from '@ngrx/effects';
|
||||||
import { SearchByTermAction, SearchActionTypes } from '@alfresco/aca-shared/store';
|
import { SearchByTermAction, SearchActionTypes, SnackbarErrorAction, SnackbarActionTypes } from '@alfresco/aca-shared/store';
|
||||||
import { AppHookService } from '@alfresco/aca-shared';
|
import { AppHookService } from '@alfresco/aca-shared';
|
||||||
import { map } from 'rxjs/operators';
|
import { map } from 'rxjs/operators';
|
||||||
import { SearchQueryBuilderService } from '@alfresco/adf-content-services';
|
import { SearchQueryBuilderService } from '@alfresco/adf-content-services';
|
||||||
@@ -139,6 +139,21 @@ describe('SearchInputComponent', () => {
|
|||||||
});
|
});
|
||||||
component.onSearchChange(searchedTerm);
|
component.onSearchChange(searchedTerm);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
it('should show snack for empty search', (done) => {
|
||||||
|
const searchedTerm = '';
|
||||||
|
actions$
|
||||||
|
.pipe(
|
||||||
|
ofType<SnackbarErrorAction>(SnackbarActionTypes.Error),
|
||||||
|
map((action) => {
|
||||||
|
expect(action.payload).toBe('APP.BROWSE.SEARCH.EMPTY_SEARCH');
|
||||||
|
})
|
||||||
|
)
|
||||||
|
.subscribe(() => {
|
||||||
|
done();
|
||||||
|
});
|
||||||
|
component.onSearchSubmit(searchedTerm);
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
describe('isLibrariesChecked()', () => {
|
describe('isLibrariesChecked()', () => {
|
||||||
|
|||||||
@@ -24,7 +24,7 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
import { AppHookService } from '@alfresco/aca-shared';
|
import { AppHookService } from '@alfresco/aca-shared';
|
||||||
import { AppStore, SearchByTermAction, SearchOptionIds, SearchOptionModel } from '@alfresco/aca-shared/store';
|
import { AppStore, SearchByTermAction, SearchOptionIds, SearchOptionModel, SnackbarErrorAction } from '@alfresco/aca-shared/store';
|
||||||
import { SearchQueryBuilderService } from '@alfresco/adf-content-services';
|
import { SearchQueryBuilderService } from '@alfresco/adf-content-services';
|
||||||
import { AppConfigService } from '@alfresco/adf-core';
|
import { AppConfigService } from '@alfresco/adf-core';
|
||||||
import { Component, OnDestroy, OnInit, ViewChild, ViewEncapsulation } from '@angular/core';
|
import { Component, OnDestroy, OnInit, ViewChild, ViewEncapsulation } from '@angular/core';
|
||||||
@@ -136,6 +136,8 @@ export class SearchInputComponent implements OnInit, OnDestroy {
|
|||||||
this.searchedWord = searchTerm;
|
this.searchedWord = searchTerm;
|
||||||
|
|
||||||
this.searchByOption();
|
this.searchByOption();
|
||||||
|
} else {
|
||||||
|
this.store.dispatch(new SnackbarErrorAction('APP.BROWSE.SEARCH.EMPTY_SEARCH'));
|
||||||
}
|
}
|
||||||
this.trigger.closeMenu();
|
this.trigger.closeMenu();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -178,6 +178,7 @@
|
|||||||
},
|
},
|
||||||
"UNKNOWN_LOCATION": "Unknown",
|
"UNKNOWN_LOCATION": "Unknown",
|
||||||
"NO_RESULTS": "Your search returned 0 results",
|
"NO_RESULTS": "Your search returned 0 results",
|
||||||
|
"EMPTY_SEARCH": "Search term required",
|
||||||
"NO_FILTER_RESULTS": "Your filter returned 0 results",
|
"NO_FILTER_RESULTS": "Your filter returned 0 results",
|
||||||
"TOGGLE_SEARCH_FILTER": "Toggle search filter",
|
"TOGGLE_SEARCH_FILTER": "Toggle search filter",
|
||||||
"ERRORS": {
|
"ERRORS": {
|
||||||
@@ -403,15 +404,6 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"PERMISSIONS": {
|
|
||||||
"DIALOG": {
|
|
||||||
"TITLE": "Manage Permissions",
|
|
||||||
"CLOSE": "Close",
|
|
||||||
"INHERIT_PERMISSIONS_BUTTON": "Inherit Permissions",
|
|
||||||
"INHERITED_PERMISSIONS_BUTTON": "Permissions Inherited",
|
|
||||||
"ADD_USER_OR_GROUP": "Add User or Group"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"SHARED_LINK": {
|
"SHARED_LINK": {
|
||||||
"UNSHARE_PERMISSION_ERROR": "You don't have permission to unshare this file"
|
"UNSHARE_PERMISSION_ERROR": "You don't have permission to unshare this file"
|
||||||
},
|
},
|
||||||
|
|||||||
Reference in New Issue
Block a user