diff options
author | Chocobozzz <me@florianbigard.com> | 2021-04-22 11:18:13 +0200 |
---|---|---|
committer | Chocobozzz <me@florianbigard.com> | 2021-04-22 11:18:13 +0200 |
commit | 0ea9f463a9dc642ec44af4887b97e9dd63b323ef (patch) | |
tree | b3fe33ab598f8ac503f74a0603a78877144939c2 /client/src | |
parent | 302eba0d898e38dca14739486441c27c0be6c62f (diff) | |
download | PeerTube-0ea9f463a9dc642ec44af4887b97e9dd63b323ef.tar.gz PeerTube-0ea9f463a9dc642ec44af4887b97e9dd63b323ef.tar.zst PeerTube-0ea9f463a9dc642ec44af4887b97e9dd63b323ef.zip |
Add action:admin-plugin-settings.init client hook
Diffstat (limited to 'client/src')
3 files changed, 12 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' | |||
2 | import { map, switchMap } from 'rxjs/operators' | 2 | import { map, switchMap } from 'rxjs/operators' |
3 | import { Component, OnDestroy, OnInit } from '@angular/core' | 3 | import { Component, OnDestroy, OnInit } from '@angular/core' |
4 | import { ActivatedRoute } from '@angular/router' | 4 | import { ActivatedRoute } from '@angular/router' |
5 | import { Notifier, PluginService } from '@app/core' | 5 | import { HooksService, Notifier, PluginService } from '@app/core' |
6 | import { BuildFormArgument } from '@app/shared/form-validators' | 6 | import { BuildFormArgument } from '@app/shared/form-validators' |
7 | import { FormReactive, FormValidatorService } from '@app/shared/shared-forms' | 7 | import { FormReactive, FormValidatorService } from '@app/shared/shared-forms' |
8 | import { PeerTubePlugin, RegisterServerSettingOptions } from '@shared/models' | 8 | import { 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), |