diff options
Diffstat (limited to 'client')
14 files changed, 110 insertions, 83 deletions
diff --git a/client/src/app/+admin/admin.module.ts b/client/src/app/+admin/admin.module.ts index 36a68ba91..dbced0e86 100644 --- a/client/src/app/+admin/admin.module.ts +++ b/client/src/app/+admin/admin.module.ts | |||
@@ -41,11 +41,14 @@ import { | |||
41 | VideoAdminService, | 41 | VideoAdminService, |
42 | VideoListComponent | 42 | VideoListComponent |
43 | } from './overview' | 43 | } from './overview' |
44 | import { PluginListInstalledComponent } from './plugins/plugin-list-installed/plugin-list-installed.component' | 44 | import { |
45 | import { PluginSearchComponent } from './plugins/plugin-search/plugin-search.component' | 45 | PluginApiService, |
46 | import { PluginShowInstalledComponent } from './plugins/plugin-show-installed/plugin-show-installed.component' | 46 | PluginCardComponent, |
47 | import { PluginsComponent } from './plugins/plugins.component' | 47 | PluginListInstalledComponent, |
48 | import { PluginApiService } from './plugins/shared/plugin-api.service' | 48 | PluginsComponent, |
49 | PluginSearchComponent, | ||
50 | PluginShowInstalledComponent | ||
51 | } from './plugins' | ||
49 | import { JobService, LogsComponent, LogsService } from './system' | 52 | import { JobService, LogsComponent, LogsService } from './system' |
50 | import { DebugComponent, DebugService } from './system/debug' | 53 | import { DebugComponent, DebugService } from './system/debug' |
51 | import { JobsComponent } from './system/jobs/jobs.component' | 54 | import { JobsComponent } from './system/jobs/jobs.component' |
@@ -99,6 +102,7 @@ import { JobsComponent } from './system/jobs/jobs.component' | |||
99 | PluginListInstalledComponent, | 102 | PluginListInstalledComponent, |
100 | PluginSearchComponent, | 103 | PluginSearchComponent, |
101 | PluginShowInstalledComponent, | 104 | PluginShowInstalledComponent, |
105 | PluginCardComponent, | ||
102 | 106 | ||
103 | JobsComponent, | 107 | JobsComponent, |
104 | LogsComponent, | 108 | LogsComponent, |
diff --git a/client/src/app/+admin/plugins/index.ts b/client/src/app/+admin/plugins/index.ts index b75a94556..c70b6568e 100644 --- a/client/src/app/+admin/plugins/index.ts +++ b/client/src/app/+admin/plugins/index.ts | |||
@@ -1 +1,6 @@ | |||
1 | export * from './plugins.component' | 1 | export * from './plugins.component' |
2 | export * from './shared' | ||
3 | export * from './plugin-list-installed' | ||
4 | export * from './plugin-search' | ||
5 | export * from './plugin-show-installed' | ||
6 | |||
diff --git a/client/src/app/+admin/plugins/plugin-list-installed/index.ts b/client/src/app/+admin/plugins/plugin-list-installed/index.ts new file mode 100644 index 000000000..0704fd22e --- /dev/null +++ b/client/src/app/+admin/plugins/plugin-list-installed/index.ts | |||
@@ -0,0 +1 @@ | |||
export * from './plugin-list-installed.component' | |||
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 b42bd27c5..2591c9a50 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 | |||
@@ -7,39 +7,21 @@ | |||
7 | </div> | 7 | </div> |
8 | 8 | ||
9 | <div class="plugins" myInfiniteScroller (nearOfBottom)="onNearOfBottom()" [dataObservable]="onDataSubject.asObservable()"> | 9 | <div class="plugins" myInfiniteScroller (nearOfBottom)="onNearOfBottom()" [dataObservable]="onDataSubject.asObservable()"> |
10 | <div class="card plugin" *ngFor="let plugin of plugins"> | 10 | <ng-container *ngFor="let plugin of plugins"> |
11 | <div class="card-body"> | 11 | <my-plugin-card [plugin]="plugin" [version]="plugin.version" [pluginType]="pluginType"> |
12 | <div class="first-row"> | 12 | <div ngProjectAs="buttons"> |
13 | <span class="plugin-name">{{ plugin.name }}</span> | 13 | <my-edit-button |
14 | 14 | *ngIf="!isTheme(plugin)" [routerLink]="getShowRouterLink(plugin)" label="Settings" i18n-label | |
15 | <span class="plugin-version">{{ plugin.version }}</span> | 15 | [responsiveLabel]="true" |
16 | 16 | ></my-edit-button> | |
17 | <a class="plugin-icon" target="_blank" rel="noopener noreferrer" [href]="plugin.homepage" i18n-title title="Plugin homepage (new window)"> | 17 | |
18 | <my-global-icon iconName="home"></my-global-icon> | 18 | <my-button |
19 | </a> | 19 | class="update-button" *ngIf="isUpdateAvailable(plugin)" (click)="update(plugin)" [loading]="isUpdating(plugin)" |
20 | 20 | [label]="getUpdateLabel(plugin)" icon="refresh" [attr.disabled]="isUpdating(plugin)" [responsiveLabel]="true" | |
21 | <a class="plugin-icon" target="_blank" rel="noopener noreferrer" [href]="getPluginOrThemeHref(plugin.name)" i18n-title title="Plugin homepage (new window)"> | 21 | ></my-button> |
22 | <my-global-icon iconName="npm"></my-global-icon> | 22 | |
23 | </a> | 23 | <my-delete-button (click)="uninstall(plugin)" label="Uninstall" i18n-label [responsiveLabel]="true"></my-delete-button> |
24 | |||
25 | <div class="buttons"> | ||
26 | <my-edit-button | ||
27 | *ngIf="!isTheme(plugin)" [routerLink]="getShowRouterLink(plugin)" label="Settings" i18n-label | ||
28 | [responsiveLabel]="true" | ||
29 | ></my-edit-button> | ||
30 | |||
31 | <my-button | ||
32 | class="update-button" *ngIf="isUpdateAvailable(plugin)" (click)="update(plugin)" [loading]="isUpdating(plugin)" | ||
33 | [label]="getUpdateLabel(plugin)" icon="refresh" [attr.disabled]="isUpdating(plugin)" [responsiveLabel]="true" | ||
34 | ></my-button> | ||
35 | |||
36 | <my-delete-button (click)="uninstall(plugin)" label="Uninstall" i18n-label [responsiveLabel]="true"></my-delete-button> | ||
37 | </div> | ||
38 | </div> | ||
39 | |||
40 | <div class="second-row"> | ||
41 | <div class="description">{{ plugin.description }}</div> | ||
42 | </div> | 24 | </div> |
43 | </div> | 25 | </my-plugin-card> |
44 | </div> | 26 | </ng-container> |
45 | </div> | 27 | </div> |
diff --git a/client/src/app/+admin/plugins/plugin-list-installed/plugin-list-installed.component.scss b/client/src/app/+admin/plugins/plugin-list-installed/plugin-list-installed.component.scss index 5fa117d51..4039f2a02 100644 --- a/client/src/app/+admin/plugins/plugin-list-installed/plugin-list-installed.component.scss +++ b/client/src/app/+admin/plugins/plugin-list-installed/plugin-list-installed.component.scss | |||
@@ -4,3 +4,8 @@ | |||
4 | .update-button[disabled=true] ::ng-deep .action-button { | 4 | .update-button[disabled=true] ::ng-deep .action-button { |
5 | cursor: default !important; | 5 | cursor: default !important; |
6 | } | 6 | } |
7 | |||
8 | my-edit-button, | ||
9 | my-button { | ||
10 | @include margin-right(10px); | ||
11 | } | ||
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 85f9879bf..6fd238848 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 | |||
@@ -12,7 +12,6 @@ import { PeerTubePlugin, PluginType } from '@shared/models' | |||
12 | templateUrl: './plugin-list-installed.component.html', | 12 | templateUrl: './plugin-list-installed.component.html', |
13 | styleUrls: [ | 13 | styleUrls: [ |
14 | '../shared/toggle-plugin-type.scss', | 14 | '../shared/toggle-plugin-type.scss', |
15 | '../shared/plugin-list.component.scss', | ||
16 | './plugin-list-installed.component.scss' | 15 | './plugin-list-installed.component.scss' |
17 | ] | 16 | ] |
18 | }) | 17 | }) |
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 | } |
diff --git a/client/src/app/+admin/plugins/plugin-show-installed/index.ts b/client/src/app/+admin/plugins/plugin-show-installed/index.ts new file mode 100644 index 000000000..8aeceb90f --- /dev/null +++ b/client/src/app/+admin/plugins/plugin-show-installed/index.ts | |||
@@ -0,0 +1 @@ | |||
export * from './plugin-show-installed.component' | |||
diff --git a/client/src/app/+admin/plugins/shared/index.ts b/client/src/app/+admin/plugins/shared/index.ts new file mode 100644 index 000000000..de037c437 --- /dev/null +++ b/client/src/app/+admin/plugins/shared/index.ts | |||
@@ -0,0 +1,2 @@ | |||
1 | export * from './plugin-api.service' | ||
2 | export * from './plugin-card.component' | ||
diff --git a/client/src/app/+admin/plugins/shared/plugin-card.component.html b/client/src/app/+admin/plugins/shared/plugin-card.component.html new file mode 100644 index 000000000..c9fe6201c --- /dev/null +++ b/client/src/app/+admin/plugins/shared/plugin-card.component.html | |||
@@ -0,0 +1,27 @@ | |||
1 | <div class="card plugin"> | ||
2 | <div class="card-body"> | ||
3 | <div class="first-row"> | ||
4 | <span class="plugin-name">{{ plugin.name }}</span> | ||
5 | |||
6 | <span class="plugin-version">{{ version }}</span> | ||
7 | |||
8 | <a class="plugin-icon" target="_blank" rel="noopener noreferrer" [href]="plugin.homepage" i18n-title title="Plugin homepage (new window)"> | ||
9 | <my-global-icon iconName="home"></my-global-icon> | ||
10 | </a> | ||
11 | |||
12 | <a class="plugin-icon" target="_blank" rel="noopener noreferrer" [href]="getPluginOrThemeHref(plugin.name)" i18n-title title="Plugin homepage (new window)"> | ||
13 | <my-global-icon iconName="npm"></my-global-icon> | ||
14 | </a> | ||
15 | |||
16 | <ng-content select="badges"></ng-content> | ||
17 | |||
18 | <div class="buttons"> | ||
19 | <ng-content select="buttons"></ng-content> | ||
20 | </div> | ||
21 | </div> | ||
22 | |||
23 | <div class="second-row"> | ||
24 | <div class="description">{{ plugin.description }}</div> | ||
25 | </div> | ||
26 | </div> | ||
27 | </div> | ||
diff --git a/client/src/app/+admin/plugins/shared/plugin-list.component.scss b/client/src/app/+admin/plugins/shared/plugin-card.component.scss index 01c6ee64d..608064722 100644 --- a/client/src/app/+admin/plugins/shared/plugin-list.component.scss +++ b/client/src/app/+admin/plugins/shared/plugin-card.component.scss | |||
@@ -36,11 +36,8 @@ | |||
36 | 36 | ||
37 | .buttons { | 37 | .buttons { |
38 | @include margin-left(auto); | 38 | @include margin-left(auto); |
39 | width: max-content; | ||
40 | 39 | ||
41 | > *:not(:last-child) { | 40 | width: max-content; |
42 | @include margin-right(10px); | ||
43 | } | ||
44 | } | 41 | } |
45 | } | 42 | } |
46 | 43 | ||
diff --git a/client/src/app/+admin/plugins/shared/plugin-card.component.ts b/client/src/app/+admin/plugins/shared/plugin-card.component.ts new file mode 100644 index 000000000..462a6c213 --- /dev/null +++ b/client/src/app/+admin/plugins/shared/plugin-card.component.ts | |||
@@ -0,0 +1,24 @@ | |||
1 | import { Component, Input } from '@angular/core' | ||
2 | import { PeerTubePlugin, PeerTubePluginIndex, PluginType } from '@shared/models' | ||
3 | import { PluginApiService } from './plugin-api.service' | ||
4 | |||
5 | @Component({ | ||
6 | selector: 'my-plugin-card', | ||
7 | templateUrl: './plugin-card.component.html', | ||
8 | styleUrls: [ './plugin-card.component.scss' ] | ||
9 | }) | ||
10 | |||
11 | export class PluginCardComponent { | ||
12 | @Input() plugin: PeerTubePluginIndex | PeerTubePlugin | ||
13 | @Input() version: string | ||
14 | @Input() pluginType: PluginType | ||
15 | |||
16 | constructor ( | ||
17 | private pluginApiService: PluginApiService | ||
18 | ) { | ||
19 | } | ||
20 | |||
21 | getPluginOrThemeHref (name: string) { | ||
22 | return this.pluginApiService.getPluginOrThemeHref(this.pluginType, name) | ||
23 | } | ||
24 | } | ||