From 0ea9f463a9dc642ec44af4887b97e9dd63b323ef Mon Sep 17 00:00:00 2001 From: Chocobozzz Date: Thu, 22 Apr 2021 11:18:13 +0200 Subject: Add action:admin-plugin-settings.init client hook --- .../plugin-show-installed.component.html | 2 +- .../plugin-show-installed/plugin-show-installed.component.ts | 11 ++++++++++- client/src/app/core/plugins/plugin.service.ts | 1 + 3 files changed, 12 insertions(+), 2 deletions(-) (limited to 'client/src') 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 @@
-
+
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' import { map, switchMap } from 'rxjs/operators' import { Component, OnDestroy, OnInit } from '@angular/core' import { ActivatedRoute } from '@angular/router' -import { Notifier, PluginService } from '@app/core' +import { HooksService, Notifier, PluginService } from '@app/core' import { BuildFormArgument } from '@app/shared/form-validators' import { FormReactive, FormValidatorService } from '@app/shared/shared-forms' import { PeerTubePlugin, RegisterServerSettingOptions } from '@shared/models' @@ -26,6 +26,7 @@ export class PluginShowInstalledComponent extends FormReactive implements OnInit private pluginService: PluginService, private pluginAPIService: PluginApiService, private notifier: Notifier, + private hooks: HooksService, private route: ActivatedRoute ) { super() @@ -70,6 +71,12 @@ export class PluginShowInstalledComponent extends FormReactive implements OnInit return script.isSettingHidden({ setting, formValues: this.form.value }) } + getWrapperId (setting: RegisterServerSettingOptions) { + if (!setting.name) return + + return setting.name + '-wrapper' + } + private loadPlugin (npmName: string) { this.pluginAPIService.getPlugin(npmName) .pipe(switchMap(plugin => { @@ -103,6 +110,8 @@ export class PluginShowInstalledComponent extends FormReactive implements OnInit this.buildForm(buildOptions) this.form.patchValue(settingsValues) + + setTimeout(() => this.hooks.runAction('action:admin-plugin-settings.init', 'admin-plugin', { npmName: this.npmName })) } 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 { pluginsLoaded: { [ scope in PluginClientScope ]: ReplaySubject } = { common: new ReplaySubject(1), + 'admin-plugin': new ReplaySubject(1), search: new ReplaySubject(1), 'video-watch': new ReplaySubject(1), signup: new ReplaySubject(1), -- cgit v1.2.3