@@ -9,7 +9,7 @@ import { stringComparatorBySortOrder } from '@Shared/Helpers'
9
9
import { AppsGroupedByProjectsType , ClusterDTO } from './types'
10
10
11
11
export const getAppOptionsGroupedByProjects = async ( ) : Promise < AppsGroupedByProjectsType > => {
12
- const { result } = ( await get ( 'app/min' ) ) as ResponseType < AppsGroupedByProjectsType >
12
+ const { result } = ( await get ( ROUTES . APP_LIST_MIN ) ) as ResponseType < AppsGroupedByProjectsType >
13
13
14
14
if ( ! result ) {
15
15
return [ ]
@@ -39,17 +39,17 @@ export const getProjectOptions = async (): Promise<Pick<Teams, 'id' | 'name'>[]>
39
39
}
40
40
41
41
export const getClusterOptions = async ( ) : Promise < ClusterType [ ] > => {
42
- const { result } = ( await get ( 'cluster/autocomplete' ) ) as ResponseType < ClusterDTO [ ] >
42
+ const { result } = ( await get ( ROUTES . CLUSTER_LIST_MIN ) ) as ResponseType < ClusterDTO [ ] >
43
43
44
44
if ( ! result ) {
45
45
return [ ]
46
46
}
47
47
48
48
return result
49
- . map ( ( cluster ) => ( {
50
- id : cluster . id ,
51
- name : cluster . cluster_name ,
52
- isVirtual : cluster . isVirtualCluster ?? false ,
49
+ . map ( ( { id , cluster_name : name , isVirtualCluster } ) => ( {
50
+ id,
51
+ name,
52
+ isVirtual : isVirtualCluster ?? false ,
53
53
} ) )
54
54
. sort ( ( a , b ) => stringComparatorBySortOrder ( a . name , b . name ) )
55
55
}
@@ -62,13 +62,22 @@ export const getEnvironmentOptions = async (): Promise<EnvironmentType[]> => {
62
62
}
63
63
64
64
return result
65
- . map ( ( environment ) => ( {
66
- id : environment . id ,
67
- name : environment . environment_name ,
68
- isVirtual : environment . isVirtualEnvironment ?? false ,
69
- cluster : environment . cluster_name ,
70
- environmentType : environment . default ? EnvironmentTypeEnum . production : EnvironmentTypeEnum . nonProduction ,
71
- namespace : environment . namespace ,
72
- } ) )
65
+ . map (
66
+ ( {
67
+ id,
68
+ environment_name : name ,
69
+ isVirtualEnvironment,
70
+ cluster_name : cluster ,
71
+ default : isDefault ,
72
+ namespace,
73
+ } ) => ( {
74
+ id,
75
+ name,
76
+ isVirtual : isVirtualEnvironment ?? false ,
77
+ cluster,
78
+ environmentType : isDefault ? EnvironmentTypeEnum . production : EnvironmentTypeEnum . nonProduction ,
79
+ namespace,
80
+ } ) ,
81
+ )
73
82
. sort ( ( a , b ) => stringComparatorBySortOrder ( a . name , b . name ) )
74
83
}
0 commit comments