1
1
import { consoleFetchJSON } from '@openshift-console/dynamic-plugin-sdk' ;
2
- import { ConfigMapKind , DeploymentConfigKind , DeploymentKind , JobKind , PersistentVolumeClaimKind , PodKind , RouteKind , SecretKind } from '../k8s-types' ;
3
- import { Application , deploymentConfigToApplication , deploymentToApplication } from '../types' ;
2
+ import { ConfigMapKind , CronJobKind , DeploymentConfigKind , DeploymentKind , JobKind , PersistentVolumeClaimKind , PodKind , RouteKind , SecretKind } from '../k8s-types' ;
3
+ import { Application , cronjobToApplication , deploymentConfigToApplication , deploymentToApplication } from '../types' ;
4
4
import { sprintf } from 'sprintf-js' ;
5
5
import { camelApplicationStore } from '../state' ;
6
6
@@ -9,6 +9,7 @@ const PROMETHEUS_API_QUERY_PATH = '/api/prometheus/api/v1/query';
9
9
const PROMETHEUS_API_QUERYRANGE_PATH = '/api/prometheus/api/v1/query_range' ;
10
10
11
11
export async function fetchDeployments ( ns : string ) : Promise < Application [ ] > {
12
+ debugger ;
12
13
let deploymentsUri = ns ? '/api/kubernetes/apis/apps/v1/namespaces/' + ns + '/deployments' : '/api/kubernetes/apis/apps/v1/deployments' ;
13
14
deploymentsUri += '?labelSelector=' + OPENSHIFT_RUNTIME_LABEL
14
15
return consoleFetchJSON ( deploymentsUri ) . then ( res => {
@@ -17,15 +18,16 @@ export async function fetchDeployments(ns: string): Promise<Application[]> {
17
18
} ) ;
18
19
}
19
20
20
- /* export async function fetchCronjobs(ns: string): Promise<Application[]> {
21
+ export async function fetchCronjobs ( ns : string ) : Promise < Application [ ] > {
22
+ debugger ;
21
23
let deploymentsUri = ns ? '/api/kubernetes/apis/batch/v1/namespaces/' + ns + '/cronjobs' : '/api/kubernetes/apis/batch/v1/cronjobs' ;
22
24
deploymentsUri += '?labelSelector=' + OPENSHIFT_RUNTIME_LABEL
23
25
return consoleFetchJSON ( deploymentsUri ) . then ( res => {
24
26
return res . items
25
- .map((d : CronJobKind) => deploymentToApplication(d ));
27
+ . map ( ( c : CronJobKind ) => cronjobToApplication ( c ) ) ;
26
28
} ) ;
27
29
}
28
- */
30
+
29
31
async function fetchDeployment ( ns : string , name : string ) : Promise < Application > {
30
32
return consoleFetchJSON ( '/api/kubernetes/apis/apps/v1/namespaces/' + ns + '/deployments/' + name ) . then ( res => {
31
33
return deploymentToApplication ( res ) ;
@@ -313,6 +315,7 @@ export async function fetchApplicationWithMetrics(kind: string, ns: string, name
313
315
}
314
316
315
317
const CamelService = {
318
+ fetchCronjobs,
316
319
fetchDeployments,
317
320
fetchDeploymentConfigs,
318
321
fetchApplications,
0 commit comments