diff options
author | Chocobozzz <me@florianbigard.com> | 2023-07-27 11:44:31 +0200 |
---|---|---|
committer | Chocobozzz <me@florianbigard.com> | 2023-07-27 14:17:12 +0200 |
commit | f18003d0ac5c3fc6ec8de2a89102d1e1e89182df (patch) | |
tree | 0b3baa5658478607f3417fe7c747cc3a782f15b3 /server/helpers | |
parent | f5af5feb5a41eb6e2796e480402106b55bd10f04 (diff) | |
download | PeerTube-f18003d0ac5c3fc6ec8de2a89102d1e1e89182df.tar.gz PeerTube-f18003d0ac5c3fc6ec8de2a89102d1e1e89182df.tar.zst PeerTube-f18003d0ac5c3fc6ec8de2a89102d1e1e89182df.zip |
Improve runner management
* Add ability to remove runner jobs
* Add runner job state quick filter
* Merge registration tokens and runners tables in the same page
* Add copy button to copy registration token
Diffstat (limited to 'server/helpers')
-rw-r--r-- | server/helpers/custom-validators/runners/jobs.ts | 16 |
1 files changed, 13 insertions, 3 deletions
diff --git a/server/helpers/custom-validators/runners/jobs.ts b/server/helpers/custom-validators/runners/jobs.ts index 725a7658f..6349e79ba 100644 --- a/server/helpers/custom-validators/runners/jobs.ts +++ b/server/helpers/custom-validators/runners/jobs.ts | |||
@@ -1,6 +1,6 @@ | |||
1 | import { UploadFilesForCheck } from 'express' | 1 | import { UploadFilesForCheck } from 'express' |
2 | import validator from 'validator' | 2 | import validator from 'validator' |
3 | import { CONSTRAINTS_FIELDS } from '@server/initializers/constants' | 3 | import { CONSTRAINTS_FIELDS, RUNNER_JOB_STATES } from '@server/initializers/constants' |
4 | import { | 4 | import { |
5 | LiveRTMPHLSTranscodingSuccess, | 5 | LiveRTMPHLSTranscodingSuccess, |
6 | RunnerJobSuccessPayload, | 6 | RunnerJobSuccessPayload, |
@@ -11,7 +11,7 @@ import { | |||
11 | VODHLSTranscodingSuccess, | 11 | VODHLSTranscodingSuccess, |
12 | VODWebVideoTranscodingSuccess | 12 | VODWebVideoTranscodingSuccess |
13 | } from '@shared/models' | 13 | } from '@shared/models' |
14 | import { exists, isFileValid, isSafeFilename } from '../misc' | 14 | import { exists, isArray, isFileValid, isSafeFilename } from '../misc' |
15 | 15 | ||
16 | const RUNNER_JOBS_CONSTRAINTS_FIELDS = CONSTRAINTS_FIELDS.RUNNER_JOBS | 16 | const RUNNER_JOBS_CONSTRAINTS_FIELDS = CONSTRAINTS_FIELDS.RUNNER_JOBS |
17 | 17 | ||
@@ -56,6 +56,14 @@ function isRunnerJobErrorMessageValid (value: string) { | |||
56 | return validator.isLength(value, RUNNER_JOBS_CONSTRAINTS_FIELDS.ERROR_MESSAGE) | 56 | return validator.isLength(value, RUNNER_JOBS_CONSTRAINTS_FIELDS.ERROR_MESSAGE) |
57 | } | 57 | } |
58 | 58 | ||
59 | function isRunnerJobStateValid (value: any) { | ||
60 | return exists(value) && RUNNER_JOB_STATES[value] !== undefined | ||
61 | } | ||
62 | |||
63 | function isRunnerJobArrayOfStateValid (value: any) { | ||
64 | return isArray(value) && value.every(v => isRunnerJobStateValid(v)) | ||
65 | } | ||
66 | |||
59 | // --------------------------------------------------------------------------- | 67 | // --------------------------------------------------------------------------- |
60 | 68 | ||
61 | export { | 69 | export { |
@@ -65,7 +73,9 @@ export { | |||
65 | isRunnerJobTokenValid, | 73 | isRunnerJobTokenValid, |
66 | isRunnerJobErrorMessageValid, | 74 | isRunnerJobErrorMessageValid, |
67 | isRunnerJobProgressValid, | 75 | isRunnerJobProgressValid, |
68 | isRunnerJobAbortReasonValid | 76 | isRunnerJobAbortReasonValid, |
77 | isRunnerJobArrayOfStateValid, | ||
78 | isRunnerJobStateValid | ||
69 | } | 79 | } |
70 | 80 | ||
71 | // --------------------------------------------------------------------------- | 81 | // --------------------------------------------------------------------------- |