You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@datalab.apache.org by dg...@apache.org on 2020/10/20 12:56:33 UTC
[incubator-datalab] branch develop updated: [DATALAB-2051]: Sorted
notebooks on roles page (#950)
This is an automated email from the ASF dual-hosted git repository.
dgnatyshyn pushed a commit to branch develop
in repository https://gitbox.apache.org/repos/asf/incubator-datalab.git
The following commit(s) were added to refs/heads/develop by this push:
new cb14cb7 [DATALAB-2051]: Sorted notebooks on roles page (#950)
cb14cb7 is described below
commit cb14cb79ce87c4e781ef2f5cbe64ad2cb00c5504
Author: Dmytro Gnatyshyn <42...@users.noreply.github.com>
AuthorDate: Tue Oct 20 15:56:22 2020 +0300
[DATALAB-2051]: Sorted notebooks on roles page (#950)
[DATALAB-2051]: Sorted notebooks on roles page
---
.../webapp/src/app/administration/roles/roles.component.ts | 5 ++---
.../src/main/resources/webapp/src/app/core/util/sortUtils.ts | 8 ++++++++
2 files changed, 10 insertions(+), 3 deletions(-)
diff --git a/services/self-service/src/main/resources/webapp/src/app/administration/roles/roles.component.ts b/services/self-service/src/main/resources/webapp/src/app/administration/roles/roles.component.ts
index b725635..61057da 100644
--- a/services/self-service/src/main/resources/webapp/src/app/administration/roles/roles.component.ts
+++ b/services/self-service/src/main/resources/webapp/src/app/administration/roles/roles.component.ts
@@ -22,7 +22,7 @@ import { ValidatorFn, FormControl } from '@angular/forms';
import { MatDialog, MatDialogRef, MAT_DIALOG_DATA } from '@angular/material/dialog';
import { ToastrService } from 'ngx-toastr';
import {RolesGroupsService, HealthStatusService, ApplicationSecurityService, AppRoutingService} from '../../core/services';
-import { CheckUtils } from '../../core/util';
+import {CheckUtils, SortUtils} from '../../core/util';
import { DICTIONARY } from '../../../dictionary/global.dictionary';
import {ProgressBarService} from '../../core/services/progress-bar.service';
import {ConfirmationDialogComponent, ConfirmationDialogType} from '../../shared/modal-dialog/confirmation-dialog';
@@ -76,8 +76,7 @@ export class RolesComponent implements OnInit {
this.rolesList = roles.map((role) => {
return {role: role.description, type: role.type, cloud: role.cloud};
});
- this.rolesList = this.rolesList.sort((a, b) => (a.cloud > b.cloud) ? 1 : ((b.cloud > a.cloud) ? -1 : 0));
- this.rolesList = this.rolesList.sort((a, b) => (a.type > b.type) ? 1 : ((b.type > a.type) ? -1 : 0));
+ this.rolesList = SortUtils.sortByKeys(this.rolesList, ['role', 'cloud', 'type']);
this.updateGroupData(groups);
this.stepperView = false;
},
diff --git a/services/self-service/src/main/resources/webapp/src/app/core/util/sortUtils.ts b/services/self-service/src/main/resources/webapp/src/app/core/util/sortUtils.ts
index 3d204ba..18567bd 100644
--- a/services/self-service/src/main/resources/webapp/src/app/core/util/sortUtils.ts
+++ b/services/self-service/src/main/resources/webapp/src/app/core/util/sortUtils.ts
@@ -59,4 +59,12 @@ export class SortUtils {
return d > 0 ? arr.reduce((acc, val) => acc.concat(Array.isArray(val) ? this.flatDeep(val, d - 1) : val), [])
: arr.slice();
}
+
+ public static sortByKeys(array, keys) {
+ keys.forEach(key => {
+ array = array.sort((a, b) => (a[key] > b[key]) ? 1 : ((b[key] > a[key]) ? -1 : 0));
+ });
+ return array;
+ }
+
}
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@datalab.apache.org
For additional commands, e-mail: commits-help@datalab.apache.org