aboutsummaryrefslogtreecommitdiffhomepage
path: root/client/src/app/+my-account/+my-account-video-channels/my-account-video-channel-create.component.ts
diff options
context:
space:
mode:
authorChocobozzz <me@florianbigard.com>2020-11-12 15:28:54 +0100
committerChocobozzz <chocobozzz@cpy.re>2020-11-13 12:02:21 +0100
commit17119e4a546522468878cf115558b17949ab50d0 (patch)
tree3f130cfd7fdccf5aeeac9beee941750590239047 /client/src/app/+my-account/+my-account-video-channels/my-account-video-channel-create.component.ts
parentb4bc269e5517849b5b89052f0c1a2c01b6f65089 (diff)
downloadPeerTube-17119e4a546522468878cf115558b17949ab50d0.tar.gz
PeerTube-17119e4a546522468878cf115558b17949ab50d0.tar.zst
PeerTube-17119e4a546522468878cf115558b17949ab50d0.zip
Reorganize left menu and account menu
Add my-settings and my-library in left menu Move administration below my-library Split account menu: my-setting and my library
Diffstat (limited to 'client/src/app/+my-account/+my-account-video-channels/my-account-video-channel-create.component.ts')
-rw-r--r--client/src/app/+my-account/+my-account-video-channels/my-account-video-channel-create.component.ts83
1 files changed, 0 insertions, 83 deletions
diff --git a/client/src/app/+my-account/+my-account-video-channels/my-account-video-channel-create.component.ts b/client/src/app/+my-account/+my-account-video-channels/my-account-video-channel-create.component.ts
deleted file mode 100644
index e2ea87fb8..000000000
--- a/client/src/app/+my-account/+my-account-video-channels/my-account-video-channel-create.component.ts
+++ /dev/null
@@ -1,83 +0,0 @@
1import { Component, OnInit } from '@angular/core'
2import { Router } from '@angular/router'
3import { AuthService, Notifier } from '@app/core'
4import {
5 VIDEO_CHANNEL_DESCRIPTION_VALIDATOR,
6 VIDEO_CHANNEL_DISPLAY_NAME_VALIDATOR,
7 VIDEO_CHANNEL_NAME_VALIDATOR,
8 VIDEO_CHANNEL_SUPPORT_VALIDATOR
9} from '@app/shared/form-validators/video-channel-validators'
10import { FormValidatorService } from '@app/shared/shared-forms'
11import { VideoChannelService } from '@app/shared/shared-main'
12import { VideoChannelCreate } from '@shared/models'
13import { MyAccountVideoChannelEdit } from './my-account-video-channel-edit'
14
15@Component({
16 selector: 'my-account-video-channel-create',
17 templateUrl: './my-account-video-channel-edit.component.html',
18 styleUrls: [ './my-account-video-channel-edit.component.scss' ]
19})
20export class MyAccountVideoChannelCreateComponent extends MyAccountVideoChannelEdit implements OnInit {
21 error: string
22
23 constructor (
24 protected formValidatorService: FormValidatorService,
25 private authService: AuthService,
26 private notifier: Notifier,
27 private router: Router,
28 private videoChannelService: VideoChannelService
29 ) {
30 super()
31 }
32
33 get instanceHost () {
34 return window.location.host
35 }
36
37 ngOnInit () {
38 this.buildForm({
39 name: VIDEO_CHANNEL_NAME_VALIDATOR,
40 'display-name': VIDEO_CHANNEL_DISPLAY_NAME_VALIDATOR,
41 description: VIDEO_CHANNEL_DESCRIPTION_VALIDATOR,
42 support: VIDEO_CHANNEL_SUPPORT_VALIDATOR
43 })
44 }
45
46 formValidated () {
47 this.error = undefined
48
49 const body = this.form.value
50 const videoChannelCreate: VideoChannelCreate = {
51 name: body.name,
52 displayName: body['display-name'],
53 description: body.description || null,
54 support: body.support || null
55 }
56
57 this.videoChannelService.createVideoChannel(videoChannelCreate).subscribe(
58 () => {
59 this.authService.refreshUserInformation()
60
61 this.notifier.success($localize`Video channel ${videoChannelCreate.displayName} created.`)
62 this.router.navigate([ '/my-account', 'video-channels' ])
63 },
64
65 err => {
66 if (err.status === 409) {
67 this.error = $localize`This name already exists on this instance.`
68 return
69 }
70
71 this.error = err.message
72 }
73 )
74 }
75
76 isCreation () {
77 return true
78 }
79
80 getFormButtonTitle () {
81 return $localize`Create`
82 }
83}