aboutsummaryrefslogtreecommitdiffhomepage
path: root/client
diff options
context:
space:
mode:
authorChocobozzz <me@florianbigard.com>2021-10-14 11:35:43 +0200
committerChocobozzz <me@florianbigard.com>2021-10-14 11:35:43 +0200
commitcf0c8ee588e37809d85ec1deec1e4fdfa0f122a5 (patch)
tree1692868027592d2a300988643fdd96e5fdfe2091 /client
parente1a570abff3ebf375433e58e7362d56bd32d4cd8 (diff)
downloadPeerTube-cf0c8ee588e37809d85ec1deec1e4fdfa0f122a5.tar.gz
PeerTube-cf0c8ee588e37809d85ec1deec1e4fdfa0f122a5.tar.zst
PeerTube-cf0c8ee588e37809d85ec1deec1e4fdfa0f122a5.zip
Fix admin edition disabling feature
Diffstat (limited to 'client')
-rw-r--r--client/src/app/+admin/config/edit-custom-config/edit-custom-config.component.html14
-rw-r--r--client/src/app/+admin/config/edit-custom-config/edit-custom-config.component.ts7
-rw-r--r--client/src/app/shared/shared-forms/markdown-textarea.component.html2
3 files changed, 18 insertions, 5 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 6ae7b1b79..8fef39b79 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
@@ -1,4 +1,9 @@
1<h1 class="sr-only" i18n>Configuration</h1> 1<h1 class="sr-only" i18n>Configuration</h1>
2
3<div class="alert alert-warning" *ngIf="!isUpdateAllowed()" i18n>
4 Updating instance configuration from the web interface is disabled by the system administrator.
5</div>
6
2<form role="form" [formGroup]="form"> 7<form role="form" [formGroup]="form">
3 8
4 <div ngbNav #nav="ngbNav" [activeId]="activeNav" (activeIdChange)="onNavChange($event)" class="nav-tabs"> 9 <div ngbNav #nav="ngbNav" [activeId]="activeNav" (activeIdChange)="onNavChange($event)" class="nav-tabs">
@@ -63,7 +68,7 @@
63 <div class="col-md-7 col-xl-5"></div> 68 <div class="col-md-7 col-xl-5"></div>
64 <div class="col-md-5 col-xl-5"> 69 <div class="col-md-5 col-xl-5">
65 70
66 <div class="form-error submit-error" i18n *ngIf="!form.valid && serverConfig.allowEdits"> 71 <div class="form-error submit-error" i18n *ngIf="!form.valid && isUpdateAllowed()">
67 There are errors in the form: 72 There are errors in the form:
68 73
69 <ul> 74 <ul>
@@ -77,11 +82,14 @@
77 You cannot allow live replay if you don't enable transcoding. 82 You cannot allow live replay if you don't enable transcoding.
78 </span> 83 </span>
79 84
80 <span i18n *ngIf="!serverConfig.allowEdits"> 85 <span i18n *ngIf="!isUpdateAllowed()">
81 You cannot change the server configuration because it's managed externally. 86 You cannot change the server configuration because it's managed externally.
82 </span> 87 </span>
83 88
84 <input (click)="formValidated()" type="submit" i18n-value value="Update configuration" [disabled]="!form.valid || !hasConsistentOptions() || !serverConfig.allowEdits"> 89 <input
90 (click)="formValidated()" type="submit" i18n-value value="Update configuration"
91 [disabled]="!form.valid || !hasConsistentOptions() || !isUpdateAllowed()"
92 >
85 </div> 93 </div>
86 </div> 94 </div>
87</form> 95</form>
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 04b0175a7..96c67fac7 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,7 +258,8 @@ 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) { 261
262 if (!this.isUpdateAllowed()) {
262 this.form.disable() 263 this.form.disable()
263 } 264 }
264 } 265 }
@@ -293,6 +294,10 @@ export class EditCustomConfigComponent extends FormReactive implements OnInit {
293 }) 294 })
294 } 295 }
295 296
297 isUpdateAllowed () {
298 return this.serverConfig.webadmin.configuration.edition.allowed === true
299 }
300
296 hasConsistentOptions () { 301 hasConsistentOptions () {
297 if (this.hasLiveAllowReplayConsistentOptions()) return true 302 if (this.hasLiveAllowReplayConsistentOptions()) return true
298 303
diff --git a/client/src/app/shared/shared-forms/markdown-textarea.component.html b/client/src/app/shared/shared-forms/markdown-textarea.component.html
index a460cb9b7..7c2a42791 100644
--- a/client/src/app/shared/shared-forms/markdown-textarea.component.html
+++ b/client/src/app/shared/shared-forms/markdown-textarea.component.html
@@ -2,7 +2,7 @@
2 <textarea #textarea 2 <textarea #textarea
3 [(ngModel)]="content" (ngModelChange)="onModelChange()" 3 [(ngModel)]="content" (ngModelChange)="onModelChange()"
4 class="form-control" [ngClass]="classes" 4 class="form-control" [ngClass]="classes"
5 [attr.disabled]="disabled" 5 [attr.disabled]="disabled || null"
6 [ngStyle]="{ height: textareaHeight }" 6 [ngStyle]="{ height: textareaHeight }"
7 [id]="name" [name]="name"> 7 [id]="name" [name]="name">
8 </textarea> 8 </textarea>