diff options
author | Chocobozzz <me@florianbigard.com> | 2021-12-29 12:14:06 +0100 |
---|---|---|
committer | Chocobozzz <me@florianbigard.com> | 2021-12-29 12:17:11 +0100 |
commit | 2accfdd8ecd092de7e8c71fbd1235e139ad29832 (patch) | |
tree | 24b5bb7da7192fa11054a48ac0e4384b8ec8fb72 /client/src/app/+admin/plugins/plugin-list-installed | |
parent | 9744bb2ae8284c4589b66055c1d99997abf18748 (diff) | |
download | PeerTube-2accfdd8ecd092de7e8c71fbd1235e139ad29832.tar.gz PeerTube-2accfdd8ecd092de7e8c71fbd1235e139ad29832.tar.zst PeerTube-2accfdd8ecd092de7e8c71fbd1235e139ad29832.zip |
Refactor admin plugins
Diffstat (limited to 'client/src/app/+admin/plugins/plugin-list-installed')
-rw-r--r-- | client/src/app/+admin/plugins/plugin-list-installed/plugin-list-installed.component.html | 4 | ||||
-rw-r--r-- | client/src/app/+admin/plugins/plugin-list-installed/plugin-list-installed.component.ts | 26 |
2 files changed, 15 insertions, 15 deletions
diff --git a/client/src/app/+admin/plugins/plugin-list-installed/plugin-list-installed.component.html b/client/src/app/+admin/plugins/plugin-list-installed/plugin-list-installed.component.html index 2591c9a50..c5d440c8c 100644 --- a/client/src/app/+admin/plugins/plugin-list-installed/plugin-list-installed.component.html +++ b/client/src/app/+admin/plugins/plugin-list-installed/plugin-list-installed.component.html | |||
@@ -1,6 +1,4 @@ | |||
1 | <div class="toggle-plugin-type"> | 1 | <my-plugin-navigation [pluginType]="pluginType"></my-plugin-navigation> |
2 | <p-selectButton [options]="pluginTypeOptions" [(ngModel)]="pluginType" (ngModelChange)="reloadPlugins()"></p-selectButton> | ||
3 | </div> | ||
4 | 2 | ||
5 | <div class="no-results" *ngIf="pagination.totalItems === 0"> | 3 | <div class="no-results" *ngIf="pagination.totalItems === 0"> |
6 | {{ getNoResultMessage() }} | 4 | {{ getNoResultMessage() }} |
diff --git a/client/src/app/+admin/plugins/plugin-list-installed/plugin-list-installed.component.ts b/client/src/app/+admin/plugins/plugin-list-installed/plugin-list-installed.component.ts index 6fd238848..6d66869dd 100644 --- a/client/src/app/+admin/plugins/plugin-list-installed/plugin-list-installed.component.ts +++ b/client/src/app/+admin/plugins/plugin-list-installed/plugin-list-installed.component.ts | |||
@@ -10,14 +10,10 @@ import { PeerTubePlugin, PluginType } from '@shared/models' | |||
10 | @Component({ | 10 | @Component({ |
11 | selector: 'my-plugin-list-installed', | 11 | selector: 'my-plugin-list-installed', |
12 | templateUrl: './plugin-list-installed.component.html', | 12 | templateUrl: './plugin-list-installed.component.html', |
13 | styleUrls: [ | 13 | styleUrls: [ './plugin-list-installed.component.scss' ] |
14 | '../shared/toggle-plugin-type.scss', | ||
15 | './plugin-list-installed.component.scss' | ||
16 | ] | ||
17 | }) | 14 | }) |
18 | export class PluginListInstalledComponent implements OnInit { | 15 | export class PluginListInstalledComponent implements OnInit { |
19 | pluginTypeOptions: { label: string, value: PluginType }[] = [] | 16 | pluginType: PluginType |
20 | pluginType: PluginType = PluginType.PLUGIN | ||
21 | 17 | ||
22 | pagination: ComponentPagination = { | 18 | pagination: ComponentPagination = { |
23 | currentPage: 1, | 19 | currentPage: 1, |
@@ -39,22 +35,28 @@ export class PluginListInstalledComponent implements OnInit { | |||
39 | private router: Router, | 35 | private router: Router, |
40 | private route: ActivatedRoute | 36 | private route: ActivatedRoute |
41 | ) { | 37 | ) { |
42 | this.pluginTypeOptions = this.pluginApiService.getPluginTypeOptions() | ||
43 | } | 38 | } |
44 | 39 | ||
45 | ngOnInit () { | 40 | ngOnInit () { |
46 | const query = this.route.snapshot.queryParams | 41 | if (!this.route.snapshot.queryParams['pluginType']) { |
47 | if (query['pluginType']) this.pluginType = parseInt(query['pluginType'], 10) | 42 | const queryParams = { pluginType: PluginType.PLUGIN } |
48 | 43 | ||
49 | this.reloadPlugins() | 44 | this.router.navigate([], { queryParams }) |
45 | } | ||
46 | |||
47 | this.route.queryParams.subscribe(query => { | ||
48 | if (!query['pluginType']) return | ||
49 | |||
50 | this.pluginType = parseInt(query['pluginType'], 10) | ||
51 | |||
52 | this.reloadPlugins() | ||
53 | }) | ||
50 | } | 54 | } |
51 | 55 | ||
52 | reloadPlugins () { | 56 | reloadPlugins () { |
53 | this.pagination.currentPage = 1 | 57 | this.pagination.currentPage = 1 |
54 | this.plugins = [] | 58 | this.plugins = [] |
55 | 59 | ||
56 | this.router.navigate([], { queryParams: { pluginType: this.pluginType } }) | ||
57 | |||
58 | this.loadMorePlugins() | 60 | this.loadMorePlugins() |
59 | } | 61 | } |
60 | 62 | ||