diff options
author | Chocobozzz <me@florianbigard.com> | 2021-12-29 10:41:48 +0100 |
---|---|---|
committer | Chocobozzz <me@florianbigard.com> | 2021-12-29 10:41:48 +0100 |
commit | 29aedac8dcfc98ff67680d91d6f0f848e86fa4db (patch) | |
tree | ea72e501d88f34b566f0ddd231110d5766fcdfeb /client/src/app/+admin/plugins/plugin-search | |
parent | 087fc5dadec95061c05bd0b6c86197a32ec4f23c (diff) | |
download | PeerTube-29aedac8dcfc98ff67680d91d6f0f848e86fa4db.tar.gz PeerTube-29aedac8dcfc98ff67680d91d6f0f848e86fa4db.tar.zst PeerTube-29aedac8dcfc98ff67680d91d6f0f848e86fa4db.zip |
Refactor plugin card
Diffstat (limited to 'client/src/app/+admin/plugins/plugin-search')
3 files changed, 19 insertions, 39 deletions
diff --git a/client/src/app/+admin/plugins/plugin-search/index.ts b/client/src/app/+admin/plugins/plugin-search/index.ts new file mode 100644 index 000000000..5bb90a62f --- /dev/null +++ b/client/src/app/+admin/plugins/plugin-search/index.ts | |||
@@ -0,0 +1 @@ | |||
export * from './plugin-search.component' | |||
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 a0d228702..14f28f7ef 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 | |||
@@ -30,45 +30,29 @@ | |||
30 | </div> | 30 | </div> |
31 | 31 | ||
32 | <div class="plugins" myInfiniteScroller (nearOfBottom)="onNearOfBottom()" [dataObservable]="onDataSubject.asObservable()"> | 32 | <div class="plugins" myInfiniteScroller (nearOfBottom)="onNearOfBottom()" [dataObservable]="onDataSubject.asObservable()"> |
33 | <div class="card plugin" *ngFor="let plugin of plugins"> | 33 | <ng-container *ngFor="let plugin of plugins" > |
34 | <div class="card-body"> | 34 | <my-plugin-card [plugin]="plugin" [version]="plugin.latestVersion" [pluginType]="pluginType"> |
35 | <div class="first-row"> | 35 | <div ngProjectAs="badges"> |
36 | <span class="plugin-name">{{ plugin.name }}</span> | 36 | <span i18n *ngIf="plugin.installed" class="badge badge-success">Installed</span> |
37 | |||
38 | <span class="plugin-version">{{ plugin.latestVersion }}</span> | ||
39 | |||
40 | <a class="plugin-icon" target="_blank" rel="noopener noreferrer" [href]="plugin.homepage" i18n-title title="Plugin homepage (new window)"> | ||
41 | <my-global-icon iconName="home"></my-global-icon> | ||
42 | </a> | ||
43 | |||
44 | <a class="plugin-icon" target="_blank" rel="noopener noreferrer" [href]="getPluginOrThemeHref(plugin.name)" i18n-title title="Plugin npm package (new window)"> | ||
45 | <my-global-icon iconName="npm"></my-global-icon> | ||
46 | </a> | ||
47 | |||
48 | <span *ngIf="plugin.installed" class="badge badge-success">Installed</span> | ||
49 | |||
50 | 37 | ||
51 | <span *ngIf="plugin.official" class="badge badge-primary" i18n i18n-title title="This plugin is developed by Framasoft"> | 38 | <span *ngIf="plugin.official" class="badge badge-primary" i18n i18n-title title="This plugin is developed by Framasoft"> |
52 | Official | 39 | Official |
53 | </span> | 40 | </span> |
54 | |||
55 | <div class="buttons"> | ||
56 | <my-edit-button | ||
57 | *ngIf="plugin.installed === true && !isThemeSearch()" [routerLink]="getShowRouterLink(plugin)" | ||
58 | label="Settings" i18n-label [responsiveLabel]="true" | ||
59 | ></my-edit-button> | ||
60 | |||
61 | <my-button | ||
62 | class="update-button" *ngIf="plugin.installed === false" (click)="install(plugin)" | ||
63 | [loading]="isInstalling(plugin)" label="Install" [responsiveLabel]="true" | ||
64 | icon="cloud-download" [attr.disabled]="isInstalling(plugin)" | ||
65 | ></my-button> | ||
66 | </div> | ||
67 | </div> | 41 | </div> |
68 | 42 | ||
69 | <div class="second-row"> | 43 | <div ngProjectAs="buttons"> |
70 | <div class="description">{{ plugin.description }}</div> | 44 | <my-edit-button |
45 | *ngIf="plugin.installed === true && !isThemeSearch()" [routerLink]="getShowRouterLink(plugin)" | ||
46 | label="Settings" i18n-label [responsiveLabel]="true" | ||
47 | ></my-edit-button> | ||
48 | |||
49 | <my-button | ||
50 | class="update-button" *ngIf="plugin.installed === false" (click)="install(plugin)" | ||
51 | [loading]="isInstalling(plugin)" label="Install" [responsiveLabel]="true" | ||
52 | icon="cloud-download" [attr.disabled]="isInstalling(plugin)" | ||
53 | ></my-button> | ||
71 | </div> | 54 | </div> |
72 | </div> | 55 | |
73 | </div> | 56 | </my-plugin-card> |
57 | </ng-container> | ||
74 | </div> | 58 | </div> |
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 803777eb3..ef704c83b 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 | |||
@@ -11,7 +11,6 @@ import { PeerTubePluginIndex, PluginType } from '@shared/models' | |||
11 | templateUrl: './plugin-search.component.html', | 11 | templateUrl: './plugin-search.component.html', |
12 | styleUrls: [ | 12 | styleUrls: [ |
13 | '../shared/toggle-plugin-type.scss', | 13 | '../shared/toggle-plugin-type.scss', |
14 | '../shared/plugin-list.component.scss', | ||
15 | './plugin-search.component.scss' | 14 | './plugin-search.component.scss' |
16 | ] | 15 | ] |
17 | }) | 16 | }) |
@@ -115,10 +114,6 @@ export class PluginSearchComponent implements OnInit { | |||
115 | return !!this.installing[plugin.npmName] | 114 | return !!this.installing[plugin.npmName] |
116 | } | 115 | } |
117 | 116 | ||
118 | getPluginOrThemeHref (name: string) { | ||
119 | return this.pluginApiService.getPluginOrThemeHref(this.pluginType, name) | ||
120 | } | ||
121 | |||
122 | getShowRouterLink (plugin: PeerTubePluginIndex) { | 117 | getShowRouterLink (plugin: PeerTubePluginIndex) { |
123 | return [ '/admin', 'plugins', 'show', this.pluginService.nameToNpmName(plugin.name, this.pluginType) ] | 118 | return [ '/admin', 'plugins', 'show', this.pluginService.nameToNpmName(plugin.name, this.pluginType) ] |
124 | } | 119 | } |