mirror of
https://github.com/paperless-ngx/paperless-ngx.git
synced 2025-04-02 13:45:10 -05:00
Refactor frontend data models
This commit is contained in:
parent
5723bd8dd8
commit
66b2d90c50
@ -1,5 +1,5 @@
|
||||
import { SettingsService } from './services/settings.service'
|
||||
import { SETTINGS_KEYS } from './data/paperless-uisettings'
|
||||
import { SETTINGS_KEYS } from './data/ui-settings'
|
||||
import { Component, OnDestroy, OnInit, Renderer2 } from '@angular/core'
|
||||
import { Router } from '@angular/router'
|
||||
import { Subscription, first } from 'rxjs'
|
||||
|
@ -13,8 +13,8 @@ import {
|
||||
import { NgSelectModule } from '@ng-select/ng-select'
|
||||
import { of, throwError } from 'rxjs'
|
||||
import { routes } from 'src/app/app-routing.module'
|
||||
import { PaperlessSavedView } from 'src/app/data/paperless-saved-view'
|
||||
import { SETTINGS_KEYS } from 'src/app/data/paperless-uisettings'
|
||||
import { SavedView } from 'src/app/data/saved-view'
|
||||
import { SETTINGS_KEYS } from 'src/app/data/ui-settings'
|
||||
import { IfPermissionsDirective } from 'src/app/directives/if-permissions.directive'
|
||||
import { PermissionsGuard } from 'src/app/guards/permissions.guard'
|
||||
import { CustomDatePipe } from 'src/app/pipes/custom-date.pipe'
|
||||
@ -138,7 +138,7 @@ describe('SettingsComponent', () => {
|
||||
of({
|
||||
all: savedViews.map((v) => v.id),
|
||||
count: savedViews.length,
|
||||
results: (savedViews as PaperlessSavedView[]).concat([]),
|
||||
results: (savedViews as SavedView[]).concat([]),
|
||||
})
|
||||
)
|
||||
}
|
||||
@ -226,9 +226,7 @@ describe('SettingsComponent', () => {
|
||||
savedViewPatchSpy.mockClear()
|
||||
|
||||
// succeed saved views
|
||||
savedViewPatchSpy.mockReturnValueOnce(
|
||||
of(savedViews as PaperlessSavedView[])
|
||||
)
|
||||
savedViewPatchSpy.mockReturnValueOnce(of(savedViews as SavedView[]))
|
||||
component.saveSettings()
|
||||
expect(toastErrorSpy).not.toHaveBeenCalled()
|
||||
expect(savedViewPatchSpy).toHaveBeenCalled()
|
||||
@ -335,7 +333,7 @@ describe('SettingsComponent', () => {
|
||||
const toastSpy = jest.spyOn(toastService, 'showInfo')
|
||||
const deleteSpy = jest.spyOn(savedViewService, 'delete')
|
||||
deleteSpy.mockReturnValue(of(true))
|
||||
component.deleteSavedView(savedViews[0] as PaperlessSavedView)
|
||||
component.deleteSavedView(savedViews[0] as SavedView)
|
||||
expect(deleteSpy).toHaveBeenCalled()
|
||||
expect(toastSpy).toHaveBeenCalledWith(
|
||||
`Saved view "${savedViews[0].name}" deleted.`
|
||||
|
@ -21,10 +21,10 @@ import {
|
||||
takeUntil,
|
||||
tap,
|
||||
} from 'rxjs'
|
||||
import { PaperlessGroup } from 'src/app/data/paperless-group'
|
||||
import { PaperlessSavedView } from 'src/app/data/paperless-saved-view'
|
||||
import { SETTINGS_KEYS } from 'src/app/data/paperless-uisettings'
|
||||
import { PaperlessUser } from 'src/app/data/paperless-user'
|
||||
import { Group } from 'src/app/data/group'
|
||||
import { SavedView } from 'src/app/data/saved-view'
|
||||
import { SETTINGS_KEYS } from 'src/app/data/ui-settings'
|
||||
import { User } from 'src/app/data/user'
|
||||
import { DocumentListViewService } from 'src/app/services/document-list-view.service'
|
||||
import {
|
||||
PermissionsService,
|
||||
@ -98,7 +98,7 @@ export class SettingsComponent
|
||||
savedViews: this.savedViewGroup,
|
||||
})
|
||||
|
||||
savedViews: PaperlessSavedView[]
|
||||
savedViews: SavedView[]
|
||||
|
||||
store: BehaviorSubject<any>
|
||||
storeSub: Subscription
|
||||
@ -107,8 +107,8 @@ export class SettingsComponent
|
||||
unsubscribeNotifier: Subject<any> = new Subject()
|
||||
savePending: boolean = false
|
||||
|
||||
users: PaperlessUser[]
|
||||
groups: PaperlessGroup[]
|
||||
users: User[]
|
||||
groups: Group[]
|
||||
|
||||
get computedDateLocale(): string {
|
||||
return (
|
||||
@ -368,7 +368,7 @@ export class SettingsComponent
|
||||
this.settings.organizingSidebarSavedViews = false
|
||||
}
|
||||
|
||||
deleteSavedView(savedView: PaperlessSavedView) {
|
||||
deleteSavedView(savedView: SavedView) {
|
||||
this.savedViewService.delete(savedView).subscribe(() => {
|
||||
this.savedViewGroup.removeControl(savedView.id.toString())
|
||||
this.savedViews.splice(this.savedViews.indexOf(savedView), 1)
|
||||
@ -531,7 +531,7 @@ export class SettingsComponent
|
||||
|
||||
saveSettings() {
|
||||
// only patch views that have actually changed
|
||||
const changed: PaperlessSavedView[] = []
|
||||
const changed: SavedView[] = []
|
||||
Object.values(this.savedViewGroup.controls)
|
||||
.filter((g: FormGroup) => !g.pristine)
|
||||
.forEach((group: FormGroup) => {
|
||||
|
@ -41,8 +41,8 @@ import { TextComponent } from '../../common/input/text/text.component'
|
||||
import { PageHeaderComponent } from '../../common/page-header/page-header.component'
|
||||
import { SettingsComponent } from '../settings/settings.component'
|
||||
import { UsersAndGroupsComponent } from './users-groups.component'
|
||||
import { PaperlessUser } from 'src/app/data/paperless-user'
|
||||
import { PaperlessGroup } from 'src/app/data/paperless-group'
|
||||
import { User } from 'src/app/data/user'
|
||||
import { Group } from 'src/app/data/group'
|
||||
|
||||
const users = [
|
||||
{ id: 1, username: 'user1', is_superuser: false },
|
||||
@ -119,7 +119,7 @@ describe('UsersAndGroupsComponent', () => {
|
||||
of({
|
||||
all: users.map((a) => a.id),
|
||||
count: users.length,
|
||||
results: (users as PaperlessUser[]).concat([]),
|
||||
results: (users as User[]).concat([]),
|
||||
})
|
||||
)
|
||||
}
|
||||
@ -128,7 +128,7 @@ describe('UsersAndGroupsComponent', () => {
|
||||
of({
|
||||
all: groups.map((r) => r.id),
|
||||
count: groups.length,
|
||||
results: (groups as PaperlessGroup[]).concat([]),
|
||||
results: (groups as Group[]).concat([]),
|
||||
})
|
||||
)
|
||||
}
|
||||
|
@ -1,8 +1,8 @@
|
||||
import { Component, OnDestroy, OnInit } from '@angular/core'
|
||||
import { NgbModal } from '@ng-bootstrap/ng-bootstrap'
|
||||
import { Subject, first, takeUntil } from 'rxjs'
|
||||
import { PaperlessGroup } from 'src/app/data/paperless-group'
|
||||
import { PaperlessUser } from 'src/app/data/paperless-user'
|
||||
import { Group } from 'src/app/data/group'
|
||||
import { User } from 'src/app/data/user'
|
||||
import { PermissionsService } from 'src/app/services/permissions.service'
|
||||
import { GroupService } from 'src/app/services/rest/group.service'
|
||||
import { UserService } from 'src/app/services/rest/user.service'
|
||||
@ -23,8 +23,8 @@ export class UsersAndGroupsComponent
|
||||
extends ComponentWithPermissions
|
||||
implements OnInit, OnDestroy
|
||||
{
|
||||
users: PaperlessUser[]
|
||||
groups: PaperlessGroup[]
|
||||
users: User[]
|
||||
groups: Group[]
|
||||
|
||||
unsubscribeNotifier: Subject<any> = new Subject()
|
||||
|
||||
@ -69,7 +69,7 @@ export class UsersAndGroupsComponent
|
||||
this.unsubscribeNotifier.next(true)
|
||||
}
|
||||
|
||||
editUser(user: PaperlessUser = null) {
|
||||
editUser(user: User = null) {
|
||||
var modal = this.modalService.open(UserEditDialogComponent, {
|
||||
backdrop: 'static',
|
||||
size: 'xl',
|
||||
@ -80,7 +80,7 @@ export class UsersAndGroupsComponent
|
||||
modal.componentInstance.object = user
|
||||
modal.componentInstance.succeeded
|
||||
.pipe(takeUntil(this.unsubscribeNotifier))
|
||||
.subscribe((newUser: PaperlessUser) => {
|
||||
.subscribe((newUser: User) => {
|
||||
if (
|
||||
newUser.id === this.settings.currentUser.id &&
|
||||
(modal.componentInstance as UserEditDialogComponent).passwordIsSet
|
||||
@ -107,7 +107,7 @@ export class UsersAndGroupsComponent
|
||||
})
|
||||
}
|
||||
|
||||
deleteUser(user: PaperlessUser) {
|
||||
deleteUser(user: User) {
|
||||
let modal = this.modalService.open(ConfirmDialogComponent, {
|
||||
backdrop: 'static',
|
||||
})
|
||||
@ -133,7 +133,7 @@ export class UsersAndGroupsComponent
|
||||
})
|
||||
}
|
||||
|
||||
editGroup(group: PaperlessGroup = null) {
|
||||
editGroup(group: Group = null) {
|
||||
var modal = this.modalService.open(GroupEditDialogComponent, {
|
||||
backdrop: 'static',
|
||||
size: 'lg',
|
||||
@ -157,7 +157,7 @@ export class UsersAndGroupsComponent
|
||||
})
|
||||
}
|
||||
|
||||
deleteGroup(group: PaperlessGroup) {
|
||||
deleteGroup(group: Group) {
|
||||
let modal = this.modalService.open(ConfirmDialogComponent, {
|
||||
backdrop: 'static',
|
||||
})
|
||||
|
@ -15,11 +15,11 @@ import { RouterTestingModule } from '@angular/router/testing'
|
||||
import { SettingsService } from 'src/app/services/settings.service'
|
||||
import { SavedViewService } from 'src/app/services/rest/saved-view.service'
|
||||
import { PermissionsService } from 'src/app/services/permissions.service'
|
||||
import { SETTINGS_KEYS } from 'src/app/data/paperless-uisettings'
|
||||
import { SETTINGS_KEYS } from 'src/app/data/ui-settings'
|
||||
import { RemoteVersionService } from 'src/app/services/rest/remote-version.service'
|
||||
import { IfPermissionsDirective } from 'src/app/directives/if-permissions.directive'
|
||||
import { FormsModule, ReactiveFormsModule } from '@angular/forms'
|
||||
import { Observable, of, tap, throwError } from 'rxjs'
|
||||
import { of, throwError } from 'rxjs'
|
||||
import { ToastService } from 'src/app/services/toast.service'
|
||||
import { environment } from 'src/environments/environment'
|
||||
import { OpenDocumentsService } from 'src/app/services/open-documents.service'
|
||||
@ -31,7 +31,7 @@ import { FILTER_FULLTEXT_QUERY } from 'src/app/data/filter-rule-type'
|
||||
import { routes } from 'src/app/app-routing.module'
|
||||
import { PermissionsGuard } from 'src/app/guards/permissions.guard'
|
||||
import { CdkDragDrop, DragDropModule } from '@angular/cdk/drag-drop'
|
||||
import { PaperlessSavedView } from 'src/app/data/paperless-saved-view'
|
||||
import { SavedView } from 'src/app/data/saved-view'
|
||||
import { ProfileEditDialogComponent } from '../common/profile-edit-dialog/profile-edit-dialog.component'
|
||||
|
||||
const saved_views = [
|
||||
@ -356,7 +356,7 @@ describe('AppFrameComponent', () => {
|
||||
const toastSpy = jest.spyOn(toastService, 'showInfo')
|
||||
jest.spyOn(settingsService, 'storeSettings').mockReturnValue(of(true))
|
||||
component.onDrop({ previousIndex: 0, currentIndex: 1 } as CdkDragDrop<
|
||||
PaperlessSavedView[]
|
||||
SavedView[]
|
||||
>)
|
||||
expect(settingsSpy).toHaveBeenCalledWith([
|
||||
saved_views[2],
|
||||
@ -379,7 +379,7 @@ describe('AppFrameComponent', () => {
|
||||
.spyOn(settingsService, 'storeSettings')
|
||||
.mockReturnValue(throwError(() => new Error('unable to save')))
|
||||
component.onDrop({ previousIndex: 0, currentIndex: 2 } as CdkDragDrop<
|
||||
PaperlessSavedView[]
|
||||
SavedView[]
|
||||
>)
|
||||
expect(toastSpy).toHaveBeenCalled()
|
||||
})
|
||||
|
@ -10,7 +10,7 @@ import {
|
||||
first,
|
||||
catchError,
|
||||
} from 'rxjs/operators'
|
||||
import { PaperlessDocument } from 'src/app/data/paperless-document'
|
||||
import { Document } from 'src/app/data/document'
|
||||
import { OpenDocumentsService } from 'src/app/services/open-documents.service'
|
||||
import { SavedViewService } from 'src/app/services/rest/saved-view.service'
|
||||
import { SearchService } from 'src/app/services/rest/search.service'
|
||||
@ -25,7 +25,7 @@ import {
|
||||
import { SettingsService } from 'src/app/services/settings.service'
|
||||
import { TasksService } from 'src/app/services/tasks.service'
|
||||
import { ComponentCanDeactivate } from 'src/app/guards/dirty-doc.guard'
|
||||
import { SETTINGS_KEYS } from 'src/app/data/paperless-uisettings'
|
||||
import { SETTINGS_KEYS } from 'src/app/data/ui-settings'
|
||||
import { ToastService } from 'src/app/services/toast.service'
|
||||
import { ComponentWithPermissions } from '../with-permissions/with-permissions.component'
|
||||
import {
|
||||
@ -33,7 +33,7 @@ import {
|
||||
PermissionsService,
|
||||
PermissionType,
|
||||
} from 'src/app/services/permissions.service'
|
||||
import { PaperlessSavedView } from 'src/app/data/paperless-saved-view'
|
||||
import { SavedView } from 'src/app/data/saved-view'
|
||||
import {
|
||||
CdkDragStart,
|
||||
CdkDragEnd,
|
||||
@ -132,7 +132,7 @@ export class AppFrameComponent
|
||||
this.closeMenu()
|
||||
}
|
||||
|
||||
get openDocuments(): PaperlessDocument[] {
|
||||
get openDocuments(): Document[] {
|
||||
return this.openDocumentsService.getOpenDocuments()
|
||||
}
|
||||
|
||||
@ -200,7 +200,7 @@ export class AppFrameComponent
|
||||
])
|
||||
}
|
||||
|
||||
closeDocument(d: PaperlessDocument) {
|
||||
closeDocument(d: Document) {
|
||||
this.openDocumentsService
|
||||
.closeDocument(d)
|
||||
.pipe(first())
|
||||
@ -250,7 +250,7 @@ export class AppFrameComponent
|
||||
this.settingsService.globalDropzoneEnabled = true
|
||||
}
|
||||
|
||||
onDrop(event: CdkDragDrop<PaperlessSavedView[]>) {
|
||||
onDrop(event: CdkDragDrop<SavedView[]>) {
|
||||
const sidebarViews = this.savedViewService.sidebarViews.concat([])
|
||||
moveItemInArray(sidebarViews, event.previousIndex, event.currentIndex)
|
||||
|
||||
|
@ -8,10 +8,7 @@ import {
|
||||
import { ToastService } from 'src/app/services/toast.service'
|
||||
import { CustomFieldsService } from 'src/app/services/rest/custom-fields.service'
|
||||
import { of } from 'rxjs'
|
||||
import {
|
||||
PaperlessCustomField,
|
||||
PaperlessCustomFieldDataType,
|
||||
} from 'src/app/data/paperless-custom-field'
|
||||
import { CustomField, CustomFieldDataType } from 'src/app/data/custom-field'
|
||||
import { SelectComponent } from '../input/select/select.component'
|
||||
import { NgSelectModule } from '@ng-select/ng-select'
|
||||
import { FormsModule, ReactiveFormsModule } from '@angular/forms'
|
||||
@ -24,16 +21,16 @@ import {
|
||||
import { CustomFieldEditDialogComponent } from '../edit-dialog/custom-field-edit-dialog/custom-field-edit-dialog.component'
|
||||
import { By } from '@angular/platform-browser'
|
||||
|
||||
const fields: PaperlessCustomField[] = [
|
||||
const fields: CustomField[] = [
|
||||
{
|
||||
id: 0,
|
||||
name: 'Field 1',
|
||||
data_type: PaperlessCustomFieldDataType.Integer,
|
||||
data_type: CustomFieldDataType.Integer,
|
||||
},
|
||||
{
|
||||
id: 1,
|
||||
name: 'Field 2',
|
||||
data_type: PaperlessCustomFieldDataType.String,
|
||||
data_type: CustomFieldDataType.String,
|
||||
},
|
||||
]
|
||||
|
||||
|
@ -7,8 +7,8 @@ import {
|
||||
} from '@angular/core'
|
||||
import { NgbModal } from '@ng-bootstrap/ng-bootstrap'
|
||||
import { Subject, first, takeUntil } from 'rxjs'
|
||||
import { PaperlessCustomField } from 'src/app/data/paperless-custom-field'
|
||||
import { PaperlessCustomFieldInstance } from 'src/app/data/paperless-custom-field-instance'
|
||||
import { CustomField } from 'src/app/data/custom-field'
|
||||
import { CustomFieldInstance } from 'src/app/data/custom-field-instance'
|
||||
import { CustomFieldsService } from 'src/app/services/rest/custom-fields.service'
|
||||
import { ToastService } from 'src/app/services/toast.service'
|
||||
import { CustomFieldEditDialogComponent } from '../edit-dialog/custom-field-edit-dialog/custom-field-edit-dialog.component'
|
||||
@ -31,16 +31,16 @@ export class CustomFieldsDropdownComponent implements OnDestroy {
|
||||
disabled: boolean = false
|
||||
|
||||
@Input()
|
||||
existingFields: PaperlessCustomFieldInstance[] = []
|
||||
existingFields: CustomFieldInstance[] = []
|
||||
|
||||
@Output()
|
||||
added: EventEmitter<PaperlessCustomField> = new EventEmitter()
|
||||
added: EventEmitter<CustomField> = new EventEmitter()
|
||||
|
||||
@Output()
|
||||
created: EventEmitter<PaperlessCustomField> = new EventEmitter()
|
||||
created: EventEmitter<CustomField> = new EventEmitter()
|
||||
|
||||
private customFields: PaperlessCustomField[] = []
|
||||
public unusedFields: PaperlessCustomField[]
|
||||
private customFields: CustomField[] = []
|
||||
public unusedFields: CustomField[]
|
||||
|
||||
public name: string
|
||||
|
||||
@ -88,8 +88,8 @@ export class CustomFieldsDropdownComponent implements OnDestroy {
|
||||
}
|
||||
|
||||
public getCustomFieldFromInstance(
|
||||
instance: PaperlessCustomFieldInstance
|
||||
): PaperlessCustomField {
|
||||
instance: CustomFieldInstance
|
||||
): CustomField {
|
||||
return this.customFields.find((f) => f.id === instance.field)
|
||||
}
|
||||
|
||||
|
@ -4,11 +4,11 @@ import { NgbActiveModal } from '@ng-bootstrap/ng-bootstrap'
|
||||
import { first } from 'rxjs'
|
||||
import {
|
||||
DocumentSource,
|
||||
PaperlessConsumptionTemplate,
|
||||
} from 'src/app/data/paperless-consumption-template'
|
||||
import { PaperlessCorrespondent } from 'src/app/data/paperless-correspondent'
|
||||
import { PaperlessDocumentType } from 'src/app/data/paperless-document-type'
|
||||
import { PaperlessStoragePath } from 'src/app/data/paperless-storage-path'
|
||||
ConsumptionTemplate,
|
||||
} from 'src/app/data/consumption-template'
|
||||
import { Correspondent } from 'src/app/data/correspondent'
|
||||
import { DocumentType } from 'src/app/data/document-type'
|
||||
import { StoragePath } from 'src/app/data/storage-path'
|
||||
import { ConsumptionTemplateService } from 'src/app/services/rest/consumption-template.service'
|
||||
import { CorrespondentService } from 'src/app/services/rest/correspondent.service'
|
||||
import { DocumentTypeService } from 'src/app/services/rest/document-type.service'
|
||||
@ -17,9 +17,9 @@ import { UserService } from 'src/app/services/rest/user.service'
|
||||
import { SettingsService } from 'src/app/services/settings.service'
|
||||
import { EditDialogComponent } from '../edit-dialog.component'
|
||||
import { MailRuleService } from 'src/app/services/rest/mail-rule.service'
|
||||
import { PaperlessMailRule } from 'src/app/data/paperless-mail-rule'
|
||||
import { MailRule } from 'src/app/data/mail-rule'
|
||||
import { CustomFieldsService } from 'src/app/services/rest/custom-fields.service'
|
||||
import { PaperlessCustomField } from 'src/app/data/paperless-custom-field'
|
||||
import { CustomField } from 'src/app/data/custom-field'
|
||||
|
||||
export const DOCUMENT_SOURCE_OPTIONS = [
|
||||
{
|
||||
@ -41,13 +41,13 @@ export const DOCUMENT_SOURCE_OPTIONS = [
|
||||
templateUrl: './consumption-template-edit-dialog.component.html',
|
||||
styleUrls: ['./consumption-template-edit-dialog.component.scss'],
|
||||
})
|
||||
export class ConsumptionTemplateEditDialogComponent extends EditDialogComponent<PaperlessConsumptionTemplate> {
|
||||
templates: PaperlessConsumptionTemplate[]
|
||||
correspondents: PaperlessCorrespondent[]
|
||||
documentTypes: PaperlessDocumentType[]
|
||||
storagePaths: PaperlessStoragePath[]
|
||||
mailRules: PaperlessMailRule[]
|
||||
customFields: PaperlessCustomField[]
|
||||
export class ConsumptionTemplateEditDialogComponent extends EditDialogComponent<ConsumptionTemplate> {
|
||||
templates: ConsumptionTemplate[]
|
||||
correspondents: Correspondent[]
|
||||
documentTypes: DocumentType[]
|
||||
storagePaths: StoragePath[]
|
||||
mailRules: MailRule[]
|
||||
customFields: CustomField[]
|
||||
|
||||
constructor(
|
||||
service: ConsumptionTemplateService,
|
||||
|
@ -3,7 +3,7 @@ import { FormControl, FormGroup } from '@angular/forms'
|
||||
import { NgbActiveModal } from '@ng-bootstrap/ng-bootstrap'
|
||||
import { EditDialogComponent } from 'src/app/components/common/edit-dialog/edit-dialog.component'
|
||||
import { DEFAULT_MATCHING_ALGORITHM } from 'src/app/data/matching-model'
|
||||
import { PaperlessCorrespondent } from 'src/app/data/paperless-correspondent'
|
||||
import { Correspondent } from 'src/app/data/correspondent'
|
||||
import { CorrespondentService } from 'src/app/services/rest/correspondent.service'
|
||||
import { UserService } from 'src/app/services/rest/user.service'
|
||||
import { SettingsService } from 'src/app/services/settings.service'
|
||||
@ -13,7 +13,7 @@ import { SettingsService } from 'src/app/services/settings.service'
|
||||
templateUrl: './correspondent-edit-dialog.component.html',
|
||||
styleUrls: ['./correspondent-edit-dialog.component.scss'],
|
||||
})
|
||||
export class CorrespondentEditDialogComponent extends EditDialogComponent<PaperlessCorrespondent> {
|
||||
export class CorrespondentEditDialogComponent extends EditDialogComponent<Correspondent> {
|
||||
constructor(
|
||||
service: CorrespondentService,
|
||||
activeModal: NgbActiveModal,
|
||||
|
@ -1,10 +1,7 @@
|
||||
import { Component, OnInit } from '@angular/core'
|
||||
import { FormGroup, FormControl } from '@angular/forms'
|
||||
import { NgbActiveModal } from '@ng-bootstrap/ng-bootstrap'
|
||||
import {
|
||||
DATA_TYPE_LABELS,
|
||||
PaperlessCustomField,
|
||||
} from 'src/app/data/paperless-custom-field'
|
||||
import { DATA_TYPE_LABELS, CustomField } from 'src/app/data/custom-field'
|
||||
import { CustomFieldsService } from 'src/app/services/rest/custom-fields.service'
|
||||
import { UserService } from 'src/app/services/rest/user.service'
|
||||
import { SettingsService } from 'src/app/services/settings.service'
|
||||
@ -16,7 +13,7 @@ import { EditDialogComponent, EditDialogMode } from '../edit-dialog.component'
|
||||
styleUrls: ['./custom-field-edit-dialog.component.scss'],
|
||||
})
|
||||
export class CustomFieldEditDialogComponent
|
||||
extends EditDialogComponent<PaperlessCustomField>
|
||||
extends EditDialogComponent<CustomField>
|
||||
implements OnInit
|
||||
{
|
||||
constructor(
|
||||
|
@ -3,7 +3,7 @@ import { FormControl, FormGroup } from '@angular/forms'
|
||||
import { NgbActiveModal } from '@ng-bootstrap/ng-bootstrap'
|
||||
import { EditDialogComponent } from 'src/app/components/common/edit-dialog/edit-dialog.component'
|
||||
import { DEFAULT_MATCHING_ALGORITHM } from 'src/app/data/matching-model'
|
||||
import { PaperlessDocumentType } from 'src/app/data/paperless-document-type'
|
||||
import { DocumentType } from 'src/app/data/document-type'
|
||||
import { DocumentTypeService } from 'src/app/services/rest/document-type.service'
|
||||
import { UserService } from 'src/app/services/rest/user.service'
|
||||
import { SettingsService } from 'src/app/services/settings.service'
|
||||
@ -13,7 +13,7 @@ import { SettingsService } from 'src/app/services/settings.service'
|
||||
templateUrl: './document-type-edit-dialog.component.html',
|
||||
styleUrls: ['./document-type-edit-dialog.component.scss'],
|
||||
})
|
||||
export class DocumentTypeEditDialogComponent extends EditDialogComponent<PaperlessDocumentType> {
|
||||
export class DocumentTypeEditDialogComponent extends EditDialogComponent<DocumentType> {
|
||||
constructor(
|
||||
service: DocumentTypeService,
|
||||
activeModal: NgbActiveModal,
|
||||
|
@ -23,8 +23,8 @@ import {
|
||||
MATCH_NONE,
|
||||
MATCH_ALL,
|
||||
} from 'src/app/data/matching-model'
|
||||
import { PaperlessTag } from 'src/app/data/paperless-tag'
|
||||
import { SETTINGS_KEYS } from 'src/app/data/paperless-uisettings'
|
||||
import { Tag } from 'src/app/data/tag'
|
||||
import { SETTINGS_KEYS } from 'src/app/data/ui-settings'
|
||||
import { TagService } from 'src/app/services/rest/tag.service'
|
||||
import { UserService } from 'src/app/services/rest/user.service'
|
||||
import { SettingsService } from 'src/app/services/settings.service'
|
||||
@ -38,7 +38,7 @@ import { EditDialogComponent, EditDialogMode } from './edit-dialog.component'
|
||||
</div>
|
||||
`,
|
||||
})
|
||||
class TestComponent extends EditDialogComponent<PaperlessTag> {
|
||||
class TestComponent extends EditDialogComponent<Tag> {
|
||||
constructor(
|
||||
service: TagService,
|
||||
activeModal: NgbActiveModal,
|
||||
|
@ -9,12 +9,12 @@ import {
|
||||
} from 'src/app/data/matching-model'
|
||||
import { ObjectWithId } from 'src/app/data/object-with-id'
|
||||
import { ObjectWithPermissions } from 'src/app/data/object-with-permissions'
|
||||
import { PaperlessUser } from 'src/app/data/paperless-user'
|
||||
import { User } from 'src/app/data/user'
|
||||
import { AbstractPaperlessService } from 'src/app/services/rest/abstract-paperless-service'
|
||||
import { UserService } from 'src/app/services/rest/user.service'
|
||||
import { PermissionsFormObject } from '../input/permissions/permissions-form/permissions-form.component'
|
||||
import { SettingsService } from 'src/app/services/settings.service'
|
||||
import { SETTINGS_KEYS } from 'src/app/data/paperless-uisettings'
|
||||
import { SETTINGS_KEYS } from 'src/app/data/ui-settings'
|
||||
|
||||
export enum EditDialogMode {
|
||||
CREATE = 0,
|
||||
@ -33,7 +33,7 @@ export abstract class EditDialogComponent<
|
||||
private settingsService: SettingsService
|
||||
) {}
|
||||
|
||||
users: PaperlessUser[]
|
||||
users: User[]
|
||||
|
||||
@Input()
|
||||
dialogMode: EditDialogMode = EditDialogMode.CREATE
|
||||
|
@ -2,7 +2,7 @@ import { Component } from '@angular/core'
|
||||
import { FormControl, FormGroup } from '@angular/forms'
|
||||
import { NgbActiveModal } from '@ng-bootstrap/ng-bootstrap'
|
||||
import { EditDialogComponent } from 'src/app/components/common/edit-dialog/edit-dialog.component'
|
||||
import { PaperlessGroup } from 'src/app/data/paperless-group'
|
||||
import { Group } from 'src/app/data/group'
|
||||
import { GroupService } from 'src/app/services/rest/group.service'
|
||||
import { UserService } from 'src/app/services/rest/user.service'
|
||||
import { SettingsService } from 'src/app/services/settings.service'
|
||||
@ -12,7 +12,7 @@ import { SettingsService } from 'src/app/services/settings.service'
|
||||
templateUrl: './group-edit-dialog.component.html',
|
||||
styleUrls: ['./group-edit-dialog.component.scss'],
|
||||
})
|
||||
export class GroupEditDialogComponent extends EditDialogComponent<PaperlessGroup> {
|
||||
export class GroupEditDialogComponent extends EditDialogComponent<Group> {
|
||||
constructor(
|
||||
service: GroupService,
|
||||
activeModal: NgbActiveModal,
|
||||
|
@ -11,7 +11,7 @@ import {
|
||||
import { FormsModule, ReactiveFormsModule } from '@angular/forms'
|
||||
import { NgbActiveModal, NgbModule } from '@ng-bootstrap/ng-bootstrap'
|
||||
import { NgSelectModule } from '@ng-select/ng-select'
|
||||
import { IMAPSecurity } from 'src/app/data/paperless-mail-account'
|
||||
import { IMAPSecurity } from 'src/app/data/mail-account'
|
||||
import { IfOwnerDirective } from 'src/app/directives/if-owner.directive'
|
||||
import { IfPermissionsDirective } from 'src/app/directives/if-permissions.directive'
|
||||
import { SettingsService } from 'src/app/services/settings.service'
|
||||
|
@ -2,10 +2,7 @@ import { Component, ViewChild } from '@angular/core'
|
||||
import { FormControl, FormGroup } from '@angular/forms'
|
||||
import { NgbActiveModal, NgbAlert } from '@ng-bootstrap/ng-bootstrap'
|
||||
import { EditDialogComponent } from 'src/app/components/common/edit-dialog/edit-dialog.component'
|
||||
import {
|
||||
IMAPSecurity,
|
||||
PaperlessMailAccount,
|
||||
} from 'src/app/data/paperless-mail-account'
|
||||
import { IMAPSecurity, MailAccount } from 'src/app/data/mail-account'
|
||||
import { MailAccountService } from 'src/app/services/rest/mail-account.service'
|
||||
import { UserService } from 'src/app/services/rest/user.service'
|
||||
import { SettingsService } from 'src/app/services/settings.service'
|
||||
@ -21,7 +18,7 @@ const IMAP_SECURITY_OPTIONS = [
|
||||
templateUrl: './mail-account-edit-dialog.component.html',
|
||||
styleUrls: ['./mail-account-edit-dialog.component.scss'],
|
||||
})
|
||||
export class MailAccountEditDialogComponent extends EditDialogComponent<PaperlessMailAccount> {
|
||||
export class MailAccountEditDialogComponent extends EditDialogComponent<MailAccount> {
|
||||
testActive: boolean = false
|
||||
testResult: string
|
||||
alertTimeout
|
||||
|
@ -7,7 +7,7 @@ import { of } from 'rxjs'
|
||||
import {
|
||||
MailMetadataCorrespondentOption,
|
||||
MailAction,
|
||||
} from 'src/app/data/paperless-mail-rule'
|
||||
} from 'src/app/data/mail-rule'
|
||||
import { IfOwnerDirective } from 'src/app/directives/if-owner.directive'
|
||||
import { IfPermissionsDirective } from 'src/app/directives/if-permissions.directive'
|
||||
import { SafeHtmlPipe } from 'src/app/pipes/safehtml.pipe'
|
||||
|
@ -3,17 +3,17 @@ import { FormControl, FormGroup } from '@angular/forms'
|
||||
import { NgbActiveModal } from '@ng-bootstrap/ng-bootstrap'
|
||||
import { first } from 'rxjs'
|
||||
import { EditDialogComponent } from 'src/app/components/common/edit-dialog/edit-dialog.component'
|
||||
import { PaperlessCorrespondent } from 'src/app/data/paperless-correspondent'
|
||||
import { PaperlessDocumentType } from 'src/app/data/paperless-document-type'
|
||||
import { PaperlessMailAccount } from 'src/app/data/paperless-mail-account'
|
||||
import { Correspondent } from 'src/app/data/correspondent'
|
||||
import { DocumentType } from 'src/app/data/document-type'
|
||||
import { MailAccount } from 'src/app/data/mail-account'
|
||||
import {
|
||||
MailAction,
|
||||
MailFilterAttachmentType,
|
||||
MailMetadataCorrespondentOption,
|
||||
MailMetadataTitleOption,
|
||||
PaperlessMailRule,
|
||||
MailRule,
|
||||
MailRuleConsumptionScope,
|
||||
} from 'src/app/data/paperless-mail-rule'
|
||||
} from 'src/app/data/mail-rule'
|
||||
import { CorrespondentService } from 'src/app/services/rest/correspondent.service'
|
||||
import { DocumentTypeService } from 'src/app/services/rest/document-type.service'
|
||||
import { MailAccountService } from 'src/app/services/rest/mail-account.service'
|
||||
@ -109,10 +109,10 @@ const METADATA_CORRESPONDENT_OPTIONS = [
|
||||
templateUrl: './mail-rule-edit-dialog.component.html',
|
||||
styleUrls: ['./mail-rule-edit-dialog.component.scss'],
|
||||
})
|
||||
export class MailRuleEditDialogComponent extends EditDialogComponent<PaperlessMailRule> {
|
||||
accounts: PaperlessMailAccount[]
|
||||
correspondents: PaperlessCorrespondent[]
|
||||
documentTypes: PaperlessDocumentType[]
|
||||
export class MailRuleEditDialogComponent extends EditDialogComponent<MailRule> {
|
||||
accounts: MailAccount[]
|
||||
correspondents: Correspondent[]
|
||||
documentTypes: DocumentType[]
|
||||
|
||||
constructor(
|
||||
service: MailRuleService,
|
||||
|
@ -3,7 +3,7 @@ import { FormControl, FormGroup } from '@angular/forms'
|
||||
import { NgbActiveModal } from '@ng-bootstrap/ng-bootstrap'
|
||||
import { EditDialogComponent } from 'src/app/components/common/edit-dialog/edit-dialog.component'
|
||||
import { DEFAULT_MATCHING_ALGORITHM } from 'src/app/data/matching-model'
|
||||
import { PaperlessStoragePath } from 'src/app/data/paperless-storage-path'
|
||||
import { StoragePath } from 'src/app/data/storage-path'
|
||||
import { StoragePathService } from 'src/app/services/rest/storage-path.service'
|
||||
import { UserService } from 'src/app/services/rest/user.service'
|
||||
import { SettingsService } from 'src/app/services/settings.service'
|
||||
@ -13,7 +13,7 @@ import { SettingsService } from 'src/app/services/settings.service'
|
||||
templateUrl: './storage-path-edit-dialog.component.html',
|
||||
styleUrls: ['./storage-path-edit-dialog.component.scss'],
|
||||
})
|
||||
export class StoragePathEditDialogComponent extends EditDialogComponent<PaperlessStoragePath> {
|
||||
export class StoragePathEditDialogComponent extends EditDialogComponent<StoragePath> {
|
||||
constructor(
|
||||
service: StoragePathService,
|
||||
activeModal: NgbActiveModal,
|
||||
|
@ -2,7 +2,7 @@ import { Component } from '@angular/core'
|
||||
import { FormControl, FormGroup } from '@angular/forms'
|
||||
import { NgbActiveModal } from '@ng-bootstrap/ng-bootstrap'
|
||||
import { EditDialogComponent } from 'src/app/components/common/edit-dialog/edit-dialog.component'
|
||||
import { PaperlessTag } from 'src/app/data/paperless-tag'
|
||||
import { Tag } from 'src/app/data/tag'
|
||||
import { TagService } from 'src/app/services/rest/tag.service'
|
||||
import { randomColor } from 'src/app/utils/color'
|
||||
import { DEFAULT_MATCHING_ALGORITHM } from 'src/app/data/matching-model'
|
||||
@ -14,7 +14,7 @@ import { SettingsService } from 'src/app/services/settings.service'
|
||||
templateUrl: './tag-edit-dialog.component.html',
|
||||
styleUrls: ['./tag-edit-dialog.component.scss'],
|
||||
})
|
||||
export class TagEditDialogComponent extends EditDialogComponent<PaperlessTag> {
|
||||
export class TagEditDialogComponent extends EditDialogComponent<Tag> {
|
||||
constructor(
|
||||
service: TagService,
|
||||
activeModal: NgbActiveModal,
|
||||
|
@ -3,8 +3,8 @@ import { FormControl, FormGroup } from '@angular/forms'
|
||||
import { NgbActiveModal } from '@ng-bootstrap/ng-bootstrap'
|
||||
import { first } from 'rxjs'
|
||||
import { EditDialogComponent } from 'src/app/components/common/edit-dialog/edit-dialog.component'
|
||||
import { PaperlessGroup } from 'src/app/data/paperless-group'
|
||||
import { PaperlessUser } from 'src/app/data/paperless-user'
|
||||
import { Group } from 'src/app/data/group'
|
||||
import { User } from 'src/app/data/user'
|
||||
import { GroupService } from 'src/app/services/rest/group.service'
|
||||
import { UserService } from 'src/app/services/rest/user.service'
|
||||
import { SettingsService } from 'src/app/services/settings.service'
|
||||
@ -15,10 +15,10 @@ import { SettingsService } from 'src/app/services/settings.service'
|
||||
styleUrls: ['./user-edit-dialog.component.scss'],
|
||||
})
|
||||
export class UserEditDialogComponent
|
||||
extends EditDialogComponent<PaperlessUser>
|
||||
extends EditDialogComponent<User>
|
||||
implements OnInit
|
||||
{
|
||||
groups: PaperlessGroup[]
|
||||
groups: Group[]
|
||||
passwordIsSet: boolean = false
|
||||
|
||||
constructor(
|
||||
|
@ -13,7 +13,7 @@ import {
|
||||
} from './filterable-dropdown.component'
|
||||
import { FilterPipe } from 'src/app/pipes/filter.pipe'
|
||||
import { NgbModule } from '@ng-bootstrap/ng-bootstrap'
|
||||
import { PaperlessTag } from 'src/app/data/paperless-tag'
|
||||
import { Tag } from 'src/app/data/tag'
|
||||
import {
|
||||
DEFAULT_MATCHING_ALGORITHM,
|
||||
MATCH_ALL,
|
||||
@ -26,7 +26,7 @@ import { TagComponent } from '../tag/tag.component'
|
||||
import { FormsModule, ReactiveFormsModule } from '@angular/forms'
|
||||
import { ClearableBadgeComponent } from '../clearable-badge/clearable-badge.component'
|
||||
|
||||
const items: PaperlessTag[] = [
|
||||
const items: Tag[] = [
|
||||
{
|
||||
id: 1,
|
||||
name: 'Tag1',
|
||||
|
@ -4,7 +4,7 @@ import {
|
||||
ToggleableItemState,
|
||||
} from './toggleable-dropdown-button.component'
|
||||
import { TagComponent } from '../../tag/tag.component'
|
||||
import { PaperlessTag } from 'src/app/data/paperless-tag'
|
||||
import { Tag } from 'src/app/data/tag'
|
||||
|
||||
describe('ToggleableDropdownButtonComponent', () => {
|
||||
let component: ToggleableDropdownButtonComponent
|
||||
@ -26,7 +26,7 @@ describe('ToggleableDropdownButtonComponent', () => {
|
||||
id: 1,
|
||||
name: 'Test Tag',
|
||||
is_inbox_tag: false,
|
||||
} as PaperlessTag
|
||||
} as Tag
|
||||
|
||||
fixture.detectChanges()
|
||||
expect(component.isTag).toBeTruthy()
|
||||
|
@ -13,7 +13,7 @@ import {
|
||||
catchError,
|
||||
} from 'rxjs'
|
||||
import { FILTER_TITLE } from 'src/app/data/filter-rule-type'
|
||||
import { PaperlessDocument } from 'src/app/data/paperless-document'
|
||||
import { Document } from 'src/app/data/document'
|
||||
import { DocumentService } from 'src/app/services/rest/document.service'
|
||||
import { AbstractInputComponent } from '../abstract-input'
|
||||
|
||||
@ -34,9 +34,9 @@ export class DocumentLinkComponent
|
||||
implements OnInit, OnDestroy
|
||||
{
|
||||
documentsInput$ = new Subject<string>()
|
||||
foundDocuments$: Observable<PaperlessDocument[]>
|
||||
foundDocuments$: Observable<Document[]>
|
||||
loading = false
|
||||
selectedDocuments: PaperlessDocument[] = []
|
||||
selectedDocuments: Document[] = []
|
||||
|
||||
private unsubscribeNotifier: Subject<any> = new Subject()
|
||||
|
||||
@ -104,21 +104,18 @@ export class DocumentLinkComponent
|
||||
)
|
||||
}
|
||||
|
||||
unselect(document: PaperlessDocument): void {
|
||||
unselect(document: Document): void {
|
||||
this.selectedDocuments = this.selectedDocuments.filter(
|
||||
(d) => d.id !== document.id
|
||||
)
|
||||
this.onChange(this.selectedDocuments.map((d) => d.id))
|
||||
}
|
||||
|
||||
compareDocuments(
|
||||
document: PaperlessDocument,
|
||||
selectedDocument: PaperlessDocument
|
||||
) {
|
||||
compareDocuments(document: Document, selectedDocument: Document) {
|
||||
return document.id === selectedDocument.id
|
||||
}
|
||||
|
||||
trackByFn(item: PaperlessDocument) {
|
||||
trackByFn(item: Document) {
|
||||
return item.id
|
||||
}
|
||||
|
||||
|
@ -1,6 +1,6 @@
|
||||
import { Component, forwardRef, Input, OnInit } from '@angular/core'
|
||||
import { FormControl, FormGroup, NG_VALUE_ACCESSOR } from '@angular/forms'
|
||||
import { PaperlessUser } from 'src/app/data/paperless-user'
|
||||
import { User } from 'src/app/data/user'
|
||||
import { AbstractInputComponent } from '../../abstract-input'
|
||||
|
||||
export interface PermissionsFormObject {
|
||||
@ -34,7 +34,7 @@ export class PermissionsFormComponent
|
||||
implements OnInit
|
||||
{
|
||||
@Input()
|
||||
users: PaperlessUser[]
|
||||
users: User[]
|
||||
|
||||
@Input()
|
||||
accordion: boolean = false
|
||||
|
@ -1,7 +1,7 @@
|
||||
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 { Group } from 'src/app/data/group'
|
||||
import { GroupService } from 'src/app/services/rest/group.service'
|
||||
import { AbstractInputComponent } from '../../abstract-input'
|
||||
|
||||
@ -17,8 +17,8 @@ import { AbstractInputComponent } from '../../abstract-input'
|
||||
templateUrl: './permissions-group.component.html',
|
||||
styleUrls: ['./permissions-group.component.scss'],
|
||||
})
|
||||
export class PermissionsGroupComponent extends AbstractInputComponent<PaperlessGroup> {
|
||||
groups: PaperlessGroup[]
|
||||
export class PermissionsGroupComponent extends AbstractInputComponent<Group> {
|
||||
groups: Group[]
|
||||
|
||||
constructor(groupService: GroupService) {
|
||||
super()
|
||||
|
@ -1,7 +1,7 @@
|
||||
import { Component, forwardRef, Input, OnInit } from '@angular/core'
|
||||
import { NG_VALUE_ACCESSOR } from '@angular/forms'
|
||||
import { first } from 'rxjs/operators'
|
||||
import { PaperlessUser } from 'src/app/data/paperless-user'
|
||||
import { User } from 'src/app/data/user'
|
||||
import { UserService } from 'src/app/services/rest/user.service'
|
||||
import { SettingsService } from 'src/app/services/settings.service'
|
||||
import { AbstractInputComponent } from '../../abstract-input'
|
||||
@ -18,10 +18,8 @@ import { AbstractInputComponent } from '../../abstract-input'
|
||||
templateUrl: './permissions-user.component.html',
|
||||
styleUrls: ['./permissions-user.component.scss'],
|
||||
})
|
||||
export class PermissionsUserComponent extends AbstractInputComponent<
|
||||
PaperlessUser[]
|
||||
> {
|
||||
users: PaperlessUser[]
|
||||
export class PermissionsUserComponent extends AbstractInputComponent<User[]> {
|
||||
users: User[]
|
||||
|
||||
constructor(userService: UserService, settings: SettingsService) {
|
||||
super()
|
||||
|
@ -10,7 +10,7 @@ import {
|
||||
NG_VALUE_ACCESSOR,
|
||||
} from '@angular/forms'
|
||||
import { SelectComponent } from './select.component'
|
||||
import { PaperlessTag } from 'src/app/data/paperless-tag'
|
||||
import { Tag } from 'src/app/data/tag'
|
||||
import {
|
||||
DEFAULT_MATCHING_ALGORITHM,
|
||||
MATCH_ALL,
|
||||
@ -18,7 +18,7 @@ import {
|
||||
import { NgSelectModule } from '@ng-select/ng-select'
|
||||
import { RouterTestingModule } from '@angular/router/testing'
|
||||
|
||||
const items: PaperlessTag[] = [
|
||||
const items: Tag[] = [
|
||||
{
|
||||
id: 1,
|
||||
name: 'Tag1',
|
||||
|
@ -5,7 +5,7 @@ import {
|
||||
NG_VALUE_ACCESSOR,
|
||||
} from '@angular/forms'
|
||||
import { TagsComponent } from './tags.component'
|
||||
import { PaperlessTag } from 'src/app/data/paperless-tag'
|
||||
import { Tag } from 'src/app/data/tag'
|
||||
import {
|
||||
DEFAULT_MATCHING_ALGORITHM,
|
||||
MATCH_ALL,
|
||||
@ -31,7 +31,7 @@ import { PermissionsFormComponent } from '../permissions/permissions-form/permis
|
||||
import { SelectComponent } from '../select/select.component'
|
||||
import { SettingsService } from 'src/app/services/settings.service'
|
||||
|
||||
const tags: PaperlessTag[] = [
|
||||
const tags: Tag[] = [
|
||||
{
|
||||
id: 1,
|
||||
name: 'Tag1',
|
||||
|
@ -9,7 +9,7 @@ import {
|
||||
} from '@angular/core'
|
||||
import { ControlValueAccessor, NG_VALUE_ACCESSOR } from '@angular/forms'
|
||||
import { NgbModal } from '@ng-bootstrap/ng-bootstrap'
|
||||
import { PaperlessTag } from 'src/app/data/paperless-tag'
|
||||
import { Tag } from 'src/app/data/tag'
|
||||
import { TagEditDialogComponent } from '../../edit-dialog/tag-edit-dialog/tag-edit-dialog.component'
|
||||
import { TagService } from 'src/app/services/rest/tag.service'
|
||||
import { EditDialogMode } from '../../edit-dialog/edit-dialog.component'
|
||||
@ -81,13 +81,13 @@ export class TagsComponent implements OnInit, ControlValueAccessor {
|
||||
horizontal: boolean = false
|
||||
|
||||
@Output()
|
||||
filterDocuments = new EventEmitter<PaperlessTag[]>()
|
||||
filterDocuments = new EventEmitter<Tag[]>()
|
||||
|
||||
@ViewChild('tagSelect') select: NgSelectComponent
|
||||
|
||||
value: number[] = []
|
||||
|
||||
tags: PaperlessTag[] = []
|
||||
tags: Tag[] = []
|
||||
|
||||
public createTagRef: (name) => void
|
||||
|
||||
|
@ -2,7 +2,7 @@ import { Component, EventEmitter, Input, Output } from '@angular/core'
|
||||
import { FormControl, FormGroup } from '@angular/forms'
|
||||
import { NgbActiveModal } from '@ng-bootstrap/ng-bootstrap'
|
||||
import { ObjectWithPermissions } from 'src/app/data/object-with-permissions'
|
||||
import { PaperlessUser } from 'src/app/data/paperless-user'
|
||||
import { User } from 'src/app/data/user'
|
||||
import { UserService } from 'src/app/services/rest/user.service'
|
||||
|
||||
@Component({
|
||||
@ -11,7 +11,7 @@ import { UserService } from 'src/app/services/rest/user.service'
|
||||
styleUrls: ['./permissions-dialog.component.scss'],
|
||||
})
|
||||
export class PermissionsDialogComponent {
|
||||
users: PaperlessUser[]
|
||||
users: User[]
|
||||
private o: ObjectWithPermissions = undefined
|
||||
|
||||
constructor(
|
||||
|
@ -1,6 +1,6 @@
|
||||
import { Component, EventEmitter, Input, Output } from '@angular/core'
|
||||
import { first } from 'rxjs'
|
||||
import { PaperlessUser } from 'src/app/data/paperless-user'
|
||||
import { User } from 'src/app/data/user'
|
||||
import {
|
||||
PermissionAction,
|
||||
PermissionType,
|
||||
@ -55,7 +55,7 @@ export class PermissionsFilterDropdownComponent extends ComponentWithPermissions
|
||||
@Output()
|
||||
ownerFilterSet = new EventEmitter<PermissionsSelectionModel>()
|
||||
|
||||
users: PaperlessUser[]
|
||||
users: User[]
|
||||
|
||||
hideUnowned: boolean
|
||||
|
||||
|
@ -5,7 +5,7 @@ import { PdfViewerComponent } from '../pdf-viewer/pdf-viewer.component'
|
||||
import { By } from '@angular/platform-browser'
|
||||
import { SafeUrlPipe } from 'src/app/pipes/safeurl.pipe'
|
||||
import { SettingsService } from 'src/app/services/settings.service'
|
||||
import { SETTINGS_KEYS } from 'src/app/data/paperless-uisettings'
|
||||
import { SETTINGS_KEYS } from 'src/app/data/ui-settings'
|
||||
import { HttpClientTestingModule } from '@angular/common/http/testing'
|
||||
import { DocumentService } from 'src/app/services/rest/document.service'
|
||||
|
||||
|
@ -1,6 +1,6 @@
|
||||
import { Component, Input } from '@angular/core'
|
||||
import { PaperlessDocument } from 'src/app/data/paperless-document'
|
||||
import { SETTINGS_KEYS } from 'src/app/data/paperless-uisettings'
|
||||
import { Document } from 'src/app/data/document'
|
||||
import { SETTINGS_KEYS } from 'src/app/data/ui-settings'
|
||||
import { DocumentService } from 'src/app/services/rest/document.service'
|
||||
import { SettingsService } from 'src/app/services/settings.service'
|
||||
|
||||
@ -11,7 +11,7 @@ import { SettingsService } from 'src/app/services/settings.service'
|
||||
})
|
||||
export class PreviewPopupComponent {
|
||||
@Input()
|
||||
document: PaperlessDocument
|
||||
document: Document
|
||||
|
||||
error = false
|
||||
|
||||
|
@ -10,10 +10,7 @@ import {
|
||||
} from '@angular/core/testing'
|
||||
import { FormsModule, ReactiveFormsModule } from '@angular/forms'
|
||||
import { of, throwError } from 'rxjs'
|
||||
import {
|
||||
PaperlessFileVersion,
|
||||
PaperlessShareLink,
|
||||
} from 'src/app/data/paperless-share-link'
|
||||
import { FileVersion, ShareLink } from 'src/app/data/share-link'
|
||||
import { ShareLinkService } from 'src/app/services/rest/share-link.service'
|
||||
import { ToastService } from 'src/app/services/toast.service'
|
||||
import { environment } from 'src/environments/environment'
|
||||
@ -60,7 +57,7 @@ describe('ShareLinksDropdownComponent', () => {
|
||||
slug: '1234slug',
|
||||
created: now.toISOString(),
|
||||
document: 99,
|
||||
file_version: PaperlessFileVersion.Archive,
|
||||
file_version: FileVersion.Archive,
|
||||
expiration: expiration7days.toISOString(),
|
||||
},
|
||||
{
|
||||
@ -68,7 +65,7 @@ describe('ShareLinksDropdownComponent', () => {
|
||||
slug: '1234slug',
|
||||
created: now.toISOString(),
|
||||
document: 99,
|
||||
file_version: PaperlessFileVersion.Original,
|
||||
file_version: FileVersion.Original,
|
||||
expiration: null,
|
||||
},
|
||||
])
|
||||
@ -152,7 +149,7 @@ describe('ShareLinksDropdownComponent', () => {
|
||||
deleteSpy.mockReturnValue(of(true))
|
||||
const refreshSpy = jest.spyOn(component, 'refresh')
|
||||
|
||||
component.delete({ id: 12 } as PaperlessShareLink)
|
||||
component.delete({ id: 12 } as ShareLink)
|
||||
fixture.detectChanges()
|
||||
expect(deleteSpy).toHaveBeenCalledWith({ id: 12 })
|
||||
expect(refreshSpy).toHaveBeenCalled()
|
||||
@ -178,18 +175,18 @@ describe('ShareLinksDropdownComponent', () => {
|
||||
expect(
|
||||
component.getDaysRemaining({
|
||||
expiration: expiration7days.toISOString(),
|
||||
} as PaperlessShareLink)
|
||||
} as ShareLink)
|
||||
).toEqual('7 days')
|
||||
expect(
|
||||
component.getDaysRemaining({
|
||||
expiration: expiration1day.toISOString(),
|
||||
} as PaperlessShareLink)
|
||||
} as ShareLink)
|
||||
).toEqual('1 day')
|
||||
})
|
||||
|
||||
// coverage
|
||||
it('should support share', () => {
|
||||
const link = { slug: '12345slug' } as PaperlessShareLink
|
||||
const link = { slug: '12345slug' } as ShareLink
|
||||
if (!('share' in navigator))
|
||||
Object.defineProperty(navigator, 'share', { value: (obj: any) => {} })
|
||||
// const navigatorSpy = jest.spyOn(navigator, 'share')
|
||||
|
@ -1,9 +1,6 @@
|
||||
import { Component, Input, OnInit } from '@angular/core'
|
||||
import { first } from 'rxjs'
|
||||
import {
|
||||
PaperlessShareLink,
|
||||
PaperlessFileVersion,
|
||||
} from 'src/app/data/paperless-share-link'
|
||||
import { ShareLink, FileVersion } from 'src/app/data/share-link'
|
||||
import { ShareLinkService } from 'src/app/services/rest/share-link.service'
|
||||
import { ToastService } from 'src/app/services/toast.service'
|
||||
import { environment } from 'src/environments/environment'
|
||||
@ -41,7 +38,7 @@ export class ShareLinksDropdownComponent implements OnInit {
|
||||
@Input()
|
||||
hasArchiveVersion: boolean = true
|
||||
|
||||
shareLinks: PaperlessShareLink[]
|
||||
shareLinks: ShareLink[]
|
||||
|
||||
loading: boolean = false
|
||||
|
||||
@ -83,21 +80,21 @@ export class ShareLinksDropdownComponent implements OnInit {
|
||||
})
|
||||
}
|
||||
|
||||
getShareUrl(link: PaperlessShareLink): string {
|
||||
getShareUrl(link: ShareLink): string {
|
||||
const apiURL = new URL(environment.apiBaseUrl)
|
||||
return `${apiURL.origin}${apiURL.pathname.replace(/\/api\/$/, '/share/')}${
|
||||
link.slug
|
||||
}`
|
||||
}
|
||||
|
||||
getDaysRemaining(link: PaperlessShareLink): string {
|
||||
getDaysRemaining(link: ShareLink): string {
|
||||
const days: number = Math.round(
|
||||
(Date.parse(link.expiration) - Date.now()) / (1000 * 60 * 60 * 24)
|
||||
)
|
||||
return days === 1 ? $localize`1 day` : $localize`${days} days`
|
||||
}
|
||||
|
||||
copy(link: PaperlessShareLink) {
|
||||
copy(link: ShareLink) {
|
||||
const success = this.clipboard.copy(this.getShareUrl(link))
|
||||
if (success) {
|
||||
this.copied = link.id
|
||||
@ -107,17 +104,17 @@ export class ShareLinksDropdownComponent implements OnInit {
|
||||
}
|
||||
}
|
||||
|
||||
canShare(link: PaperlessShareLink): boolean {
|
||||
canShare(link: ShareLink): boolean {
|
||||
return (
|
||||
navigator?.canShare && navigator.canShare({ url: this.getShareUrl(link) })
|
||||
)
|
||||
}
|
||||
|
||||
share(link: PaperlessShareLink) {
|
||||
share(link: ShareLink) {
|
||||
navigator.share({ url: this.getShareUrl(link) })
|
||||
}
|
||||
|
||||
delete(link: PaperlessShareLink) {
|
||||
delete(link: ShareLink) {
|
||||
this.shareLinkService.delete(link).subscribe({
|
||||
next: () => {
|
||||
this.refresh()
|
||||
@ -138,9 +135,7 @@ export class ShareLinksDropdownComponent implements OnInit {
|
||||
this.shareLinkService
|
||||
.createLinkForDocument(
|
||||
this._documentId,
|
||||
this.useArchiveVersion
|
||||
? PaperlessFileVersion.Archive
|
||||
: PaperlessFileVersion.Original,
|
||||
this.useArchiveVersion ? FileVersion.Archive : FileVersion.Original,
|
||||
expiration
|
||||
)
|
||||
.subscribe({
|
||||
|
@ -1,9 +1,9 @@
|
||||
import { ComponentFixture, TestBed } from '@angular/core/testing'
|
||||
import { TagComponent } from './tag.component'
|
||||
import { PaperlessTag } from 'src/app/data/paperless-tag'
|
||||
import { Tag } from 'src/app/data/tag'
|
||||
import { By } from '@angular/platform-browser'
|
||||
|
||||
const tag: PaperlessTag = {
|
||||
const tag: Tag = {
|
||||
id: 1,
|
||||
color: '#ff0000',
|
||||
name: 'Tag1',
|
||||
|
@ -1,5 +1,5 @@
|
||||
import { Component, Input } from '@angular/core'
|
||||
import { PaperlessTag } from 'src/app/data/paperless-tag'
|
||||
import { Tag } from 'src/app/data/tag'
|
||||
|
||||
@Component({
|
||||
selector: 'pngx-tag',
|
||||
@ -10,7 +10,7 @@ export class TagComponent {
|
||||
constructor() {}
|
||||
|
||||
@Input()
|
||||
tag: PaperlessTag
|
||||
tag: Tag
|
||||
|
||||
@Input()
|
||||
linkTitle: string = ''
|
||||
|
@ -18,9 +18,9 @@ import { TourNgBootstrapModule, TourService } from 'ngx-ui-tour-ng-bootstrap'
|
||||
import { LogoComponent } from '../common/logo/logo.component'
|
||||
import { of, throwError } from 'rxjs'
|
||||
import { ToastService } from 'src/app/services/toast.service'
|
||||
import { SETTINGS_KEYS } from 'src/app/data/paperless-uisettings'
|
||||
import { SETTINGS_KEYS } from 'src/app/data/ui-settings'
|
||||
import { CdkDragDrop, DragDropModule } from '@angular/cdk/drag-drop'
|
||||
import { PaperlessSavedView } from 'src/app/data/paperless-saved-view'
|
||||
import { SavedView } from 'src/app/data/saved-view'
|
||||
|
||||
const saved_views = [
|
||||
{
|
||||
@ -167,7 +167,7 @@ describe('DashboardComponent', () => {
|
||||
const toastSpy = jest.spyOn(toastService, 'showInfo')
|
||||
jest.spyOn(settingsService, 'storeSettings').mockReturnValue(of(true))
|
||||
component.onDrop({ previousIndex: 0, currentIndex: 1 } as CdkDragDrop<
|
||||
PaperlessSavedView[]
|
||||
SavedView[]
|
||||
>)
|
||||
expect(settingsSpy).toHaveBeenCalledWith([
|
||||
saved_views[2],
|
||||
@ -190,7 +190,7 @@ describe('DashboardComponent', () => {
|
||||
.spyOn(settingsService, 'storeSettings')
|
||||
.mockReturnValue(throwError(() => new Error('unable to save')))
|
||||
component.onDrop({ previousIndex: 0, currentIndex: 2 } as CdkDragDrop<
|
||||
PaperlessSavedView[]
|
||||
SavedView[]
|
||||
>)
|
||||
expect(toastSpy).toHaveBeenCalled()
|
||||
})
|
||||
|
@ -3,9 +3,9 @@ import { SavedViewService } from 'src/app/services/rest/saved-view.service'
|
||||
import { SettingsService } from 'src/app/services/settings.service'
|
||||
import { ComponentWithPermissions } from '../with-permissions/with-permissions.component'
|
||||
import { TourService } from 'ngx-ui-tour-ng-bootstrap'
|
||||
import { PaperlessSavedView } from 'src/app/data/paperless-saved-view'
|
||||
import { SavedView } from 'src/app/data/saved-view'
|
||||
import { ToastService } from 'src/app/services/toast.service'
|
||||
import { SETTINGS_KEYS } from 'src/app/data/paperless-uisettings'
|
||||
import { SETTINGS_KEYS } from 'src/app/data/ui-settings'
|
||||
import {
|
||||
CdkDragDrop,
|
||||
CdkDragEnd,
|
||||
@ -19,7 +19,7 @@ import {
|
||||
styleUrls: ['./dashboard.component.scss'],
|
||||
})
|
||||
export class DashboardComponent extends ComponentWithPermissions {
|
||||
public dashboardViews: PaperlessSavedView[] = []
|
||||
public dashboardViews: SavedView[] = []
|
||||
constructor(
|
||||
public settingsService: SettingsService,
|
||||
public savedViewService: SavedViewService,
|
||||
@ -57,7 +57,7 @@ export class DashboardComponent extends ComponentWithPermissions {
|
||||
this.settingsService.globalDropzoneEnabled = true
|
||||
}
|
||||
|
||||
onDrop(event: CdkDragDrop<PaperlessSavedView[]>) {
|
||||
onDrop(event: CdkDragDrop<SavedView[]>) {
|
||||
moveItemInArray(
|
||||
this.dashboardViews,
|
||||
event.previousIndex,
|
||||
|
@ -12,7 +12,7 @@ import { NgbModule } from '@ng-bootstrap/ng-bootstrap'
|
||||
import { of, Subject } from 'rxjs'
|
||||
import { routes } from 'src/app/app-routing.module'
|
||||
import { FILTER_HAS_TAGS_ALL } from 'src/app/data/filter-rule-type'
|
||||
import { PaperlessSavedView } from 'src/app/data/paperless-saved-view'
|
||||
import { SavedView } from 'src/app/data/saved-view'
|
||||
import { IfPermissionsDirective } from 'src/app/directives/if-permissions.directive'
|
||||
import { PermissionsGuard } from 'src/app/guards/permissions.guard'
|
||||
import { CustomDatePipe } from 'src/app/pipes/custom-date.pipe'
|
||||
@ -31,7 +31,7 @@ import { SafeUrlPipe } from 'src/app/pipes/safeurl.pipe'
|
||||
import { DragDropModule } from '@angular/cdk/drag-drop'
|
||||
import { PreviewPopupComponent } from 'src/app/components/common/preview-popup/preview-popup.component'
|
||||
|
||||
const savedView: PaperlessSavedView = {
|
||||
const savedView: SavedView = {
|
||||
id: 1,
|
||||
name: 'Saved View 1',
|
||||
sort_field: 'added',
|
||||
|
@ -8,11 +8,11 @@ import {
|
||||
} from '@angular/core'
|
||||
import { Params, Router } from '@angular/router'
|
||||
import { Subject, takeUntil } from 'rxjs'
|
||||
import { PaperlessDocument } from 'src/app/data/paperless-document'
|
||||
import { PaperlessSavedView } from 'src/app/data/paperless-saved-view'
|
||||
import { Document } from 'src/app/data/document'
|
||||
import { SavedView } from 'src/app/data/saved-view'
|
||||
import { ConsumerStatusService } from 'src/app/services/consumer-status.service'
|
||||
import { DocumentService } from 'src/app/services/rest/document.service'
|
||||
import { PaperlessTag } from 'src/app/data/paperless-tag'
|
||||
import { Tag } from 'src/app/data/tag'
|
||||
import {
|
||||
FILTER_CORRESPONDENT,
|
||||
FILTER_HAS_TAGS_ALL,
|
||||
@ -46,9 +46,9 @@ export class SavedViewWidgetComponent
|
||||
}
|
||||
|
||||
@Input()
|
||||
savedView: PaperlessSavedView
|
||||
savedView: SavedView
|
||||
|
||||
documents: PaperlessDocument[] = []
|
||||
documents: Document[] = []
|
||||
|
||||
unsubscribeNotifier: Subject<any> = new Subject()
|
||||
|
||||
@ -101,7 +101,7 @@ export class SavedViewWidgetComponent
|
||||
}
|
||||
}
|
||||
|
||||
clickTag(tag: PaperlessTag, event: MouseEvent) {
|
||||
clickTag(tag: Tag, event: MouseEvent) {
|
||||
event.preventDefault()
|
||||
event.stopImmediatePropagation()
|
||||
|
||||
@ -110,15 +110,15 @@ export class SavedViewWidgetComponent
|
||||
])
|
||||
}
|
||||
|
||||
getPreviewUrl(document: PaperlessDocument): string {
|
||||
getPreviewUrl(document: Document): string {
|
||||
return this.documentService.getPreviewUrl(document.id)
|
||||
}
|
||||
|
||||
getDownloadUrl(document: PaperlessDocument): string {
|
||||
getDownloadUrl(document: Document): string {
|
||||
return this.documentService.getDownloadUrl(document.id)
|
||||
}
|
||||
|
||||
mouseEnterPreviewButton(doc: PaperlessDocument) {
|
||||
mouseEnterPreviewButton(doc: Document) {
|
||||
const newPopover = this.popovers.get(this.documents.indexOf(doc))
|
||||
if (this.popover !== newPopover && this.popover?.isOpen())
|
||||
this.popover.close()
|
||||
|
@ -1,7 +1,7 @@
|
||||
import { Component, QueryList, ViewChildren } from '@angular/core'
|
||||
import { NgbAlert } from '@ng-bootstrap/ng-bootstrap'
|
||||
import { ComponentWithPermissions } from 'src/app/components/with-permissions/with-permissions.component'
|
||||
import { SETTINGS_KEYS } from 'src/app/data/paperless-uisettings'
|
||||
import { SETTINGS_KEYS } from 'src/app/data/ui-settings'
|
||||
import {
|
||||
ConsumerStatusService,
|
||||
FileStatus,
|
||||
|
@ -30,11 +30,11 @@ import {
|
||||
FILTER_CREATED_AFTER,
|
||||
FILTER_CREATED_BEFORE,
|
||||
} from 'src/app/data/filter-rule-type'
|
||||
import { PaperlessCorrespondent } from 'src/app/data/paperless-correspondent'
|
||||
import { PaperlessDocument } from 'src/app/data/paperless-document'
|
||||
import { PaperlessDocumentType } from 'src/app/data/paperless-document-type'
|
||||
import { PaperlessStoragePath } from 'src/app/data/paperless-storage-path'
|
||||
import { PaperlessTag } from 'src/app/data/paperless-tag'
|
||||
import { Correspondent } from 'src/app/data/correspondent'
|
||||
import { Document } from 'src/app/data/document'
|
||||
import { DocumentType } from 'src/app/data/document-type'
|
||||
import { StoragePath } from 'src/app/data/storage-path'
|
||||
import { Tag } from 'src/app/data/tag'
|
||||
import { IfOwnerDirective } from 'src/app/directives/if-owner.directive'
|
||||
import { IfPermissionsDirective } from 'src/app/directives/if-permissions.directive'
|
||||
import { PermissionsGuard } from 'src/app/guards/permissions.guard'
|
||||
@ -67,11 +67,11 @@ import { DocumentNotesComponent } from '../document-notes/document-notes.compone
|
||||
import { DocumentDetailComponent } from './document-detail.component'
|
||||
import { ShareLinksDropdownComponent } from '../common/share-links-dropdown/share-links-dropdown.component'
|
||||
import { CustomFieldsDropdownComponent } from '../common/custom-fields-dropdown/custom-fields-dropdown.component'
|
||||
import { PaperlessCustomFieldDataType } from 'src/app/data/paperless-custom-field'
|
||||
import { CustomFieldDataType } from 'src/app/data/custom-field'
|
||||
import { CustomFieldsService } from 'src/app/services/rest/custom-fields.service'
|
||||
import { PdfViewerComponent } from '../common/pdf-viewer/pdf-viewer.component'
|
||||
|
||||
const doc: PaperlessDocument = {
|
||||
const doc: Document = {
|
||||
id: 3,
|
||||
title: 'Doc 3',
|
||||
correspondent: 11,
|
||||
@ -111,13 +111,13 @@ const customFields = [
|
||||
{
|
||||
id: 0,
|
||||
name: 'Field 1',
|
||||
data_type: PaperlessCustomFieldDataType.String,
|
||||
data_type: CustomFieldDataType.String,
|
||||
created: new Date(),
|
||||
},
|
||||
{
|
||||
id: 1,
|
||||
name: 'Custom Field 2',
|
||||
data_type: PaperlessCustomFieldDataType.Integer,
|
||||
data_type: CustomFieldDataType.Integer,
|
||||
created: new Date(),
|
||||
},
|
||||
]
|
||||
@ -732,7 +732,7 @@ describe('DocumentDetailComponent', () => {
|
||||
id: 22,
|
||||
name: 'Correspondent22',
|
||||
last_correspondence: new Date().toISOString(),
|
||||
} as PaperlessCorrespondent
|
||||
} as Correspondent
|
||||
const qfSpy = jest.spyOn(documentListViewService, 'quickFilter')
|
||||
component.filterDocuments([object])
|
||||
expect(qfSpy).toHaveBeenCalledWith([
|
||||
@ -745,7 +745,7 @@ describe('DocumentDetailComponent', () => {
|
||||
|
||||
it('should support quick filtering by doc type', () => {
|
||||
initNormally()
|
||||
const object = { id: 22, name: 'DocumentType22' } as PaperlessDocumentType
|
||||
const object = { id: 22, name: 'DocumentType22' } as DocumentType
|
||||
const qfSpy = jest.spyOn(documentListViewService, 'quickFilter')
|
||||
component.filterDocuments([object])
|
||||
expect(qfSpy).toHaveBeenCalledWith([
|
||||
@ -762,7 +762,7 @@ describe('DocumentDetailComponent', () => {
|
||||
id: 22,
|
||||
name: 'StoragePath22',
|
||||
path: '/foo/bar/',
|
||||
} as PaperlessStoragePath
|
||||
} as StoragePath
|
||||
const qfSpy = jest.spyOn(documentListViewService, 'quickFilter')
|
||||
component.filterDocuments([object])
|
||||
expect(qfSpy).toHaveBeenCalledWith([
|
||||
@ -781,14 +781,14 @@ describe('DocumentDetailComponent', () => {
|
||||
is_inbox_tag: true,
|
||||
color: '#ff0000',
|
||||
text_color: '#000000',
|
||||
} as PaperlessTag
|
||||
} as Tag
|
||||
const object2 = {
|
||||
id: 23,
|
||||
name: 'Tag22',
|
||||
is_inbox_tag: true,
|
||||
color: '#ff0000',
|
||||
text_color: '#000000',
|
||||
} as PaperlessTag
|
||||
} as Tag
|
||||
const qfSpy = jest.spyOn(documentListViewService, 'quickFilter')
|
||||
component.filterDocuments([object1, object2])
|
||||
expect(qfSpy).toHaveBeenCalledWith([
|
||||
|
@ -7,11 +7,11 @@ import {
|
||||
NgbNav,
|
||||
NgbNavChangeEvent,
|
||||
} from '@ng-bootstrap/ng-bootstrap'
|
||||
import { PaperlessCorrespondent } from 'src/app/data/paperless-correspondent'
|
||||
import { PaperlessDocument } from 'src/app/data/paperless-document'
|
||||
import { PaperlessDocumentMetadata } from 'src/app/data/paperless-document-metadata'
|
||||
import { PaperlessDocumentType } from 'src/app/data/paperless-document-type'
|
||||
import { PaperlessTag } from 'src/app/data/paperless-tag'
|
||||
import { Correspondent } from 'src/app/data/correspondent'
|
||||
import { Document } from 'src/app/data/document'
|
||||
import { DocumentMetadata } from 'src/app/data/document-metadata'
|
||||
import { DocumentType } from 'src/app/data/document-type'
|
||||
import { Tag } from 'src/app/data/tag'
|
||||
import { DocumentTitlePipe } from 'src/app/pipes/document-title.pipe'
|
||||
import { DocumentListViewService } from 'src/app/services/document-list-view.service'
|
||||
import { OpenDocumentsService } from 'src/app/services/open-documents.service'
|
||||
@ -34,7 +34,7 @@ import {
|
||||
debounceTime,
|
||||
distinctUntilChanged,
|
||||
} from 'rxjs/operators'
|
||||
import { PaperlessDocumentSuggestions } from 'src/app/data/paperless-document-suggestions'
|
||||
import { DocumentSuggestions } from 'src/app/data/document-suggestions'
|
||||
import {
|
||||
FILTER_CORRESPONDENT,
|
||||
FILTER_CREATED_AFTER,
|
||||
@ -45,28 +45,25 @@ import {
|
||||
FILTER_STORAGE_PATH,
|
||||
} from 'src/app/data/filter-rule-type'
|
||||
import { StoragePathService } from 'src/app/services/rest/storage-path.service'
|
||||
import { PaperlessStoragePath } from 'src/app/data/paperless-storage-path'
|
||||
import { StoragePath } from 'src/app/data/storage-path'
|
||||
import { StoragePathEditDialogComponent } from '../common/edit-dialog/storage-path-edit-dialog/storage-path-edit-dialog.component'
|
||||
import { SETTINGS_KEYS } from 'src/app/data/paperless-uisettings'
|
||||
import { SETTINGS_KEYS } from 'src/app/data/ui-settings'
|
||||
import {
|
||||
PermissionAction,
|
||||
PermissionsService,
|
||||
PermissionType,
|
||||
} from 'src/app/services/permissions.service'
|
||||
import { PaperlessUser } from 'src/app/data/paperless-user'
|
||||
import { User } from 'src/app/data/user'
|
||||
import { UserService } from 'src/app/services/rest/user.service'
|
||||
import { PaperlessDocumentNote } from 'src/app/data/paperless-document-note'
|
||||
import { DocumentNote } from 'src/app/data/document-note'
|
||||
import { HttpClient } from '@angular/common/http'
|
||||
import { ComponentWithPermissions } from '../with-permissions/with-permissions.component'
|
||||
import { EditDialogMode } from '../common/edit-dialog/edit-dialog.component'
|
||||
import { ObjectWithId } from 'src/app/data/object-with-id'
|
||||
import { FilterRule } from 'src/app/data/filter-rule'
|
||||
import { ISODateAdapter } from 'src/app/utils/ngb-iso-date-adapter'
|
||||
import {
|
||||
PaperlessCustomField,
|
||||
PaperlessCustomFieldDataType,
|
||||
} from 'src/app/data/paperless-custom-field'
|
||||
import { PaperlessCustomFieldInstance } from 'src/app/data/paperless-custom-field-instance'
|
||||
import { CustomField, CustomFieldDataType } from 'src/app/data/custom-field'
|
||||
import { CustomFieldInstance } from 'src/app/data/custom-field-instance'
|
||||
import { CustomFieldsService } from 'src/app/services/rest/custom-fields.service'
|
||||
import { PDFDocumentProxy } from '../common/pdf-viewer/typings'
|
||||
|
||||
@ -111,10 +108,10 @@ export class DocumentDetailComponent
|
||||
networkActive = false
|
||||
|
||||
documentId: number
|
||||
document: PaperlessDocument
|
||||
metadata: PaperlessDocumentMetadata
|
||||
suggestions: PaperlessDocumentSuggestions
|
||||
users: PaperlessUser[]
|
||||
document: Document
|
||||
metadata: DocumentMetadata
|
||||
suggestions: DocumentSuggestions
|
||||
users: User[]
|
||||
|
||||
title: string
|
||||
titleSubject: Subject<string> = new Subject()
|
||||
@ -123,9 +120,9 @@ export class DocumentDetailComponent
|
||||
downloadUrl: string
|
||||
downloadOriginalUrl: string
|
||||
|
||||
correspondents: PaperlessCorrespondent[]
|
||||
documentTypes: PaperlessDocumentType[]
|
||||
storagePaths: PaperlessStoragePath[]
|
||||
correspondents: Correspondent[]
|
||||
documentTypes: DocumentType[]
|
||||
storagePaths: StoragePath[]
|
||||
|
||||
documentForm: FormGroup = new FormGroup({
|
||||
title: new FormControl(''),
|
||||
@ -155,8 +152,8 @@ export class DocumentDetailComponent
|
||||
|
||||
ogDate: Date
|
||||
|
||||
customFields: PaperlessCustomField[]
|
||||
public readonly PaperlessCustomFieldDataType = PaperlessCustomFieldDataType
|
||||
customFields: CustomField[]
|
||||
public readonly PaperlessCustomFieldDataType = CustomFieldDataType
|
||||
|
||||
@ViewChild('nav') nav: NgbNav
|
||||
@ViewChild('pdfPreview') set pdfPreview(element) {
|
||||
@ -409,7 +406,7 @@ export class DocumentDetailComponent
|
||||
])
|
||||
}
|
||||
|
||||
updateComponent(doc: PaperlessDocument) {
|
||||
updateComponent(doc: Document) {
|
||||
this.document = doc
|
||||
this.requiresPassword = false
|
||||
// this.customFields = doc.custom_fields.concat([])
|
||||
@ -825,13 +822,13 @@ export class DocumentDetailComponent
|
||||
)
|
||||
}
|
||||
|
||||
notesUpdated(notes: PaperlessDocumentNote[]) {
|
||||
notesUpdated(notes: DocumentNote[]) {
|
||||
this.document.notes = notes
|
||||
this.openDocumentService.refreshDocument(this.documentId)
|
||||
}
|
||||
|
||||
get userIsOwner(): boolean {
|
||||
let doc: PaperlessDocument = Object.assign({}, this.document)
|
||||
let doc: Document = Object.assign({}, this.document)
|
||||
// dont disable while editing
|
||||
if (this.document && this.store?.value.permissions_form?.owner) {
|
||||
doc.owner = this.store?.value.permissions_form?.owner
|
||||
@ -840,7 +837,7 @@ export class DocumentDetailComponent
|
||||
}
|
||||
|
||||
get userCanEdit(): boolean {
|
||||
let doc: PaperlessDocument = Object.assign({}, this.document)
|
||||
let doc: Document = Object.assign({}, this.document)
|
||||
// dont disable while editing
|
||||
if (this.document && this.store?.value.permissions_form?.owner) {
|
||||
doc.owner = this.store?.value.permissions_form?.owner
|
||||
@ -877,25 +874,25 @@ export class DocumentDetailComponent
|
||||
// Correspondent
|
||||
return {
|
||||
rule_type: FILTER_CORRESPONDENT,
|
||||
value: (i as PaperlessCorrespondent).id.toString(),
|
||||
value: (i as Correspondent).id.toString(),
|
||||
}
|
||||
} else if (i.hasOwnProperty('path')) {
|
||||
// Storage Path
|
||||
return {
|
||||
rule_type: FILTER_STORAGE_PATH,
|
||||
value: (i as PaperlessStoragePath).id.toString(),
|
||||
value: (i as StoragePath).id.toString(),
|
||||
}
|
||||
} else if (i.hasOwnProperty('is_inbox_tag')) {
|
||||
// Tag
|
||||
return {
|
||||
rule_type: FILTER_HAS_TAGS_ALL,
|
||||
value: (i as PaperlessTag).id.toString(),
|
||||
value: (i as Tag).id.toString(),
|
||||
}
|
||||
} else {
|
||||
// Document Type, has no specific props
|
||||
return {
|
||||
rule_type: FILTER_DOCUMENT_TYPE,
|
||||
value: (i as PaperlessDocumentType).id.toString(),
|
||||
value: (i as DocumentType).id.toString(),
|
||||
}
|
||||
}
|
||||
})
|
||||
@ -916,8 +913,8 @@ export class DocumentDetailComponent
|
||||
}
|
||||
|
||||
public getCustomFieldFromInstance(
|
||||
instance: PaperlessCustomFieldInstance
|
||||
): PaperlessCustomField {
|
||||
instance: CustomFieldInstance
|
||||
): CustomField {
|
||||
return this.customFields?.find((f) => f.id === instance.field)
|
||||
}
|
||||
|
||||
@ -941,7 +938,7 @@ export class DocumentDetailComponent
|
||||
})
|
||||
}
|
||||
|
||||
public addField(field: PaperlessCustomField) {
|
||||
public addField(field: CustomField) {
|
||||
this.document.custom_fields.push({
|
||||
field: field.id,
|
||||
value: null,
|
||||
@ -951,7 +948,7 @@ export class DocumentDetailComponent
|
||||
this.updateFormForCustomFields(true)
|
||||
}
|
||||
|
||||
public removeField(fieldInstance: PaperlessCustomFieldInstance) {
|
||||
public removeField(fieldInstance: CustomFieldInstance) {
|
||||
this.document.custom_fields.splice(
|
||||
this.document.custom_fields.indexOf(fieldInstance),
|
||||
1
|
||||
|
@ -1,7 +1,7 @@
|
||||
import { Component, OnDestroy, OnInit } from '@angular/core'
|
||||
import { PaperlessTag } from 'src/app/data/paperless-tag'
|
||||
import { PaperlessCorrespondent } from 'src/app/data/paperless-correspondent'
|
||||
import { PaperlessDocumentType } from 'src/app/data/paperless-document-type'
|
||||
import { Tag } from 'src/app/data/tag'
|
||||
import { Correspondent } from 'src/app/data/correspondent'
|
||||
import { DocumentType } from 'src/app/data/document-type'
|
||||
import { TagService } from 'src/app/services/rest/tag.service'
|
||||
import { CorrespondentService } from 'src/app/services/rest/correspondent.service'
|
||||
import { DocumentTypeService } from 'src/app/services/rest/document-type.service'
|
||||
@ -23,8 +23,8 @@ import { SettingsService } from 'src/app/services/settings.service'
|
||||
import { ToastService } from 'src/app/services/toast.service'
|
||||
import { saveAs } from 'file-saver'
|
||||
import { StoragePathService } from 'src/app/services/rest/storage-path.service'
|
||||
import { PaperlessStoragePath } from 'src/app/data/paperless-storage-path'
|
||||
import { SETTINGS_KEYS } from 'src/app/data/paperless-uisettings'
|
||||
import { StoragePath } from 'src/app/data/storage-path'
|
||||
import { SETTINGS_KEYS } from 'src/app/data/ui-settings'
|
||||
import { ComponentWithPermissions } from '../../with-permissions/with-permissions.component'
|
||||
import { PermissionsDialogComponent } from '../../common/permissions-dialog/permissions-dialog.component'
|
||||
import {
|
||||
@ -44,10 +44,10 @@ export class BulkEditorComponent
|
||||
extends ComponentWithPermissions
|
||||
implements OnInit, OnDestroy
|
||||
{
|
||||
tags: PaperlessTag[]
|
||||
correspondents: PaperlessCorrespondent[]
|
||||
documentTypes: PaperlessDocumentType[]
|
||||
storagePaths: PaperlessStoragePath[]
|
||||
tags: Tag[]
|
||||
correspondents: Correspondent[]
|
||||
documentTypes: DocumentType[]
|
||||
storagePaths: StoragePath[]
|
||||
|
||||
tagSelectionModel = new FilterableDropdownSelectionModel()
|
||||
correspondentSelectionModel = new FilterableDropdownSelectionModel()
|
||||
|
@ -5,11 +5,11 @@ import {
|
||||
Output,
|
||||
ViewChild,
|
||||
} from '@angular/core'
|
||||
import { PaperlessDocument } from 'src/app/data/paperless-document'
|
||||
import { Document } from 'src/app/data/document'
|
||||
import { DocumentService } from 'src/app/services/rest/document.service'
|
||||
import { SettingsService } from 'src/app/services/settings.service'
|
||||
import { NgbPopover } from '@ng-bootstrap/ng-bootstrap'
|
||||
import { SETTINGS_KEYS } from 'src/app/data/paperless-uisettings'
|
||||
import { SETTINGS_KEYS } from 'src/app/data/ui-settings'
|
||||
import { ComponentWithPermissions } from '../../with-permissions/with-permissions.component'
|
||||
|
||||
@Component({
|
||||
@ -36,7 +36,7 @@ export class DocumentCardLargeComponent extends ComponentWithPermissions {
|
||||
}
|
||||
|
||||
@Input()
|
||||
document: PaperlessDocument
|
||||
document: Document
|
||||
|
||||
@Output()
|
||||
dblClickDocument = new EventEmitter()
|
||||
|
@ -20,7 +20,7 @@ import { DocumentCardSmallComponent } from './document-card-small.component'
|
||||
import { of } from 'rxjs'
|
||||
import { By } from '@angular/platform-browser'
|
||||
import { TagComponent } from '../../common/tag/tag.component'
|
||||
import { PaperlessTag } from 'src/app/data/paperless-tag'
|
||||
import { Tag } from 'src/app/data/tag'
|
||||
import { IsNumberPipe } from 'src/app/pipes/is-number.pipe'
|
||||
import { PreviewPopupComponent } from '../../common/preview-popup/preview-popup.component'
|
||||
|
||||
@ -89,10 +89,7 @@ describe('DocumentCardSmallComponent', () => {
|
||||
fixture.debugElement.queryAll(By.directive(TagComponent))
|
||||
).toHaveLength(5)
|
||||
component.document.tags = [1, 2]
|
||||
component.document.tags$ = of([
|
||||
{ id: 1 } as PaperlessTag,
|
||||
{ id: 2 } as PaperlessTag,
|
||||
])
|
||||
component.document.tags$ = of([{ id: 1 } as Tag, { id: 2 } as Tag])
|
||||
fixture.detectChanges()
|
||||
expect(
|
||||
fixture.debugElement.queryAll(By.directive(TagComponent))
|
||||
|
@ -6,11 +6,11 @@ import {
|
||||
ViewChild,
|
||||
} from '@angular/core'
|
||||
import { map } from 'rxjs/operators'
|
||||
import { PaperlessDocument } from 'src/app/data/paperless-document'
|
||||
import { Document } from 'src/app/data/document'
|
||||
import { DocumentService } from 'src/app/services/rest/document.service'
|
||||
import { SettingsService } from 'src/app/services/settings.service'
|
||||
import { NgbPopover } from '@ng-bootstrap/ng-bootstrap'
|
||||
import { SETTINGS_KEYS } from 'src/app/data/paperless-uisettings'
|
||||
import { SETTINGS_KEYS } from 'src/app/data/ui-settings'
|
||||
import { ComponentWithPermissions } from '../../with-permissions/with-permissions.component'
|
||||
|
||||
@Component({
|
||||
@ -33,7 +33,7 @@ export class DocumentCardSmallComponent extends ComponentWithPermissions {
|
||||
toggleSelected = new EventEmitter()
|
||||
|
||||
@Input()
|
||||
document: PaperlessDocument
|
||||
document: Document
|
||||
|
||||
@Output()
|
||||
dblClickDocument = new EventEmitter()
|
||||
|
@ -34,7 +34,7 @@ import {
|
||||
import { Subject, of, throwError } from 'rxjs'
|
||||
import { SavedViewService } from 'src/app/services/rest/saved-view.service'
|
||||
import { ActivatedRoute, Router, convertToParamMap } from '@angular/router'
|
||||
import { PaperlessSavedView } from 'src/app/data/paperless-saved-view'
|
||||
import { SavedView } from 'src/app/data/saved-view'
|
||||
import {
|
||||
FILTER_FULLTEXT_MORELIKE,
|
||||
FILTER_FULLTEXT_QUERY,
|
||||
@ -47,7 +47,7 @@ import { DocumentCardSmallComponent } from './document-card-small/document-card-
|
||||
import { DocumentCardLargeComponent } from './document-card-large/document-card-large.component'
|
||||
import { DocumentTitlePipe } from 'src/app/pipes/document-title.pipe'
|
||||
import { UsernamePipe } from 'src/app/pipes/username.pipe'
|
||||
import { PaperlessDocument } from 'src/app/data/paperless-document'
|
||||
import { Document } from 'src/app/data/document'
|
||||
import {
|
||||
DOCUMENT_SORT_FIELDS,
|
||||
DOCUMENT_SORT_FIELDS_FULLTEXT,
|
||||
@ -61,10 +61,10 @@ import { CheckComponent } from '../common/input/check/check.component'
|
||||
import { HttpErrorResponse } from '@angular/common/http'
|
||||
import { PermissionsGuard } from 'src/app/guards/permissions.guard'
|
||||
import { SettingsService } from 'src/app/services/settings.service'
|
||||
import { SETTINGS_KEYS } from 'src/app/data/paperless-uisettings'
|
||||
import { SETTINGS_KEYS } from 'src/app/data/ui-settings'
|
||||
import { IsNumberPipe } from 'src/app/pipes/is-number.pipe'
|
||||
|
||||
const docs: PaperlessDocument[] = [
|
||||
const docs: Document[] = [
|
||||
{
|
||||
id: 1,
|
||||
title: 'Doc1',
|
||||
@ -222,7 +222,7 @@ describe('DocumentListComponent', () => {
|
||||
})
|
||||
|
||||
it('should load saved view from URL', () => {
|
||||
const view: PaperlessSavedView = {
|
||||
const view: SavedView = {
|
||||
id: 10,
|
||||
sort_field: 'added',
|
||||
sort_reverse: true,
|
||||
@ -264,7 +264,7 @@ describe('DocumentListComponent', () => {
|
||||
})
|
||||
|
||||
it('should load saved view from query params', () => {
|
||||
const view: PaperlessSavedView = {
|
||||
const view: SavedView = {
|
||||
id: 10,
|
||||
sort_field: 'added',
|
||||
sort_reverse: true,
|
||||
@ -412,7 +412,7 @@ describe('DocumentListComponent', () => {
|
||||
})
|
||||
|
||||
it('should support saving an edited view', () => {
|
||||
const view: PaperlessSavedView = {
|
||||
const view: SavedView = {
|
||||
id: 10,
|
||||
name: 'Saved View 10',
|
||||
sort_field: 'added',
|
||||
@ -448,7 +448,7 @@ describe('DocumentListComponent', () => {
|
||||
})
|
||||
|
||||
it('should support edited view saving as', () => {
|
||||
const view: PaperlessSavedView = {
|
||||
const view: SavedView = {
|
||||
id: 10,
|
||||
name: 'Saved View 10',
|
||||
sort_field: 'added',
|
||||
@ -494,7 +494,7 @@ describe('DocumentListComponent', () => {
|
||||
})
|
||||
|
||||
it('should handle error on edited view saving as', () => {
|
||||
const view: PaperlessSavedView = {
|
||||
const view: SavedView = {
|
||||
id: 10,
|
||||
name: 'Saved View 10',
|
||||
sort_field: 'added',
|
||||
|
@ -15,9 +15,9 @@ import {
|
||||
isFullTextFilterRule,
|
||||
} from 'src/app/utils/filter-rules'
|
||||
import { FILTER_FULLTEXT_MORELIKE } from 'src/app/data/filter-rule-type'
|
||||
import { PaperlessDocument } from 'src/app/data/paperless-document'
|
||||
import { PaperlessSavedView } from 'src/app/data/paperless-saved-view'
|
||||
import { SETTINGS_KEYS } from 'src/app/data/paperless-uisettings'
|
||||
import { Document } from 'src/app/data/document'
|
||||
import { SavedView } from 'src/app/data/saved-view'
|
||||
import { SETTINGS_KEYS } from 'src/app/data/ui-settings'
|
||||
import {
|
||||
SortableDirective,
|
||||
SortEvent,
|
||||
@ -67,7 +67,7 @@ export class DocumentListComponent
|
||||
displayMode = 'smallCards' // largeCards, smallCards, details
|
||||
|
||||
unmodifiedFilterRules: FilterRule[] = []
|
||||
private unmodifiedSavedView: PaperlessSavedView
|
||||
private unmodifiedSavedView: SavedView
|
||||
|
||||
private unsubscribeNotifier: Subject<any> = new Subject()
|
||||
|
||||
@ -192,7 +192,7 @@ export class DocumentListComponent
|
||||
|
||||
saveViewConfig() {
|
||||
if (this.list.activeSavedViewId != null) {
|
||||
let savedView: PaperlessSavedView = {
|
||||
let savedView: SavedView = {
|
||||
id: this.list.activeSavedViewId,
|
||||
filter_rules: this.list.filterRules,
|
||||
sort_field: this.list.sortField,
|
||||
@ -229,7 +229,7 @@ export class DocumentListComponent
|
||||
modal.componentInstance.defaultName = this.filterEditor.generateFilterName()
|
||||
modal.componentInstance.saveClicked.pipe(first()).subscribe((formValue) => {
|
||||
modal.componentInstance.buttonsEnabled = false
|
||||
let savedView: PaperlessSavedView = {
|
||||
let savedView: SavedView = {
|
||||
name: formValue.name,
|
||||
show_on_dashboard: formValue.showOnDashboard,
|
||||
show_in_sidebar: formValue.showInSideBar,
|
||||
@ -260,11 +260,11 @@ export class DocumentListComponent
|
||||
})
|
||||
}
|
||||
|
||||
openDocumentDetail(document: PaperlessDocument) {
|
||||
openDocumentDetail(document: Document) {
|
||||
this.router.navigate(['documents', document.id])
|
||||
}
|
||||
|
||||
toggleSelected(document: PaperlessDocument, event: MouseEvent): void {
|
||||
toggleSelected(document: Document, event: MouseEvent): void {
|
||||
if (!event.shiftKey) this.list.toggleSelected(document)
|
||||
else this.list.selectRangeTo(document)
|
||||
}
|
||||
@ -295,7 +295,7 @@ export class DocumentListComponent
|
||||
])
|
||||
}
|
||||
|
||||
trackByDocumentId(index, item: PaperlessDocument) {
|
||||
trackByDocumentId(index, item: Document) {
|
||||
return item.id
|
||||
}
|
||||
|
||||
|
@ -49,11 +49,11 @@ import {
|
||||
FILTER_CUSTOM_FIELDS,
|
||||
FILTER_SHARED_BY_USER,
|
||||
} from 'src/app/data/filter-rule-type'
|
||||
import { PaperlessCorrespondent } from 'src/app/data/paperless-correspondent'
|
||||
import { PaperlessDocumentType } from 'src/app/data/paperless-document-type'
|
||||
import { PaperlessStoragePath } from 'src/app/data/paperless-storage-path'
|
||||
import { PaperlessTag } from 'src/app/data/paperless-tag'
|
||||
import { PaperlessUser } from 'src/app/data/paperless-user'
|
||||
import { Correspondent } from 'src/app/data/correspondent'
|
||||
import { DocumentType } from 'src/app/data/document-type'
|
||||
import { StoragePath } from 'src/app/data/storage-path'
|
||||
import { Tag } from 'src/app/data/tag'
|
||||
import { User } from 'src/app/data/user'
|
||||
import { IfPermissionsDirective } from 'src/app/directives/if-permissions.directive'
|
||||
import { CustomDatePipe } from 'src/app/pipes/custom-date.pipe'
|
||||
import { FilterPipe } from 'src/app/pipes/filter.pipe'
|
||||
@ -78,7 +78,7 @@ import {
|
||||
} from '../../common/permissions-filter-dropdown/permissions-filter-dropdown.component'
|
||||
import { FilterEditorComponent } from './filter-editor.component'
|
||||
|
||||
const tags: PaperlessTag[] = [
|
||||
const tags: Tag[] = [
|
||||
{
|
||||
id: 2,
|
||||
name: 'Tag2',
|
||||
@ -89,7 +89,7 @@ const tags: PaperlessTag[] = [
|
||||
},
|
||||
]
|
||||
|
||||
const correspondents: PaperlessCorrespondent[] = [
|
||||
const correspondents: Correspondent[] = [
|
||||
{
|
||||
id: 12,
|
||||
name: 'Corresp12',
|
||||
@ -100,7 +100,7 @@ const correspondents: PaperlessCorrespondent[] = [
|
||||
},
|
||||
]
|
||||
|
||||
const document_types: PaperlessDocumentType[] = [
|
||||
const document_types: DocumentType[] = [
|
||||
{
|
||||
id: 22,
|
||||
name: 'DocType22',
|
||||
@ -111,7 +111,7 @@ const document_types: PaperlessDocumentType[] = [
|
||||
},
|
||||
]
|
||||
|
||||
const storage_paths: PaperlessStoragePath[] = [
|
||||
const storage_paths: StoragePath[] = [
|
||||
{
|
||||
id: 32,
|
||||
name: 'StoragePath32',
|
||||
@ -122,7 +122,7 @@ const storage_paths: PaperlessStoragePath[] = [
|
||||
},
|
||||
]
|
||||
|
||||
const users: PaperlessUser[] = [
|
||||
const users: User[] = [
|
||||
{
|
||||
id: 1,
|
||||
username: 'user1',
|
||||
|
@ -8,9 +8,9 @@ import {
|
||||
ViewChild,
|
||||
ElementRef,
|
||||
} from '@angular/core'
|
||||
import { PaperlessTag } from 'src/app/data/paperless-tag'
|
||||
import { PaperlessCorrespondent } from 'src/app/data/paperless-correspondent'
|
||||
import { PaperlessDocumentType } from 'src/app/data/paperless-document-type'
|
||||
import { Tag } from 'src/app/data/tag'
|
||||
import { Correspondent } from 'src/app/data/correspondent'
|
||||
import { DocumentType } from 'src/app/data/document-type'
|
||||
import { Subject, Subscription } from 'rxjs'
|
||||
import { debounceTime, distinctUntilChanged, filter } from 'rxjs/operators'
|
||||
import { DocumentTypeService } from 'src/app/services/rest/document-type.service'
|
||||
@ -62,8 +62,8 @@ import {
|
||||
SelectionData,
|
||||
SelectionDataItem,
|
||||
} from 'src/app/services/rest/document.service'
|
||||
import { PaperlessDocument } from 'src/app/data/paperless-document'
|
||||
import { PaperlessStoragePath } from 'src/app/data/paperless-storage-path'
|
||||
import { Document } from 'src/app/data/document'
|
||||
import { StoragePath } from 'src/app/data/storage-path'
|
||||
import { StoragePathService } from 'src/app/services/rest/storage-path.service'
|
||||
import { RelativeDate } from '../../common/date-dropdown/date-dropdown.component'
|
||||
import {
|
||||
@ -230,10 +230,10 @@ export class FilterEditorComponent implements OnInit, OnDestroy {
|
||||
@ViewChild('textFilterInput')
|
||||
textFilterInput: ElementRef
|
||||
|
||||
tags: PaperlessTag[] = []
|
||||
correspondents: PaperlessCorrespondent[] = []
|
||||
documentTypes: PaperlessDocumentType[] = []
|
||||
storagePaths: PaperlessStoragePath[] = []
|
||||
tags: Tag[] = []
|
||||
correspondents: Correspondent[] = []
|
||||
documentTypes: DocumentType[] = []
|
||||
storagePaths: StoragePath[] = []
|
||||
|
||||
tagDocumentCounts: SelectionDataItem[]
|
||||
correspondentDocumentCounts: SelectionDataItem[]
|
||||
@ -242,7 +242,7 @@ export class FilterEditorComponent implements OnInit, OnDestroy {
|
||||
|
||||
_textFilter = ''
|
||||
_moreLikeId: number
|
||||
_moreLikeDoc: PaperlessDocument
|
||||
_moreLikeDoc: Document
|
||||
|
||||
get textFilterTargets() {
|
||||
if (this.textFilterTarget == TEXT_FILTER_TARGET_FULLTEXT_MORELIKE) {
|
||||
|
@ -5,7 +5,7 @@ import { UserService } from 'src/app/services/rest/user.service'
|
||||
import { of, throwError } from 'rxjs'
|
||||
import { DocumentNotesService } from 'src/app/services/rest/document-notes.service'
|
||||
import { ToastService } from 'src/app/services/toast.service'
|
||||
import { PaperlessDocumentNote } from 'src/app/data/paperless-document-note'
|
||||
import { DocumentNote } from 'src/app/data/document-note'
|
||||
import { HttpClientTestingModule } from '@angular/common/http/testing'
|
||||
import { CustomDatePipe } from 'src/app/pipes/custom-date.pipe'
|
||||
import { IfPermissionsDirective } from 'src/app/directives/if-permissions.directive'
|
||||
@ -14,7 +14,7 @@ import { By } from '@angular/platform-browser'
|
||||
import { PermissionsService } from 'src/app/services/permissions.service'
|
||||
import { FormsModule, ReactiveFormsModule } from '@angular/forms'
|
||||
|
||||
const notes: PaperlessDocumentNote[] = [
|
||||
const notes: DocumentNote[] = [
|
||||
{
|
||||
id: 23,
|
||||
note: 'Note 23',
|
||||
|
@ -1,11 +1,11 @@
|
||||
import { Component, Input, Output, EventEmitter } from '@angular/core'
|
||||
import { DocumentNotesService } from 'src/app/services/rest/document-notes.service'
|
||||
import { PaperlessDocumentNote } from 'src/app/data/paperless-document-note'
|
||||
import { DocumentNote } from 'src/app/data/document-note'
|
||||
import { FormControl, FormGroup } from '@angular/forms'
|
||||
import { ToastService } from 'src/app/services/toast.service'
|
||||
import { ComponentWithPermissions } from '../with-permissions/with-permissions.component'
|
||||
import { UserService } from 'src/app/services/rest/user.service'
|
||||
import { PaperlessUser } from 'src/app/data/paperless-user'
|
||||
import { User } from 'src/app/data/user'
|
||||
|
||||
@Component({
|
||||
selector: 'pngx-document-notes',
|
||||
@ -24,14 +24,14 @@ export class DocumentNotesComponent extends ComponentWithPermissions {
|
||||
documentId: number
|
||||
|
||||
@Input()
|
||||
notes: PaperlessDocumentNote[] = []
|
||||
notes: DocumentNote[] = []
|
||||
|
||||
@Input()
|
||||
addDisabled: boolean = false
|
||||
|
||||
@Output()
|
||||
updated: EventEmitter<PaperlessDocumentNote[]> = new EventEmitter()
|
||||
users: PaperlessUser[]
|
||||
updated: EventEmitter<DocumentNote[]> = new EventEmitter()
|
||||
users: User[]
|
||||
|
||||
constructor(
|
||||
private notesService: DocumentNotesService,
|
||||
@ -82,7 +82,7 @@ export class DocumentNotesComponent extends ComponentWithPermissions {
|
||||
})
|
||||
}
|
||||
|
||||
displayName(note: PaperlessDocumentNote): string {
|
||||
displayName(note: DocumentNote): string {
|
||||
if (!note.user) return ''
|
||||
const user = this.users?.find((u) => u.id === note.user)
|
||||
if (!user) return ''
|
||||
|
@ -11,8 +11,8 @@ import {
|
||||
import { of, throwError } from 'rxjs'
|
||||
import {
|
||||
DocumentSource,
|
||||
PaperlessConsumptionTemplate,
|
||||
} from 'src/app/data/paperless-consumption-template'
|
||||
ConsumptionTemplate,
|
||||
} from 'src/app/data/consumption-template'
|
||||
import { IfPermissionsDirective } from 'src/app/directives/if-permissions.directive'
|
||||
import { ConsumptionTemplateService } from 'src/app/services/rest/consumption-template.service'
|
||||
import { ToastService } from 'src/app/services/toast.service'
|
||||
@ -22,7 +22,7 @@ import { ConsumptionTemplatesComponent } from './consumption-templates.component
|
||||
import { ConsumptionTemplateEditDialogComponent } from '../../common/edit-dialog/consumption-template-edit-dialog/consumption-template-edit-dialog.component'
|
||||
import { PermissionsService } from 'src/app/services/permissions.service'
|
||||
|
||||
const templates: PaperlessConsumptionTemplate[] = [
|
||||
const templates: ConsumptionTemplate[] = [
|
||||
{
|
||||
id: 0,
|
||||
name: 'Template 1',
|
||||
|
@ -2,7 +2,7 @@ import { Component, OnInit } from '@angular/core'
|
||||
import { ConsumptionTemplateService } from 'src/app/services/rest/consumption-template.service'
|
||||
import { ComponentWithPermissions } from '../../with-permissions/with-permissions.component'
|
||||
import { Subject, takeUntil } from 'rxjs'
|
||||
import { PaperlessConsumptionTemplate } from 'src/app/data/paperless-consumption-template'
|
||||
import { ConsumptionTemplate } from 'src/app/data/consumption-template'
|
||||
import { NgbModal } from '@ng-bootstrap/ng-bootstrap'
|
||||
import { ToastService } from 'src/app/services/toast.service'
|
||||
import { PermissionsService } from 'src/app/services/permissions.service'
|
||||
@ -22,7 +22,7 @@ export class ConsumptionTemplatesComponent
|
||||
extends ComponentWithPermissions
|
||||
implements OnInit
|
||||
{
|
||||
public templates: PaperlessConsumptionTemplate[] = []
|
||||
public templates: ConsumptionTemplate[] = []
|
||||
|
||||
private unsubscribeNotifier: Subject<any> = new Subject()
|
||||
|
||||
@ -48,13 +48,13 @@ export class ConsumptionTemplatesComponent
|
||||
})
|
||||
}
|
||||
|
||||
getSourceList(template: PaperlessConsumptionTemplate): string {
|
||||
getSourceList(template: ConsumptionTemplate): string {
|
||||
return template.sources
|
||||
.map((id) => DOCUMENT_SOURCE_OPTIONS.find((s) => s.id === id).name)
|
||||
.join(', ')
|
||||
}
|
||||
|
||||
editTemplate(rule: PaperlessConsumptionTemplate) {
|
||||
editTemplate(rule: ConsumptionTemplate) {
|
||||
const modal = this.modalService.open(
|
||||
ConsumptionTemplateEditDialogComponent,
|
||||
{
|
||||
@ -82,7 +82,7 @@ export class ConsumptionTemplatesComponent
|
||||
})
|
||||
}
|
||||
|
||||
deleteTemplate(rule: PaperlessConsumptionTemplate) {
|
||||
deleteTemplate(rule: ConsumptionTemplate) {
|
||||
const modal = this.modalService.open(ConfirmDialogComponent, {
|
||||
backdrop: 'static',
|
||||
})
|
||||
|
@ -1,7 +1,7 @@
|
||||
import { Component } from '@angular/core'
|
||||
import { NgbModal } from '@ng-bootstrap/ng-bootstrap'
|
||||
import { FILTER_HAS_CORRESPONDENT_ANY } from 'src/app/data/filter-rule-type'
|
||||
import { PaperlessCorrespondent } from 'src/app/data/paperless-correspondent'
|
||||
import { Correspondent } from 'src/app/data/correspondent'
|
||||
import { CustomDatePipe } from 'src/app/pipes/custom-date.pipe'
|
||||
import { DocumentListViewService } from 'src/app/services/document-list-view.service'
|
||||
import {
|
||||
@ -19,7 +19,7 @@ import { ManagementListComponent } from '../management-list/management-list.comp
|
||||
styleUrls: ['./../management-list/management-list.component.scss'],
|
||||
providers: [{ provide: CustomDatePipe }],
|
||||
})
|
||||
export class CorrespondentListComponent extends ManagementListComponent<PaperlessCorrespondent> {
|
||||
export class CorrespondentListComponent extends ManagementListComponent<Correspondent> {
|
||||
constructor(
|
||||
correspondentsService: CorrespondentService,
|
||||
modalService: NgbModal,
|
||||
@ -43,7 +43,7 @@ export class CorrespondentListComponent extends ManagementListComponent<Paperles
|
||||
{
|
||||
key: 'last_correspondence',
|
||||
name: $localize`Last used`,
|
||||
valueFn: (c: PaperlessCorrespondent) => {
|
||||
valueFn: (c: Correspondent) => {
|
||||
if (c.last_correspondence) {
|
||||
let date = new Date(c.last_correspondence)
|
||||
if (date.toString() == 'Invalid Date') {
|
||||
@ -63,7 +63,7 @@ export class CorrespondentListComponent extends ManagementListComponent<Paperles
|
||||
)
|
||||
}
|
||||
|
||||
getDeleteMessage(object: PaperlessCorrespondent) {
|
||||
getDeleteMessage(object: Correspondent) {
|
||||
return $localize`Do you really want to delete the correspondent "${object.name}"?`
|
||||
}
|
||||
}
|
||||
|
@ -1,10 +1,7 @@
|
||||
import { ComponentFixture, TestBed } from '@angular/core/testing'
|
||||
|
||||
import { CustomFieldsComponent } from './custom-fields.component'
|
||||
import {
|
||||
PaperlessCustomField,
|
||||
PaperlessCustomFieldDataType,
|
||||
} from 'src/app/data/paperless-custom-field'
|
||||
import { CustomField, CustomFieldDataType } from 'src/app/data/custom-field'
|
||||
import { CustomFieldsService } from 'src/app/services/rest/custom-fields.service'
|
||||
import { HttpClientTestingModule } from '@angular/common/http/testing'
|
||||
import { FormsModule, ReactiveFormsModule } from '@angular/forms'
|
||||
@ -23,16 +20,16 @@ import { ConfirmDialogComponent } from '../../common/confirm-dialog/confirm-dial
|
||||
import { PageHeaderComponent } from '../../common/page-header/page-header.component'
|
||||
import { CustomFieldEditDialogComponent } from '../../common/edit-dialog/custom-field-edit-dialog/custom-field-edit-dialog.component'
|
||||
|
||||
const fields: PaperlessCustomField[] = [
|
||||
const fields: CustomField[] = [
|
||||
{
|
||||
id: 0,
|
||||
name: 'Field 1',
|
||||
data_type: PaperlessCustomFieldDataType.String,
|
||||
data_type: CustomFieldDataType.String,
|
||||
},
|
||||
{
|
||||
id: 1,
|
||||
name: 'Field 2',
|
||||
data_type: PaperlessCustomFieldDataType.Integer,
|
||||
data_type: CustomFieldDataType.Integer,
|
||||
},
|
||||
]
|
||||
|
||||
|
@ -1,10 +1,7 @@
|
||||
import { Component, OnInit } from '@angular/core'
|
||||
import { NgbModal } from '@ng-bootstrap/ng-bootstrap'
|
||||
import { Subject, takeUntil } from 'rxjs'
|
||||
import {
|
||||
DATA_TYPE_LABELS,
|
||||
PaperlessCustomField,
|
||||
} from 'src/app/data/paperless-custom-field'
|
||||
import { DATA_TYPE_LABELS, CustomField } from 'src/app/data/custom-field'
|
||||
import { PermissionsService } from 'src/app/services/permissions.service'
|
||||
import { CustomFieldsService } from 'src/app/services/rest/custom-fields.service'
|
||||
import { ToastService } from 'src/app/services/toast.service'
|
||||
@ -22,7 +19,7 @@ export class CustomFieldsComponent
|
||||
extends ComponentWithPermissions
|
||||
implements OnInit
|
||||
{
|
||||
public fields: PaperlessCustomField[] = []
|
||||
public fields: CustomField[] = []
|
||||
|
||||
private unsubscribeNotifier: Subject<any> = new Subject()
|
||||
constructor(
|
||||
@ -47,7 +44,7 @@ export class CustomFieldsComponent
|
||||
})
|
||||
}
|
||||
|
||||
editField(field: PaperlessCustomField) {
|
||||
editField(field: CustomField) {
|
||||
const modal = this.modalService.open(CustomFieldEditDialogComponent)
|
||||
modal.componentInstance.dialogMode = field
|
||||
? EditDialogMode.EDIT
|
||||
@ -67,7 +64,7 @@ export class CustomFieldsComponent
|
||||
})
|
||||
}
|
||||
|
||||
deleteField(field: PaperlessCustomField) {
|
||||
deleteField(field: CustomField) {
|
||||
const modal = this.modalService.open(ConfirmDialogComponent, {
|
||||
backdrop: 'static',
|
||||
})
|
||||
@ -92,7 +89,7 @@ export class CustomFieldsComponent
|
||||
})
|
||||
}
|
||||
|
||||
getDataType(field: PaperlessCustomField): string {
|
||||
getDataType(field: CustomField): string {
|
||||
return DATA_TYPE_LABELS.find((l) => l.id === field.data_type).name
|
||||
}
|
||||
}
|
||||
|
@ -1,7 +1,7 @@
|
||||
import { Component } from '@angular/core'
|
||||
import { NgbModal } from '@ng-bootstrap/ng-bootstrap'
|
||||
import { FILTER_HAS_DOCUMENT_TYPE_ANY } from 'src/app/data/filter-rule-type'
|
||||
import { PaperlessDocumentType } from 'src/app/data/paperless-document-type'
|
||||
import { DocumentType } from 'src/app/data/document-type'
|
||||
import { DocumentListViewService } from 'src/app/services/document-list-view.service'
|
||||
import {
|
||||
PermissionsService,
|
||||
@ -17,7 +17,7 @@ import { ManagementListComponent } from '../management-list/management-list.comp
|
||||
templateUrl: './../management-list/management-list.component.html',
|
||||
styleUrls: ['./../management-list/management-list.component.scss'],
|
||||
})
|
||||
export class DocumentTypeListComponent extends ManagementListComponent<PaperlessDocumentType> {
|
||||
export class DocumentTypeListComponent extends ManagementListComponent<DocumentType> {
|
||||
constructor(
|
||||
documentTypeService: DocumentTypeService,
|
||||
modalService: NgbModal,
|
||||
@ -40,7 +40,7 @@ export class DocumentTypeListComponent extends ManagementListComponent<Paperless
|
||||
)
|
||||
}
|
||||
|
||||
getDeleteMessage(object: PaperlessDocumentType) {
|
||||
getDeleteMessage(object: DocumentType) {
|
||||
return $localize`Do you really want to delete the document type "${object.name}"?`
|
||||
}
|
||||
}
|
||||
|
@ -13,8 +13,8 @@ import {
|
||||
import { NgSelectModule } from '@ng-select/ng-select'
|
||||
import { of, throwError } from 'rxjs'
|
||||
import { routes } from 'src/app/app-routing.module'
|
||||
import { PaperlessMailAccount } from 'src/app/data/paperless-mail-account'
|
||||
import { PaperlessMailRule } from 'src/app/data/paperless-mail-rule'
|
||||
import { MailAccount } from 'src/app/data/mail-account'
|
||||
import { MailRule } from 'src/app/data/mail-rule'
|
||||
import { IfOwnerDirective } from 'src/app/directives/if-owner.directive'
|
||||
import { IfPermissionsDirective } from 'src/app/directives/if-permissions.directive'
|
||||
import { PermissionsGuard } from 'src/app/guards/permissions.guard'
|
||||
@ -118,7 +118,7 @@ describe('MailComponent', () => {
|
||||
of({
|
||||
all: mailAccounts.map((a) => a.id),
|
||||
count: mailAccounts.length,
|
||||
results: (mailAccounts as PaperlessMailAccount[]).concat([]),
|
||||
results: (mailAccounts as MailAccount[]).concat([]),
|
||||
})
|
||||
)
|
||||
}
|
||||
@ -127,7 +127,7 @@ describe('MailComponent', () => {
|
||||
of({
|
||||
all: mailRules.map((r) => r.id),
|
||||
count: mailRules.length,
|
||||
results: (mailRules as PaperlessMailRule[]).concat([]),
|
||||
results: (mailRules as MailRule[]).concat([]),
|
||||
})
|
||||
)
|
||||
}
|
||||
@ -163,7 +163,7 @@ describe('MailComponent', () => {
|
||||
completeSetup()
|
||||
let modal: NgbModalRef
|
||||
modalService.activeInstances.subscribe((refs) => (modal = refs[0]))
|
||||
component.editMailAccount(mailAccounts[0] as PaperlessMailAccount)
|
||||
component.editMailAccount(mailAccounts[0] as MailAccount)
|
||||
let editDialog = modal.componentInstance as MailAccountEditDialogComponent
|
||||
const toastErrorSpy = jest.spyOn(toastService, 'showError')
|
||||
const toastInfoSpy = jest.spyOn(toastService, 'showInfo')
|
||||
@ -181,7 +181,7 @@ describe('MailComponent', () => {
|
||||
completeSetup()
|
||||
let modal: NgbModalRef
|
||||
modalService.activeInstances.subscribe((refs) => (modal = refs[0]))
|
||||
component.deleteMailAccount(mailAccounts[0] as PaperlessMailAccount)
|
||||
component.deleteMailAccount(mailAccounts[0] as MailAccount)
|
||||
const deleteDialog = modal.componentInstance as ConfirmDialogComponent
|
||||
const deleteSpy = jest.spyOn(mailAccountService, 'delete')
|
||||
const toastErrorSpy = jest.spyOn(toastService, 'showError')
|
||||
@ -202,7 +202,7 @@ describe('MailComponent', () => {
|
||||
completeSetup()
|
||||
let modal: NgbModalRef
|
||||
modalService.activeInstances.subscribe((refs) => (modal = refs[0]))
|
||||
component.editMailRule(mailRules[0] as PaperlessMailRule)
|
||||
component.editMailRule(mailRules[0] as MailRule)
|
||||
const editDialog = modal.componentInstance as MailRuleEditDialogComponent
|
||||
const toastErrorSpy = jest.spyOn(toastService, 'showError')
|
||||
const toastInfoSpy = jest.spyOn(toastService, 'showInfo')
|
||||
@ -220,7 +220,7 @@ describe('MailComponent', () => {
|
||||
completeSetup()
|
||||
let modal: NgbModalRef
|
||||
modalService.activeInstances.subscribe((refs) => (modal = refs[0]))
|
||||
component.deleteMailRule(mailRules[0] as PaperlessMailRule)
|
||||
component.deleteMailRule(mailRules[0] as MailRule)
|
||||
const deleteDialog = modal.componentInstance as ConfirmDialogComponent
|
||||
const deleteSpy = jest.spyOn(mailRuleService, 'delete')
|
||||
const toastErrorSpy = jest.spyOn(toastService, 'showError')
|
||||
@ -257,7 +257,7 @@ describe('MailComponent', () => {
|
||||
const toastErrorSpy = jest.spyOn(toastService, 'showError')
|
||||
const toastInfoSpy = jest.spyOn(toastService, 'showInfo')
|
||||
const rulePatchSpy = jest.spyOn(mailRuleService, 'patch')
|
||||
component.editPermissions(mailRules[0] as PaperlessMailRule)
|
||||
component.editPermissions(mailRules[0] as MailRule)
|
||||
expect(modal).not.toBeUndefined()
|
||||
let dialog = modal.componentInstance as PermissionsDialogComponent
|
||||
expect(dialog.object).toEqual(mailRules[0])
|
||||
@ -268,7 +268,7 @@ describe('MailComponent', () => {
|
||||
dialog.confirmClicked.emit(perms)
|
||||
expect(rulePatchSpy).toHaveBeenCalled()
|
||||
expect(toastErrorSpy).toHaveBeenCalled()
|
||||
rulePatchSpy.mockReturnValueOnce(of(mailRules[0] as PaperlessMailRule))
|
||||
rulePatchSpy.mockReturnValueOnce(of(mailRules[0] as MailRule))
|
||||
dialog.confirmClicked.emit(perms)
|
||||
expect(toastInfoSpy).toHaveBeenCalledWith('Permissions updated')
|
||||
|
||||
@ -293,7 +293,7 @@ describe('MailComponent', () => {
|
||||
let modal: NgbModalRef
|
||||
modalService.activeInstances.subscribe((refs) => (modal = refs[0]))
|
||||
const accountPatchSpy = jest.spyOn(mailAccountService, 'patch')
|
||||
component.editPermissions(mailAccounts[0] as PaperlessMailAccount)
|
||||
component.editPermissions(mailAccounts[0] as MailAccount)
|
||||
expect(modal).not.toBeUndefined()
|
||||
let dialog = modal.componentInstance as PermissionsDialogComponent
|
||||
expect(dialog.object).toEqual(mailAccounts[0])
|
||||
|
@ -2,8 +2,8 @@ import { Component, OnInit, OnDestroy } from '@angular/core'
|
||||
import { NgbModal } from '@ng-bootstrap/ng-bootstrap'
|
||||
import { Subject, first, takeUntil } from 'rxjs'
|
||||
import { ObjectWithPermissions } from 'src/app/data/object-with-permissions'
|
||||
import { PaperlessMailAccount } from 'src/app/data/paperless-mail-account'
|
||||
import { PaperlessMailRule } from 'src/app/data/paperless-mail-rule'
|
||||
import { MailAccount } from 'src/app/data/mail-account'
|
||||
import { MailRule } from 'src/app/data/mail-rule'
|
||||
import {
|
||||
PermissionsService,
|
||||
PermissionAction,
|
||||
@ -28,8 +28,8 @@ export class MailComponent
|
||||
extends ComponentWithPermissions
|
||||
implements OnInit, OnDestroy
|
||||
{
|
||||
mailAccounts: PaperlessMailAccount[] = []
|
||||
mailRules: PaperlessMailRule[] = []
|
||||
mailAccounts: MailAccount[] = []
|
||||
mailRules: MailRule[] = []
|
||||
|
||||
unsubscribeNotifier: Subject<any> = new Subject()
|
||||
|
||||
@ -76,7 +76,7 @@ export class MailComponent
|
||||
this.unsubscribeNotifier.next(true)
|
||||
}
|
||||
|
||||
editMailAccount(account: PaperlessMailAccount = null) {
|
||||
editMailAccount(account: MailAccount = null) {
|
||||
const modal = this.modalService.open(MailAccountEditDialogComponent, {
|
||||
backdrop: 'static',
|
||||
size: 'xl',
|
||||
@ -105,7 +105,7 @@ export class MailComponent
|
||||
})
|
||||
}
|
||||
|
||||
deleteMailAccount(account: PaperlessMailAccount) {
|
||||
deleteMailAccount(account: MailAccount) {
|
||||
const modal = this.modalService.open(ConfirmDialogComponent, {
|
||||
backdrop: 'static',
|
||||
})
|
||||
@ -137,7 +137,7 @@ export class MailComponent
|
||||
})
|
||||
}
|
||||
|
||||
editMailRule(rule: PaperlessMailRule = null) {
|
||||
editMailRule(rule: MailRule = null) {
|
||||
const modal = this.modalService.open(MailRuleEditDialogComponent, {
|
||||
backdrop: 'static',
|
||||
size: 'xl',
|
||||
@ -164,7 +164,7 @@ export class MailComponent
|
||||
})
|
||||
}
|
||||
|
||||
deleteMailRule(rule: PaperlessMailRule) {
|
||||
deleteMailRule(rule: MailRule) {
|
||||
const modal = this.modalService.open(ConfirmDialogComponent, {
|
||||
backdrop: 'static',
|
||||
})
|
||||
@ -193,7 +193,7 @@ export class MailComponent
|
||||
})
|
||||
}
|
||||
|
||||
editPermissions(object: PaperlessMailRule | PaperlessMailAccount) {
|
||||
editPermissions(object: MailRule | MailAccount) {
|
||||
const modal = this.modalService.open(PermissionsDialogComponent, {
|
||||
backdrop: 'static',
|
||||
})
|
||||
@ -202,9 +202,8 @@ export class MailComponent
|
||||
dialog.object = object
|
||||
modal.componentInstance.confirmClicked.subscribe((permissions) => {
|
||||
modal.componentInstance.buttonsEnabled = false
|
||||
const service: AbstractPaperlessService<
|
||||
PaperlessMailRule | PaperlessMailAccount
|
||||
> = 'account' in object ? this.mailRuleService : this.mailAccountService
|
||||
const service: AbstractPaperlessService<MailRule | MailAccount> =
|
||||
'account' in object ? this.mailRuleService : this.mailAccountService
|
||||
object.owner = permissions['owner']
|
||||
object['set_permissions'] = permissions['set_permissions']
|
||||
service.patch(object).subscribe({
|
||||
|
@ -15,7 +15,7 @@ import {
|
||||
NgbPaginationModule,
|
||||
} from '@ng-bootstrap/ng-bootstrap'
|
||||
import { of, throwError } from 'rxjs'
|
||||
import { PaperlessTag } from 'src/app/data/paperless-tag'
|
||||
import { Tag } from 'src/app/data/tag'
|
||||
import { IfPermissionsDirective } from 'src/app/directives/if-permissions.directive'
|
||||
import { SortableDirective } from 'src/app/directives/sortable.directive'
|
||||
import { SafeHtmlPipe } from 'src/app/pipes/safehtml.pipe'
|
||||
@ -37,7 +37,7 @@ import { MATCH_NONE } from 'src/app/data/matching-model'
|
||||
import { MATCH_LITERAL } from 'src/app/data/matching-model'
|
||||
import { PermissionsDialogComponent } from '../../common/permissions-dialog/permissions-dialog.component'
|
||||
|
||||
const tags: PaperlessTag[] = [
|
||||
const tags: Tag[] = [
|
||||
{
|
||||
id: 1,
|
||||
name: 'Tag1 Foo',
|
||||
@ -57,8 +57,8 @@ const tags: PaperlessTag[] = [
|
||||
]
|
||||
|
||||
describe('ManagementListComponent', () => {
|
||||
let component: ManagementListComponent<PaperlessTag>
|
||||
let fixture: ComponentFixture<ManagementListComponent<PaperlessTag>>
|
||||
let component: ManagementListComponent<Tag>
|
||||
let fixture: ComponentFixture<ManagementListComponent<Tag>>
|
||||
let tagService: TagService
|
||||
let modalService: NgbModal
|
||||
let toastService: ToastService
|
||||
@ -151,8 +151,7 @@ describe('ManagementListComponent', () => {
|
||||
createButton.triggerEventHandler('click')
|
||||
|
||||
expect(modal).not.toBeUndefined()
|
||||
const editDialog =
|
||||
modal.componentInstance as EditDialogComponent<PaperlessTag>
|
||||
const editDialog = modal.componentInstance as EditDialogComponent<Tag>
|
||||
|
||||
// fail first
|
||||
editDialog.failed.emit({ error: 'error creating item' })
|
||||
@ -176,8 +175,7 @@ describe('ManagementListComponent', () => {
|
||||
editButton.triggerEventHandler('click')
|
||||
|
||||
expect(modal).not.toBeUndefined()
|
||||
const editDialog =
|
||||
modal.componentInstance as EditDialogComponent<PaperlessTag>
|
||||
const editDialog = modal.componentInstance as EditDialogComponent<Tag>
|
||||
expect(editDialog.object).toEqual(tags[0])
|
||||
|
||||
// fail first
|
||||
|
@ -1,7 +1,7 @@
|
||||
import { Component } from '@angular/core'
|
||||
import { NgbModal } from '@ng-bootstrap/ng-bootstrap'
|
||||
import { FILTER_HAS_STORAGE_PATH_ANY } from 'src/app/data/filter-rule-type'
|
||||
import { PaperlessStoragePath } from 'src/app/data/paperless-storage-path'
|
||||
import { StoragePath } from 'src/app/data/storage-path'
|
||||
import { DocumentListViewService } from 'src/app/services/document-list-view.service'
|
||||
import {
|
||||
PermissionsService,
|
||||
@ -17,7 +17,7 @@ import { ManagementListComponent } from '../management-list/management-list.comp
|
||||
templateUrl: './../management-list/management-list.component.html',
|
||||
styleUrls: ['./../management-list/management-list.component.scss'],
|
||||
})
|
||||
export class StoragePathListComponent extends ManagementListComponent<PaperlessStoragePath> {
|
||||
export class StoragePathListComponent extends ManagementListComponent<StoragePath> {
|
||||
constructor(
|
||||
directoryService: StoragePathService,
|
||||
modalService: NgbModal,
|
||||
@ -40,7 +40,7 @@ export class StoragePathListComponent extends ManagementListComponent<PaperlessS
|
||||
{
|
||||
key: 'path',
|
||||
name: $localize`Path`,
|
||||
valueFn: (c: PaperlessStoragePath) => {
|
||||
valueFn: (c: StoragePath) => {
|
||||
return c.path
|
||||
},
|
||||
},
|
||||
@ -48,7 +48,7 @@ export class StoragePathListComponent extends ManagementListComponent<PaperlessS
|
||||
)
|
||||
}
|
||||
|
||||
getDeleteMessage(object: PaperlessStoragePath) {
|
||||
getDeleteMessage(object: StoragePath) {
|
||||
return $localize`Do you really want to delete the storage path "${object.name}"?`
|
||||
}
|
||||
}
|
||||
|
@ -1,7 +1,7 @@
|
||||
import { Component } from '@angular/core'
|
||||
import { NgbModal } from '@ng-bootstrap/ng-bootstrap'
|
||||
import { FILTER_HAS_TAGS_ALL } from 'src/app/data/filter-rule-type'
|
||||
import { PaperlessTag } from 'src/app/data/paperless-tag'
|
||||
import { Tag } from 'src/app/data/tag'
|
||||
import { DocumentListViewService } from 'src/app/services/document-list-view.service'
|
||||
import {
|
||||
PermissionsService,
|
||||
@ -17,7 +17,7 @@ import { ManagementListComponent } from '../management-list/management-list.comp
|
||||
templateUrl: './../management-list/management-list.component.html',
|
||||
styleUrls: ['./../management-list/management-list.component.scss'],
|
||||
})
|
||||
export class TagListComponent extends ManagementListComponent<PaperlessTag> {
|
||||
export class TagListComponent extends ManagementListComponent<Tag> {
|
||||
constructor(
|
||||
tagService: TagService,
|
||||
modalService: NgbModal,
|
||||
@ -41,7 +41,7 @@ export class TagListComponent extends ManagementListComponent<PaperlessTag> {
|
||||
key: 'color',
|
||||
name: $localize`Color`,
|
||||
rendersHtml: true,
|
||||
valueFn: (t: PaperlessTag) => {
|
||||
valueFn: (t: Tag) => {
|
||||
return `<span class="badge" style="color: ${t.text_color}; background-color: ${t.color}">${t.color}</span>`
|
||||
},
|
||||
},
|
||||
@ -49,7 +49,7 @@ export class TagListComponent extends ManagementListComponent<PaperlessTag> {
|
||||
)
|
||||
}
|
||||
|
||||
getDeleteMessage(object: PaperlessTag) {
|
||||
getDeleteMessage(object: Tag) {
|
||||
return $localize`Do you really want to delete the tag "${object.name}"?`
|
||||
}
|
||||
}
|
||||
|
43
src-ui/src/app/data/consumption-template.ts
Normal file
43
src-ui/src/app/data/consumption-template.ts
Normal file
@ -0,0 +1,43 @@
|
||||
import { ObjectWithId } from './object-with-id'
|
||||
|
||||
export enum DocumentSource {
|
||||
ConsumeFolder = 1,
|
||||
ApiUpload = 2,
|
||||
MailFetch = 3,
|
||||
}
|
||||
|
||||
export interface ConsumptionTemplate extends ObjectWithId {
|
||||
name: string
|
||||
|
||||
order: number
|
||||
|
||||
sources: DocumentSource[]
|
||||
|
||||
filter_filename: string
|
||||
|
||||
filter_path?: string
|
||||
|
||||
filter_mailrule?: number // MailRule.id
|
||||
|
||||
assign_title?: string
|
||||
|
||||
assign_tags?: number[] // Tag.id
|
||||
|
||||
assign_document_type?: number // DocumentType.id
|
||||
|
||||
assign_correspondent?: number // Correspondent.id
|
||||
|
||||
assign_storage_path?: number // StoragePath.id
|
||||
|
||||
assign_owner?: number // User.id
|
||||
|
||||
assign_view_users?: number[] // [User.id]
|
||||
|
||||
assign_view_groups?: number[] // [Group.id]
|
||||
|
||||
assign_change_users?: number[] // [User.id]
|
||||
|
||||
assign_change_groups?: number[] // [Group.id]
|
||||
|
||||
assign_custom_fields?: number[] // [CustomField.id]
|
||||
}
|
@ -1,5 +1,5 @@
|
||||
import { MatchingModel } from './matching-model'
|
||||
|
||||
export interface PaperlessCorrespondent extends MatchingModel {
|
||||
export interface Correspondent extends MatchingModel {
|
||||
last_correspondence?: string // Date
|
||||
}
|
8
src-ui/src/app/data/custom-field-instance.ts
Normal file
8
src-ui/src/app/data/custom-field-instance.ts
Normal file
@ -0,0 +1,8 @@
|
||||
import { ObjectWithId } from './object-with-id'
|
||||
|
||||
export interface CustomFieldInstance extends ObjectWithId {
|
||||
document: number // Document
|
||||
field: number // CustomField
|
||||
created: Date
|
||||
value?: any
|
||||
}
|
@ -1,6 +1,6 @@
|
||||
import { ObjectWithId } from './object-with-id'
|
||||
|
||||
export enum PaperlessCustomFieldDataType {
|
||||
export enum CustomFieldDataType {
|
||||
String = 'string',
|
||||
Url = 'url',
|
||||
Date = 'date',
|
||||
@ -13,41 +13,41 @@ export enum PaperlessCustomFieldDataType {
|
||||
|
||||
export const DATA_TYPE_LABELS = [
|
||||
{
|
||||
id: PaperlessCustomFieldDataType.Boolean,
|
||||
id: CustomFieldDataType.Boolean,
|
||||
name: $localize`Boolean`,
|
||||
},
|
||||
{
|
||||
id: PaperlessCustomFieldDataType.Date,
|
||||
id: CustomFieldDataType.Date,
|
||||
name: $localize`Date`,
|
||||
},
|
||||
{
|
||||
id: PaperlessCustomFieldDataType.Integer,
|
||||
id: CustomFieldDataType.Integer,
|
||||
name: $localize`Integer`,
|
||||
},
|
||||
{
|
||||
id: PaperlessCustomFieldDataType.Float,
|
||||
id: CustomFieldDataType.Float,
|
||||
name: $localize`Number`,
|
||||
},
|
||||
{
|
||||
id: PaperlessCustomFieldDataType.Monetary,
|
||||
id: CustomFieldDataType.Monetary,
|
||||
name: $localize`Monetary`,
|
||||
},
|
||||
{
|
||||
id: PaperlessCustomFieldDataType.String,
|
||||
id: CustomFieldDataType.String,
|
||||
name: $localize`Text`,
|
||||
},
|
||||
{
|
||||
id: PaperlessCustomFieldDataType.Url,
|
||||
id: CustomFieldDataType.Url,
|
||||
name: $localize`Url`,
|
||||
},
|
||||
{
|
||||
id: PaperlessCustomFieldDataType.DocumentLink,
|
||||
id: CustomFieldDataType.DocumentLink,
|
||||
name: $localize`Document Link`,
|
||||
},
|
||||
]
|
||||
|
||||
export interface PaperlessCustomField extends ObjectWithId {
|
||||
data_type: PaperlessCustomFieldDataType
|
||||
export interface CustomField extends ObjectWithId {
|
||||
data_type: CustomFieldDataType
|
||||
name: string
|
||||
created?: Date
|
||||
}
|
@ -1,4 +1,4 @@
|
||||
export interface PaperlessDocumentMetadata {
|
||||
export interface DocumentMetadata {
|
||||
original_checksum?: string
|
||||
|
||||
archived_checksum?: string
|
7
src-ui/src/app/data/document-note.ts
Normal file
7
src-ui/src/app/data/document-note.ts
Normal file
@ -0,0 +1,7 @@
|
||||
import { ObjectWithId } from './object-with-id'
|
||||
|
||||
export interface DocumentNote extends ObjectWithId {
|
||||
created?: Date
|
||||
note?: string
|
||||
user?: number // User
|
||||
}
|
@ -1,4 +1,4 @@
|
||||
export interface PaperlessDocumentSuggestions {
|
||||
export interface DocumentSuggestions {
|
||||
tags?: number[]
|
||||
|
||||
correspondents?: number[]
|
3
src-ui/src/app/data/document-type.ts
Normal file
3
src-ui/src/app/data/document-type.ts
Normal file
@ -0,0 +1,3 @@
|
||||
import { MatchingModel } from './matching-model'
|
||||
|
||||
export interface DocumentType extends MatchingModel {}
|
66
src-ui/src/app/data/document.ts
Normal file
66
src-ui/src/app/data/document.ts
Normal file
@ -0,0 +1,66 @@
|
||||
import { Correspondent } from './correspondent'
|
||||
import { Tag } from './tag'
|
||||
import { DocumentType } from './document-type'
|
||||
import { Observable } from 'rxjs'
|
||||
import { StoragePath } from './storage-path'
|
||||
import { ObjectWithPermissions } from './object-with-permissions'
|
||||
import { DocumentNote } from './document-note'
|
||||
import { CustomFieldInstance } from './custom-field-instance'
|
||||
|
||||
export interface SearchHit {
|
||||
score?: number
|
||||
rank?: number
|
||||
|
||||
highlights?: string
|
||||
note_highlights?: string
|
||||
}
|
||||
|
||||
export interface Document extends ObjectWithPermissions {
|
||||
correspondent$?: Observable<Correspondent>
|
||||
|
||||
correspondent?: number
|
||||
|
||||
document_type$?: Observable<DocumentType>
|
||||
|
||||
document_type?: number
|
||||
|
||||
storage_path$?: Observable<StoragePath>
|
||||
|
||||
storage_path?: number
|
||||
|
||||
title?: string
|
||||
|
||||
content?: string
|
||||
|
||||
tags$?: Observable<Tag[]>
|
||||
|
||||
tags?: number[]
|
||||
|
||||
checksum?: string
|
||||
|
||||
// UTC
|
||||
created?: Date
|
||||
|
||||
// localized date
|
||||
created_date?: Date
|
||||
|
||||
modified?: Date
|
||||
|
||||
added?: Date
|
||||
|
||||
original_file_name?: string
|
||||
|
||||
archived_file_name?: string
|
||||
|
||||
download_url?: string
|
||||
|
||||
thumbnail_url?: string
|
||||
|
||||
archive_serial_number?: number
|
||||
|
||||
notes?: DocumentNote[]
|
||||
|
||||
__search_hit__?: SearchHit
|
||||
|
||||
custom_fields?: CustomFieldInstance[]
|
||||
}
|
@ -1,6 +1,6 @@
|
||||
import { ObjectWithId } from './object-with-id'
|
||||
|
||||
export interface PaperlessGroup extends ObjectWithId {
|
||||
export interface Group extends ObjectWithId {
|
||||
name?: string
|
||||
|
||||
user_count?: number // not implemented yet
|
@ -6,7 +6,7 @@ export enum IMAPSecurity {
|
||||
STARTTLS = 3,
|
||||
}
|
||||
|
||||
export interface PaperlessMailAccount extends ObjectWithPermissions {
|
||||
export interface MailAccount extends ObjectWithPermissions {
|
||||
name: string
|
||||
|
||||
imap_server: string
|
@ -32,7 +32,7 @@ export enum MailMetadataCorrespondentOption {
|
||||
FromCustom = 4,
|
||||
}
|
||||
|
||||
export interface PaperlessMailRule extends ObjectWithPermissions {
|
||||
export interface MailRule extends ObjectWithPermissions {
|
||||
name: string
|
||||
|
||||
account: number // PaperlessMailAccount.id
|
@ -1,43 +0,0 @@
|
||||
import { ObjectWithId } from './object-with-id'
|
||||
|
||||
export enum DocumentSource {
|
||||
ConsumeFolder = 1,
|
||||
ApiUpload = 2,
|
||||
MailFetch = 3,
|
||||
}
|
||||
|
||||
export interface PaperlessConsumptionTemplate extends ObjectWithId {
|
||||
name: string
|
||||
|
||||
order: number
|
||||
|
||||
sources: DocumentSource[]
|
||||
|
||||
filter_filename: string
|
||||
|
||||
filter_path?: string
|
||||
|
||||
filter_mailrule?: number // PaperlessMailRule.id
|
||||
|
||||
assign_title?: string
|
||||
|
||||
assign_tags?: number[] // PaperlessTag.id
|
||||
|
||||
assign_document_type?: number // PaperlessDocumentType.id
|
||||
|
||||
assign_correspondent?: number // PaperlessCorrespondent.id
|
||||
|
||||
assign_storage_path?: number // PaperlessStoragePath.id
|
||||
|
||||
assign_owner?: number // PaperlessUser.id
|
||||
|
||||
assign_view_users?: number[] // [PaperlessUser.id]
|
||||
|
||||
assign_view_groups?: number[] // [PaperlessGroup.id]
|
||||
|
||||
assign_change_users?: number[] // [PaperlessUser.id]
|
||||
|
||||
assign_change_groups?: number[] // [PaperlessGroup.id]
|
||||
|
||||
assign_custom_fields?: number[] // [PaperlessCustomField.id]
|
||||
}
|
@ -1,9 +0,0 @@
|
||||
import { ObjectWithId } from './object-with-id'
|
||||
import { PaperlessCustomField } from './paperless-custom-field'
|
||||
|
||||
export interface PaperlessCustomFieldInstance extends ObjectWithId {
|
||||
document: number // PaperlessDocument
|
||||
field: number // PaperlessCustomField
|
||||
created: Date
|
||||
value?: any
|
||||
}
|
@ -1,7 +0,0 @@
|
||||
import { ObjectWithId } from './object-with-id'
|
||||
|
||||
export interface PaperlessDocumentNote extends ObjectWithId {
|
||||
created?: Date
|
||||
note?: string
|
||||
user?: number // PaperlessUser
|
||||
}
|
@ -1,3 +0,0 @@
|
||||
import { MatchingModel } from './matching-model'
|
||||
|
||||
export interface PaperlessDocumentType extends MatchingModel {}
|
@ -1,66 +0,0 @@
|
||||
import { PaperlessCorrespondent } from './paperless-correspondent'
|
||||
import { PaperlessTag } from './paperless-tag'
|
||||
import { PaperlessDocumentType } from './paperless-document-type'
|
||||
import { Observable } from 'rxjs'
|
||||
import { PaperlessStoragePath } from './paperless-storage-path'
|
||||
import { ObjectWithPermissions } from './object-with-permissions'
|
||||
import { PaperlessDocumentNote } from './paperless-document-note'
|
||||
import { PaperlessCustomFieldInstance } from './paperless-custom-field-instance'
|
||||
|
||||
export interface SearchHit {
|
||||
score?: number
|
||||
rank?: number
|
||||
|
||||
highlights?: string
|
||||
note_highlights?: string
|
||||
}
|
||||
|
||||
export interface PaperlessDocument extends ObjectWithPermissions {
|
||||
correspondent$?: Observable<PaperlessCorrespondent>
|
||||
|
||||
correspondent?: number
|
||||
|
||||
document_type$?: Observable<PaperlessDocumentType>
|
||||
|
||||
document_type?: number
|
||||
|
||||
storage_path$?: Observable<PaperlessStoragePath>
|
||||
|
||||
storage_path?: number
|
||||
|
||||
title?: string
|
||||
|
||||
content?: string
|
||||
|
||||
tags$?: Observable<PaperlessTag[]>
|
||||
|
||||
tags?: number[]
|
||||
|
||||
checksum?: string
|
||||
|
||||
// UTC
|
||||
created?: Date
|
||||
|
||||
// localized date
|
||||
created_date?: Date
|
||||
|
||||
modified?: Date
|
||||
|
||||
added?: Date
|
||||
|
||||
original_file_name?: string
|
||||
|
||||
archived_file_name?: string
|
||||
|
||||
download_url?: string
|
||||
|
||||
thumbnail_url?: string
|
||||
|
||||
archive_serial_number?: number
|
||||
|
||||
notes?: PaperlessDocumentNote[]
|
||||
|
||||
__search_hit__?: SearchHit
|
||||
|
||||
custom_fields?: PaperlessCustomFieldInstance[]
|
||||
}
|
@ -1,7 +1,7 @@
|
||||
import { FilterRule } from './filter-rule'
|
||||
import { ObjectWithPermissions } from './object-with-permissions'
|
||||
|
||||
export interface PaperlessSavedView extends ObjectWithPermissions {
|
||||
export interface SavedView extends ObjectWithPermissions {
|
||||
name?: string
|
||||
|
||||
show_on_dashboard?: boolean
|
@ -1,18 +1,18 @@
|
||||
import { ObjectWithPermissions } from './object-with-permissions'
|
||||
|
||||
export enum PaperlessFileVersion {
|
||||
export enum FileVersion {
|
||||
Archive = 'archive',
|
||||
Original = 'original',
|
||||
}
|
||||
|
||||
export interface PaperlessShareLink extends ObjectWithPermissions {
|
||||
export interface ShareLink extends ObjectWithPermissions {
|
||||
created: string // Date
|
||||
|
||||
expiration?: string // Date
|
||||
|
||||
slug: string
|
||||
|
||||
document: number // PaperlessDocument
|
||||
document: number // Document
|
||||
|
||||
file_version: string
|
||||
}
|
@ -1,5 +1,5 @@
|
||||
import { MatchingModel } from './matching-model'
|
||||
|
||||
export interface PaperlessStoragePath extends MatchingModel {
|
||||
export interface StoragePath extends MatchingModel {
|
||||
path?: string
|
||||
}
|
@ -1,6 +1,6 @@
|
||||
import { MatchingModel } from './matching-model'
|
||||
|
||||
export interface PaperlessTag extends MatchingModel {
|
||||
export interface Tag extends MatchingModel {
|
||||
color?: string
|
||||
|
||||
text_color?: string
|
@ -1,12 +1,12 @@
|
||||
import { PaperlessUser } from './paperless-user'
|
||||
import { User } from './user'
|
||||
|
||||
export interface PaperlessUiSettings {
|
||||
user: PaperlessUser
|
||||
export interface UiSettings {
|
||||
user: User
|
||||
settings: Object
|
||||
permissions: string[]
|
||||
}
|
||||
|
||||
export interface PaperlessUiSetting {
|
||||
export interface UiSetting {
|
||||
key: string
|
||||
type: string
|
||||
default: any
|
||||
@ -53,7 +53,7 @@ export const SETTINGS_KEYS = {
|
||||
DEFAULT_PERMS_EDIT_GROUPS: 'general-settings:permissions:default-edit-groups',
|
||||
}
|
||||
|
||||
export const SETTINGS: PaperlessUiSetting[] = [
|
||||
export const SETTINGS: UiSetting[] = [
|
||||
{
|
||||
key: SETTINGS_KEYS.LANGUAGE,
|
||||
type: 'string',
|
@ -1,6 +1,6 @@
|
||||
import { ObjectWithId } from './object-with-id'
|
||||
|
||||
export interface PaperlessUser extends ObjectWithId {
|
||||
export interface User extends ObjectWithId {
|
||||
username?: string
|
||||
first_name?: string
|
||||
last_name?: string
|
||||
@ -8,7 +8,7 @@ export interface PaperlessUser extends ObjectWithId {
|
||||
is_staff?: boolean
|
||||
is_active?: boolean
|
||||
is_superuser?: boolean
|
||||
groups?: number[] // PaperlessGroup[]
|
||||
groups?: number[] // Group[]
|
||||
user_permissions?: string[]
|
||||
inherited_permissions?: string[]
|
||||
}
|
@ -4,7 +4,7 @@ import { DocumentListComponent } from '../components/document-list/document-list
|
||||
import { NgbModal } from '@ng-bootstrap/ng-bootstrap'
|
||||
import { ConfirmDialogComponent } from '../components/common/confirm-dialog/confirm-dialog.component'
|
||||
import { SettingsService } from '../services/settings.service'
|
||||
import { SETTINGS_KEYS } from '../data/paperless-uisettings'
|
||||
import { SETTINGS_KEYS } from '../data/ui-settings'
|
||||
|
||||
@Injectable()
|
||||
export class DirtySavedViewGuard {
|
||||
|
@ -1,6 +1,6 @@
|
||||
import { DatePipe } from '@angular/common'
|
||||
import { Inject, LOCALE_ID, Pipe, PipeTransform } from '@angular/core'
|
||||
import { SETTINGS_KEYS } from '../data/paperless-uisettings'
|
||||
import { SETTINGS_KEYS } from '../data/ui-settings'
|
||||
import { SettingsService } from '../services/settings.service'
|
||||
|
||||
const FORMAT_TO_ISO_FORMAT = {
|
||||
|
@ -5,13 +5,13 @@ import {
|
||||
PermissionType,
|
||||
PermissionsService,
|
||||
} from '../services/permissions.service'
|
||||
import { PaperlessUser } from '../data/paperless-user'
|
||||
import { User } from '../data/user'
|
||||
|
||||
@Pipe({
|
||||
name: 'username',
|
||||
})
|
||||
export class UsernamePipe implements PipeTransform {
|
||||
users: PaperlessUser[]
|
||||
users: User[]
|
||||
|
||||
constructor(
|
||||
permissionsService: PermissionsService,
|
||||
@ -33,7 +33,7 @@ export class UsernamePipe implements PipeTransform {
|
||||
: $localize`Shared`
|
||||
}
|
||||
|
||||
getName(user: PaperlessUser): string {
|
||||
getName(user: User): string {
|
||||
if (!user) return ''
|
||||
const name = [user.first_name, user.last_name].join(' ')
|
||||
if (name.length > 1) return name.trim()
|
||||
|
@ -12,13 +12,13 @@ import {
|
||||
FILTER_HAS_TAGS_ALL,
|
||||
FILTER_HAS_TAGS_ANY,
|
||||
} from '../data/filter-rule-type'
|
||||
import { PaperlessSavedView } from '../data/paperless-saved-view'
|
||||
import { SavedView } from '../data/saved-view'
|
||||
import { FilterRule } from '../data/filter-rule'
|
||||
import { RouterTestingModule } from '@angular/router/testing'
|
||||
import { routes } from 'src/app/app-routing.module'
|
||||
import { PermissionsGuard } from '../guards/permissions.guard'
|
||||
import { SettingsService } from './settings.service'
|
||||
import { SETTINGS_KEYS } from '../data/paperless-uisettings'
|
||||
import { SETTINGS_KEYS } from '../data/ui-settings'
|
||||
|
||||
const documents = [
|
||||
{
|
||||
@ -69,7 +69,7 @@ const filterRules: FilterRule[] = [
|
||||
},
|
||||
]
|
||||
|
||||
const view: PaperlessSavedView = {
|
||||
const view: SavedView = {
|
||||
id: 3,
|
||||
name: 'Saved View',
|
||||
sort_field: 'added',
|
||||
|
@ -7,9 +7,9 @@ import {
|
||||
cloneFilterRules,
|
||||
isFullTextFilterRule,
|
||||
} from '../utils/filter-rules'
|
||||
import { PaperlessDocument } from '../data/paperless-document'
|
||||
import { PaperlessSavedView } from '../data/paperless-saved-view'
|
||||
import { SETTINGS_KEYS } from '../data/paperless-uisettings'
|
||||
import { Document } from '../data/document'
|
||||
import { SavedView } from '../data/saved-view'
|
||||
import { SETTINGS_KEYS } from '../data/ui-settings'
|
||||
import { DOCUMENT_LIST_SERVICE } from '../data/storage-keys'
|
||||
import { paramsFromViewState, paramsToViewState } from '../utils/query-params'
|
||||
import {
|
||||
@ -31,7 +31,7 @@ export interface ListViewState {
|
||||
/**
|
||||
* Current paginated list of documents displayed.
|
||||
*/
|
||||
documents?: PaperlessDocument[]
|
||||
documents?: Document[]
|
||||
|
||||
currentPage: number
|
||||
|
||||
@ -149,7 +149,7 @@ export class DocumentListViewService {
|
||||
this.unsubscribeNotifier.next(true)
|
||||
}
|
||||
|
||||
activateSavedView(view: PaperlessSavedView) {
|
||||
activateSavedView(view: SavedView) {
|
||||
this.rangeSelectionAnchorIndex = this.lastRangeSelectionToIndex = null
|
||||
if (view) {
|
||||
this._activeSavedViewId = view.id
|
||||
@ -159,16 +159,13 @@ export class DocumentListViewService {
|
||||
}
|
||||
}
|
||||
|
||||
activateSavedViewWithQueryParams(
|
||||
view: PaperlessSavedView,
|
||||
queryParams: ParamMap
|
||||
) {
|
||||
activateSavedViewWithQueryParams(view: SavedView, queryParams: ParamMap) {
|
||||
const viewState = paramsToViewState(queryParams)
|
||||
this.activateSavedView(view)
|
||||
this.currentPage = viewState.currentPage
|
||||
}
|
||||
|
||||
loadSavedView(view: PaperlessSavedView, closeCurrentView: boolean = false) {
|
||||
loadSavedView(view: SavedView, closeCurrentView: boolean = false) {
|
||||
if (closeCurrentView) {
|
||||
this._activeSavedViewId = null
|
||||
}
|
||||
@ -350,7 +347,7 @@ export class DocumentListViewService {
|
||||
this.saveDocumentListView()
|
||||
}
|
||||
|
||||
get documents(): PaperlessDocument[] {
|
||||
get documents(): Document[] {
|
||||
return this.activeListViewState.documents
|
||||
}
|
||||
|
||||
@ -494,18 +491,18 @@ export class DocumentListViewService {
|
||||
})
|
||||
}
|
||||
|
||||
isSelected(d: PaperlessDocument) {
|
||||
isSelected(d: Document) {
|
||||
return this.selected.has(d.id)
|
||||
}
|
||||
|
||||
toggleSelected(d: PaperlessDocument): void {
|
||||
toggleSelected(d: Document): void {
|
||||
if (this.selected.has(d.id)) this.selected.delete(d.id)
|
||||
else this.selected.add(d.id)
|
||||
this.rangeSelectionAnchorIndex = this.documentIndexInCurrentView(d.id)
|
||||
this.lastRangeSelectionToIndex = null
|
||||
}
|
||||
|
||||
selectRangeTo(d: PaperlessDocument) {
|
||||
selectRangeTo(d: Document) {
|
||||
if (this.rangeSelectionAnchorIndex !== null) {
|
||||
const documentToIndex = this.documentIndexInCurrentView(d.id)
|
||||
const fromIndex = Math.min(
|
||||
|
@ -1,5 +1,5 @@
|
||||
import { Injectable } from '@angular/core'
|
||||
import { PaperlessDocument } from '../data/paperless-document'
|
||||
import { Document } from '../data/document'
|
||||
import { OPEN_DOCUMENT_SERVICE } from '../data/storage-keys'
|
||||
import { DocumentService } from './rest/document.service'
|
||||
import { NgbModal } from '@ng-bootstrap/ng-bootstrap'
|
||||
@ -29,7 +29,7 @@ export class OpenDocumentsService {
|
||||
}
|
||||
}
|
||||
|
||||
private openDocuments: PaperlessDocument[] = []
|
||||
private openDocuments: Document[] = []
|
||||
private dirtyDocuments: Set<number> = new Set<number>()
|
||||
|
||||
refreshDocument(id: number) {
|
||||
@ -48,15 +48,15 @@ export class OpenDocumentsService {
|
||||
}
|
||||
}
|
||||
|
||||
getOpenDocuments(): PaperlessDocument[] {
|
||||
getOpenDocuments(): Document[] {
|
||||
return this.openDocuments
|
||||
}
|
||||
|
||||
getOpenDocument(id: number): PaperlessDocument {
|
||||
getOpenDocument(id: number): Document {
|
||||
return this.openDocuments.find((d) => d.id == id)
|
||||
}
|
||||
|
||||
openDocument(doc: PaperlessDocument): Observable<boolean> {
|
||||
openDocument(doc: Document): Observable<boolean> {
|
||||
if (this.openDocuments.find((d) => d.id == doc.id) == null) {
|
||||
if (this.openDocuments.length == this.MAX_OPEN_DOCUMENTS) {
|
||||
// at max, ensure changes arent lost
|
||||
@ -74,13 +74,13 @@ export class OpenDocumentsService {
|
||||
return of(true)
|
||||
}
|
||||
|
||||
private finishOpenDocument(doc: PaperlessDocument) {
|
||||
private finishOpenDocument(doc: Document) {
|
||||
this.openDocuments.unshift(doc)
|
||||
this.dirtyDocuments.delete(doc.id)
|
||||
this.save()
|
||||
}
|
||||
|
||||
setDirty(doc: PaperlessDocument, dirty: boolean) {
|
||||
setDirty(doc: Document, dirty: boolean) {
|
||||
if (!this.openDocuments.find((d) => d.id == doc.id)) return
|
||||
if (dirty) this.dirtyDocuments.add(doc.id)
|
||||
else this.dirtyDocuments.delete(doc.id)
|
||||
@ -90,7 +90,7 @@ export class OpenDocumentsService {
|
||||
return this.dirtyDocuments.size > 0
|
||||
}
|
||||
|
||||
closeDocument(doc: PaperlessDocument): Observable<boolean> {
|
||||
closeDocument(doc: Document): Observable<boolean> {
|
||||
let index = this.openDocuments.findIndex((d) => d.id == doc.id)
|
||||
if (index == -1) return of(true)
|
||||
if (!this.dirtyDocuments.has(doc.id)) {
|
||||
|
@ -4,27 +4,27 @@ import {
|
||||
PermissionType,
|
||||
PermissionsService,
|
||||
} from './permissions.service'
|
||||
import { PaperlessDocument } from '../data/paperless-document'
|
||||
import { Document } from '../data/document'
|
||||
|
||||
describe('PermissionsService', () => {
|
||||
let permissionsService: PermissionsService
|
||||
|
||||
const docUnowned: PaperlessDocument = {
|
||||
const docUnowned: Document = {
|
||||
title: 'Doc title',
|
||||
owner: null,
|
||||
}
|
||||
|
||||
const docOwned: PaperlessDocument = {
|
||||
const docOwned: Document = {
|
||||
title: 'Doc title 2',
|
||||
owner: 1,
|
||||
}
|
||||
|
||||
const docNotOwned: PaperlessDocument = {
|
||||
const docNotOwned: Document = {
|
||||
title: 'Doc title 3',
|
||||
owner: 2,
|
||||
}
|
||||
|
||||
const docUserViewGranted: PaperlessDocument = {
|
||||
const docUserViewGranted: Document = {
|
||||
title: 'Doc title 4',
|
||||
owner: 2,
|
||||
permissions: {
|
||||
@ -39,7 +39,7 @@ describe('PermissionsService', () => {
|
||||
},
|
||||
}
|
||||
|
||||
const docUserEditGranted: PaperlessDocument = {
|
||||
const docUserEditGranted: Document = {
|
||||
title: 'Doc title 5',
|
||||
owner: 2,
|
||||
permissions: {
|
||||
@ -54,7 +54,7 @@ describe('PermissionsService', () => {
|
||||
},
|
||||
}
|
||||
|
||||
const docGroupViewGranted: PaperlessDocument = {
|
||||
const docGroupViewGranted: Document = {
|
||||
title: 'Doc title 4',
|
||||
owner: 2,
|
||||
permissions: {
|
||||
@ -69,7 +69,7 @@ describe('PermissionsService', () => {
|
||||
},
|
||||
}
|
||||
|
||||
const docGroupEditGranted: PaperlessDocument = {
|
||||
const docGroupEditGranted: Document = {
|
||||
title: 'Doc title 5',
|
||||
owner: 2,
|
||||
permissions: {
|
||||
|
@ -1,6 +1,6 @@
|
||||
import { Injectable } from '@angular/core'
|
||||
import { ObjectWithPermissions } from '../data/object-with-permissions'
|
||||
import { PaperlessUser } from '../data/paperless-user'
|
||||
import { User } from '../data/user'
|
||||
|
||||
export enum PermissionAction {
|
||||
Add = 'add',
|
||||
@ -34,9 +34,9 @@ export enum PermissionType {
|
||||
})
|
||||
export class PermissionsService {
|
||||
private permissions: string[]
|
||||
private currentUser: PaperlessUser
|
||||
private currentUser: User
|
||||
|
||||
public initialize(permissions: string[], currentUser: PaperlessUser) {
|
||||
public initialize(permissions: string[], currentUser: User) {
|
||||
this.permissions = permissions
|
||||
this.currentUser = currentUser
|
||||
}
|
||||
|
@ -6,13 +6,13 @@ import { commonAbstractPaperlessServiceTests } from './abstract-paperless-servic
|
||||
import { ConsumptionTemplateService } from './consumption-template.service'
|
||||
import {
|
||||
DocumentSource,
|
||||
PaperlessConsumptionTemplate,
|
||||
} from 'src/app/data/paperless-consumption-template'
|
||||
ConsumptionTemplate,
|
||||
} from 'src/app/data/consumption-template'
|
||||
|
||||
let httpTestingController: HttpTestingController
|
||||
let service: ConsumptionTemplateService
|
||||
const endpoint = 'consumption_templates'
|
||||
const templates: PaperlessConsumptionTemplate[] = [
|
||||
const templates: ConsumptionTemplate[] = [
|
||||
{
|
||||
name: 'Template 1',
|
||||
id: 1,
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
x
Reference in New Issue
Block a user