aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/helpers
diff options
context:
space:
mode:
authorChocobozzz <me@florianbigard.com>2023-07-27 11:44:31 +0200
committerChocobozzz <me@florianbigard.com>2023-07-27 14:17:12 +0200
commitf18003d0ac5c3fc6ec8de2a89102d1e1e89182df (patch)
tree0b3baa5658478607f3417fe7c747cc3a782f15b3 /server/helpers
parentf5af5feb5a41eb6e2796e480402106b55bd10f04 (diff)
downloadPeerTube-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.ts16
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 @@
1import { UploadFilesForCheck } from 'express' 1import { UploadFilesForCheck } from 'express'
2import validator from 'validator' 2import validator from 'validator'
3import { CONSTRAINTS_FIELDS } from '@server/initializers/constants' 3import { CONSTRAINTS_FIELDS, RUNNER_JOB_STATES } from '@server/initializers/constants'
4import { 4import {
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'
14import { exists, isFileValid, isSafeFilename } from '../misc' 14import { exists, isArray, isFileValid, isSafeFilename } from '../misc'
15 15
16const RUNNER_JOBS_CONSTRAINTS_FIELDS = CONSTRAINTS_FIELDS.RUNNER_JOBS 16const 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
59function isRunnerJobStateValid (value: any) {
60 return exists(value) && RUNNER_JOB_STATES[value] !== undefined
61}
62
63function isRunnerJobArrayOfStateValid (value: any) {
64 return isArray(value) && value.every(v => isRunnerJobStateValid(v))
65}
66
59// --------------------------------------------------------------------------- 67// ---------------------------------------------------------------------------
60 68
61export { 69export {
@@ -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// ---------------------------------------------------------------------------