mirror of https://github.com/Chocobozzz/PeerTube
Add settings button after plugin install
parent
40a5242168
commit
c96e457bde
|
@ -23,7 +23,7 @@
|
|||
</a>
|
||||
|
||||
<div class="buttons">
|
||||
<my-edit-button *ngIf="pluginType !== PluginType.THEME" [routerLink]="getShowRouterLink(plugin)" label="Settings" i18n-label></my-edit-button>
|
||||
<my-edit-button *ngIf="!isTheme(plugin)" [routerLink]="getShowRouterLink(plugin)" label="Settings" i18n-label></my-edit-button>
|
||||
|
||||
<my-button class="update-button" *ngIf="isUpdateAvailable(plugin)" (click)="update(plugin)" [loading]="isUpdating(plugin)"
|
||||
[label]="getUpdateLabel(plugin)" icon="refresh" [attr.disabled]="isUpdating(plugin)"
|
||||
|
|
|
@ -31,8 +31,6 @@ export class PluginListInstalledComponent implements OnInit {
|
|||
plugins: PeerTubePlugin[] = []
|
||||
updating: { [name: string]: boolean } = {}
|
||||
|
||||
PluginType = PluginType
|
||||
|
||||
onDataSubject = new Subject<any[]>()
|
||||
|
||||
constructor (
|
||||
|
@ -104,6 +102,10 @@ export class PluginListInstalledComponent implements OnInit {
|
|||
return !!this.updating[this.getUpdatingKey(plugin)]
|
||||
}
|
||||
|
||||
isTheme (plugin: PeerTubePlugin) {
|
||||
return plugin.type === PluginType.THEME
|
||||
}
|
||||
|
||||
async uninstall (plugin: PeerTubePlugin) {
|
||||
const res = await this.confirmService.confirm(
|
||||
$localize`Do you really want to uninstall ${plugin.name}?`,
|
||||
|
|
|
@ -48,6 +48,8 @@
|
|||
<span *ngIf="plugin.installed" class="badge badge-success">Installed</span>
|
||||
|
||||
<div class="buttons">
|
||||
<my-edit-button *ngIf="plugin.installed === true && !isThemeSearch()" [routerLink]="getShowRouterLink(plugin)" label="Settings" i18n-label></my-edit-button>
|
||||
|
||||
<my-button class="update-button" *ngIf="plugin.installed === false" (click)="install(plugin)" [loading]="isInstalling(plugin)"
|
||||
label="Install" icon="cloud-download" [attr.disabled]="isInstalling(plugin)"
|
||||
></my-button>
|
||||
|
|
|
@ -3,7 +3,7 @@ import { debounceTime, distinctUntilChanged } from 'rxjs/operators'
|
|||
import { Component, OnInit } from '@angular/core'
|
||||
import { ActivatedRoute, Router } from '@angular/router'
|
||||
import { PluginApiService } from '@app/+admin/plugins/shared/plugin-api.service'
|
||||
import { ComponentPagination, ConfirmService, hasMoreItems, Notifier } from '@app/core'
|
||||
import { ComponentPagination, ConfirmService, hasMoreItems, Notifier, PluginService } from '@app/core'
|
||||
import { PeerTubePluginIndex } from '@shared/models/plugins/peertube-plugin-index.model'
|
||||
import { PluginType } from '@shared/models/plugins/plugin.type'
|
||||
|
||||
|
@ -39,6 +39,7 @@ export class PluginSearchComponent implements OnInit {
|
|||
private searchSubject = new Subject<string>()
|
||||
|
||||
constructor (
|
||||
private pluginService: PluginService,
|
||||
private pluginApiService: PluginApiService,
|
||||
private notifier: Notifier,
|
||||
private confirmService: ConfirmService,
|
||||
|
@ -119,6 +120,14 @@ export class PluginSearchComponent implements OnInit {
|
|||
return this.pluginApiService.getPluginOrThemeHref(this.pluginType, name)
|
||||
}
|
||||
|
||||
getShowRouterLink (plugin: PeerTubePluginIndex) {
|
||||
return [ '/admin', 'plugins', 'show', this.pluginService.nameToNpmName(plugin.name, this.pluginType) ]
|
||||
}
|
||||
|
||||
isThemeSearch () {
|
||||
return this.pluginType === PluginType.THEME
|
||||
}
|
||||
|
||||
async install (plugin: PeerTubePluginIndex) {
|
||||
if (this.installing[plugin.npmName]) return
|
||||
|
||||
|
|
Loading…
Reference in New Issue