aboutsummaryrefslogtreecommitdiffhomepage
path: root/client/src/app/+admin/plugins/plugin-show-installed/plugin-show-installed.component.ts
diff options
context:
space:
mode:
Diffstat (limited to 'client/src/app/+admin/plugins/plugin-show-installed/plugin-show-installed.component.ts')
-rw-r--r--client/src/app/+admin/plugins/plugin-show-installed/plugin-show-installed.component.ts18
1 files changed, 11 insertions, 7 deletions
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 2c5dbea95..ca9ad9922 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
@@ -19,6 +19,7 @@ export class PluginShowInstalledComponent extends FormReactive implements OnInit
19 pluginTypeLabel: string 19 pluginTypeLabel: string
20 20
21 private sub: Subscription 21 private sub: Subscription
22 private npmName: string
22 23
23 constructor ( 24 constructor (
24 protected formValidatorService: FormValidatorService, 25 protected formValidatorService: FormValidatorService,
@@ -33,9 +34,9 @@ export class PluginShowInstalledComponent extends FormReactive implements OnInit
33 ngOnInit () { 34 ngOnInit () {
34 this.sub = this.route.params.subscribe( 35 this.sub = this.route.params.subscribe(
35 routeParams => { 36 routeParams => {
36 const npmName = routeParams['npmName'] 37 this.npmName = routeParams['npmName']
37 38
38 this.loadPlugin(npmName) 39 this.loadPlugin(this.npmName)
39 } 40 }
40 ) 41 )
41 } 42 }
@@ -62,7 +63,11 @@ export class PluginShowInstalledComponent extends FormReactive implements OnInit
62 } 63 }
63 64
64 isSettingHidden (setting: RegisterServerSettingOptions) { 65 isSettingHidden (setting: RegisterServerSettingOptions) {
65 return false 66 const script = this.pluginService.getRegisteredSettingsScript(this.npmName)
67
68 if (!script?.isSettingHidden) return false
69
70 return script.isSettingHidden({ setting, formValues: this.form.value })
66 } 71 }
67 72
68 private loadPlugin (npmName: string) { 73 private loadPlugin (npmName: string) {
@@ -74,6 +79,7 @@ export class PluginShowInstalledComponent extends FormReactive implements OnInit
74 .subscribe( 79 .subscribe(
75 async ({ plugin, registeredSettings }) => { 80 async ({ plugin, registeredSettings }) => {
76 this.plugin = plugin 81 this.plugin = plugin
82
77 this.registeredSettings = await this.translateSettings(registeredSettings) 83 this.registeredSettings = await this.translateSettings(registeredSettings)
78 84
79 this.pluginTypeLabel = this.pluginAPIService.getPluginTypeLabel(this.plugin.type) 85 this.pluginTypeLabel = this.pluginAPIService.getPluginTypeLabel(this.plugin.type)
@@ -110,11 +116,9 @@ export class PluginShowInstalledComponent extends FormReactive implements OnInit
110 } 116 }
111 117
112 private async translateSettings (settings: RegisterServerSettingOptions[]) { 118 private async translateSettings (settings: RegisterServerSettingOptions[]) {
113 const npmName = this.pluginService.nameToNpmName(this.plugin.name, this.plugin.type)
114
115 for (const setting of settings) { 119 for (const setting of settings) {
116 for (const key of [ 'label', 'html', 'descriptionHTML' ]) { 120 for (const key of [ 'label', 'html', 'descriptionHTML' ]) {
117 if (setting[key]) setting[key] = await this.pluginService.translateBy(npmName, setting[key]) 121 if (setting[key]) setting[key] = await this.pluginService.translateBy(this.npmName, setting[key])
118 } 122 }
119 123
120 if (Array.isArray(setting.options)) { 124 if (Array.isArray(setting.options)) {
@@ -123,7 +127,7 @@ export class PluginShowInstalledComponent extends FormReactive implements OnInit
123 for (const o of setting.options) { 127 for (const o of setting.options) {
124 newOptions.push({ 128 newOptions.push({
125 value: o.value, 129 value: o.value,
126 label: await this.pluginService.translateBy(npmName, o.label) 130 label: await this.pluginService.translateBy(this.npmName, o.label)
127 }) 131 })
128 } 132 }
129 133