mirror of
https://github.com/Alfresco/alfresco-content-app.git
synced 2025-10-01 14:41:14 +00:00
ADW Saved Search (#4173)
* [ACS-8751] Adapt search results to handle query encoding and state propagation * ADW Saved Search * ADW Saved Search * Changes after CR, bug fixed * Changes after CR, bug fixed * Changes after CR, bug fixed * Changes after CR, bug fixed * Changes after CR, bug fixed * Changes after code review * Changes after code review * Changes after code review * Changes after code review * Changes after code review * Changes after code review * Changes after code review * Changes after code review * Changes after code review * Changes after code review * ACS-8751 fix e2e * ACS-8751 fix e2e * ACS-8751 fix e2e * ACS-8751 fix e2e saved-search * ACS-8751 fix e2e recent file * ACS-8751 fix e2e recent file * [ACS-8751] Change encoding from ascii to utf8 to handle special language characters --------- Co-authored-by: MichalKinas <michal.kinas@hyland.com> Co-authored-by: akash.rathod@hyland.com <akash.rathod@hyland.com>
This commit is contained in:
committed by
GitHub
parent
b9213f345c
commit
a7573dc933
@@ -20,7 +20,6 @@
|
||||
<mat-expansion-panel
|
||||
class="aca-expansion-panel"
|
||||
[expanded]="true"
|
||||
[acaExpansionPanel]="item"
|
||||
[@.disabled]="true"
|
||||
>
|
||||
<mat-expansion-panel-header expandedHeight="32px" collapsedHeight="32px" role="group" class="aca-expansion-panel-header">
|
||||
@@ -44,6 +43,7 @@
|
||||
<button
|
||||
acaActiveLink="aca-action-button--active"
|
||||
[action]="child"
|
||||
(actionClicked)="actionClicked.emit()"
|
||||
[attr.aria-label]="child.title | translate"
|
||||
[id]="child.id"
|
||||
[attr.data-automation-id]="child.id"
|
||||
|
@@ -22,7 +22,7 @@
|
||||
* from Hyland Software. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
import { Component, OnInit, Input, ViewEncapsulation, ChangeDetectorRef } from '@angular/core';
|
||||
import { ChangeDetectorRef, Component, EventEmitter, Input, OnInit, Output, ViewEncapsulation } from '@angular/core';
|
||||
import { NavBarLinkRef } from '@alfresco/adf-extensions';
|
||||
import { CommonModule } from '@angular/common';
|
||||
import { TranslateModule } from '@ngx-translate/core';
|
||||
@@ -54,6 +54,9 @@ export class ExpandMenuComponent implements OnInit {
|
||||
@Input()
|
||||
item: NavBarLinkRef;
|
||||
|
||||
@Output()
|
||||
actionClicked = new EventEmitter<void>();
|
||||
|
||||
constructor(private cd: ChangeDetectorRef) {}
|
||||
|
||||
ngOnInit() {
|
||||
|
@@ -23,34 +23,46 @@
|
||||
*/
|
||||
|
||||
import { ActionDirective } from './action.directive';
|
||||
import { provideRouter, Router } from '@angular/router';
|
||||
import { TestBed } from '@angular/core/testing';
|
||||
import { provideMockStore } from '@ngrx/store/testing';
|
||||
import { Store } from '@ngrx/store';
|
||||
import { AppStore } from '@alfresco/aca-shared/store';
|
||||
|
||||
describe('ActionDirective', () => {
|
||||
let directive: ActionDirective;
|
||||
const routeMock: any = {
|
||||
navigate: jasmine.createSpy('navigate'),
|
||||
parseUrl: () => ({
|
||||
root: {
|
||||
children: []
|
||||
}
|
||||
})
|
||||
};
|
||||
const storeMock: any = {
|
||||
dispatch: jasmine.createSpy('dispatch')
|
||||
};
|
||||
let router: Router;
|
||||
let store: Store<AppStore>;
|
||||
|
||||
beforeEach(() => {
|
||||
directive = new ActionDirective(routeMock, storeMock);
|
||||
TestBed.configureTestingModule({
|
||||
imports: [ActionDirective],
|
||||
providers: [provideRouter([]), provideMockStore()]
|
||||
});
|
||||
|
||||
store = TestBed.inject(Store);
|
||||
router = TestBed.inject(Router);
|
||||
directive = new ActionDirective(router, store);
|
||||
});
|
||||
|
||||
it('should navigate if action is route', () => {
|
||||
spyOn(router, 'navigate');
|
||||
directive.action = { url: 'dummy' };
|
||||
directive.onClick();
|
||||
expect(routeMock.navigate).toHaveBeenCalled();
|
||||
expect(router.navigate).toHaveBeenCalledWith(['dummy', {}], { queryParams: {} });
|
||||
});
|
||||
|
||||
it('should get query params correctly from URL', () => {
|
||||
spyOn(router, 'navigate');
|
||||
directive.action = { url: 'dummy?q=12345' };
|
||||
directive.onClick();
|
||||
expect(router.navigate).toHaveBeenCalledWith(['dummy', {}], { queryParams: { q: '12345' } });
|
||||
});
|
||||
|
||||
it('should dispatch store action', () => {
|
||||
spyOn(store, 'dispatch');
|
||||
directive.action = { click: {} };
|
||||
directive.onClick();
|
||||
expect(storeMock.dispatch).toHaveBeenCalled();
|
||||
expect(store.dispatch).toHaveBeenCalled();
|
||||
});
|
||||
});
|
||||
|
@@ -22,8 +22,8 @@
|
||||
* from Hyland Software. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
import { Directive, Input, HostListener } from '@angular/core';
|
||||
import { PRIMARY_OUTLET, Router } from '@angular/router';
|
||||
import { Directive, EventEmitter, HostListener, Input, Output } from '@angular/core';
|
||||
import { Params, PRIMARY_OUTLET, Router } from '@angular/router';
|
||||
import { Store } from '@ngrx/store';
|
||||
import { AppStore } from '@alfresco/aca-shared/store';
|
||||
|
||||
@@ -36,20 +36,22 @@ import { AppStore } from '@alfresco/aca-shared/store';
|
||||
export class ActionDirective {
|
||||
@Input() action;
|
||||
|
||||
@Output() actionClicked = new EventEmitter<void>();
|
||||
|
||||
@HostListener('click')
|
||||
onClick() {
|
||||
if (this.action.url) {
|
||||
this.router.navigate(this.getNavigationCommands(this.action.url));
|
||||
this.router.navigate(this.getNavigationCommands(this.action.url), { queryParams: this.getNavigationQueryParams(this.action.url) });
|
||||
} else if (this.action.click) {
|
||||
this.store.dispatch({
|
||||
type: this.action.click.action,
|
||||
payload: this.getNavigationCommands(this.action.click.payload)
|
||||
});
|
||||
}
|
||||
this.actionClicked.next();
|
||||
}
|
||||
|
||||
constructor(private router: Router, private store: Store<AppStore>) {}
|
||||
|
||||
private getNavigationCommands(url: string): any[] {
|
||||
const urlTree = this.router.parseUrl(url);
|
||||
const urlSegmentGroup = urlTree.root.children[PRIMARY_OUTLET];
|
||||
@@ -65,4 +67,8 @@ export class ActionDirective {
|
||||
return acc;
|
||||
}, []);
|
||||
}
|
||||
|
||||
private getNavigationQueryParams(url: string): Params {
|
||||
return this.router.parseUrl(url).queryParams;
|
||||
}
|
||||
}
|
||||
|
@@ -22,8 +22,8 @@
|
||||
* from Hyland Software. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
import { Directive, OnInit, Input, ElementRef, Renderer2, ContentChildren, QueryList, AfterContentInit, Optional } from '@angular/core';
|
||||
import { Router, NavigationEnd } from '@angular/router';
|
||||
import { AfterContentInit, ContentChildren, Directive, ElementRef, Input, OnInit, Optional, QueryList, Renderer2 } from '@angular/core';
|
||||
import { NavigationEnd, Router } from '@angular/router';
|
||||
import { filter, takeUntil } from 'rxjs/operators';
|
||||
import { Subject } from 'rxjs';
|
||||
import { ActionDirective } from './action.directive';
|
||||
|
Reference in New Issue
Block a user