@@ -6,6 +6,8 @@ import {SortEvent} from '../../shared/directives/sortable/type/sort-event';
66import { ElasticSearchIndexService } from '../../shared/services/elasticsearch/elasticsearch-index.service' ;
77import { ElasticsearchIndexInfoType } from '../../shared/types/elasticsearch/elasticsearch-index-info.type' ;
88import { IndexDeleteComponent } from './index-delete/index-delete.component' ;
9+ import { UtmAccountModule } from "../../account/account.module" ;
10+ import { UtmToastService } from "../../shared/alert/utm-toast.service" ;
911
1012@Component ( {
1113 selector : 'app-index-management' ,
@@ -23,7 +25,8 @@ export class IndexManagementComponent implements OnInit {
2325 req : any ;
2426
2527 constructor ( private elasticIndexService : ElasticSearchIndexService ,
26- private modalService : NgbModal ) {
28+ private modalService : NgbModal ,
29+ private toastService : UtmToastService , ) {
2730 }
2831
2932 ngOnInit ( ) {
@@ -43,7 +46,23 @@ export class IndexManagementComponent implements OnInit {
4346 }
4447
4548 onSortBy ( $event : SortEvent ) {
46- this . req . sort = $event . column + ',' + $event . direction ;
49+ switch ( $event . column ) {
50+ case 'creationDate' :
51+ this . req . sort = 'creation.date.string' + ',' + $event . direction ;
52+ break ;
53+
54+ case 'docsCount' :
55+ this . req . sort = 'docs.count' + ',' + $event . direction ;
56+ break ;
57+
58+ case 'size' :
59+ this . req . sort = 'store.size' + ',' + $event . direction ;
60+ break ;
61+
62+ default :
63+ this . req . sort = $event . column + ',' + $event . direction ;
64+ break ;
65+ }
4766 this . getIndexes ( ) ;
4867 }
4968
@@ -97,6 +116,7 @@ export class IndexManagementComponent implements OnInit {
97116 }
98117
99118 private onError ( error ) {
100- // this.alertService.error(error.error, error.message, null);
119+ this . toastService . showError ( 'Error' , 'An error occurred while listing the indexes' ) ;
120+ this . loading = false ;
101121 }
102122}
0 commit comments