Add ability to install a plugin from the admin page

This commit is contained in:
Chocobozzz 2019-07-16 11:48:52 +02:00 committed by Chocobozzz
parent 6702a1b2cc
commit 89c344dba4
3 changed files with 16 additions and 1 deletions

View 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">

View File

@ -21,3 +21,9 @@
margin-right: 5px;
}
}
.badge {
font-size: 13px;
font-weight: $font-semibold;
margin-left: 5px;
}

View 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 }))