aboutsummaryrefslogtreecommitdiffhomepage
path: root/client/src/app/core
diff options
context:
space:
mode:
Diffstat (limited to 'client/src/app/core')
-rw-r--r--client/src/app/core/plugins/plugin.service.ts17
1 files changed, 17 insertions, 0 deletions
diff --git a/client/src/app/core/plugins/plugin.service.ts b/client/src/app/core/plugins/plugin.service.ts
index aa6823060..b4ed56cbe 100644
--- a/client/src/app/core/plugins/plugin.service.ts
+++ b/client/src/app/core/plugins/plugin.service.ts
@@ -20,6 +20,7 @@ import { getDevLocale, isOnDevLocale } from '@app/shared/i18n/i18n-utils'
20import { RegisterClientHelpers } from '../../../types/register-client-option.model' 20import { RegisterClientHelpers } from '../../../types/register-client-option.model'
21import { PluginTranslation } from '@shared/models/plugins/plugin-translation.model' 21import { PluginTranslation } from '@shared/models/plugins/plugin-translation.model'
22import { importModule } from '@app/shared/misc/utils' 22import { importModule } from '@app/shared/misc/utils'
23import { CustomModalComponent } from '@app/modal/custom-modal.component'
23 24
24interface HookStructValue extends RegisterClientHookOptions { 25interface HookStructValue extends RegisterClientHookOptions {
25 plugin: ServerConfigPlugin 26 plugin: ServerConfigPlugin
@@ -49,6 +50,8 @@ export class PluginService implements ClientHook {
49 50
50 translationsObservable: Observable<PluginTranslation> 51 translationsObservable: Observable<PluginTranslation>
51 52
53 customModal: CustomModalComponent
54
52 private plugins: ServerConfigPlugin[] = [] 55 private plugins: ServerConfigPlugin[] = []
53 private scopes: { [ scopeName: string ]: PluginInfo[] } = {} 56 private scopes: { [ scopeName: string ]: PluginInfo[] } = {}
54 private loadedScripts: { [ script: string ]: boolean } = {} 57 private loadedScripts: { [ script: string ]: boolean } = {}
@@ -81,6 +84,10 @@ export class PluginService implements ClientHook {
81 }) 84 })
82 } 85 }
83 86
87 initializeCustomModal (customModal: CustomModalComponent) {
88 this.customModal = customModal
89 }
90
84 ensurePluginsAreBuilt () { 91 ensurePluginsAreBuilt () {
85 return this.pluginsBuilt.asObservable() 92 return this.pluginsBuilt.asObservable()
86 .pipe(first(), shareReplay()) 93 .pipe(first(), shareReplay())
@@ -279,6 +286,16 @@ export class PluginService implements ClientHook {
279 success: (text: string, title?: string, timeout?: number) => this.notifier.success(text, title, timeout) 286 success: (text: string, title?: string, timeout?: number) => this.notifier.success(text, title, timeout)
280 }, 287 },
281 288
289 showModal: (input: {
290 title: string,
291 content: string,
292 close?: boolean,
293 cancel?: { value: string, action?: () => void },
294 confirm?: { value: string, action?: () => void }
295 }) => {
296 this.customModal.show(input)
297 },
298
282 translate: (value: string) => { 299 translate: (value: string) => {
283 return this.translationsObservable 300 return this.translationsObservable
284 .pipe(map(allTranslations => allTranslations[npmName])) 301 .pipe(map(allTranslations => allTranslations[npmName]))