aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorChocobozzz <me@florianbigard.com>2021-04-12 10:24:16 +0200
committerChocobozzz <me@florianbigard.com>2021-04-12 11:19:15 +0200
commitc96e457bde8495cf9103bf819f887f341a528543 (patch)
tree2460bdc1c8e955fb0f093e528280c33a96115dc5
parent40a5242168a9f8cad4984c770673883a64e73569 (diff)
downloadPeerTube-c96e457bde8495cf9103bf819f887f341a528543.tar.gz
PeerTube-c96e457bde8495cf9103bf819f887f341a528543.tar.zst
PeerTube-c96e457bde8495cf9103bf819f887f341a528543.zip
Add settings button after plugin install
-rw-r--r--client/src/app/+admin/plugins/plugin-list-installed/plugin-list-installed.component.html2
-rw-r--r--client/src/app/+admin/plugins/plugin-list-installed/plugin-list-installed.component.ts6
-rw-r--r--client/src/app/+admin/plugins/plugin-search/plugin-search.component.html2
-rw-r--r--client/src/app/+admin/plugins/plugin-search/plugin-search.component.ts11
4 files changed, 17 insertions, 4 deletions
diff --git a/client/src/app/+admin/plugins/plugin-list-installed/plugin-list-installed.component.html b/client/src/app/+admin/plugins/plugin-list-installed/plugin-list-installed.component.html
index 82a965313..9cbec03a1 100644
--- a/client/src/app/+admin/plugins/plugin-list-installed/plugin-list-installed.component.html
+++ b/client/src/app/+admin/plugins/plugin-list-installed/plugin-list-installed.component.html
@@ -23,7 +23,7 @@
23 </a> 23 </a>
24 24
25 <div class="buttons"> 25 <div class="buttons">
26 <my-edit-button *ngIf="pluginType !== PluginType.THEME" [routerLink]="getShowRouterLink(plugin)" label="Settings" i18n-label></my-edit-button> 26 <my-edit-button *ngIf="!isTheme(plugin)" [routerLink]="getShowRouterLink(plugin)" label="Settings" i18n-label></my-edit-button>
27 27
28 <my-button class="update-button" *ngIf="isUpdateAvailable(plugin)" (click)="update(plugin)" [loading]="isUpdating(plugin)" 28 <my-button class="update-button" *ngIf="isUpdateAvailable(plugin)" (click)="update(plugin)" [loading]="isUpdating(plugin)"
29 [label]="getUpdateLabel(plugin)" icon="refresh" [attr.disabled]="isUpdating(plugin)" 29 [label]="getUpdateLabel(plugin)" icon="refresh" [attr.disabled]="isUpdating(plugin)"
diff --git a/client/src/app/+admin/plugins/plugin-list-installed/plugin-list-installed.component.ts b/client/src/app/+admin/plugins/plugin-list-installed/plugin-list-installed.component.ts
index cbdc379a8..1a95980ae 100644
--- a/client/src/app/+admin/plugins/plugin-list-installed/plugin-list-installed.component.ts
+++ b/client/src/app/+admin/plugins/plugin-list-installed/plugin-list-installed.component.ts
@@ -31,8 +31,6 @@ export class PluginListInstalledComponent implements OnInit {
31 plugins: PeerTubePlugin[] = [] 31 plugins: PeerTubePlugin[] = []
32 updating: { [name: string]: boolean } = {} 32 updating: { [name: string]: boolean } = {}
33 33
34 PluginType = PluginType
35
36 onDataSubject = new Subject<any[]>() 34 onDataSubject = new Subject<any[]>()
37 35
38 constructor ( 36 constructor (
@@ -104,6 +102,10 @@ export class PluginListInstalledComponent implements OnInit {
104 return !!this.updating[this.getUpdatingKey(plugin)] 102 return !!this.updating[this.getUpdatingKey(plugin)]
105 } 103 }
106 104
105 isTheme (plugin: PeerTubePlugin) {
106 return plugin.type === PluginType.THEME
107 }
108
107 async uninstall (plugin: PeerTubePlugin) { 109 async uninstall (plugin: PeerTubePlugin) {
108 const res = await this.confirmService.confirm( 110 const res = await this.confirmService.confirm(
109 $localize`Do you really want to uninstall ${plugin.name}?`, 111 $localize`Do you really want to uninstall ${plugin.name}?`,
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 8edf03a89..727633399 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
@@ -48,6 +48,8 @@
48 <span *ngIf="plugin.installed" class="badge badge-success">Installed</span> 48 <span *ngIf="plugin.installed" class="badge badge-success">Installed</span>
49 49
50 <div class="buttons"> 50 <div class="buttons">
51 <my-edit-button *ngIf="plugin.installed === true && !isThemeSearch()" [routerLink]="getShowRouterLink(plugin)" label="Settings" i18n-label></my-edit-button>
52
51 <my-button class="update-button" *ngIf="plugin.installed === false" (click)="install(plugin)" [loading]="isInstalling(plugin)" 53 <my-button class="update-button" *ngIf="plugin.installed === false" (click)="install(plugin)" [loading]="isInstalling(plugin)"
52 label="Install" icon="cloud-download" [attr.disabled]="isInstalling(plugin)" 54 label="Install" icon="cloud-download" [attr.disabled]="isInstalling(plugin)"
53 ></my-button> 55 ></my-button>
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 4c571dee4..d2c179aba 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
@@ -3,7 +3,7 @@ import { debounceTime, distinctUntilChanged } from 'rxjs/operators'
3import { Component, OnInit } from '@angular/core' 3import { Component, OnInit } from '@angular/core'
4import { ActivatedRoute, Router } from '@angular/router' 4import { ActivatedRoute, Router } from '@angular/router'
5import { PluginApiService } from '@app/+admin/plugins/shared/plugin-api.service' 5import { PluginApiService } from '@app/+admin/plugins/shared/plugin-api.service'
6import { ComponentPagination, ConfirmService, hasMoreItems, Notifier } from '@app/core' 6import { ComponentPagination, ConfirmService, hasMoreItems, Notifier, PluginService } from '@app/core'
7import { PeerTubePluginIndex } from '@shared/models/plugins/peertube-plugin-index.model' 7import { PeerTubePluginIndex } from '@shared/models/plugins/peertube-plugin-index.model'
8import { PluginType } from '@shared/models/plugins/plugin.type' 8import { PluginType } from '@shared/models/plugins/plugin.type'
9 9
@@ -39,6 +39,7 @@ export class PluginSearchComponent implements OnInit {
39 private searchSubject = new Subject<string>() 39 private searchSubject = new Subject<string>()
40 40
41 constructor ( 41 constructor (
42 private pluginService: PluginService,
42 private pluginApiService: PluginApiService, 43 private pluginApiService: PluginApiService,
43 private notifier: Notifier, 44 private notifier: Notifier,
44 private confirmService: ConfirmService, 45 private confirmService: ConfirmService,
@@ -119,6 +120,14 @@ export class PluginSearchComponent implements OnInit {
119 return this.pluginApiService.getPluginOrThemeHref(this.pluginType, name) 120 return this.pluginApiService.getPluginOrThemeHref(this.pluginType, name)
120 } 121 }
121 122
123 getShowRouterLink (plugin: PeerTubePluginIndex) {
124 return [ '/admin', 'plugins', 'show', this.pluginService.nameToNpmName(plugin.name, this.pluginType) ]
125 }
126
127 isThemeSearch () {
128 return this.pluginType === PluginType.THEME
129 }
130
122 async install (plugin: PeerTubePluginIndex) { 131 async install (plugin: PeerTubePluginIndex) {
123 if (this.installing[plugin.npmName]) return 132 if (this.installing[plugin.npmName]) return
124 133