Plugins can add custom instance infobox
This commit is contained in:
parent
4abc7b053a
commit
071f3e519c
5 changed files with 31 additions and 6 deletions
|
@ -85,7 +85,10 @@
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div #instanceInformation class="instance-information">
|
<div #instanceInformation class="instance-information">
|
||||||
<my-instance-about-accordion (init)="onInstanceAboutAccordionInit($event)" [panels]="instanceInformationPanels"></my-instance-about-accordion>
|
<my-instance-about-accordion
|
||||||
|
(init)="onInstanceAboutAccordionInit($event)" [panels]="instanceInformationPanels"
|
||||||
|
pluginScope="login" pluginHook="filter:login.instance-about-plugin-panels.create.result"
|
||||||
|
></my-instance-about-accordion>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</ng-container>
|
</ng-container>
|
||||||
|
|
|
@ -17,7 +17,10 @@
|
||||||
<my-custom-stepper linear *ngIf="!signupDone">
|
<my-custom-stepper linear *ngIf="!signupDone">
|
||||||
<cdk-step [stepControl]="formStepTerms" i18n-label="Stepper label for the registration page describing terms of service" label="Terms">
|
<cdk-step [stepControl]="formStepTerms" i18n-label="Stepper label for the registration page describing terms of service" label="Terms">
|
||||||
<div class="instance-information">
|
<div class="instance-information">
|
||||||
<my-instance-about-accordion (init)="onInstanceAboutAccordionInit($event)" [panels]="instanceInformationPanels"></my-instance-about-accordion>
|
<my-instance-about-accordion
|
||||||
|
(init)="onInstanceAboutAccordionInit($event)" [panels]="instanceInformationPanels"
|
||||||
|
pluginScope="signup" pluginHook="filter:signup.instance-about-plugin-panels.create.result"
|
||||||
|
></my-instance-about-accordion>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<my-register-step-terms
|
<my-register-step-terms
|
||||||
|
|
|
@ -49,5 +49,11 @@
|
||||||
<div class="block" [innerHTML]="aboutHtml.codeOfConduct"></div>
|
<div class="block" [innerHTML]="aboutHtml.codeOfConduct"></div>
|
||||||
</ng-template>
|
</ng-template>
|
||||||
</ngb-panel>
|
</ngb-panel>
|
||||||
|
|
||||||
|
<ngb-panel *ngFor="let pluginPanel of pluginPanels" [id]="pluginPanel.id" [title]="pluginPanel.title">
|
||||||
|
<ng-template ngbPanelContent>
|
||||||
|
<div class="block" [innerHTML]="pluginPanel.html"></div>
|
||||||
|
</ng-template>
|
||||||
|
</ngb-panel>
|
||||||
</ng-container>
|
</ng-container>
|
||||||
</ngb-accordion>
|
</ngb-accordion>
|
||||||
|
|
|
@ -1,8 +1,9 @@
|
||||||
import { Component, EventEmitter, Input, OnInit, Output, ViewChild } from '@angular/core'
|
import { Component, EventEmitter, Input, OnInit, Output, ViewChild } from '@angular/core'
|
||||||
|
import { HooksService, Notifier } from '@app/core'
|
||||||
import { NgbAccordion } from '@ng-bootstrap/ng-bootstrap'
|
import { NgbAccordion } from '@ng-bootstrap/ng-bootstrap'
|
||||||
import { InstanceService } from './instance.service'
|
import { ClientFilterHookName, PluginClientScope } from '@shared/models/plugins'
|
||||||
import { Notifier } from '@app/core'
|
|
||||||
import { About } from '@shared/models/server'
|
import { About } from '@shared/models/server'
|
||||||
|
import { InstanceService } from './instance.service'
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'my-instance-about-accordion',
|
selector: 'my-instance-about-accordion',
|
||||||
|
@ -11,8 +12,12 @@ import { About } from '@shared/models/server'
|
||||||
})
|
})
|
||||||
export class InstanceAboutAccordionComponent implements OnInit {
|
export class InstanceAboutAccordionComponent implements OnInit {
|
||||||
@ViewChild('accordion', { static: true }) accordion: NgbAccordion
|
@ViewChild('accordion', { static: true }) accordion: NgbAccordion
|
||||||
|
|
||||||
@Output() init: EventEmitter<InstanceAboutAccordionComponent> = new EventEmitter<InstanceAboutAccordionComponent>()
|
@Output() init: EventEmitter<InstanceAboutAccordionComponent> = new EventEmitter<InstanceAboutAccordionComponent>()
|
||||||
|
|
||||||
|
@Input() pluginScope: PluginClientScope
|
||||||
|
@Input() pluginHook: ClientFilterHookName
|
||||||
|
|
||||||
@Input() panels = {
|
@Input() panels = {
|
||||||
features: true,
|
features: true,
|
||||||
administrators: true,
|
administrators: true,
|
||||||
|
@ -29,12 +34,15 @@ export class InstanceAboutAccordionComponent implements OnInit {
|
||||||
administrator: ''
|
administrator: ''
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pluginPanels: { id: string, title: string, html: string }[] = []
|
||||||
|
|
||||||
constructor (
|
constructor (
|
||||||
private instanceService: InstanceService,
|
private instanceService: InstanceService,
|
||||||
private notifier: Notifier
|
private notifier: Notifier,
|
||||||
|
private hookService: HooksService
|
||||||
) { }
|
) { }
|
||||||
|
|
||||||
ngOnInit (): void {
|
async ngOnInit () {
|
||||||
this.instanceService.getAbout()
|
this.instanceService.getAbout()
|
||||||
.subscribe({
|
.subscribe({
|
||||||
next: async about => {
|
next: async about => {
|
||||||
|
@ -47,6 +55,8 @@ export class InstanceAboutAccordionComponent implements OnInit {
|
||||||
|
|
||||||
error: err => this.notifier.error(err.message)
|
error: err => this.notifier.error(err.message)
|
||||||
})
|
})
|
||||||
|
|
||||||
|
this.pluginPanels = await this.hookService.wrapObject([], this.pluginScope, this.pluginHook)
|
||||||
}
|
}
|
||||||
|
|
||||||
getAdministratorsPanel () {
|
getAdministratorsPanel () {
|
||||||
|
|
|
@ -65,6 +65,9 @@ export const clientFilterHookObject = {
|
||||||
// Filter upload page alert messages
|
// Filter upload page alert messages
|
||||||
'filter:upload.messages.create.result': true,
|
'filter:upload.messages.create.result': true,
|
||||||
|
|
||||||
|
'filter:login.instance-about-plugin-panels.create.result': true,
|
||||||
|
'filter:signup.instance-about-plugin-panels.create.result': true,
|
||||||
|
|
||||||
// Filter videojs options built for PeerTube player
|
// Filter videojs options built for PeerTube player
|
||||||
'filter:internal.player.videojs.options.result': true
|
'filter:internal.player.videojs.options.result': true
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue