aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-rw-r--r--client/src/app/+about/about-instance/about-instance.component.html4
-rw-r--r--client/src/app/+about/about-instance/about-instance.component.ts8
-rw-r--r--client/src/app/+about/about-instance/about-instance.resolver.ts62
-rw-r--r--client/src/app/+about/about-instance/instance-statistics.component.html (renamed from client/src/app/shared/shared-instance/instance-statistics.component.html)0
-rw-r--r--client/src/app/+about/about-instance/instance-statistics.component.scss (renamed from client/src/app/shared/shared-instance/instance-statistics.component.scss)0
-rw-r--r--client/src/app/+about/about-instance/instance-statistics.component.ts11
-rw-r--r--client/src/app/+about/about.module.ts8
-rw-r--r--client/src/app/shared/shared-instance/index.ts1
-rw-r--r--client/src/app/shared/shared-instance/instance-statistics.component.ts24
-rw-r--r--client/src/app/shared/shared-instance/shared-instance.module.ts8
10 files changed, 71 insertions, 55 deletions
diff --git a/client/src/app/+about/about-instance/about-instance.component.html b/client/src/app/+about/about-instance/about-instance.component.html
index fdd6157e5..f602ec1b5 100644
--- a/client/src/app/+about/about-instance/about-instance.component.html
+++ b/client/src/app/+about/about-instance/about-instance.component.html
@@ -210,6 +210,7 @@
210 210
211 <div class="col" myPluginSelector pluginSelectorId="about-instance-statistics"> 211 <div class="col" myPluginSelector pluginSelectorId="about-instance-statistics">
212 <div class="anchor" id="statistics"></div> 212 <div class="anchor" id="statistics"></div>
213
213 <a 214 <a
214 class="anchor-link" 215 class="anchor-link"
215 routerLink="/about/instance" 216 routerLink="/about/instance"
@@ -218,7 +219,8 @@
218 (click)="onClickCopyLink(anchorLink)"> 219 (click)="onClickCopyLink(anchorLink)">
219 <h2 i18n class="middle-title">STATISTICS</h2> 220 <h2 i18n class="middle-title">STATISTICS</h2>
220 </a> 221 </a>
221 <my-instance-statistics></my-instance-statistics> 222
223 <my-instance-statistics [serverStats]="serverStats"></my-instance-statistics>
222 </div> 224 </div>
223</div> 225</div>
224 226
diff --git a/client/src/app/+about/about-instance/about-instance.component.ts b/client/src/app/+about/about-instance/about-instance.component.ts
index e1501d7de..fc5214215 100644
--- a/client/src/app/+about/about-instance/about-instance.component.ts
+++ b/client/src/app/+about/about-instance/about-instance.component.ts
@@ -4,7 +4,7 @@ import { ActivatedRoute } from '@angular/router'
4import { Notifier, ServerService } from '@app/core' 4import { Notifier, ServerService } from '@app/core'
5import { AboutHTML } from '@app/shared/shared-instance' 5import { AboutHTML } from '@app/shared/shared-instance'
6import { copyToClipboard } from '@root-helpers/utils' 6import { copyToClipboard } from '@root-helpers/utils'
7import { HTMLServerConfig } from '@shared/models/server' 7import { HTMLServerConfig, ServerStats } from '@shared/models/server'
8import { ResolverData } from './about-instance.resolver' 8import { ResolverData } from './about-instance.resolver'
9import { ContactAdminModalComponent } from './contact-admin-modal.component' 9import { ContactAdminModalComponent } from './contact-admin-modal.component'
10 10
@@ -26,6 +26,8 @@ export class AboutInstanceComponent implements OnInit, AfterViewChecked {
26 26
27 initialized = false 27 initialized = false
28 28
29 serverStats: ServerStats
30
29 private serverConfig: HTMLServerConfig 31 private serverConfig: HTMLServerConfig
30 32
31 private lastScrollHash: string 33 private lastScrollHash: string
@@ -50,7 +52,9 @@ export class AboutInstanceComponent implements OnInit, AfterViewChecked {
50 } 52 }
51 53
52 ngOnInit () { 54 ngOnInit () {
53 const { about, languages, categories, aboutHTML, descriptionElement }: ResolverData = this.route.snapshot.data.instanceData 55 const { about, languages, categories, aboutHTML, descriptionElement, serverStats }: ResolverData = this.route.snapshot.data.instanceData
56
57 this.serverStats = serverStats
54 58
55 this.aboutHTML = aboutHTML 59 this.aboutHTML = aboutHTML
56 this.descriptionElement = descriptionElement 60 this.descriptionElement = descriptionElement
diff --git a/client/src/app/+about/about-instance/about-instance.resolver.ts b/client/src/app/+about/about-instance/about-instance.resolver.ts
index 8818fc582..94388e71d 100644
--- a/client/src/app/+about/about-instance/about-instance.resolver.ts
+++ b/client/src/app/+about/about-instance/about-instance.resolver.ts
@@ -1,12 +1,14 @@
1import { forkJoin } from 'rxjs' 1import { forkJoin, Observable } from 'rxjs'
2import { map, switchMap } from 'rxjs/operators' 2import { map, switchMap } from 'rxjs/operators'
3import { Injectable } from '@angular/core' 3import { Injectable } from '@angular/core'
4import { Resolve } from '@angular/router' 4import { Resolve } from '@angular/router'
5import { ServerService } from '@app/core'
5import { CustomMarkupService } from '@app/shared/shared-custom-markup' 6import { CustomMarkupService } from '@app/shared/shared-custom-markup'
6import { AboutHTML, InstanceService } from '@app/shared/shared-instance' 7import { AboutHTML, InstanceService } from '@app/shared/shared-instance'
7import { About } from '@shared/models/server' 8import { About, ServerStats } from '@shared/models/server'
8 9
9export type ResolverData = { 10export type ResolverData = {
11 serverStats: ServerStats
10 about: About 12 about: About
11 languages: string[] 13 languages: string[]
12 categories: string[] 14 categories: string[]
@@ -19,25 +21,47 @@ export class AboutInstanceResolver implements Resolve<any> {
19 21
20 constructor ( 22 constructor (
21 private instanceService: InstanceService, 23 private instanceService: InstanceService,
22 private customMarkupService: CustomMarkupService 24 private customMarkupService: CustomMarkupService,
23 25 private serverService: ServerService
24 ) {} 26 ) {}
25 27
26 resolve () { 28 resolve (): Observable<ResolverData> {
29 return forkJoin([
30 this.buildInstanceAboutObservable(),
31 this.buildInstanceStatsObservable()
32 ]).pipe(
33 map(([
34 [ about, languages, categories, aboutHTML, { rootElement } ],
35 serverStats
36 ]) => {
37 return {
38 serverStats,
39 about,
40 languages,
41 categories,
42 aboutHTML,
43 descriptionElement: rootElement
44 }
45 })
46 )
47 }
48
49 private buildInstanceAboutObservable () {
27 return this.instanceService.getAbout() 50 return this.instanceService.getAbout()
28 .pipe( 51 .pipe(
29 switchMap(about => { 52 switchMap(about => {
30 return forkJoin([ 53 return forkJoin([
31 Promise.resolve(about), 54 Promise.resolve(about),
32 this.instanceService.buildTranslatedLanguages(about), 55 this.instanceService.buildTranslatedLanguages(about),
33 this.instanceService.buildTranslatedCategories(about), 56 this.instanceService.buildTranslatedCategories(about),
34 this.instanceService.buildHtml(about), 57 this.instanceService.buildHtml(about),
35 this.customMarkupService.buildElement(about.instance.description) 58 this.customMarkupService.buildElement(about.instance.description)
36 ]) 59 ])
37 }), 60 })
38 map(([ about, languages, categories, aboutHTML, { rootElement } ]) => { 61 )
39 return { about, languages, categories, aboutHTML, descriptionElement: rootElement } as ResolverData 62 }
40 }) 63
41 ) 64 private buildInstanceStatsObservable () {
65 return this.serverService.getServerStats()
42 } 66 }
43} 67}
diff --git a/client/src/app/shared/shared-instance/instance-statistics.component.html b/client/src/app/+about/about-instance/instance-statistics.component.html
index 68b209990..68b209990 100644
--- a/client/src/app/shared/shared-instance/instance-statistics.component.html
+++ b/client/src/app/+about/about-instance/instance-statistics.component.html
diff --git a/client/src/app/shared/shared-instance/instance-statistics.component.scss b/client/src/app/+about/about-instance/instance-statistics.component.scss
index e1d489d28..e1d489d28 100644
--- a/client/src/app/shared/shared-instance/instance-statistics.component.scss
+++ b/client/src/app/+about/about-instance/instance-statistics.component.scss
diff --git a/client/src/app/+about/about-instance/instance-statistics.component.ts b/client/src/app/+about/about-instance/instance-statistics.component.ts
new file mode 100644
index 000000000..ac6984438
--- /dev/null
+++ b/client/src/app/+about/about-instance/instance-statistics.component.ts
@@ -0,0 +1,11 @@
1import { Component, Input } from '@angular/core'
2import { ServerStats } from '@shared/models/server'
3
4@Component({
5 selector: 'my-instance-statistics',
6 templateUrl: './instance-statistics.component.html',
7 styleUrls: [ './instance-statistics.component.scss' ]
8})
9export class InstanceStatisticsComponent {
10 @Input() serverStats: ServerStats
11}
diff --git a/client/src/app/+about/about.module.ts b/client/src/app/+about/about.module.ts
index 6a3d72290..2cdfdf822 100644
--- a/client/src/app/+about/about.module.ts
+++ b/client/src/app/+about/about.module.ts
@@ -3,6 +3,7 @@ import { AboutFollowsComponent } from '@app/+about/about-follows/about-follows.c
3import { AboutInstanceComponent } from '@app/+about/about-instance/about-instance.component' 3import { AboutInstanceComponent } from '@app/+about/about-instance/about-instance.component'
4import { AboutInstanceResolver } from '@app/+about/about-instance/about-instance.resolver' 4import { AboutInstanceResolver } from '@app/+about/about-instance/about-instance.resolver'
5import { ContactAdminModalComponent } from '@app/+about/about-instance/contact-admin-modal.component' 5import { ContactAdminModalComponent } from '@app/+about/about-instance/contact-admin-modal.component'
6import { InstanceStatisticsComponent } from '@app/+about/about-instance/instance-statistics.component'
6import { AboutPeertubeComponent } from '@app/+about/about-peertube/about-peertube.component' 7import { AboutPeertubeComponent } from '@app/+about/about-peertube/about-peertube.component'
7import { SharedCustomMarkupModule } from '@app/shared/shared-custom-markup' 8import { SharedCustomMarkupModule } from '@app/shared/shared-custom-markup'
8import { SharedFormModule } from '@app/shared/shared-forms' 9import { SharedFormModule } from '@app/shared/shared-forms'
@@ -25,10 +26,13 @@ import { AboutComponent } from './about.component'
25 26
26 declarations: [ 27 declarations: [
27 AboutComponent, 28 AboutComponent,
29
28 AboutInstanceComponent, 30 AboutInstanceComponent,
31 ContactAdminModalComponent,
32 InstanceStatisticsComponent,
33
29 AboutPeertubeComponent, 34 AboutPeertubeComponent,
30 AboutFollowsComponent, 35 AboutFollowsComponent
31 ContactAdminModalComponent
32 ], 36 ],
33 37
34 exports: [ 38 exports: [
diff --git a/client/src/app/shared/shared-instance/index.ts b/client/src/app/shared/shared-instance/index.ts
index d7172f7b6..d8a69afe0 100644
--- a/client/src/app/shared/shared-instance/index.ts
+++ b/client/src/app/shared/shared-instance/index.ts
@@ -2,6 +2,5 @@ export * from './feature-boolean.component'
2export * from './instance-about-accordion.component' 2export * from './instance-about-accordion.component'
3export * from './instance-features-table.component' 3export * from './instance-features-table.component'
4export * from './instance-follow.service' 4export * from './instance-follow.service'
5export * from './instance-statistics.component'
6export * from './instance.service' 5export * from './instance.service'
7export * from './shared-instance.module' 6export * from './shared-instance.module'
diff --git a/client/src/app/shared/shared-instance/instance-statistics.component.ts b/client/src/app/shared/shared-instance/instance-statistics.component.ts
deleted file mode 100644
index 0618efe69..000000000
--- a/client/src/app/shared/shared-instance/instance-statistics.component.ts
+++ /dev/null
@@ -1,24 +0,0 @@
1import { Component, OnInit } from '@angular/core'
2import { ServerStats } from '@shared/models/server'
3import { ServerService } from '@app/core'
4
5@Component({
6 selector: 'my-instance-statistics',
7 templateUrl: './instance-statistics.component.html',
8 styleUrls: [ './instance-statistics.component.scss' ]
9})
10export class InstanceStatisticsComponent implements OnInit {
11 serverStats: ServerStats = null
12
13 constructor (
14 private serverService: ServerService
15 ) {
16 }
17
18 ngOnInit () {
19 this.serverService.getServerStats()
20 .subscribe(res => {
21 this.serverStats = res
22 })
23 }
24}
diff --git a/client/src/app/shared/shared-instance/shared-instance.module.ts b/client/src/app/shared/shared-instance/shared-instance.module.ts
index dfce88e11..4ce98eafe 100644
--- a/client/src/app/shared/shared-instance/shared-instance.module.ts
+++ b/client/src/app/shared/shared-instance/shared-instance.module.ts
@@ -1,4 +1,3 @@
1
2import { NgModule } from '@angular/core' 1import { NgModule } from '@angular/core'
3import { NgbAccordionModule } from '@ng-bootstrap/ng-bootstrap' 2import { NgbAccordionModule } from '@ng-bootstrap/ng-bootstrap'
4import { SharedGlobalIconModule } from '../shared-icons' 3import { SharedGlobalIconModule } from '../shared-icons'
@@ -7,7 +6,6 @@ import { FeatureBooleanComponent } from './feature-boolean.component'
7import { InstanceAboutAccordionComponent } from './instance-about-accordion.component' 6import { InstanceAboutAccordionComponent } from './instance-about-accordion.component'
8import { InstanceFeaturesTableComponent } from './instance-features-table.component' 7import { InstanceFeaturesTableComponent } from './instance-features-table.component'
9import { InstanceFollowService } from './instance-follow.service' 8import { InstanceFollowService } from './instance-follow.service'
10import { InstanceStatisticsComponent } from './instance-statistics.component'
11import { InstanceService } from './instance.service' 9import { InstanceService } from './instance.service'
12 10
13@NgModule({ 11@NgModule({
@@ -20,15 +18,13 @@ import { InstanceService } from './instance.service'
20 declarations: [ 18 declarations: [
21 FeatureBooleanComponent, 19 FeatureBooleanComponent,
22 InstanceAboutAccordionComponent, 20 InstanceAboutAccordionComponent,
23 InstanceFeaturesTableComponent, 21 InstanceFeaturesTableComponent
24 InstanceStatisticsComponent
25 ], 22 ],
26 23
27 exports: [ 24 exports: [
28 FeatureBooleanComponent, 25 FeatureBooleanComponent,
29 InstanceAboutAccordionComponent, 26 InstanceAboutAccordionComponent,
30 InstanceFeaturesTableComponent, 27 InstanceFeaturesTableComponent
31 InstanceStatisticsComponent
32 ], 28 ],
33 29
34 providers: [ 30 providers: [