This is an automated email from the ASF dual-hosted git repository. hshpak pushed a commit to branch fix-sort-user-data in repository https://gitbox.apache.org/repos/asf/incubator-datalab.git
commit af90858a0764990be2cf44a4dd504e0f4d96d971 Author: Hennadii_Shpak <[email protected]> AuthorDate: Fri Sep 23 13:19:00 2022 +0300 sorted user data --- .../image-detail-dialog.component.html | 4 ++-- .../image-detail-dialog/image-detail-dialog.component.ts | 16 +++++++++++++++- 2 files changed, 17 insertions(+), 3 deletions(-) diff --git a/services/self-service/src/main/resources/webapp/src/app/resources/exploratory/image-detail-dialog/image-detail-dialog.component.html b/services/self-service/src/main/resources/webapp/src/app/resources/exploratory/image-detail-dialog/image-detail-dialog.component.html index 69b9ebeed..bb9ad3769 100644 --- a/services/self-service/src/main/resources/webapp/src/app/resources/exploratory/image-detail-dialog/image-detail-dialog.component.html +++ b/services/self-service/src/main/resources/webapp/src/app/resources/exploratory/image-detail-dialog/image-detail-dialog.component.html @@ -85,13 +85,13 @@ <span class="modal-row__item modal-row__item--title">Shared with</span> <div class="user-data__list--wrapper scrolling"> <ul class="groups__list"> - <li *ngFor="let group of data.image.sharedWith.groups" class="groups__item"> + <li *ngFor="let group of sortedShareWith.groups" class="groups__item"> <span class="icon--wrapper"><mat-icon class="user-data__icon">people</mat-icon></span> <span class="groups__item--wrapper">{{group}}</span> </li> </ul> <ul class="users__list"> - <li *ngFor="let user of data.image.sharedWith.users" class="users__item"> + <li *ngFor="let user of sortedShareWith.users" class="users__item"> <span class="icon--wrapper"><mat-icon class="user-data__icon">person</mat-icon></span> <span class="groups__item--wrapper">{{user}}</span> </li> diff --git a/services/self-service/src/main/resources/webapp/src/app/resources/exploratory/image-detail-dialog/image-detail-dialog.component.ts b/services/self-service/src/main/resources/webapp/src/app/resources/exploratory/image-detail-dialog/image-detail-dialog.component.ts index 05116a3a4..699a2f4fe 100644 --- a/services/self-service/src/main/resources/webapp/src/app/resources/exploratory/image-detail-dialog/image-detail-dialog.component.ts +++ b/services/self-service/src/main/resources/webapp/src/app/resources/exploratory/image-detail-dialog/image-detail-dialog.component.ts @@ -19,7 +19,7 @@ import { Component, Inject, OnInit } from '@angular/core'; import { MAT_DIALOG_DATA, MatDialog, MatDialogRef } from '@angular/material/dialog'; -import { LibraryInfoItem, Library, ImageDetailModalData, SharingStatus } from '../../images'; +import { LibraryInfoItem, Library, ImageDetailModalData, SharingStatus, SharedWithField } from '../../images'; import { LibraryInfoModalComponent } from '../library-info-modal/library-info-modal.component'; import { caseInsensitiveSortUtil } from '../../../core/util'; @@ -37,6 +37,7 @@ export class ImageDetailDialogComponent implements OnInit { maxDescriptionLength: number = 170; libraryList = []; + sortedShareWith: SharedWithField; constructor( public dialogRef: MatDialogRef<ImageDetailDialogComponent>, @@ -46,6 +47,7 @@ export class ImageDetailDialogComponent implements OnInit { ngOnInit(): void { this.libraryList = this.normalizeLibraries(); + this.sortedShareWith = this.sortUserData(); } onLibraryInfo(libraryList): void { @@ -85,4 +87,16 @@ export class ImageDetailDialogComponent implements OnInit { } return library.name; } + + private sortUserData(): SharedWithField { + const { groups, users } = this.data.image.sharedWith; + return { + users: this.sortUserDataByValue(users), + groups: this.sortUserDataByValue(groups), + }; + } + + private sortUserDataByValue(arr: string[]): string[] { + return arr.sort((a, b) => a.toLowerCase() > b.toLowerCase() ? 1 : -1); + } } --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
