diff options
Diffstat (limited to 'client/src/app/+admin/plugins/shared/plugin-api.service.ts')
-rw-r--r-- | client/src/app/+admin/plugins/shared/plugin-api.service.ts | 23 |
1 files changed, 21 insertions, 2 deletions
diff --git a/client/src/app/+admin/plugins/shared/plugin-api.service.ts b/client/src/app/+admin/plugins/shared/plugin-api.service.ts index 89f190675..51f086a93 100644 --- a/client/src/app/+admin/plugins/shared/plugin-api.service.ts +++ b/client/src/app/+admin/plugins/shared/plugin-api.service.ts | |||
@@ -11,6 +11,7 @@ import { PeerTubePlugin } from '@shared/models/plugins/peertube-plugin.model' | |||
11 | import { ManagePlugin } from '@shared/models/plugins/manage-plugin.model' | 11 | import { ManagePlugin } from '@shared/models/plugins/manage-plugin.model' |
12 | import { InstallOrUpdatePlugin } from '@shared/models/plugins/install-plugin.model' | 12 | import { InstallOrUpdatePlugin } from '@shared/models/plugins/install-plugin.model' |
13 | import { RegisterSettingOptions } from '@shared/models/plugins/register-setting.model' | 13 | import { RegisterSettingOptions } from '@shared/models/plugins/register-setting.model' |
14 | import { PeerTubePluginIndex } from '@shared/models/plugins/peertube-plugin-index.model' | ||
14 | 15 | ||
15 | @Injectable() | 16 | @Injectable() |
16 | export class PluginApiService { | 17 | export class PluginApiService { |
@@ -45,7 +46,7 @@ export class PluginApiService { | |||
45 | } | 46 | } |
46 | 47 | ||
47 | getPlugins ( | 48 | getPlugins ( |
48 | type: PluginType, | 49 | pluginType: PluginType, |
49 | componentPagination: ComponentPagination, | 50 | componentPagination: ComponentPagination, |
50 | sort: string | 51 | sort: string |
51 | ) { | 52 | ) { |
@@ -53,12 +54,30 @@ export class PluginApiService { | |||
53 | 54 | ||
54 | let params = new HttpParams() | 55 | let params = new HttpParams() |
55 | params = this.restService.addRestGetParams(params, pagination, sort) | 56 | params = this.restService.addRestGetParams(params, pagination, sort) |
56 | params = params.append('type', type.toString()) | 57 | params = params.append('pluginType', pluginType.toString()) |
57 | 58 | ||
58 | return this.authHttp.get<ResultList<PeerTubePlugin>>(PluginApiService.BASE_APPLICATION_URL, { params }) | 59 | return this.authHttp.get<ResultList<PeerTubePlugin>>(PluginApiService.BASE_APPLICATION_URL, { params }) |
59 | .pipe(catchError(res => this.restExtractor.handleError(res))) | 60 | .pipe(catchError(res => this.restExtractor.handleError(res))) |
60 | } | 61 | } |
61 | 62 | ||
63 | searchAvailablePlugins ( | ||
64 | pluginType: PluginType, | ||
65 | componentPagination: ComponentPagination, | ||
66 | sort: string, | ||
67 | search?: string | ||
68 | ) { | ||
69 | const pagination = this.restService.componentPaginationToRestPagination(componentPagination) | ||
70 | |||
71 | let params = new HttpParams() | ||
72 | params = this.restService.addRestGetParams(params, pagination, sort) | ||
73 | params = params.append('pluginType', pluginType.toString()) | ||
74 | |||
75 | if (search) params = params.append('search', search) | ||
76 | |||
77 | return this.authHttp.get<ResultList<PeerTubePluginIndex>>(PluginApiService.BASE_APPLICATION_URL + '/available', { params }) | ||
78 | .pipe(catchError(res => this.restExtractor.handleError(res))) | ||
79 | } | ||
80 | |||
62 | getPlugin (npmName: string) { | 81 | getPlugin (npmName: string) { |
63 | const path = PluginApiService.BASE_APPLICATION_URL + '/' + npmName | 82 | const path = PluginApiService.BASE_APPLICATION_URL + '/' + npmName |
64 | 83 | ||