Skip to content

Commit

Permalink
Fix: collections in bookmark
Browse files Browse the repository at this point in the history
  • Loading branch information
mbarbet committed Jan 23, 2024
1 parent 5e0efac commit 3d76d29
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,10 @@ import { ArlasBookmarkService } from '../../services/bookmark/bookmark.service';
import { BookMark } from '../../services/bookmark/model';
import { BookmarkPersistenceDatabase } from '../../services/bookmark/bookmarkPersistenceDatabase';
import { BookmarkDataSource } from '../../services/bookmark/bookmarkDataSource';
import { ArlasStartupService } from '../../services/startup/startup.service';
import { MatPaginator, PageEvent } from '@angular/material/paginator';
import { MAT_DIALOG_DATA, MatDialog } from '@angular/material/dialog';
import { BookmarkAddDialogComponent } from './bookmark-add-dialog.component';
import { ArlasCollaborativesearchService } from '../../services/startup/startup.service';

@Component({
selector: 'arlas-bookmark',
Expand Down Expand Up @@ -55,7 +55,7 @@ export class BookmarkComponent {
public constructor(
private bookmarkService: ArlasBookmarkService,
private dialog: MatDialog,
private startupService: ArlasStartupService,
private arlasCollaborativesearchService: ArlasCollaborativesearchService,
@Inject(MAT_DIALOG_DATA) public data: { isSelect: boolean; }
) {
if (!!data && !data.isSelect) {
Expand All @@ -64,7 +64,7 @@ export class BookmarkComponent {
this.showCombine = false;
}

this.currentCollections = Array.from(this.startupService.collectionsMap.keys()).sort().join(',');
this.currentCollections = Array.from(this.arlasCollaborativesearchService.collections).sort().join(',');
// Init component with data from persistence server, if defined and server is reachable
if (this.bookmarkService.dataBase instanceof BookmarkPersistenceDatabase) {
this.isPersistenceActive = true;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ export class ArlasBookmarkService {
this.bookMarkMap = this.dataBase.storageObjectMap;
});
} else {
this.dataBase = new BookmarkLocalDatabase(this, this.arlasStartupService);
this.dataBase = new BookmarkLocalDatabase(this, this.collaborativesearchService ,this.arlasStartupService);
this.dataBase.dataChange.subscribe(() => {
this.bookMarkMap = this.dataBase.storageObjectMap;
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,12 +22,13 @@ import { ArlasBookmarkService } from './bookmark.service';
import { Guid } from '../../tools/utils';
import { Observable } from 'rxjs';
import { ArlasLocalDatabase } from '../../tools/arlasLocalDatabase';
import { ArlasStartupService } from '../startup/startup.service';
import { ArlasStartupService, ArlasCollaborativesearchService } from '../startup/startup.service';

export class BookmarkLocalDatabase extends ArlasLocalDatabase<BookMark> {

public constructor(
public bookmarkService: ArlasBookmarkService,
public arlasCollaborativesearchService: ArlasCollaborativesearchService,
public startupService: ArlasStartupService) {
super('bookmark', bookmarkService);
}
Expand Down Expand Up @@ -80,7 +81,7 @@ export class BookmarkLocalDatabase extends ArlasLocalDatabase<BookMark> {
color: color,
count: new Observable<0>(),
views: bookmarkViews,
collections: Array.from(this.startupService.collectionsMap.keys()).sort().join(',')
collections: Array.from(this.arlasCollaborativesearchService.collections).sort().join(',')
};
this.bookmarkService.setBookMarkCount(bookMark);
return bookMark;
Expand Down

0 comments on commit 3d76d29

Please sign in to comment.