diff options
author | Chocobozzz <me@florianbigard.com> | 2019-03-12 11:40:42 +0100 |
---|---|---|
committer | Chocobozzz <chocobozzz@cpy.re> | 2019-03-18 11:17:59 +0100 |
commit | 15e9d5ca39e0b792f61453fbf3885a0fc446afa7 (patch) | |
tree | 015628bc7497f45477d287e8bb482e39d5d491e2 /client/src/app/shared | |
parent | c5a1ae500e68b759f76851552be6dd10631d34f4 (diff) | |
download | PeerTube-15e9d5ca39e0b792f61453fbf3885a0fc446afa7.tar.gz PeerTube-15e9d5ca39e0b792f61453fbf3885a0fc446afa7.tar.zst PeerTube-15e9d5ca39e0b792f61453fbf3885a0fc446afa7.zip |
Playlist reorder support
Diffstat (limited to 'client/src/app/shared')
-rw-r--r-- | client/src/app/shared/shared.module.ts | 3 | ||||
-rw-r--r-- | client/src/app/shared/video-playlist/video-playlist.service.ts | 14 |
2 files changed, 14 insertions, 3 deletions
diff --git a/client/src/app/shared/shared.module.ts b/client/src/app/shared/shared.module.ts index 1f9eee0b7..05da0d829 100644 --- a/client/src/app/shared/shared.module.ts +++ b/client/src/app/shared/shared.module.ts | |||
@@ -9,7 +9,6 @@ import { InfiniteScrollerDirective } from '@app/shared/video/infinite-scroller.d | |||
9 | 9 | ||
10 | import { BytesPipe, KeysPipe, NgPipesModule } from 'ngx-pipes' | 10 | import { BytesPipe, KeysPipe, NgPipesModule } from 'ngx-pipes' |
11 | import { SharedModule as PrimeSharedModule } from 'primeng/components/common/shared' | 11 | import { SharedModule as PrimeSharedModule } from 'primeng/components/common/shared' |
12 | import { KeyFilterModule } from 'primeng/keyfilter' | ||
13 | 12 | ||
14 | import { AUTH_INTERCEPTOR_PROVIDER } from './auth' | 13 | import { AUTH_INTERCEPTOR_PROVIDER } from './auth' |
15 | import { ButtonComponent } from './buttons/button.component' | 14 | import { ButtonComponent } from './buttons/button.component' |
@@ -95,7 +94,6 @@ import { TimestampInputComponent } from '@app/shared/forms/timestamp-input.compo | |||
95 | 94 | ||
96 | PrimeSharedModule, | 95 | PrimeSharedModule, |
97 | InputMaskModule, | 96 | InputMaskModule, |
98 | KeyFilterModule, | ||
99 | NgPipesModule | 97 | NgPipesModule |
100 | ], | 98 | ], |
101 | 99 | ||
@@ -155,7 +153,6 @@ import { TimestampInputComponent } from '@app/shared/forms/timestamp-input.compo | |||
155 | 153 | ||
156 | PrimeSharedModule, | 154 | PrimeSharedModule, |
157 | InputMaskModule, | 155 | InputMaskModule, |
158 | KeyFilterModule, | ||
159 | BytesPipe, | 156 | BytesPipe, |
160 | KeysPipe, | 157 | KeysPipe, |
161 | 158 | ||
diff --git a/client/src/app/shared/video-playlist/video-playlist.service.ts b/client/src/app/shared/video-playlist/video-playlist.service.ts index f7b37f83a..da7437507 100644 --- a/client/src/app/shared/video-playlist/video-playlist.service.ts +++ b/client/src/app/shared/video-playlist/video-playlist.service.ts | |||
@@ -17,6 +17,7 @@ import { AccountService } from '@app/shared/account/account.service' | |||
17 | import { Account } from '@app/shared/account/account.model' | 17 | import { Account } from '@app/shared/account/account.model' |
18 | import { RestService } from '@app/shared/rest' | 18 | import { RestService } from '@app/shared/rest' |
19 | import { VideoExistInPlaylist } from '@shared/models/videos/playlist/video-exist-in-playlist.model' | 19 | import { VideoExistInPlaylist } from '@shared/models/videos/playlist/video-exist-in-playlist.model' |
20 | import { VideoPlaylistReorder } from '@shared/models/videos/playlist/video-playlist-reorder.model' | ||
20 | 21 | ||
21 | @Injectable() | 22 | @Injectable() |
22 | export class VideoPlaylistService { | 23 | export class VideoPlaylistService { |
@@ -125,6 +126,19 @@ export class VideoPlaylistService { | |||
125 | ) | 126 | ) |
126 | } | 127 | } |
127 | 128 | ||
129 | reorderPlaylist (playlistId: number, oldPosition: number, newPosition: number) { | ||
130 | const body: VideoPlaylistReorder = { | ||
131 | startPosition: oldPosition, | ||
132 | insertAfterPosition: newPosition | ||
133 | } | ||
134 | |||
135 | return this.authHttp.post(VideoPlaylistService.BASE_VIDEO_PLAYLIST_URL + playlistId + '/videos/reorder', body) | ||
136 | .pipe( | ||
137 | map(this.restExtractor.extractDataBool), | ||
138 | catchError(err => this.restExtractor.handleError(err)) | ||
139 | ) | ||
140 | } | ||
141 | |||
128 | doesVideoExistInPlaylist (videoId: number) { | 142 | doesVideoExistInPlaylist (videoId: number) { |
129 | this.videoExistsInPlaylistSubject.next(videoId) | 143 | this.videoExistsInPlaylistSubject.next(videoId) |
130 | 144 | ||