mirror of
https://github.com/paperless-ngx/paperless-ngx.git
synced 2025-04-02 13:45:10 -05:00
Refactoring a few frontend components
This commit is contained in:
parent
09086e574d
commit
e293d23ae3
@ -8,6 +8,7 @@ import {
|
||||
} from 'src/app/services/permissions.service'
|
||||
import { UserService } from 'src/app/services/rest/user.service'
|
||||
import { SettingsService } from 'src/app/services/settings.service'
|
||||
import { ComponentWithPermissions } from '../../with-permissions/with-permissions.component'
|
||||
|
||||
export class PermissionsSelectionModel {
|
||||
ownerFilter: OwnerFilterType
|
||||
@ -38,9 +39,7 @@ export enum OwnerFilterType {
|
||||
templateUrl: './permissions-filter-dropdown.component.html',
|
||||
styleUrls: ['./permissions-filter-dropdown.component.scss'],
|
||||
})
|
||||
export class PermissionsFilterDropdownComponent {
|
||||
public PermissionAction = PermissionAction
|
||||
public PermissionType = PermissionType
|
||||
export class PermissionsFilterDropdownComponent extends ComponentWithPermissions {
|
||||
public OwnerFilterType = OwnerFilterType
|
||||
|
||||
@Input()
|
||||
@ -71,6 +70,7 @@ export class PermissionsFilterDropdownComponent {
|
||||
userService: UserService,
|
||||
private settingsService: SettingsService
|
||||
) {
|
||||
super()
|
||||
if (
|
||||
permissionsService.currentUserCan(
|
||||
PermissionAction.View,
|
||||
|
@ -11,6 +11,7 @@ import {
|
||||
PermissionsService,
|
||||
PermissionType,
|
||||
} from 'src/app/services/permissions.service'
|
||||
import { ComponentWithPermissions } from '../../with-permissions/with-permissions.component'
|
||||
|
||||
@Component({
|
||||
providers: [
|
||||
@ -25,11 +26,9 @@ import {
|
||||
styleUrls: ['./permissions-select.component.scss'],
|
||||
})
|
||||
export class PermissionsSelectComponent
|
||||
extends ComponentWithPermissions
|
||||
implements OnInit, ControlValueAccessor
|
||||
{
|
||||
PermissionType = PermissionType
|
||||
PermissionAction = PermissionAction
|
||||
|
||||
@Input()
|
||||
title: string = 'Permissions'
|
||||
|
||||
@ -62,6 +61,7 @@ export class PermissionsSelectComponent
|
||||
inheritedWarning: string = $localize`Inherited from group`
|
||||
|
||||
constructor(private readonly permissionsService: PermissionsService) {
|
||||
super()
|
||||
for (const type in PermissionType) {
|
||||
const control = new FormGroup({})
|
||||
for (const action in PermissionAction) {
|
||||
|
@ -44,6 +44,7 @@ import { PaperlessUser } from 'src/app/data/paperless-user'
|
||||
import { UserService } from 'src/app/services/rest/user.service'
|
||||
import { PaperlessDocumentNote } from 'src/app/data/paperless-document-note'
|
||||
import { HttpClient } from '@angular/common/http'
|
||||
import { ComponentWithPermissions } from '../with-permissions/with-permissions.component'
|
||||
|
||||
enum DocumentDetailNavIDs {
|
||||
Details = 1,
|
||||
@ -60,6 +61,7 @@ enum DocumentDetailNavIDs {
|
||||
styleUrls: ['./document-detail.component.scss'],
|
||||
})
|
||||
export class DocumentDetailComponent
|
||||
extends ComponentWithPermissions
|
||||
implements OnInit, OnDestroy, DirtyComponent
|
||||
{
|
||||
@ViewChild('inputTitle')
|
||||
@ -127,8 +129,6 @@ export class DocumentDetailComponent
|
||||
}
|
||||
}
|
||||
|
||||
PermissionAction = PermissionAction
|
||||
PermissionType = PermissionType
|
||||
DocumentDetailNavIDs = DocumentDetailNavIDs
|
||||
activeNavID: number
|
||||
|
||||
@ -148,7 +148,9 @@ export class DocumentDetailComponent
|
||||
private permissionsService: PermissionsService,
|
||||
private userService: UserService,
|
||||
private http: HttpClient
|
||||
) {}
|
||||
) {
|
||||
super()
|
||||
}
|
||||
|
||||
titleKeyUp(event) {
|
||||
this.titleSubject.next(event.target?.value)
|
||||
|
Loading…
x
Reference in New Issue
Block a user