]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/commitdiff
Add settings button after plugin install
authorChocobozzz <me@florianbigard.com>
Mon, 12 Apr 2021 08:24:16 +0000 (10:24 +0200)
committerChocobozzz <me@florianbigard.com>
Mon, 12 Apr 2021 09:19:15 +0000 (11:19 +0200)
client/src/app/+admin/plugins/plugin-list-installed/plugin-list-installed.component.html
client/src/app/+admin/plugins/plugin-list-installed/plugin-list-installed.component.ts
client/src/app/+admin/plugins/plugin-search/plugin-search.component.html
client/src/app/+admin/plugins/plugin-search/plugin-search.component.ts

index 82a965313b57f41c0cdb30c72d376ba63261d604..9cbec03a11b6729422ad42392dd7f9e0cce4c732 100644 (file)
@@ -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)"
index cbdc379a878df2e9ee00fdf6ff9cf75e2e9ed109..1a95980aeda70e794ef964994b6973c8d51f8500 100644 (file)
@@ -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}?`,
index 8edf03a89946083e5da6a4ec30f9c8c66f9cac72..727633399655002369123d1d3aa8e7043d0e4397 100644 (file)
@@ -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>
index 4c571dee43298a3e9d9462d1b971db696b5f5199..d2c179aba2e464fd86561ee3d8fa54bd69673a1f 100644 (file)
@@ -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