diff options
author | Jelle Besseling <jelle@pingiun.com> | 2021-10-12 13:33:44 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-10-12 13:33:44 +0200 |
commit | 8d8a037e3fe9b1d2ccbc4169ce59b13000b59cb0 (patch) | |
tree | 755ba56bc3acbd82ec195974545581c1e49aae5e /client/src/app/+admin | |
parent | badacdbb4a3e4a1aae4d324abc496be8e261b2ef (diff) | |
download | PeerTube-8d8a037e3fe9b1d2ccbc4169ce59b13000b59cb0.tar.gz PeerTube-8d8a037e3fe9b1d2ccbc4169ce59b13000b59cb0.tar.zst PeerTube-8d8a037e3fe9b1d2ccbc4169ce59b13000b59cb0.zip |
Allow configuration to be static/readonly (#4315)
* Allow configuration to be static/readonly
* Make all components disableable
* Improve disabled component styling
* Rename edits allowed field in configuration
* Fix CI
Diffstat (limited to 'client/src/app/+admin')
3 files changed, 19 insertions, 2 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 3ceea02ca..6ae7b1b79 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 | |||
@@ -63,7 +63,7 @@ | |||
63 | <div class="col-md-7 col-xl-5"></div> | 63 | <div class="col-md-7 col-xl-5"></div> |
64 | <div class="col-md-5 col-xl-5"> | 64 | <div class="col-md-5 col-xl-5"> |
65 | 65 | ||
66 | <div class="form-error submit-error" i18n *ngIf="!form.valid"> | 66 | <div class="form-error submit-error" i18n *ngIf="!form.valid && serverConfig.allowEdits"> |
67 | There are errors in the form: | 67 | There are errors in the form: |
68 | 68 | ||
69 | <ul> | 69 | <ul> |
@@ -77,7 +77,11 @@ | |||
77 | You cannot allow live replay if you don't enable transcoding. | 77 | You cannot allow live replay if you don't enable transcoding. |
78 | </span> | 78 | </span> |
79 | 79 | ||
80 | <input (click)="formValidated()" type="submit" i18n-value value="Update configuration" [disabled]="!form.valid || !hasConsistentOptions()"> | 80 | <span i18n *ngIf="!serverConfig.allowEdits"> |
81 | You cannot change the server configuration because it's managed externally. | ||
82 | </span> | ||
83 | |||
84 | <input (click)="formValidated()" type="submit" i18n-value value="Update configuration" [disabled]="!form.valid || !hasConsistentOptions() || !serverConfig.allowEdits"> | ||
81 | </div> | 85 | </div> |
82 | </div> | 86 | </div> |
83 | </form> | 87 | </form> |
diff --git a/client/src/app/+admin/config/edit-custom-config/edit-custom-config.component.scss b/client/src/app/+admin/config/edit-custom-config/edit-custom-config.component.scss index 5951d0aaa..0458d257f 100644 --- a/client/src/app/+admin/config/edit-custom-config/edit-custom-config.component.scss +++ b/client/src/app/+admin/config/edit-custom-config/edit-custom-config.component.scss | |||
@@ -33,6 +33,11 @@ input[type=number] { | |||
33 | top: 5px; | 33 | top: 5px; |
34 | right: 2.5rem; | 34 | right: 2.5rem; |
35 | } | 35 | } |
36 | |||
37 | input[disabled] { | ||
38 | background-color: #f9f9f9; | ||
39 | pointer-events: none; | ||
40 | } | ||
36 | } | 41 | } |
37 | 42 | ||
38 | input[type=checkbox] { | 43 | input[type=checkbox] { |
@@ -93,6 +98,11 @@ textarea { | |||
93 | } | 98 | } |
94 | } | 99 | } |
95 | 100 | ||
101 | input[disabled] { | ||
102 | opacity: 0.5; | ||
103 | } | ||
104 | |||
105 | |||
96 | .form-group-right { | 106 | .form-group-right { |
97 | padding-top: 2px; | 107 | padding-top: 2px; |
98 | } | 108 | } |
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 f13fe4bf9..04b0175a7 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 | |||
@@ -258,6 +258,9 @@ export class EditCustomConfigComponent extends FormReactive implements OnInit { | |||
258 | 258 | ||
259 | this.loadConfigAndUpdateForm() | 259 | this.loadConfigAndUpdateForm() |
260 | this.loadCategoriesAndLanguages() | 260 | this.loadCategoriesAndLanguages() |
261 | if (!this.serverConfig.allowEdits) { | ||
262 | this.form.disable() | ||
263 | } | ||
261 | } | 264 | } |
262 | 265 | ||
263 | formValidated () { | 266 | formValidated () { |