[ACA-1769] Favorites - refresh after unfavoriting an item ()

* favorite toggle action event

* subscribe favorite view to toggle favorite event

* emit event on toggle favorite
This commit is contained in:
Cilibiu Bogdan 2018-09-06 16:09:33 +03:00 committed by Denys Vuika
parent 1be7c0fd20
commit 7ac613d72c
3 changed files with 8 additions and 4 deletions
src/app

@ -66,6 +66,7 @@ export class FavoritesComponent extends PageComponent implements OnInit {
this.content.folderEdited.subscribe(() => this.reload()),
this.content.nodesMoved.subscribe(() => this.reload()),
this.content.favoriteRemoved.subscribe(() => this.reload()),
this.content.favoriteToggle.subscribe(() => this.reload()),
this.breakpointObserver
.observe([

@ -23,12 +23,13 @@
* along with Alfresco. If not, see <http://www.gnu.org/licenses/>.
*/
import { Component, ChangeDetectorRef } from '@angular/core';
import { Component } from '@angular/core';
import { Store } from '@ngrx/store';
import { AppStore } from '../../../store/states';
import { appSelection } from '../../../store/selectors/app.selectors';
import { Observable } from 'rxjs';
import { SelectionState } from '@alfresco/adf-extensions';
import { ContentManagementService } from '../../../services/content-management.service';
@Component({
selector: 'app-toggle-favorite',
@ -50,12 +51,11 @@ export class ToggleFavoriteComponent {
constructor(
private store: Store<AppStore>,
private changeDetection: ChangeDetectorRef) {
private content: ContentManagementService) {
this.selection$ = this.store.select(appSelection);
}
onToggleEvent() {
this.changeDetection.detectChanges();
this.content.favoriteToggle.next();
}
}

@ -69,6 +69,7 @@ export class ContentManagementService {
linksUnshared = new Subject<any>();
favoriteAdded = new Subject<Array<MinimalNodeEntity>>();
favoriteRemoved = new Subject<Array<MinimalNodeEntity>>();
favoriteToggle = new Subject<Array<MinimalNodeEntity>>();
constructor(
private store: Store<AppStore>,
@ -88,6 +89,7 @@ export class ContentManagementService {
});
this.store.dispatch(new SetSelectedNodesAction(nodes));
this.favoriteAdded.next(nodes);
this.favoriteToggle.next(nodes);
});
}
}
@ -100,6 +102,7 @@ export class ContentManagementService {
});
this.store.dispatch(new SetSelectedNodesAction(nodes));
this.favoriteRemoved.next(nodes);
this.favoriteToggle.next(nodes);
});
}
}