diff --git a/src/app/components/dashboard-search/dashboard-search.component.ts b/src/app/components/dashboard-search/dashboard-search.component.ts index 1f5fda1..14d1922 100644 --- a/src/app/components/dashboard-search/dashboard-search.component.ts +++ b/src/app/components/dashboard-search/dashboard-search.component.ts @@ -48,7 +48,7 @@ export class DashboardSearchComponent implements OnInit, OnDestroy{ public ngOnInit(): void { this._searchSub = this.searchCtrl.valueChanges.pipe( - debounceTime(400), + debounceTime(300), filter(v => v !== null ), map((v: string) => this.search(v)) ).subscribe(); diff --git a/src/app/components/dynamic-hub/dynamic-hub.component.html b/src/app/components/dynamic-hub/dynamic-hub.component.html index f4806af..4fa75dd 100644 --- a/src/app/components/dynamic-hub/dynamic-hub.component.html +++ b/src/app/components/dynamic-hub/dynamic-hub.component.html @@ -38,22 +38,5 @@

{{ 'No dashboard available' | translate}} - - -
-
-

{{'Collections' | translate}}

-
- - - {{col.key | getCollectionDisplayName | translate}} - - -
-
-
-
diff --git a/src/app/components/dynamic-hub/dynamic-hub.component.scss b/src/app/components/dynamic-hub/dynamic-hub.component.scss index 5b9ffb5..c56877f 100644 --- a/src/app/components/dynamic-hub/dynamic-hub.component.scss +++ b/src/app/components/dynamic-hub/dynamic-hub.component.scss @@ -88,61 +88,6 @@ h2 { color: rgba(0, 0, 0, 0.7); } } - .collection { - flex: 1; - - &-wrapper { - height: calc(100vh - ($top-menu-height + $header-height)); - position: sticky; - width: 100%; - top: $header-height; - } - - &--without-edit-header { - top: $header-height - 10px; - } - - .cards { - padding-top: 1px; - height: calc(100% - 90px); // top menu height + dynamic hub header height + collection h2 height - overflow-x: hidden; - overflow-y: auto; - & .scroll-hider { - position: absolute; - background: #F5F5F5; - height: 100%; - top: 0; - right: 0; - width: 6px; - -webkit-transition: all .5s; - transition: all .5s; - opacity: 1; - } - &:hover .scroll-hider { - opacity: 0; - -webkit-transition: all .5s; - transition: all .5s; - } - - .card { - margin: 4px 0px; - border-left: 3px solid; - border-radius: 0px; - padding: 8px 15px; - cursor: pointer; - box-shadow: none; - - .mat-mdc-card-header { - padding: 0; - } - - &.disabled { - border-color: whitesmoke !important; - color: rgba(0, 0, 0, 0.54); - } - } - } - } } } diff --git a/src/app/components/dynamic-hub/dynamic-hub.component.ts b/src/app/components/dynamic-hub/dynamic-hub.component.ts index f388d6b..3e41ac5 100644 --- a/src/app/components/dynamic-hub/dynamic-hub.component.ts +++ b/src/app/components/dynamic-hub/dynamic-hub.component.ts @@ -50,13 +50,10 @@ export class DynamicHubComponent implements OnInit { public canCreateDashboardByOrg: Map; public allowedOrganisations: string[] = []; - public cardCollections = new Map(); public canCreateDashboard = false; public userGroups: string[] = []; - public selectedCollection: string[] = []; - public connected = false; public isAuthentActivated: boolean; public authentMode: 'openid' | 'iam'; @@ -88,7 +85,6 @@ export class DynamicHubComponent implements OnInit { } public ngOnInit(): void { - this.cardCollections.clear(); if (!this.isAuthentActivated) { this.fetchCards(); @@ -131,17 +127,17 @@ export class DynamicHubComponent implements OnInit { this.initSearch(); } - public initSearch(){ + public initSearch() { this.dashboardSearch.valueChanged$ .pipe( - tap(() => this.isLoading = true), + tap(() => this.isLoading = true), debounceTime(500), map((v) => { this.filterDashboard(v); this.isLoading = false; }) ) - .subscribe({error: () => this.isLoading = false}); + .subscribe({ error: () => this.isLoading = false }); } public add(org?: string) { @@ -237,7 +233,7 @@ export class DynamicHubComponent implements OnInit { } public publicAtTheEnd = (a: KeyValue, b: KeyValue): number => { - if (a.key !== this.PUBLIC_ORG && b.key === this.PUBLIC_ORG ) { + if (a.key !== this.PUBLIC_ORG && b.key === this.PUBLIC_ORG) { return -1; } if (a.key === this.PUBLIC_ORG && b.key !== this.PUBLIC_ORG) { @@ -275,7 +271,7 @@ export class DynamicHubComponent implements OnInit { )); this.cardsRef.set(o, cards); i++; - this.applyCollectionFilter(); + this.initFilter(); if (i === this.orgs.length) { this.isLoading = false; } @@ -294,7 +290,7 @@ export class DynamicHubComponent implements OnInit { next: (cards) => { this.storeExternalOrganisationsCards(cards); this.isLoading = false; - this.applyCollectionFilter(); + this.initFilter(); } }); } @@ -320,8 +316,8 @@ export class DynamicHubComponent implements OnInit { if (!publicCards) { publicCards = []; } - this.registerCollection(c); - c.preview$ = this.getPreview$(c.previewId,{}); + + c.preview$ = this.getPreview$(c.previewId, {}); this.addCard(c, publicCards); this.cardsRef.set(publicOrg, publicCards); } @@ -336,11 +332,7 @@ export class DynamicHubComponent implements OnInit { } - private registerCollection(c: Card) { - if (!this.cardCollections.has(c.collection)) { - this.cardCollections.set(c.collection, { color: c.color, selected: true }); - } - } + private enrichCards(cards: Card[], fetchOptions?): Card[] { cards.forEach(c => { @@ -349,7 +341,7 @@ export class DynamicHubComponent implements OnInit { .forEach(a => a.url = this.arlasSettingsService.getArlasWuiUrl()); c.actions.filter(a => a.type === ConfigActionEnum.EDIT) .forEach(a => a.url = this.arlasSettingsService.getArlasBuilderUrl().concat('/load/')); - this.registerCollection(c); + c.preview$ = this.getPreview$(c.previewId, fetchOptions); c.isPublic = c.readers.find(g => g.name === 'public') !== undefined; }); @@ -378,30 +370,21 @@ export class DynamicHubComponent implements OnInit { } } - public applyCollectionFilter() { - if (this.selectedCollection.length > 0) { - const filteredMap = new Map(); - this.cardsRef.forEach((values: Card[], key: string) => { - filteredMap.set(key, values.filter(c => this.selectedCollection.includes(c.collection))); - }); - this.cards = filteredMap; - } else { - this.cards = this.cardsRef; - } - + public initFilter() { + this.cards = this.cardsRef; this.dashboardSearch.buildSearchIndex(this.cards); this.filterDashboard(this.dashboardSearch.currentFilter); } - public filterDashboard(searchValue: string, preserveEmptyCardList = false){ + public filterDashboard(searchValue: string, preserveEmptyCardList = false) { let previous; - if(searchValue){ + if (searchValue) { previous = this.cardsFiltered; this.cardsFiltered = new Map(); this.dashboardSearch .getMatchingSearchIndices() .forEach(searchIndex => { - if(this.cardsFiltered.has(searchIndex.key)){ + if (this.cardsFiltered.has(searchIndex.key)) { this.cardsFiltered.get(searchIndex.key).push(this.cards.get(searchIndex.key)[searchIndex.cardIndex]); } else { this.cardsFiltered.set(searchIndex.key, [this.cards.get(searchIndex.key)[searchIndex.cardIndex]]); @@ -411,49 +394,13 @@ export class DynamicHubComponent implements OnInit { this.cardsFiltered = this.cards; } - if(preserveEmptyCardList && this.cardsFiltered.size === 0){ + if (preserveEmptyCardList && this.cardsFiltered.size === 0) { previous.forEach((v, k) => { this.cardsFiltered.set(k, []); }); } } - public getCheckbox(state: boolean, collectionKey: string) { - if (this.selectedCollection.length === 0) { - this.cardCollections.forEach(v => v.selected = false); - this.selectedCollection.push(collectionKey); - this.cardCollections.get(collectionKey).selected = true; - } else { - if (state) { - this.cardCollections.get(collectionKey).selected = true; - if (!this.selectedCollection.includes(collectionKey)) { - this.selectedCollection.push(collectionKey); - } - if (this.selectedCollection.length === this.cardCollections.size) { - this.selectedCollection = []; - } - } else { - this.selectedCollection = this.selectedCollection.filter(c => c !== collectionKey); - this.cardCollections.get(collectionKey).selected = false; - if (this.selectedCollection.length === 0) { - this.cardCollections.forEach(v => { - v.selected = true; - }); - } - } - } - this.cards = this.cardsRef; - if (this.selectedCollection.length > 0) { - const filteredMap = new Map(); - this.cards.forEach((values: Card[], key: string) => { - filteredMap.set(key, values.filter(c => this.selectedCollection.includes(c.collection))); - }); - this.cards = filteredMap; - } - this.dashboardSearch.buildSearchIndex(this.cards); - this.filterDashboard(this.dashboardSearch.currentFilter, true); - } - public getAllowedOrganisations(): string[] { return [...this.canCreateDashboardByOrg.entries()].filter(m => !!m[1]).map(m => m[0]); }