-
Notifications
You must be signed in to change notification settings - Fork 149
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
) * [ACS-8751] Adapt search results to handle query encoding and state propagation * Changes after CR, bug fixed * Changes after CR, bug fixed * [ACS-8634] "Manage Searches" - a full page list of saved searches * Changes after Code Review * [ACS-8634] Update package-lock * [ACS-8634] Minor fixes * [ACS-8634] Use latest ADF, fix unit tests * [ACS-8634] Fix package lock * [ACS-8634] Minor fixes * [ACS-8634] CR fixes * [ACS-8634] Sidenav state fixes * [ACS-8634] Final fix for sidenav state * [ACS-8634] CR fixes * [ACS-8634] CR fix --------- Co-authored-by: MichalKinas <[email protected]>
- Loading branch information
1 parent
cacc414
commit c2d2f95
Showing
37 changed files
with
2,730 additions
and
4,153 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
23 changes: 23 additions & 0 deletions
23
...lib/components/search/search-save/dialog/delete/saved-search-delete-dialog.component.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
<div class="aca-saved-search-delete-dialog__header"> | ||
<h2 class="aca-saved-search-delete-dialog__title">{{"APP.BROWSE.SEARCH.SAVE_SEARCH.DELETE_DIALOG.TITLE" | translate}}</h2> | ||
<button | ||
mat-icon-button | ||
mat-dialog-close | ||
[attr.aria-label]="'CLOSE' | translate" | ||
[attr.title]="'CLOSE' | translate"> | ||
<mat-icon>close</mat-icon> | ||
</button> | ||
</div> | ||
<mat-dialog-content> | ||
<p>{{ 'APP.BROWSE.SEARCH.SAVE_SEARCH.DELETE_DIALOG.CONTENT' | translate }}</p> | ||
</mat-dialog-content> | ||
<mat-dialog-actions align="end"> | ||
<button mat-button | ||
mat-dialog-close | ||
id="aca-save-search-delete-dialog-cancel-button">{{ 'CANCEL' | titlecase | translate }}</button> | ||
<button mat-flat-button | ||
id="aca-save-search-delete-dialog-submit-button" | ||
color="primary" | ||
[disabled]="isLoading" | ||
(click)="onSubmit()">{{ 'DELETE' | titlecase | translate }}</button> | ||
</mat-dialog-actions> |
14 changes: 14 additions & 0 deletions
14
...lib/components/search/search-save/dialog/delete/saved-search-delete-dialog.component.scss
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
.aca-saved-search-delete-dialog { | ||
.aca-saved-search-delete-dialog__header { | ||
display: flex; | ||
align-items: center; | ||
padding-left: 20px; | ||
justify-content: space-between; | ||
} | ||
|
||
.aca-saved-search-delete-dialog__title { | ||
font-size: large; | ||
font-weight: 200; | ||
margin: 0; | ||
} | ||
} |
101 changes: 101 additions & 0 deletions
101
.../components/search/search-save/dialog/delete/saved-search-delete-dialog.component.spec.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,101 @@ | ||
/*! | ||
* Copyright © 2005-2024 Hyland Software, Inc. and its affiliates. All rights reserved. | ||
* | ||
* Alfresco Example Content Application | ||
* | ||
* This file is part of the Alfresco Example Content Application. | ||
* If the software was purchased under a paid Alfresco license, the terms of | ||
* the paid license agreement will prevail. Otherwise, the software is | ||
* provided under the following open source license terms: | ||
* | ||
* The Alfresco Example Content Application is free software: you can redistribute it and/or modify | ||
* it under the terms of the GNU Lesser General Public License as published by | ||
* the Free Software Foundation, either version 3 of the License, or | ||
* (at your option) any later version. | ||
* | ||
* The Alfresco Example Content Application is distributed in the hope that it will be useful, | ||
* but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
* GNU Lesser General Public License for more details. | ||
* | ||
* You should have received a copy of the GNU Lesser General Public License | ||
* from Hyland Software. If not, see <http://www.gnu.org/licenses/>. | ||
*/ | ||
|
||
import { ComponentFixture, fakeAsync, TestBed, tick } from '@angular/core/testing'; | ||
import { MAT_DIALOG_DATA, MatDialogRef } from '@angular/material/dialog'; | ||
import { of } from 'rxjs'; | ||
import { SavedSearchDeleteDialogComponent } from './saved-search-delete-dialog.component'; | ||
import { ContentTestingModule, SavedSearch, SavedSearchesService } from '@alfresco/adf-content-services'; | ||
import { provideMockStore } from '@ngrx/store/testing'; | ||
import { Store } from '@ngrx/store'; | ||
import { SnackbarErrorAction, SnackbarInfoAction } from '@alfresco/aca-shared/store'; | ||
import { AppTestingModule } from '../../../../../testing/app-testing.module'; | ||
|
||
describe('SaveSearchDeleteDialogComponent', () => { | ||
let fixture: ComponentFixture<SavedSearchDeleteDialogComponent>; | ||
let savedSearchesService: SavedSearchesService; | ||
let store: Store; | ||
let submitButton: HTMLButtonElement; | ||
let cancelButton: HTMLButtonElement; | ||
|
||
const savedSearchToDelete: SavedSearch = { | ||
name: 'test', | ||
encodedUrl: '1234', | ||
order: 0 | ||
}; | ||
|
||
const dialogRef = { | ||
close: jasmine.createSpy('close') | ||
}; | ||
|
||
beforeEach(() => { | ||
TestBed.configureTestingModule({ | ||
imports: [ContentTestingModule, AppTestingModule], | ||
providers: [ | ||
{ provide: MatDialogRef, useValue: dialogRef }, | ||
provideMockStore(), | ||
{ provide: SavedSearchesService, useValue: { deleteSavedSearch: () => of() } }, | ||
{ provide: MAT_DIALOG_DATA, useValue: savedSearchToDelete } | ||
] | ||
}); | ||
dialogRef.close.calls.reset(); | ||
fixture = TestBed.createComponent(SavedSearchDeleteDialogComponent); | ||
savedSearchesService = TestBed.inject(SavedSearchesService); | ||
store = TestBed.inject(Store); | ||
|
||
submitButton = fixture.nativeElement.querySelector('#aca-save-search-delete-dialog-submit-button'); | ||
cancelButton = fixture.nativeElement.querySelector('#aca-save-search-delete-dialog-cancel-button'); | ||
}); | ||
|
||
afterEach(() => { | ||
fixture.destroy(); | ||
}); | ||
|
||
it('should not delete and close dialog window if cancel button clicked', () => { | ||
spyOn(savedSearchesService, 'deleteSavedSearch').and.callThrough(); | ||
cancelButton.click(); | ||
expect(savedSearchesService.deleteSavedSearch).not.toHaveBeenCalled(); | ||
expect(dialogRef.close).toHaveBeenCalled(); | ||
}); | ||
|
||
it('should delete search, show snackbar message and close modal if submit button clicked', fakeAsync(() => () => { | ||
spyOn(savedSearchesService, 'deleteSavedSearch').and.callThrough(); | ||
clickSubmitButton(); | ||
expect(store.dispatch).toHaveBeenCalledWith(new SnackbarInfoAction('APP.BROWSE.SEARCH.SAVE_SEARCH.DELETE_DIALOG.SUCCESS_MESSAGE')); | ||
expect(dialogRef.close).toHaveBeenCalled(); | ||
})); | ||
|
||
it('should show snackbar error if there is delete error', fakeAsync(() => () => { | ||
spyOn(savedSearchesService, 'deleteSavedSearch').and.throwError(''); | ||
clickSubmitButton(); | ||
expect(store.dispatch).toHaveBeenCalledWith(new SnackbarErrorAction('APP.BROWSE.SEARCH.SAVE_SEARCH.DELETE_DIALOG.SUCCESS_MESSAGE')); | ||
expect(dialogRef.close).not.toHaveBeenCalled(); | ||
})); | ||
|
||
function clickSubmitButton() { | ||
submitButton.click(); | ||
tick(); | ||
expect(savedSearchesService.deleteSavedSearch).toHaveBeenCalledWith(savedSearchToDelete); | ||
} | ||
}); |
72 changes: 72 additions & 0 deletions
72
...c/lib/components/search/search-save/dialog/delete/saved-search-delete-dialog.component.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,72 @@ | ||
/*! | ||
* Copyright © 2005-2024 Hyland Software, Inc. and its affiliates. All rights reserved. | ||
* | ||
* Alfresco Example Content Application | ||
* | ||
* This file is part of the Alfresco Example Content Application. | ||
* If the software was purchased under a paid Alfresco license, the terms of | ||
* the paid license agreement will prevail. Otherwise, the software is | ||
* provided under the following open source license terms: | ||
* | ||
* The Alfresco Example Content Application is free software: you can redistribute it and/or modify | ||
* it under the terms of the GNU Lesser General Public License as published by | ||
* the Free Software Foundation, either version 3 of the License, or | ||
* (at your option) any later version. | ||
* | ||
* The Alfresco Example Content Application is distributed in the hope that it will be useful, | ||
* but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
* GNU Lesser General Public License for more details. | ||
* | ||
* You should have received a copy of the GNU Lesser General Public License | ||
* from Hyland Software. If not, see <http://www.gnu.org/licenses/>. | ||
*/ | ||
|
||
import { Component, Inject, ViewEncapsulation } from '@angular/core'; | ||
import { SavedSearch, SavedSearchesService } from '@alfresco/adf-content-services'; | ||
import { MAT_DIALOG_DATA, MatDialogRef } from '@angular/material/dialog'; | ||
import { take } from 'rxjs/operators'; | ||
import { AppStore, SnackbarErrorAction, SnackbarInfoAction } from '@alfresco/aca-shared/store'; | ||
import { Store } from '@ngrx/store'; | ||
import { CoreModule } from '@alfresco/adf-core'; | ||
|
||
@Component({ | ||
standalone: true, | ||
imports: [CoreModule], | ||
selector: 'aca-saved-search-delete-dialog', | ||
templateUrl: './saved-search-delete-dialog.component.html', | ||
styleUrls: ['./saved-search-delete-dialog.component.scss'], | ||
encapsulation: ViewEncapsulation.None, | ||
host: { class: 'aca-saved-search-delete-dialog' } | ||
}) | ||
export class SavedSearchDeleteDialogComponent { | ||
isLoading = false; | ||
|
||
constructor( | ||
private readonly dialog: MatDialogRef<SavedSearchDeleteDialogComponent>, | ||
private readonly savedSearchesService: SavedSearchesService, | ||
private readonly store: Store<AppStore>, | ||
@Inject(MAT_DIALOG_DATA) private readonly data: SavedSearch | ||
) {} | ||
|
||
onSubmit() { | ||
if (this.isLoading) { | ||
return; | ||
} | ||
this.isLoading = true; | ||
this.savedSearchesService | ||
.deleteSavedSearch(this.data) | ||
.pipe(take(1)) | ||
.subscribe({ | ||
next: () => { | ||
this.dialog.close(this.data); | ||
this.store.dispatch(new SnackbarInfoAction('APP.BROWSE.SEARCH.SAVE_SEARCH.DELETE_DIALOG.SUCCESS_MESSAGE')); | ||
this.isLoading = false; | ||
}, | ||
error: () => { | ||
this.store.dispatch(new SnackbarErrorAction('APP.BROWSE.SEARCH.SAVE_SEARCH.DELETE_DIALOG.ERROR_MESSAGE')); | ||
this.isLoading = false; | ||
} | ||
}); | ||
} | ||
} |
Oops, something went wrong.