diff options
author | Chocobozzz <me@florianbigard.com> | 2018-01-31 16:42:40 +0100 |
---|---|---|
committer | Chocobozzz <me@florianbigard.com> | 2018-01-31 16:42:40 +0100 |
commit | 66b16cafb380012d3eca14e524d86f2450e04069 (patch) | |
tree | 02a6d2327e2499dbe921c22a03b8a9d741773dd6 /client/src/app/+admin/config/edit-custom-config/edit-custom-config.component.ts | |
parent | 81ebea48bfba2d81e62dd7a0f01a0cadf41d2607 (diff) | |
download | PeerTube-66b16cafb380012d3eca14e524d86f2450e04069.tar.gz PeerTube-66b16cafb380012d3eca14e524d86f2450e04069.tar.zst PeerTube-66b16cafb380012d3eca14e524d86f2450e04069.zip |
Add new name/terms/description config options
Diffstat (limited to 'client/src/app/+admin/config/edit-custom-config/edit-custom-config.component.ts')
-rw-r--r-- | client/src/app/+admin/config/edit-custom-config/edit-custom-config.component.ts | 25 |
1 files changed, 24 insertions, 1 deletions
diff --git a/client/src/app/+admin/config/edit-custom-config/edit-custom-config.component.ts b/client/src/app/+admin/config/edit-custom-config/edit-custom-config.component.ts index 1b3522786..cd8c926f7 100644 --- a/client/src/app/+admin/config/edit-custom-config/edit-custom-config.component.ts +++ b/client/src/app/+admin/config/edit-custom-config/edit-custom-config.component.ts | |||
@@ -4,7 +4,13 @@ import { Router } from '@angular/router' | |||
4 | import { ConfigService } from '@app/+admin/config/shared/config.service' | 4 | import { ConfigService } from '@app/+admin/config/shared/config.service' |
5 | import { ServerService } from '@app/core/server/server.service' | 5 | import { ServerService } from '@app/core/server/server.service' |
6 | import { FormReactive, USER_VIDEO_QUOTA } from '@app/shared' | 6 | import { FormReactive, USER_VIDEO_QUOTA } from '@app/shared' |
7 | import { ADMIN_EMAIL, CACHE_PREVIEWS_SIZE, SIGNUP_LIMIT, TRANSCODING_THREADS } from '@app/shared/forms/form-validators/custom-config' | 7 | import { |
8 | ADMIN_EMAIL, | ||
9 | CACHE_PREVIEWS_SIZE, | ||
10 | INSTANCE_NAME, | ||
11 | SIGNUP_LIMIT, | ||
12 | TRANSCODING_THREADS | ||
13 | } from '@app/shared/forms/form-validators/custom-config' | ||
8 | import { NotificationsService } from 'angular2-notifications' | 14 | import { NotificationsService } from 'angular2-notifications' |
9 | import { CustomConfig } from '../../../../../../shared/models/config/custom-config.model' | 15 | import { CustomConfig } from '../../../../../../shared/models/config/custom-config.model' |
10 | 16 | ||
@@ -36,6 +42,9 @@ export class EditCustomConfigComponent extends FormReactive implements OnInit { | |||
36 | 42 | ||
37 | form: FormGroup | 43 | form: FormGroup |
38 | formErrors = { | 44 | formErrors = { |
45 | instanceName: '', | ||
46 | instanceDescription: '', | ||
47 | instanceTerms: '', | ||
39 | cachePreviewsSize: '', | 48 | cachePreviewsSize: '', |
40 | signupLimit: '', | 49 | signupLimit: '', |
41 | adminEmail: '', | 50 | adminEmail: '', |
@@ -43,6 +52,7 @@ export class EditCustomConfigComponent extends FormReactive implements OnInit { | |||
43 | transcodingThreads: '' | 52 | transcodingThreads: '' |
44 | } | 53 | } |
45 | validationMessages = { | 54 | validationMessages = { |
55 | instanceName: INSTANCE_NAME.MESSAGES, | ||
46 | cachePreviewsSize: CACHE_PREVIEWS_SIZE.MESSAGES, | 56 | cachePreviewsSize: CACHE_PREVIEWS_SIZE.MESSAGES, |
47 | signupLimit: SIGNUP_LIMIT.MESSAGES, | 57 | signupLimit: SIGNUP_LIMIT.MESSAGES, |
48 | adminEmail: ADMIN_EMAIL.MESSAGES, | 58 | adminEmail: ADMIN_EMAIL.MESSAGES, |
@@ -65,6 +75,9 @@ export class EditCustomConfigComponent extends FormReactive implements OnInit { | |||
65 | 75 | ||
66 | buildForm () { | 76 | buildForm () { |
67 | const formGroupData = { | 77 | const formGroupData = { |
78 | instanceName: [ '', INSTANCE_NAME.VALIDATORS ], | ||
79 | instanceDescription: [ '' ], | ||
80 | instanceTerms: [ '' ], | ||
68 | cachePreviewsSize: [ '', CACHE_PREVIEWS_SIZE.VALIDATORS ], | 81 | cachePreviewsSize: [ '', CACHE_PREVIEWS_SIZE.VALIDATORS ], |
69 | signupEnabled: [ ], | 82 | signupEnabled: [ ], |
70 | signupLimit: [ '', SIGNUP_LIMIT.VALIDATORS ], | 83 | signupLimit: [ '', SIGNUP_LIMIT.VALIDATORS ], |
@@ -109,6 +122,11 @@ export class EditCustomConfigComponent extends FormReactive implements OnInit { | |||
109 | 122 | ||
110 | formValidated () { | 123 | formValidated () { |
111 | const data = { | 124 | const data = { |
125 | instance: { | ||
126 | name: this.form.value['instanceName'], | ||
127 | description: this.form.value['instanceDescription'], | ||
128 | terms: this.form.value['instanceTerms'] | ||
129 | }, | ||
112 | cache: { | 130 | cache: { |
113 | previews: { | 131 | previews: { |
114 | size: this.form.value['cachePreviewsSize'] | 132 | size: this.form.value['cachePreviewsSize'] |
@@ -146,6 +164,8 @@ export class EditCustomConfigComponent extends FormReactive implements OnInit { | |||
146 | this.serverService.loadConfig() | 164 | this.serverService.loadConfig() |
147 | 165 | ||
148 | this.updateForm() | 166 | this.updateForm() |
167 | |||
168 | this.notificationsService.success('Success', 'Configuration updated.') | ||
149 | }, | 169 | }, |
150 | 170 | ||
151 | err => this.notificationsService.error('Error', err.message) | 171 | err => this.notificationsService.error('Error', err.message) |
@@ -154,6 +174,9 @@ export class EditCustomConfigComponent extends FormReactive implements OnInit { | |||
154 | 174 | ||
155 | private updateForm () { | 175 | private updateForm () { |
156 | const data = { | 176 | const data = { |
177 | instanceName: this.customConfig.instance.name, | ||
178 | instanceDescription: this.customConfig.instance.description, | ||
179 | instanceTerms: this.customConfig.instance.terms, | ||
157 | cachePreviewsSize: this.customConfig.cache.previews.size, | 180 | cachePreviewsSize: this.customConfig.cache.previews.size, |
158 | signupEnabled: this.customConfig.signup.enabled, | 181 | signupEnabled: this.customConfig.signup.enabled, |
159 | signupLimit: this.customConfig.signup.limit, | 182 | signupLimit: this.customConfig.signup.limit, |