aboutsummaryrefslogtreecommitdiffhomepage
path: root/shared/extra-utils
diff options
context:
space:
mode:
Diffstat (limited to 'shared/extra-utils')
-rw-r--r--shared/extra-utils/server/jobs.ts20
1 files changed, 14 insertions, 6 deletions
diff --git a/shared/extra-utils/server/jobs.ts b/shared/extra-utils/server/jobs.ts
index cac00e9ab..a53749589 100644
--- a/shared/extra-utils/server/jobs.ts
+++ b/shared/extra-utils/server/jobs.ts
@@ -1,12 +1,20 @@
1import * as request from 'supertest' 1import * as request from 'supertest'
2import { HttpStatusCode } from '../../../shared/core-utils/miscs/http-error-codes'
3import { makeGetRequest } from '../../../shared/extra-utils'
2import { Job, JobState, JobType } from '../../models' 4import { Job, JobState, JobType } from '../../models'
3import { wait } from '../miscs/miscs' 5import { wait } from '../miscs/miscs'
4import { ServerInfo } from './servers' 6import { ServerInfo } from './servers'
5import { makeGetRequest } from '../../../shared/extra-utils'
6import { HttpStatusCode } from '../../../shared/core-utils/miscs/http-error-codes'
7 7
8function getJobsList (url: string, accessToken: string, state: JobState) { 8function buildJobsUrl (state?: JobState) {
9 const path = '/api/v1/jobs/' + state 9 let path = '/api/v1/jobs'
10
11 if (state) path += '/' + state
12
13 return path
14}
15
16function getJobsList (url: string, accessToken: string, state?: JobState) {
17 const path = buildJobsUrl(state)
10 18
11 return request(url) 19 return request(url)
12 .get(path) 20 .get(path)
@@ -19,14 +27,14 @@ function getJobsList (url: string, accessToken: string, state: JobState) {
19function getJobsListPaginationAndSort (options: { 27function getJobsListPaginationAndSort (options: {
20 url: string 28 url: string
21 accessToken: string 29 accessToken: string
22 state: JobState
23 start: number 30 start: number
24 count: number 31 count: number
25 sort: string 32 sort: string
33 state?: JobState
26 jobType?: JobType 34 jobType?: JobType
27}) { 35}) {
28 const { url, accessToken, state, start, count, sort, jobType } = options 36 const { url, accessToken, state, start, count, sort, jobType } = options
29 const path = '/api/v1/jobs/' + state 37 const path = buildJobsUrl(state)
30 38
31 const query = { 39 const query = {
32 start, 40 start,