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 | |
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')
-rw-r--r-- | client/src/app/+admin/config/edit-custom-config/edit-custom-config.component.html | 35 | ||||
-rw-r--r-- | client/src/app/+admin/config/edit-custom-config/edit-custom-config.component.ts | 25 |
2 files changed, 59 insertions, 1 deletions
diff --git a/client/src/app/+admin/config/edit-custom-config/edit-custom-config.component.html b/client/src/app/+admin/config/edit-custom-config/edit-custom-config.component.html index c568a43b4..0fe2aa203 100644 --- a/client/src/app/+admin/config/edit-custom-config/edit-custom-config.component.html +++ b/client/src/app/+admin/config/edit-custom-config/edit-custom-config.component.html | |||
@@ -2,6 +2,41 @@ | |||
2 | 2 | ||
3 | <form role="form" (ngSubmit)="formValidated()" [formGroup]="form"> | 3 | <form role="form" (ngSubmit)="formValidated()" [formGroup]="form"> |
4 | 4 | ||
5 | <div class="inner-form-title">Instance</div> | ||
6 | |||
7 | <div class="form-group"> | ||
8 | <label for="instanceName">Name</label> | ||
9 | <input | ||
10 | type="text" id="instanceName" | ||
11 | formControlName="instanceName" [ngClass]="{ 'input-error': formErrors['instanceName'] }" | ||
12 | > | ||
13 | <div *ngIf="formErrors.instanceName" class="form-error"> | ||
14 | {{ formErrors.instanceName }} | ||
15 | </div> | ||
16 | </div> | ||
17 | |||
18 | <div class="form-group"> | ||
19 | <label for="instanceDescription">Description (markdown)</label> | ||
20 | <my-markdown-textarea | ||
21 | id="instanceDescription" formControlName="instanceDescription" textareaWidth="500px" [previewColumn]="true" | ||
22 | [classes]="{ 'input-error': formErrors['instanceDescription'] }" | ||
23 | ></my-markdown-textarea> | ||
24 | <div *ngIf="formErrors.instanceDescription" class="form-error"> | ||
25 | {{ formErrors.instanceDescription }} | ||
26 | </div> | ||
27 | </div> | ||
28 | |||
29 | <div class="form-group"> | ||
30 | <label for="instanceTerms">Terms (markdown)</label> | ||
31 | <my-markdown-textarea | ||
32 | id="instanceTerms" formControlName="instanceTerms" textareaWidth="500px" [previewColumn]="true" | ||
33 | [ngClass]="{ 'input-error': formErrors['instanceTerms'] }" | ||
34 | ></my-markdown-textarea> | ||
35 | <div *ngIf="formErrors.instanceTerms" class="form-error"> | ||
36 | {{ formErrors.instanceTerms }} | ||
37 | </div> | ||
38 | </div> | ||
39 | |||
5 | <div class="inner-form-title">Cache</div> | 40 | <div class="inner-form-title">Cache</div> |
6 | 41 | ||
7 | <div class="form-group"> | 42 | <div class="form-group"> |
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, |