Add ability to install a plugin from the admin page
authorChocobozzz <me@florianbigard.com>
Tue, 16 Jul 2019 09:48:52 +0000 (11:48 +0200)
committerChocobozzz <chocobozzz@cpy.re>
Wed, 24 Jul 2019 08:58:16 +0000 (10:58 +0200)
client/src/app/+admin/plugins/plugin-search/plugin-search.component.html
client/src/app/+admin/plugins/plugin-search/plugin-search.component.scss
client/src/app/+admin/plugins/plugin-search/plugin-search.component.ts

index 7dd1039799b087cb83c69d6a2cebdc492b95ff35..5247d8d2ef09cbeb888263100c19bb8079ba03b6 100644 (file)
@@ -6,6 +6,10 @@
   <input type="text" (input)="onSearchChange($event.target.value)" i18n-placeholder placeholder="Search..."/>
 </div>
 
+<div class="alert alert-info" i18n *ngIf="pluginInstalled">
+  To load your new installed plugins or themes, refresh the page.
+</div>
+
 <div class="result-title" *ngIf="!isSearching">
   <ng-container *ngIf="!search">
     <my-global-icon iconName="trending"></my-global-icon>
@@ -32,6 +36,8 @@
         <span class="plugin-name">{{ plugin.name }}</span>
 
         <span class="plugin-version">{{ plugin.latestVersion }}</span>
+
+        <span *ngIf="plugin.installed" class="badge badge-success">Installed</span>
       </div>
 
       <div class="second-row">
index ad6ff89da76fdae6a04172abf15c802dcc85589d..ed06825c8dec3097041d746f30051427e721329e 100644 (file)
@@ -21,3 +21,9 @@
     margin-right: 5px;
   }
 }
+
+.badge {
+  font-size: 13px;
+  font-weight: $font-semibold;
+  margin-left: 5px;
+}
index 935e113620dea24b101a92cc5b18579bd6cfb418..0058fa691d5fe9f251f1df453559288aa3148536 100644 (file)
@@ -1,5 +1,5 @@
 import { Component, OnInit } from '@angular/core'
-import { Notifier } from '@app/core'
+import { Notifier, ServerService } from '@app/core'
 import { ConfirmService } from '../../../core'
 import { I18n } from '@ngx-translate/i18n-polyfill'
 import { PluginType } from '@shared/models/plugins/plugin.type'
@@ -34,10 +34,12 @@ export class PluginSearchComponent implements OnInit {
 
   plugins: PeerTubePluginIndex[] = []
   installing: { [name: string]: boolean } = {}
+  pluginInstalled = false
 
   private searchSubject = new Subject<string>()
 
   constructor (
+    private server: ServerService,
     private i18n: I18n,
     private pluginService: PluginApiService,
     private notifier: Notifier,
@@ -121,6 +123,7 @@ export class PluginSearchComponent implements OnInit {
         .subscribe(
           () => {
             this.installing[plugin.npmName] = false
+            this.pluginInstalled = true
 
             this.notifier.success(this.i18n('{{pluginName}} installed.', { pluginName: plugin.name }))