aboutsummaryrefslogtreecommitdiffhomepage
path: root/shared
diff options
context:
space:
mode:
authorChocobozzz <me@florianbigard.com>2022-01-19 14:23:00 +0100
committerChocobozzz <me@florianbigard.com>2022-01-19 14:31:05 +0100
commit419b520ca4434d17f3505013174e195c3a316716 (patch)
tree24dbf663c4e11e970cb780f96e6eb3efe023b222 /shared
parent52435e467a0b30175a10af1dd3ae10d7d564d8ae (diff)
downloadPeerTube-419b520ca4434d17f3505013174e195c3a316716.tar.gz
PeerTube-419b520ca4434d17f3505013174e195c3a316716.tar.zst
PeerTube-419b520ca4434d17f3505013174e195c3a316716.zip
Add ability to cancel & delete video imports
Diffstat (limited to 'shared')
-rw-r--r--shared/models/users/user-right.enum.ts4
-rw-r--r--shared/models/videos/import/video-import-state.enum.ts4
-rw-r--r--shared/server-commands/server/jobs-command.ts24
-rw-r--r--shared/server-commands/videos/imports-command.ts28
4 files changed, 58 insertions, 2 deletions
diff --git a/shared/models/users/user-right.enum.ts b/shared/models/users/user-right.enum.ts
index 668535f4e..d3f793d8b 100644
--- a/shared/models/users/user-right.enum.ts
+++ b/shared/models/users/user-right.enum.ts
@@ -41,5 +41,7 @@ export const enum UserRight {
41 MANAGE_VIDEOS_REDUNDANCIES, 41 MANAGE_VIDEOS_REDUNDANCIES,
42 42
43 MANAGE_VIDEO_FILES, 43 MANAGE_VIDEO_FILES,
44 RUN_VIDEO_TRANSCODING 44 RUN_VIDEO_TRANSCODING,
45
46 MANAGE_VIDEO_IMPORTS
45} 47}
diff --git a/shared/models/videos/import/video-import-state.enum.ts b/shared/models/videos/import/video-import-state.enum.ts
index 33dd83f88..ff5c6beff 100644
--- a/shared/models/videos/import/video-import-state.enum.ts
+++ b/shared/models/videos/import/video-import-state.enum.ts
@@ -2,5 +2,7 @@ export const enum VideoImportState {
2 PENDING = 1, 2 PENDING = 1,
3 SUCCESS = 2, 3 SUCCESS = 2,
4 FAILED = 3, 4 FAILED = 3,
5 REJECTED = 4 5 REJECTED = 4,
6 CANCELLED = 5,
7 PROCESSING = 6
6} 8}
diff --git a/shared/server-commands/server/jobs-command.ts b/shared/server-commands/server/jobs-command.ts
index ac62157d1..b8790ea00 100644
--- a/shared/server-commands/server/jobs-command.ts
+++ b/shared/server-commands/server/jobs-command.ts
@@ -14,6 +14,30 @@ export class JobsCommand extends AbstractCommand {
14 return data[0] 14 return data[0]
15 } 15 }
16 16
17 pauseJobQueue (options: OverrideCommandOptions = {}) {
18 const path = '/api/v1/jobs/pause'
19
20 return this.postBodyRequest({
21 ...options,
22
23 path,
24 implicitToken: true,
25 defaultExpectedStatus: HttpStatusCode.NO_CONTENT_204
26 })
27 }
28
29 resumeJobQueue (options: OverrideCommandOptions = {}) {
30 const path = '/api/v1/jobs/resume'
31
32 return this.postBodyRequest({
33 ...options,
34
35 path,
36 implicitToken: true,
37 defaultExpectedStatus: HttpStatusCode.NO_CONTENT_204
38 })
39 }
40
17 list (options: OverrideCommandOptions & { 41 list (options: OverrideCommandOptions & {
18 state?: JobState 42 state?: JobState
19 jobType?: JobType 43 jobType?: JobType
diff --git a/shared/server-commands/videos/imports-command.ts b/shared/server-commands/videos/imports-command.ts
index e4944694d..f63ed5d4b 100644
--- a/shared/server-commands/videos/imports-command.ts
+++ b/shared/server-commands/videos/imports-command.ts
@@ -26,6 +26,34 @@ export class ImportsCommand extends AbstractCommand {
26 })) 26 }))
27 } 27 }
28 28
29 delete (options: OverrideCommandOptions & {
30 importId: number
31 }) {
32 const path = '/api/v1/videos/imports/' + options.importId
33
34 return this.deleteRequest({
35 ...options,
36
37 path,
38 implicitToken: true,
39 defaultExpectedStatus: HttpStatusCode.NO_CONTENT_204
40 })
41 }
42
43 cancel (options: OverrideCommandOptions & {
44 importId: number
45 }) {
46 const path = '/api/v1/videos/imports/' + options.importId + '/cancel'
47
48 return this.postBodyRequest({
49 ...options,
50
51 path,
52 implicitToken: true,
53 defaultExpectedStatus: HttpStatusCode.NO_CONTENT_204
54 })
55 }
56
29 getMyVideoImports (options: OverrideCommandOptions & { 57 getMyVideoImports (options: OverrideCommandOptions & {
30 sort?: string 58 sort?: string
31 } = {}) { 59 } = {}) {