aboutsummaryrefslogtreecommitdiffhomepage
path: root/client/src/app/+admin
diff options
context:
space:
mode:
authorChocobozzz <me@florianbigard.com>2021-04-22 11:18:13 +0200
committerChocobozzz <me@florianbigard.com>2021-04-22 11:18:13 +0200
commit0ea9f463a9dc642ec44af4887b97e9dd63b323ef (patch)
treeb3fe33ab598f8ac503f74a0603a78877144939c2 /client/src/app/+admin
parent302eba0d898e38dca14739486441c27c0be6c62f (diff)
downloadPeerTube-0ea9f463a9dc642ec44af4887b97e9dd63b323ef.tar.gz
PeerTube-0ea9f463a9dc642ec44af4887b97e9dd63b323ef.tar.zst
PeerTube-0ea9f463a9dc642ec44af4887b97e9dd63b323ef.zip
Add action:admin-plugin-settings.init client hook
Diffstat (limited to 'client/src/app/+admin')
-rw-r--r--client/src/app/+admin/plugins/plugin-show-installed/plugin-show-installed.component.html2
-rw-r--r--client/src/app/+admin/plugins/plugin-show-installed/plugin-show-installed.component.ts11
2 files changed, 11 insertions, 2 deletions
diff --git a/client/src/app/+admin/plugins/plugin-show-installed/plugin-show-installed.component.html b/client/src/app/+admin/plugins/plugin-show-installed/plugin-show-installed.component.html
index ad65293d4..dbc521092 100644
--- a/client/src/app/+admin/plugins/plugin-show-installed/plugin-show-installed.component.html
+++ b/client/src/app/+admin/plugins/plugin-show-installed/plugin-show-installed.component.html
@@ -6,7 +6,7 @@
6 </h2> 6 </h2>
7 7
8 <form *ngIf="hasRegisteredSettings()" role="form" (ngSubmit)="formValidated()" [formGroup]="form"> 8 <form *ngIf="hasRegisteredSettings()" role="form" (ngSubmit)="formValidated()" [formGroup]="form">
9 <div class="form-group" *ngFor="let setting of registeredSettings"> 9 <div class="form-group" *ngFor="let setting of registeredSettings" [id]="getWrapperId(setting)">
10 <my-dynamic-form-field [hidden]="isSettingHidden(setting)" [form]="form" [setting]="setting" [formErrors]="formErrors"></my-dynamic-form-field> 10 <my-dynamic-form-field [hidden]="isSettingHidden(setting)" [form]="form" [setting]="setting" [formErrors]="formErrors"></my-dynamic-form-field>
11 </div> 11 </div>
12 12
diff --git a/client/src/app/+admin/plugins/plugin-show-installed/plugin-show-installed.component.ts b/client/src/app/+admin/plugins/plugin-show-installed/plugin-show-installed.component.ts
index ca9ad9922..c3d14d2b3 100644
--- a/client/src/app/+admin/plugins/plugin-show-installed/plugin-show-installed.component.ts
+++ b/client/src/app/+admin/plugins/plugin-show-installed/plugin-show-installed.component.ts
@@ -2,7 +2,7 @@ import { Subscription } from 'rxjs'
2import { map, switchMap } from 'rxjs/operators' 2import { map, switchMap } from 'rxjs/operators'
3import { Component, OnDestroy, OnInit } from '@angular/core' 3import { Component, OnDestroy, OnInit } from '@angular/core'
4import { ActivatedRoute } from '@angular/router' 4import { ActivatedRoute } from '@angular/router'
5import { Notifier, PluginService } from '@app/core' 5import { HooksService, Notifier, PluginService } from '@app/core'
6import { BuildFormArgument } from '@app/shared/form-validators' 6import { BuildFormArgument } from '@app/shared/form-validators'
7import { FormReactive, FormValidatorService } from '@app/shared/shared-forms' 7import { FormReactive, FormValidatorService } from '@app/shared/shared-forms'
8import { PeerTubePlugin, RegisterServerSettingOptions } from '@shared/models' 8import { PeerTubePlugin, RegisterServerSettingOptions } from '@shared/models'
@@ -26,6 +26,7 @@ export class PluginShowInstalledComponent extends FormReactive implements OnInit
26 private pluginService: PluginService, 26 private pluginService: PluginService,
27 private pluginAPIService: PluginApiService, 27 private pluginAPIService: PluginApiService,
28 private notifier: Notifier, 28 private notifier: Notifier,
29 private hooks: HooksService,
29 private route: ActivatedRoute 30 private route: ActivatedRoute
30 ) { 31 ) {
31 super() 32 super()
@@ -70,6 +71,12 @@ export class PluginShowInstalledComponent extends FormReactive implements OnInit
70 return script.isSettingHidden({ setting, formValues: this.form.value }) 71 return script.isSettingHidden({ setting, formValues: this.form.value })
71 } 72 }
72 73
74 getWrapperId (setting: RegisterServerSettingOptions) {
75 if (!setting.name) return
76
77 return setting.name + '-wrapper'
78 }
79
73 private loadPlugin (npmName: string) { 80 private loadPlugin (npmName: string) {
74 this.pluginAPIService.getPlugin(npmName) 81 this.pluginAPIService.getPlugin(npmName)
75 .pipe(switchMap(plugin => { 82 .pipe(switchMap(plugin => {
@@ -103,6 +110,8 @@ export class PluginShowInstalledComponent extends FormReactive implements OnInit
103 this.buildForm(buildOptions) 110 this.buildForm(buildOptions)
104 111
105 this.form.patchValue(settingsValues) 112 this.form.patchValue(settingsValues)
113
114 setTimeout(() => this.hooks.runAction('action:admin-plugin-settings.init', 'admin-plugin', { npmName: this.npmName }))
106 } 115 }
107 116
108 private getSetting (name: string) { 117 private getSetting (name: string) {