aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-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
-rw-r--r--client/src/app/core/plugins/plugin.service.ts1
-rw-r--r--shared/models/plugins/client-hook.model.ts4
-rw-r--r--shared/models/plugins/plugin-client-scope.type.ts10
5 files changed, 25 insertions, 3 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) {
diff --git a/client/src/app/core/plugins/plugin.service.ts b/client/src/app/core/plugins/plugin.service.ts
index 1243bac67..ee80d4d39 100644
--- a/client/src/app/core/plugins/plugin.service.ts
+++ b/client/src/app/core/plugins/plugin.service.ts
@@ -34,6 +34,7 @@ export class PluginService implements ClientHook {
34 34
35 pluginsLoaded: { [ scope in PluginClientScope ]: ReplaySubject<boolean> } = { 35 pluginsLoaded: { [ scope in PluginClientScope ]: ReplaySubject<boolean> } = {
36 common: new ReplaySubject<boolean>(1), 36 common: new ReplaySubject<boolean>(1),
37 'admin-plugin': new ReplaySubject<boolean>(1),
37 search: new ReplaySubject<boolean>(1), 38 search: new ReplaySubject<boolean>(1),
38 'video-watch': new ReplaySubject<boolean>(1), 39 'video-watch': new ReplaySubject<boolean>(1),
39 signup: new ReplaySubject<boolean>(1), 40 signup: new ReplaySubject<boolean>(1),
diff --git a/shared/models/plugins/client-hook.model.ts b/shared/models/plugins/client-hook.model.ts
index f8ca32771..620651051 100644
--- a/shared/models/plugins/client-hook.model.ts
+++ b/shared/models/plugins/client-hook.model.ts
@@ -85,6 +85,10 @@ export const clientActionHookObject = {
85 // Fired when the registration page is being initialized 85 // Fired when the registration page is being initialized
86 'action:signup.register.init': true, 86 'action:signup.register.init': true,
87 87
88 // PeerTube >= 3.2
89 // Fired when the admin plugin settings page is being initialized
90 'action:admin-plugin-settings.init': true,
91
88 // Fired when the video upload page is being initalized 92 // Fired when the video upload page is being initalized
89 'action:video-upload.init': true, 93 'action:video-upload.init': true,
90 // Fired when the video import by URL page is being initalized 94 // Fired when the video import by URL page is being initalized
diff --git a/shared/models/plugins/plugin-client-scope.type.ts b/shared/models/plugins/plugin-client-scope.type.ts
index e188ce100..8cc234ff2 100644
--- a/shared/models/plugins/plugin-client-scope.type.ts
+++ b/shared/models/plugins/plugin-client-scope.type.ts
@@ -1 +1,9 @@
1export type PluginClientScope = 'common' | 'video-watch' | 'search' | 'signup' | 'login' | 'embed' | 'video-edit' 1export type PluginClientScope =
2 'common' |
3 'video-watch' |
4 'search' |
5 'signup' |
6 'login' |
7 'embed' |
8 'video-edit' |
9 'admin-plugin'