Skip to content

Commit

Permalink
Feat: display public collection at the end
Browse files Browse the repository at this point in the history
  • Loading branch information
mbarbet committed Nov 6, 2024
1 parent c4df87f commit d0d5e69
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/app/components/dynamic-hub/dynamic-hub.component.html
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
</div>
<div class="dynamic-hub__content">
<div class="dashboards">
<div class="dashboard" *ngFor="let data of cards | keyvalue">
<div class="dashboard" *ngFor="let data of cards | keyvalue : publicAtTheEnd ">
<h2>
<span class="dashboard-title">{{data.key | titlecase | translate}} {{'dashboards' | translate}}</span>
<ng-container *ngIf="data.key | getValue:canCreateDashboardByOrg">
Expand Down
11 changes: 11 additions & 0 deletions src/app/components/dynamic-hub/dynamic-hub.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ import { catchError, filter, map, mergeMap, take, tap } from 'rxjs/operators';
import { Card, CardService } from '../../services/card.service';
import { Action } from '../card/card.component';
import { HubAction, HubActionEnum, HubActionModalComponent } from '../hub-action-modal/hub-action-modal.component';
import { KeyValue } from '@angular/common';

@Component({
selector: 'arlas-dynamic-hub',
Expand Down Expand Up @@ -214,6 +215,16 @@ export class DynamicHubComponent implements OnInit {
}
}

public publicAtTheEnd = (a: KeyValue<string, Card[]>, b: KeyValue<string, Card[]>): number => {
if (a.key !== this.PUBLIC_ORG && b.key === this.PUBLIC_ORG ) {
return -1;
}
if (a.key === this.PUBLIC_ORG && b.key !== this.PUBLIC_ORG) {
return 1;
}
return a.key > b.key ? 1 : (b.key > a.key ? -1 : 0);
};

private fetchCardsByUserOrganisation() {
let i = 0;
this.orgs.map(o => o.name).forEach(o => {
Expand Down

0 comments on commit d0d5e69

Please sign in to comment.