mirror of
https://github.com/paperless-ngx/paperless-ngx.git
synced 2025-12-14 18:46:52 +01:00
Refactor permissions to use enums, permissions service
This commit is contained in:
parent
59e359ff98
commit
96a29883cd
39 changed files with 335 additions and 134 deletions
|
|
@ -9,7 +9,7 @@
|
|||
</a>
|
||||
</div>
|
||||
<div content tourAnchor="tour.upload-widget">
|
||||
<form *ifPermissions="'documents.add_document'">
|
||||
<form *ifPermissions="{ action: PermissionAction.Add, type: PermissionType.Document }">
|
||||
<ngx-file-drop dropZoneLabel="Drop documents here or" browseBtnLabel="Browse files" (onFileDrop)="dropped($event)"
|
||||
(onFileOver)="fileOver($event)" (onFileLeave)="fileLeave($event)" dropZoneClassName="bg-light card"
|
||||
multiple="true" contentClassName="justify-content-center d-flex align-items-center py-5 px-2" [showBrowseBtn]=true
|
||||
|
|
@ -40,7 +40,7 @@
|
|||
<h6 class="alert-heading">{{status.filename}}</h6>
|
||||
<p class="mb-0 pb-1" *ngIf="!isFinished(status) || (isFinished(status) && !status.documentId)">{{status.message}}</p>
|
||||
<ngb-progressbar [value]="status.getProgress()" [max]="1" [type]="getStatusColor(status)"></ngb-progressbar>
|
||||
<div *ifPermissions="'documents.view_document'">
|
||||
<div *ifPermissions="{ action: PermissionAction.View, type: PermissionType.Document }">
|
||||
<div *ngIf="isFinished(status)">
|
||||
<button *ngIf="status.documentId" class="btn btn-sm btn-outline-primary btn-open" routerLink="/documents/{{status.documentId}}" (click)="dismiss(status)">
|
||||
<small i18n>Open document</small>
|
||||
|
|
|
|||
|
|
@ -1,6 +1,7 @@
|
|||
import { HttpEventType } from '@angular/common/http'
|
||||
import { Component, OnInit } from '@angular/core'
|
||||
import { FileSystemFileEntry, NgxFileDropEntry } from 'ngx-file-drop'
|
||||
import { ComponentWithPermissions } from 'src/app/components/with-permissions/with-permissions.component'
|
||||
import {
|
||||
ConsumerStatusService,
|
||||
FileStatus,
|
||||
|
|
@ -15,13 +16,18 @@ const MAX_ALERTS = 5
|
|||
templateUrl: './upload-file-widget.component.html',
|
||||
styleUrls: ['./upload-file-widget.component.scss'],
|
||||
})
|
||||
export class UploadFileWidgetComponent implements OnInit {
|
||||
export class UploadFileWidgetComponent
|
||||
extends ComponentWithPermissions
|
||||
implements OnInit
|
||||
{
|
||||
alertsExpanded = false
|
||||
|
||||
constructor(
|
||||
private consumerStatusService: ConsumerStatusService,
|
||||
private uploadDocumentsService: UploadDocumentsService
|
||||
) {}
|
||||
) {
|
||||
super()
|
||||
}
|
||||
|
||||
getStatus() {
|
||||
return this.consumerStatusService.getConsumerStatus().slice(0, MAX_ALERTS)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue