mirror of
https://github.com/paperless-ngx/paperless-ngx.git
synced 2025-09-16 21:55:37 -05:00
Merge branch 'dev' into feature-improve-paperless-task
This commit is contained in:
@@ -71,6 +71,10 @@ export const DOCUMENT_SOURCE_OPTIONS = [
|
||||
id: DocumentSource.MailFetch,
|
||||
name: $localize`Mail Fetch`,
|
||||
},
|
||||
{
|
||||
id: DocumentSource.WebUI,
|
||||
name: $localize`Web UI`,
|
||||
},
|
||||
]
|
||||
|
||||
export const SCHEDULE_DATE_FIELD_OPTIONS = [
|
||||
|
@@ -145,7 +145,10 @@ export class SavedViewWidgetComponent
|
||||
})
|
||||
}
|
||||
|
||||
if (this.savedView.display_fields) {
|
||||
if (
|
||||
this.savedView.display_fields &&
|
||||
this.savedView.display_fields.length > 0
|
||||
) {
|
||||
this.displayFields = this.savedView.display_fields
|
||||
}
|
||||
|
||||
|
@@ -4,6 +4,7 @@ export enum DocumentSource {
|
||||
ConsumeFolder = 1,
|
||||
ApiUpload = 2,
|
||||
MailFetch = 3,
|
||||
WebUI = 4,
|
||||
}
|
||||
|
||||
export enum WorkflowTriggerType {
|
||||
|
@@ -114,6 +114,48 @@ describe(`Additional service tests for SavedViewService`, () => {
|
||||
])
|
||||
})
|
||||
|
||||
it('should treat empty display_fields as null', () => {
|
||||
subscription = service
|
||||
.patch({
|
||||
id: 1,
|
||||
name: 'Saved View',
|
||||
show_on_dashboard: true,
|
||||
show_in_sidebar: true,
|
||||
sort_field: 'name',
|
||||
sort_reverse: true,
|
||||
filter_rules: [],
|
||||
display_fields: [],
|
||||
})
|
||||
.subscribe()
|
||||
const req = httpTestingController.expectOne(
|
||||
`${environment.apiBaseUrl}${endpoint}/1/`
|
||||
)
|
||||
expect(req.request.body.display_fields).toBeNull()
|
||||
})
|
||||
|
||||
it('should support patch without reload', () => {
|
||||
subscription = service
|
||||
.patch(
|
||||
{
|
||||
id: 1,
|
||||
name: 'Saved View',
|
||||
show_on_dashboard: true,
|
||||
show_in_sidebar: true,
|
||||
sort_field: 'name',
|
||||
sort_reverse: true,
|
||||
filter_rules: [],
|
||||
},
|
||||
false
|
||||
)
|
||||
.subscribe()
|
||||
const req = httpTestingController.expectOne(
|
||||
`${environment.apiBaseUrl}${endpoint}/1/`
|
||||
)
|
||||
expect(req.request.method).toEqual('PATCH')
|
||||
req.flush({})
|
||||
httpTestingController.verify() // no reload
|
||||
})
|
||||
|
||||
beforeEach(() => {
|
||||
// Dont need to setup again
|
||||
|
||||
|
@@ -87,12 +87,21 @@ export class SavedViewService extends AbstractPaperlessService<SavedView> {
|
||||
return super.create(o).pipe(tap(() => this.reload()))
|
||||
}
|
||||
|
||||
update(o: SavedView) {
|
||||
return super.update(o).pipe(tap(() => this.reload()))
|
||||
patch(o: SavedView, reload: boolean = false): Observable<SavedView> {
|
||||
if (o.display_fields?.length === 0) {
|
||||
o.display_fields = null
|
||||
}
|
||||
return super.patch(o).pipe(
|
||||
tap(() => {
|
||||
if (reload) {
|
||||
this.reload()
|
||||
}
|
||||
})
|
||||
)
|
||||
}
|
||||
|
||||
patchMany(objects: SavedView[]): Observable<SavedView[]> {
|
||||
return combineLatest(objects.map((o) => super.patch(o))).pipe(
|
||||
return combineLatest(objects.map((o) => this.patch(o, false))).pipe(
|
||||
tap(() => this.reload())
|
||||
)
|
||||
}
|
||||
|
@@ -37,6 +37,7 @@ export class UploadDocumentsService {
|
||||
private uploadFile(file: File) {
|
||||
let formData = new FormData()
|
||||
formData.append('document', file, file.name)
|
||||
formData.append('from_webui', 'true')
|
||||
let status = this.websocketStatusService.newFileUpload(file.name)
|
||||
|
||||
status.message = $localize`Connecting...`
|
||||
|
Reference in New Issue
Block a user