mirror of
https://github.com/paperless-ngx/paperless-ngx.git
synced 2025-08-12 00:19:48 +00:00
move permissions input components
This commit is contained in:
@@ -0,0 +1,13 @@
|
||||
<div class="paperless-input-select">
|
||||
<div>
|
||||
<ng-select name="inputId" [(ngModel)]="value"
|
||||
[disabled]="disabled"
|
||||
clearable="true"
|
||||
[items]="groups"
|
||||
multiple="true"
|
||||
bindLabel="name"
|
||||
bindValue="id"
|
||||
(change)="onChange(value)">
|
||||
</ng-select>
|
||||
</div>
|
||||
</div>
|
@@ -0,0 +1,30 @@
|
||||
import { Component, forwardRef, Input, OnInit } from '@angular/core'
|
||||
import { NG_VALUE_ACCESSOR } from '@angular/forms'
|
||||
import { first } from 'rxjs/operators'
|
||||
import { PaperlessGroup } from 'src/app/data/paperless-group'
|
||||
import { GroupService } from 'src/app/services/rest/group.service'
|
||||
import { AbstractInputComponent } from '../../abstract-input'
|
||||
|
||||
@Component({
|
||||
providers: [
|
||||
{
|
||||
provide: NG_VALUE_ACCESSOR,
|
||||
useExisting: forwardRef(() => PermissionsGroupComponent),
|
||||
multi: true,
|
||||
},
|
||||
],
|
||||
selector: 'app-permissions-group',
|
||||
templateUrl: './permissions-group.component.html',
|
||||
styleUrls: ['./permissions-group.component.scss'],
|
||||
})
|
||||
export class PermissionsGroupComponent extends AbstractInputComponent<PaperlessGroup> {
|
||||
groups: PaperlessGroup[]
|
||||
|
||||
constructor(groupService: GroupService) {
|
||||
super()
|
||||
groupService
|
||||
.listAll()
|
||||
.pipe(first())
|
||||
.subscribe((result) => (this.groups = result.results))
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user