@@ -6,6 +6,8 @@ import {SortEvent} from '../../shared/directives/sortable/type/sort-event';
6
6
import { ElasticSearchIndexService } from '../../shared/services/elasticsearch/elasticsearch-index.service' ;
7
7
import { ElasticsearchIndexInfoType } from '../../shared/types/elasticsearch/elasticsearch-index-info.type' ;
8
8
import { IndexDeleteComponent } from './index-delete/index-delete.component' ;
9
+ import { UtmAccountModule } from "../../account/account.module" ;
10
+ import { UtmToastService } from "../../shared/alert/utm-toast.service" ;
9
11
10
12
@Component ( {
11
13
selector : 'app-index-management' ,
@@ -23,7 +25,8 @@ export class IndexManagementComponent implements OnInit {
23
25
req : any ;
24
26
25
27
constructor ( private elasticIndexService : ElasticSearchIndexService ,
26
- private modalService : NgbModal ) {
28
+ private modalService : NgbModal ,
29
+ private toastService : UtmToastService , ) {
27
30
}
28
31
29
32
ngOnInit ( ) {
@@ -43,7 +46,23 @@ export class IndexManagementComponent implements OnInit {
43
46
}
44
47
45
48
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
+ }
47
66
this . getIndexes ( ) ;
48
67
}
49
68
@@ -97,6 +116,7 @@ export class IndexManagementComponent implements OnInit {
97
116
}
98
117
99
118
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 ;
101
121
}
102
122
}
0 commit comments