aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorChocobozzz <me@florianbigard.com>2019-07-16 11:48:52 +0200
committerChocobozzz <chocobozzz@cpy.re>2019-07-24 10:58:16 +0200
commit89c344dba4ae2fca39cf636c3c6f09f31a339493 (patch)
treee781d5a19fd6d8d01fb85091d00962c7d39072d2
parent6702a1b2ccd666285dee9c72b5bace641d2fce8b (diff)
downloadPeerTube-89c344dba4ae2fca39cf636c3c6f09f31a339493.tar.gz
PeerTube-89c344dba4ae2fca39cf636c3c6f09f31a339493.tar.zst
PeerTube-89c344dba4ae2fca39cf636c3c6f09f31a339493.zip
Add ability to install a plugin from the admin page
-rw-r--r--client/src/app/+admin/plugins/plugin-search/plugin-search.component.html6
-rw-r--r--client/src/app/+admin/plugins/plugin-search/plugin-search.component.scss6
-rw-r--r--client/src/app/+admin/plugins/plugin-search/plugin-search.component.ts5
3 files changed, 16 insertions, 1 deletions
diff --git a/client/src/app/+admin/plugins/plugin-search/plugin-search.component.html b/client/src/app/+admin/plugins/plugin-search/plugin-search.component.html
index 7dd103979..5247d8d2e 100644
--- a/client/src/app/+admin/plugins/plugin-search/plugin-search.component.html
+++ b/client/src/app/+admin/plugins/plugin-search/plugin-search.component.html
@@ -6,6 +6,10 @@
6 <input type="text" (input)="onSearchChange($event.target.value)" i18n-placeholder placeholder="Search..."/> 6 <input type="text" (input)="onSearchChange($event.target.value)" i18n-placeholder placeholder="Search..."/>
7</div> 7</div>
8 8
9<div class="alert alert-info" i18n *ngIf="pluginInstalled">
10 To load your new installed plugins or themes, refresh the page.
11</div>
12
9<div class="result-title" *ngIf="!isSearching"> 13<div class="result-title" *ngIf="!isSearching">
10 <ng-container *ngIf="!search"> 14 <ng-container *ngIf="!search">
11 <my-global-icon iconName="trending"></my-global-icon> 15 <my-global-icon iconName="trending"></my-global-icon>
@@ -32,6 +36,8 @@
32 <span class="plugin-name">{{ plugin.name }}</span> 36 <span class="plugin-name">{{ plugin.name }}</span>
33 37
34 <span class="plugin-version">{{ plugin.latestVersion }}</span> 38 <span class="plugin-version">{{ plugin.latestVersion }}</span>
39
40 <span *ngIf="plugin.installed" class="badge badge-success">Installed</span>
35 </div> 41 </div>
36 42
37 <div class="second-row"> 43 <div class="second-row">
diff --git a/client/src/app/+admin/plugins/plugin-search/plugin-search.component.scss b/client/src/app/+admin/plugins/plugin-search/plugin-search.component.scss
index ad6ff89da..ed06825c8 100644
--- a/client/src/app/+admin/plugins/plugin-search/plugin-search.component.scss
+++ b/client/src/app/+admin/plugins/plugin-search/plugin-search.component.scss
@@ -21,3 +21,9 @@
21 margin-right: 5px; 21 margin-right: 5px;
22 } 22 }
23} 23}
24
25.badge {
26 font-size: 13px;
27 font-weight: $font-semibold;
28 margin-left: 5px;
29}
diff --git a/client/src/app/+admin/plugins/plugin-search/plugin-search.component.ts b/client/src/app/+admin/plugins/plugin-search/plugin-search.component.ts
index 935e11362..0058fa691 100644
--- a/client/src/app/+admin/plugins/plugin-search/plugin-search.component.ts
+++ b/client/src/app/+admin/plugins/plugin-search/plugin-search.component.ts
@@ -1,5 +1,5 @@
1import { Component, OnInit } from '@angular/core' 1import { Component, OnInit } from '@angular/core'
2import { Notifier } from '@app/core' 2import { Notifier, ServerService } from '@app/core'
3import { ConfirmService } from '../../../core' 3import { ConfirmService } from '../../../core'
4import { I18n } from '@ngx-translate/i18n-polyfill' 4import { I18n } from '@ngx-translate/i18n-polyfill'
5import { PluginType } from '@shared/models/plugins/plugin.type' 5import { PluginType } from '@shared/models/plugins/plugin.type'
@@ -34,10 +34,12 @@ export class PluginSearchComponent implements OnInit {
34 34
35 plugins: PeerTubePluginIndex[] = [] 35 plugins: PeerTubePluginIndex[] = []
36 installing: { [name: string]: boolean } = {} 36 installing: { [name: string]: boolean } = {}
37 pluginInstalled = false
37 38
38 private searchSubject = new Subject<string>() 39 private searchSubject = new Subject<string>()
39 40
40 constructor ( 41 constructor (
42 private server: ServerService,
41 private i18n: I18n, 43 private i18n: I18n,
42 private pluginService: PluginApiService, 44 private pluginService: PluginApiService,
43 private notifier: Notifier, 45 private notifier: Notifier,
@@ -121,6 +123,7 @@ export class PluginSearchComponent implements OnInit {
121 .subscribe( 123 .subscribe(
122 () => { 124 () => {
123 this.installing[plugin.npmName] = false 125 this.installing[plugin.npmName] = false
126 this.pluginInstalled = true
124 127
125 this.notifier.success(this.i18n('{{pluginName}} installed.', { pluginName: plugin.name })) 128 this.notifier.success(this.i18n('{{pluginName}} installed.', { pluginName: plugin.name }))
126 129