mirror of
https://github.com/paperless-ngx/paperless-ngx.git
synced 2026-11-21 20:15:29 +00:00
Compare commits
2
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
b901689e69 | ||
|
|
4973be8499 |
No files matched your search
@@ -227,12 +227,6 @@
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row">
|
||||
<div class="col">
|
||||
<pngx-input-check i18n-title title="Show nested tags with their parents" i18n-hint hint="Child tags are shown together with their parent tags, instead of separately." formControlName="tagsShowHierarchy"></pngx-input-check>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<h5 class="mt-3" i18n>Document editing</h5>
|
||||
<div class="row">
|
||||
<div class="col">
|
||||
|
||||
@@ -305,7 +305,7 @@ describe('SettingsComponent', () => {
|
||||
expect(toastErrorSpy).toHaveBeenCalled()
|
||||
expect(storeSpy).toHaveBeenCalled()
|
||||
expect(appearanceSettingsSpy).not.toHaveBeenCalled()
|
||||
expect(setSpy).toHaveBeenCalledTimes(34)
|
||||
expect(setSpy).toHaveBeenCalledTimes(33)
|
||||
expect(setSpy).toHaveBeenCalledWith(SETTINGS_KEYS.SIDEBAR_HIDDEN_ITEMS, [
|
||||
HideableSidebarItemID.Workflows,
|
||||
])
|
||||
|
||||
@@ -163,7 +163,6 @@ export class SettingsComponent
|
||||
bulkEditConfirmationDialogs: new FormControl(null),
|
||||
bulkEditApplyOnClose: new FormControl(null),
|
||||
documentListItemPerPage: new FormControl(null),
|
||||
tagsShowHierarchy: new FormControl(null),
|
||||
slimSidebarEnabled: new FormControl(null),
|
||||
sidebarHiddenItems: new FormControl<HideableSidebarItemID[]>([]),
|
||||
darkModeUseSystem: new FormControl(null),
|
||||
@@ -343,7 +342,6 @@ export class SettingsComponent
|
||||
bulkEditApplyOnClose: this.settings.get(
|
||||
SETTINGS_KEYS.BULK_EDIT_APPLY_ON_CLOSE
|
||||
),
|
||||
tagsShowHierarchy: this.settings.get(SETTINGS_KEYS.TAGS_SHOW_HIERARCHY),
|
||||
documentListItemPerPage: this.settings.get(
|
||||
SETTINGS_KEYS.DOCUMENT_LIST_SIZE
|
||||
),
|
||||
@@ -609,10 +607,6 @@ export class SettingsComponent
|
||||
SETTINGS_KEYS.DEFAULT_PERMS_EDIT_GROUPS,
|
||||
this.settingsForm.value.defaultPermsEditGroups
|
||||
)
|
||||
this.settings.set(
|
||||
SETTINGS_KEYS.TAGS_SHOW_HIERARCHY,
|
||||
this.settingsForm.value.tagsShowHierarchy
|
||||
)
|
||||
this.settings.set(
|
||||
SETTINGS_KEYS.DOCUMENT_EDITING_REMOVE_INBOX_TAGS,
|
||||
this.settingsForm.value.documentEditingRemoveInboxTags
|
||||
|
||||
@@ -17,21 +17,16 @@
|
||||
[searchFn]="searchFn"
|
||||
addTagText="Add tag"
|
||||
i18n-addTagText
|
||||
[keyDownFn]="onKeyDown"
|
||||
(add)="onAdd($event)"
|
||||
(change)="onChange(value)">
|
||||
|
||||
<ng-template ng-label-tmp let-item="item">
|
||||
@if (isImplied(item.id)) {
|
||||
<span class="implied-tag"></span>
|
||||
} @else {
|
||||
<button class="tag-wrap btn p-0 d-flex align-items-center mw-100" (click)="removeBadge(item.id)" (mousedown)="$event.stopImmediatePropagation()" type="button" title="Remove tag" i18n-title>
|
||||
<pngx-bs-icon name="x" style="margin-inline-end: 1px;"></pngx-bs-icon>
|
||||
@if (item.id && tags) {
|
||||
<pngx-tag class="mw-100 overflow-hidden" [tag]="getTag(item.id)" [split]="preserveHierarchy" (click)="removeTag(item.id); $event.stopPropagation()" (parentClick)="removeTag($event)"></pngx-tag>
|
||||
}
|
||||
</button>
|
||||
}
|
||||
<button class="tag-wrap btn p-0 d-flex align-items-center" (click)="removeTag(item.id)" (mousedown)="$event.stopImmediatePropagation()" type="button" title="Remove tag" i18n-title>
|
||||
<pngx-bs-icon name="x" style="margin-inline-end: 1px;"></pngx-bs-icon>
|
||||
@if (item.id && tags) {
|
||||
<pngx-tag style="background-color: none;" [tag]="getTag(item.id)"></pngx-tag>
|
||||
}
|
||||
</button>
|
||||
</ng-template>
|
||||
<ng-template ng-option-tmp let-item="item" let-index="index" let-search="searchTerm">
|
||||
<div class="tag-option-row d-flex align-items-center" [class.w-auto]="!getTag(item.id)?.parent">
|
||||
|
||||
@@ -7,11 +7,6 @@
|
||||
font-size: 1rem;
|
||||
}
|
||||
|
||||
// ancestors of another selected tag render inside that tag's badge
|
||||
::ng-deep .paperless-input-tags .ng-value:has(> .implied-tag) {
|
||||
display: none !important;
|
||||
}
|
||||
|
||||
.paperless-input-select.disabled {
|
||||
.input-group {
|
||||
cursor: not-allowed;
|
||||
|
||||
@@ -278,59 +278,4 @@ describe('TagsComponent', () => {
|
||||
component.tags = [lone]
|
||||
expect(component.getParentChain(5)).toEqual([])
|
||||
})
|
||||
|
||||
describe('hierarchy', () => {
|
||||
const root: Tag = { id: 1, name: 'root' }
|
||||
const mid: Tag = { id: 2, name: 'mid', parent: 1 }
|
||||
const leaf: Tag = { id: 3, name: 'leaf', parent: 2 }
|
||||
const other: Tag = { id: 4, name: 'other' }
|
||||
|
||||
beforeEach(() => {
|
||||
component.tags = [root, mid, leaf, other]
|
||||
component.value = [3, 2, 1, 4]
|
||||
})
|
||||
|
||||
it('should treat ancestors of another selected tag as implied', () => {
|
||||
expect([1, 2, 3, 4].map((id) => component.isImplied(id))).toEqual([
|
||||
true,
|
||||
true,
|
||||
false,
|
||||
false,
|
||||
])
|
||||
component.preserveHierarchy = false
|
||||
expect(component.isImplied(1)).toBe(false)
|
||||
})
|
||||
|
||||
it('should remove a whole badge, keeping ancestors other tags still need', () => {
|
||||
component.removeBadge(3)
|
||||
expect(component.value).toEqual([4])
|
||||
|
||||
const sibling: Tag = { id: 5, name: 'sibling', parent: 1 }
|
||||
component.tags = [root, mid, leaf, other, sibling]
|
||||
component.value = [3, 2, 1, 5, 4]
|
||||
component.removeBadge(3)
|
||||
expect(component.value).toEqual([1, 5, 4])
|
||||
})
|
||||
|
||||
it('should remove only the tag itself from a badge when hierarchy is not shown', () => {
|
||||
component.preserveHierarchy = false
|
||||
component.removeBadge(3)
|
||||
expect(component.value).toEqual([2, 1, 4])
|
||||
})
|
||||
|
||||
it('should remove the last visible tag on backspace, not a hidden ancestor', () => {
|
||||
const backspace = new KeyboardEvent('keydown', { key: 'Backspace' })
|
||||
expect(component.onKeyDown(backspace)).toBe(false)
|
||||
expect(component.value).toEqual([3, 2, 1])
|
||||
expect(component.onKeyDown(backspace)).toBe(false)
|
||||
expect(component.value).toEqual([2, 1])
|
||||
|
||||
// nothing hidden: leave it to ng-select
|
||||
component.value = [4]
|
||||
expect(component.onKeyDown(backspace)).toBe(true)
|
||||
expect(
|
||||
component.onKeyDown(new KeyboardEvent('keydown', { key: 'a' }))
|
||||
).toBe(true)
|
||||
})
|
||||
})
|
||||
})
|
||||
@@ -21,13 +21,7 @@ import { NgSelectComponent, NgSelectModule } from '@ng-select/ng-select'
|
||||
import { first, firstValueFrom, tap } from 'rxjs'
|
||||
import { BootstrapIconComponent } from 'src/app/components/common/bootstrap-icon/bootstrap-icon.component'
|
||||
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 { SettingsService } from 'src/app/services/settings.service'
|
||||
import {
|
||||
collapseImpliedAncestors,
|
||||
getTagAncestors,
|
||||
} from 'src/app/utils/collapse-tags'
|
||||
import { matchesSearchText } from 'src/app/utils/text-search'
|
||||
import { EditDialogMode } from '../../edit-dialog/edit-dialog.component'
|
||||
import { TagEditDialogComponent } from '../../edit-dialog/tag-edit-dialog/tag-edit-dialog.component'
|
||||
@@ -56,7 +50,6 @@ import { TagComponent } from '../../tag/tag.component'
|
||||
export class TagsComponent implements OnInit, ControlValueAccessor {
|
||||
private tagService = inject(TagService)
|
||||
private modalService = inject(NgbModal)
|
||||
private readonly settingsService = inject(SettingsService)
|
||||
private readonly changeDetector = inject(ChangeDetectorRef)
|
||||
|
||||
constructor() {
|
||||
@@ -138,33 +131,6 @@ export class TagsComponent implements OnInit, ControlValueAccessor {
|
||||
term
|
||||
)
|
||||
|
||||
/**
|
||||
* Selected tags that are ancestors of another selected tag which are shown
|
||||
* as segments of their descendant's badge.
|
||||
*/
|
||||
isImplied(id: number): boolean {
|
||||
if (!this.showsHierarchy || !this.tags || !this.value) return false
|
||||
return !collapseImpliedAncestors(this.value, this.tagsById).includes(id)
|
||||
}
|
||||
|
||||
private get showsHierarchy(): boolean {
|
||||
return (
|
||||
this.preserveHierarchy &&
|
||||
!!this.settingsService.get(SETTINGS_KEYS.TAGS_SHOW_HIERARCHY)
|
||||
)
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove the last visible tag (in case its actually a hidden ancestor)
|
||||
*/
|
||||
readonly onKeyDown = (event: KeyboardEvent): boolean => {
|
||||
if (event.key !== 'Backspace' || this.select?.searchTerm) return true
|
||||
const visible = this.value?.filter((id) => !this.isImplied(id)) ?? []
|
||||
if (visible.length === (this.value?.length ?? 0)) return true
|
||||
this.removeTag(visible.at(-1))
|
||||
return false
|
||||
}
|
||||
|
||||
getTag(id: number) {
|
||||
if (this.tags) {
|
||||
return this.tags.find((tag) => tag.id == id)
|
||||
@@ -173,26 +139,6 @@ export class TagsComponent implements OnInit, ControlValueAccessor {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove a whole badge i.e. the tag plus any ancestors that no other selected
|
||||
* tag still needs.
|
||||
*/
|
||||
removeBadge(tagID: number) {
|
||||
if (this.disabled) return
|
||||
if (!this.showsHierarchy) return this.removeTag(tagID)
|
||||
|
||||
const ancestors = new Set(this.getParentChain(tagID).map((t) => t.id))
|
||||
const needed = new Set(
|
||||
this.value
|
||||
.filter((id) => id !== tagID && !ancestors.has(id))
|
||||
.flatMap((id) => this.getParentChain(id).map((t) => t.id))
|
||||
)
|
||||
this.value = this.value.filter(
|
||||
(id) => id !== tagID && (!ancestors.has(id) || needed.has(id))
|
||||
)
|
||||
this.onChange(this.value)
|
||||
}
|
||||
|
||||
removeTag(tagID: number) {
|
||||
if (this.disabled) return
|
||||
|
||||
@@ -289,17 +235,18 @@ export class TagsComponent implements OnInit, ControlValueAccessor {
|
||||
}
|
||||
|
||||
getParentChain(id: number): Tag[] {
|
||||
return getTagAncestors(id, this.tagsById)
|
||||
}
|
||||
|
||||
private tagsByIdSource: Tag[]
|
||||
private tagsByIdCache: Map<number, Tag>
|
||||
|
||||
private get tagsById(): Map<number, Tag> {
|
||||
if (this.tagsByIdSource !== this.tags) {
|
||||
this.tagsByIdSource = this.tags
|
||||
this.tagsByIdCache = new Map(this.tags?.map((t) => [t.id, t]))
|
||||
// Returns ancestors from root → immediate parent for a tag id
|
||||
const chain: Tag[] = []
|
||||
let current = this.getTag(id)
|
||||
const guard = new Set<number>()
|
||||
while (current?.parent) {
|
||||
if (guard.has(current.parent)) break
|
||||
guard.add(current.parent)
|
||||
const parent = this.getTag(current.parent)
|
||||
if (!parent) break
|
||||
chain.unshift(parent)
|
||||
current = parent
|
||||
}
|
||||
return this.tagsByIdCache
|
||||
return chain
|
||||
}
|
||||
}
|
||||
@@ -1,18 +1,13 @@
|
||||
@if (tag()) {
|
||||
@if (ancestorSegments.length) {
|
||||
<span #pill class="split-pill d-inline-flex mw-100" [title]="path()" (mouseleave)="setFocus(pill, null)">
|
||||
@for (ancestor of ancestorSegments; track ancestor.id; let first = $first) {
|
||||
<span #segment class="badge split-parent" [class.rounded-end-0]="first" [class.rounded-0]="!first" [style.background]="ancestor.color" [style.color]="ancestor.text_color" (mouseenter)="setFocus(pill, segment)" (click)="onParentClick($event, ancestor.id)">{{ancestor.name}}</span>
|
||||
}
|
||||
<span #leaf class="badge rounded-start-0 split-child" [style.background]="tag().color" [style.color]="tag().text_color" (mouseenter)="setFocus(pill, leaf)">{{tag().name}}</span>
|
||||
</span>
|
||||
} @else {
|
||||
@if (!clickable()) {
|
||||
<span class="badge" [style.background]="tag().color" [style.color]="tag().text_color">{{tag().name}}</span>
|
||||
}
|
||||
@if (clickable()) {
|
||||
<a [title]="linkTitle()" class="badge" [style.background]="tag().color" [style.color]="tag().text_color">{{tag().name}}</a>
|
||||
}
|
||||
@if (showParents() && tag().parent) {
|
||||
<pngx-tag [tagID]="tag().parent" [clickable]="clickable()" [linkTitle]="linkTitle()"></pngx-tag>
|
||||
>
|
||||
}
|
||||
@if (!clickable()) {
|
||||
<span class="badge" [style.background]="tag().color" [style.color]="tag().text_color">{{tag().name}}</span>
|
||||
}
|
||||
@if (clickable()) {
|
||||
<a [title]="linkTitle()" class="badge" [style.background]="tag().color" [style.color]="tag().text_color">{{tag().name}}</a>
|
||||
}
|
||||
} @else if (loading) {
|
||||
<span class="placeholder-glow">
|
||||
|
||||
@@ -11,45 +11,3 @@ a, span {
|
||||
opacity: .5;
|
||||
font-style: italic;
|
||||
}
|
||||
|
||||
.split-parent,
|
||||
.split-child {
|
||||
overflow: hidden;
|
||||
white-space: nowrap;
|
||||
transition: color .2s ease;
|
||||
}
|
||||
|
||||
.split-parent {
|
||||
min-width: 1.5em;
|
||||
max-width: 10em;
|
||||
padding-inline: .4em;
|
||||
text-overflow: clip;
|
||||
|
||||
&:nth-last-child(2) { flex-shrink: 1e12; }
|
||||
&:nth-last-child(3) { flex-shrink: 1e18; }
|
||||
&:nth-last-child(4) { flex-shrink: 1e24; }
|
||||
&:nth-last-child(5) { flex-shrink: 1e30; }
|
||||
|
||||
&.collapsed {
|
||||
color: transparent !important;
|
||||
}
|
||||
}
|
||||
|
||||
.split-child {
|
||||
flex-shrink: 1e6;
|
||||
min-width: 2em;
|
||||
text-overflow: ellipsis;
|
||||
}
|
||||
|
||||
// Hovered segment gets priority, other parents can shrink to a sliver
|
||||
.split-pill {
|
||||
> .split-parent.focused,
|
||||
> .split-child.focused {
|
||||
flex-shrink: 1;
|
||||
text-overflow: ellipsis;
|
||||
}
|
||||
|
||||
&:has(> .focused) > .split-parent:not(.focused) {
|
||||
min-width: 0;
|
||||
}
|
||||
}
|
||||
@@ -6,7 +6,6 @@ import { of } from 'rxjs'
|
||||
import { Tag } from 'src/app/data/tag'
|
||||
import { PermissionsService } from 'src/app/services/permissions.service'
|
||||
import { TagService } from 'src/app/services/rest/tag.service'
|
||||
import { SettingsService } from 'src/app/services/settings.service'
|
||||
import { TagComponent } from './tag.component'
|
||||
|
||||
const tag: Tag = {
|
||||
@@ -70,88 +69,4 @@ describe('TagComponent', () => {
|
||||
expect(getCachedSpy).toHaveBeenCalledWith(1)
|
||||
expect(component.tag()).toEqual(tag)
|
||||
})
|
||||
describe('split badge', () => {
|
||||
const root: Tag = { id: 1, name: 'Root', color: '#000000' }
|
||||
const mid: Tag = { id: 2, name: 'Mid', color: '#111111', parent: 1 }
|
||||
const leaf: Tag = { id: 3, name: 'Leaf', color: '#222222', parent: 2 }
|
||||
|
||||
const segments = (): HTMLElement[] =>
|
||||
fixture.debugElement
|
||||
.queryAll(By.css('.split-pill > .badge'))
|
||||
.map((d) => d.nativeElement)
|
||||
|
||||
beforeEach(() => {
|
||||
jest.spyOn(permissionsService, 'currentUserCan').mockReturnValue(true)
|
||||
jest.spyOn(tagService, 'getCached').mockReturnValue(of(leaf))
|
||||
jest
|
||||
.spyOn(tagService, 'listAll')
|
||||
.mockReturnValue(
|
||||
of({ count: 3, all: [1, 2, 3], results: [root, mid, leaf] })
|
||||
)
|
||||
fixture.componentRef.setInput('tagID', 3)
|
||||
fixture.componentRef.setInput('split', true)
|
||||
fixture.detectChanges()
|
||||
})
|
||||
|
||||
it('should render ancestors as segments with the full path as title', () => {
|
||||
expect(segments().map((s) => s.textContent.trim())).toEqual([
|
||||
'Root',
|
||||
'Mid',
|
||||
'Leaf',
|
||||
])
|
||||
expect(
|
||||
fixture.debugElement.query(By.css('.split-pill')).nativeElement.title
|
||||
).toEqual('Root › Mid › Leaf')
|
||||
})
|
||||
|
||||
it('should render a plain badge when the setting is off', () => {
|
||||
jest.spyOn(TestBed.inject(SettingsService), 'get').mockReturnValue(false)
|
||||
fixture.componentRef.setInput('split', false)
|
||||
fixture.detectChanges()
|
||||
fixture.componentRef.setInput('split', true)
|
||||
fixture.detectChanges()
|
||||
expect(fixture.debugElement.query(By.css('.split-pill'))).toBeNull()
|
||||
expect(component.ancestorSegments).toEqual([])
|
||||
})
|
||||
|
||||
it('should emit the ancestor id when an ancestor segment is clicked', () => {
|
||||
const emitSpy = jest.spyOn(component.parentClick, 'emit')
|
||||
const event = new MouseEvent('click', { bubbles: true })
|
||||
const stopSpy = jest.spyOn(event, 'stopImmediatePropagation')
|
||||
segments()[1].dispatchEvent(event)
|
||||
expect(emitSpy).toHaveBeenCalledWith(2)
|
||||
expect(stopSpy).toHaveBeenCalled()
|
||||
})
|
||||
|
||||
it('should focus the hovered segment and animate width changes', () => {
|
||||
const [rootSeg, midSeg, leafSeg] = segments()
|
||||
const pill = rootSeg.parentElement
|
||||
// before / after widths per segment, as measured by setFocus
|
||||
const widths = new Map<HTMLElement, number[]>([
|
||||
[rootSeg, [20, 4]],
|
||||
[midSeg, [20, 60]],
|
||||
[leafSeg, [40, 40]],
|
||||
])
|
||||
const animate = jest.fn()
|
||||
for (const [seg, [before, after]] of widths) {
|
||||
seg.getAnimations = jest.fn(() => [])
|
||||
seg.animate = animate
|
||||
jest
|
||||
.spyOn(seg, 'getBoundingClientRect')
|
||||
.mockReturnValueOnce({ width: before } as DOMRect)
|
||||
.mockReturnValueOnce({ width: after } as DOMRect)
|
||||
}
|
||||
|
||||
midSeg.dispatchEvent(new MouseEvent('mouseenter'))
|
||||
expect(midSeg.classList).toContain('focused')
|
||||
expect(rootSeg.classList).not.toContain('focused')
|
||||
// only the segments whose width changed are animated
|
||||
expect(animate).toHaveBeenCalledTimes(2)
|
||||
|
||||
pill.dispatchEvent(new MouseEvent('mouseleave'))
|
||||
expect(segments().some((s) => s.classList.contains('focused'))).toBe(
|
||||
false
|
||||
)
|
||||
})
|
||||
})
|
||||
})
|
||||
@@ -1,27 +1,11 @@
|
||||
import {
|
||||
Component,
|
||||
computed,
|
||||
effect,
|
||||
inject,
|
||||
input,
|
||||
model,
|
||||
output,
|
||||
signal,
|
||||
} from '@angular/core'
|
||||
import { Component, effect, inject, input, model } from '@angular/core'
|
||||
import { Tag } from 'src/app/data/tag'
|
||||
import { SETTINGS_KEYS } from 'src/app/data/ui-settings'
|
||||
import {
|
||||
PermissionAction,
|
||||
PermissionsService,
|
||||
PermissionType,
|
||||
} from 'src/app/services/permissions.service'
|
||||
import { TagService } from 'src/app/services/rest/tag.service'
|
||||
import { SettingsService } from 'src/app/services/settings.service'
|
||||
import { getTagAncestors } from 'src/app/utils/collapse-tags'
|
||||
|
||||
const FOCUS_ANIMATION_MS = 200
|
||||
// matches the .split-parent min-width in tag.component.scss
|
||||
const COLLAPSE_BELOW_EM = 1.5
|
||||
|
||||
@Component({
|
||||
selector: 'pngx-tag',
|
||||
@@ -29,9 +13,8 @@ const COLLAPSE_BELOW_EM = 1.5
|
||||
styleUrls: ['./tag.component.scss'],
|
||||
})
|
||||
export class TagComponent {
|
||||
private readonly permissionsService = inject(PermissionsService)
|
||||
private readonly tagService = inject(TagService)
|
||||
private readonly settingsService = inject(SettingsService)
|
||||
private permissionsService = inject(PermissionsService)
|
||||
private tagService = inject(TagService)
|
||||
|
||||
readonly tag = model<Tag>(null)
|
||||
readonly tagID = input<number>(undefined)
|
||||
@@ -40,101 +23,27 @@ export class TagComponent {
|
||||
transform: (value: boolean | string) =>
|
||||
value === '' || value === true || value === 'true',
|
||||
})
|
||||
|
||||
readonly split = input(false)
|
||||
|
||||
readonly parentClick = output<number>()
|
||||
|
||||
private readonly ancestors = signal<Tag[]>([])
|
||||
|
||||
public get ancestorSegments(): Tag[] {
|
||||
return this.split() &&
|
||||
this.settingsService.get(SETTINGS_KEYS.TAGS_SHOW_HIERARCHY)
|
||||
? this.ancestors()
|
||||
: []
|
||||
}
|
||||
|
||||
public readonly path = computed(() =>
|
||||
[...this.ancestors(), this.tag()]
|
||||
.filter(Boolean)
|
||||
.map((t) => t.name)
|
||||
.join(' › ')
|
||||
)
|
||||
readonly showParents = input(false)
|
||||
|
||||
constructor() {
|
||||
effect(() => {
|
||||
const tagID = this.tagID()
|
||||
if (tagID && this.canViewTags) {
|
||||
this.tagService.getCached(tagID).subscribe((tag) => {
|
||||
this.tag.set(tag)
|
||||
})
|
||||
}
|
||||
})
|
||||
|
||||
// ancestors for split badges, from either tagID or a passed-in tag
|
||||
effect(() => {
|
||||
const id = this.tagID() || this.tag()?.id
|
||||
if (!this.split() || !id || !this.canViewTags) {
|
||||
this.ancestors.set([])
|
||||
return
|
||||
}
|
||||
this.tagService.listAll().subscribe((tags) => {
|
||||
this.ancestors.set(
|
||||
getTagAncestors(
|
||||
id,
|
||||
new Map<number, Tag>(tags.results.map((t) => [t.id, t]))
|
||||
if (tagID) {
|
||||
if (
|
||||
this.permissionsService.currentUserCan(
|
||||
PermissionAction.View,
|
||||
PermissionType.Tag
|
||||
)
|
||||
)
|
||||
})
|
||||
) {
|
||||
this.tagService.getCached(tagID).subscribe((tag) => {
|
||||
this.tag.set(tag)
|
||||
})
|
||||
}
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
private get canViewTags(): boolean {
|
||||
return this.permissionsService.currentUserCan(
|
||||
PermissionAction.View,
|
||||
PermissionType.Tag
|
||||
)
|
||||
}
|
||||
|
||||
public get loading(): boolean {
|
||||
return this.tagService.loading
|
||||
}
|
||||
|
||||
/**
|
||||
* Gives the hovered segment priority (.focused class, see scss)
|
||||
* and animates each from old width to new
|
||||
*/
|
||||
setFocus(segment: HTMLElement, focused: HTMLElement | null) {
|
||||
const segments = Array.from(segment.children) as HTMLElement[]
|
||||
const before = segments.map((s) => s.getBoundingClientRect().width)
|
||||
for (const segment of segments) {
|
||||
segment.getAnimations().forEach((a) => a.cancel())
|
||||
segment.classList.toggle('focused', segment === focused)
|
||||
}
|
||||
const after = segments.map((s) => s.getBoundingClientRect().width)
|
||||
|
||||
segments.forEach((segment, i) => {
|
||||
const em = Number.parseFloat(getComputedStyle(segment).fontSize)
|
||||
segment.classList.toggle(
|
||||
'collapsed',
|
||||
!!focused &&
|
||||
segment.classList.contains('split-parent') &&
|
||||
after[i] < COLLAPSE_BELOW_EM * em
|
||||
)
|
||||
if (Math.abs(after[i] - before[i]) < 0.5) return
|
||||
segment.animate(
|
||||
[
|
||||
{ flex: `0 0 ${before[i]}px`, minWidth: 0 },
|
||||
{ flex: `0 0 ${after[i]}px`, minWidth: 0 },
|
||||
],
|
||||
{ duration: FOCUS_ANIMATION_MS, easing: 'ease' }
|
||||
)
|
||||
})
|
||||
}
|
||||
|
||||
onParentClick(event: MouseEvent, id: number) {
|
||||
event.preventDefault()
|
||||
event.stopImmediatePropagation()
|
||||
this.parentClick.emit(id)
|
||||
}
|
||||
}
|
||||
+2
-2
@@ -76,8 +76,8 @@
|
||||
}
|
||||
}
|
||||
@case (DisplayField.TAGS) {
|
||||
@for (tagID of doc.tags | collapseTags | async; track tagID) {
|
||||
<pngx-tag [tagID]="tagID" [split]="true" class="ms-1 fs-6" (click)="clickTag(tagID, $event)" (parentClick)="clickTag($event)" [clickable]="true" linkTitle="Filter by tag" i18n-title></pngx-tag>
|
||||
@for (tagID of doc.tags; track tagID) {
|
||||
<pngx-tag [tagID]="tagID" class="ms-1 fs-6" (click)="clickTag(tagID, $event)" [clickable]="true" linkTitle="Filter by tag" i18n-title></pngx-tag>
|
||||
}
|
||||
}
|
||||
@case (DisplayField.DOCUMENT_TYPE) {
|
||||
|
||||
-2
@@ -38,7 +38,6 @@ import {
|
||||
} from 'src/app/data/filter-rule-type'
|
||||
import { SavedView } from 'src/app/data/saved-view'
|
||||
import { IfPermissionsDirective } from 'src/app/directives/if-permissions.directive'
|
||||
import { CollapseTagsPipe } from 'src/app/pipes/collapse-tags.pipe'
|
||||
import { CorrespondentNamePipe } from 'src/app/pipes/correspondent-name.pipe'
|
||||
import { CustomDatePipe } from 'src/app/pipes/custom-date.pipe'
|
||||
import { DocumentTitlePipe } from 'src/app/pipes/document-title.pipe'
|
||||
@@ -76,7 +75,6 @@ import { WidgetFrameComponent } from '../widget-frame/widget-frame.component'
|
||||
DocumentTypeNamePipe,
|
||||
StoragePathNamePipe,
|
||||
AsyncPipe,
|
||||
CollapseTagsPipe,
|
||||
DocumentTitlePipe,
|
||||
CustomDatePipe,
|
||||
NgClass,
|
||||
|
||||
+2
-2
@@ -36,8 +36,8 @@
|
||||
{{document().title | documentTitle}}
|
||||
}
|
||||
@if (displayFields().includes(DisplayField.TAGS)) {
|
||||
@for (tagID of document().tags | collapseTags | async; track tagID) {
|
||||
<pngx-tag [tagID]="tagID" [split]="true" linkTitle="Filter by tag" i18n-linkTitle class="ms-1" (click)="clickTag.emit(tagID);$event.stopPropagation()" (parentClick)="clickTag.emit($event)" [clickable]="clickTag.observers.length"></pngx-tag>
|
||||
@for (tagID of document().tags; track tagID) {
|
||||
<pngx-tag [tagID]="tagID" linkTitle="Filter by tag" i18n-linkTitle class="ms-1" (click)="clickTag.emit(tagID);$event.stopPropagation()" [clickable]="clickTag.observers.length"></pngx-tag>
|
||||
}
|
||||
}
|
||||
} @else {
|
||||
|
||||
-2
@@ -20,7 +20,6 @@ import {
|
||||
Document,
|
||||
} from 'src/app/data/document'
|
||||
import { SETTINGS_KEYS } from 'src/app/data/ui-settings'
|
||||
import { CollapseTagsPipe } from 'src/app/pipes/collapse-tags.pipe'
|
||||
import { CorrespondentNamePipe } from 'src/app/pipes/correspondent-name.pipe'
|
||||
import { CustomDatePipe } from 'src/app/pipes/custom-date.pipe'
|
||||
import { DocumentTitlePipe } from 'src/app/pipes/document-title.pipe'
|
||||
@@ -46,7 +45,6 @@ import { LoadingComponentWithPermissions } from '../../loading-component/loading
|
||||
TagComponent,
|
||||
CustomFieldDisplayComponent,
|
||||
AsyncPipe,
|
||||
CollapseTagsPipe,
|
||||
NgOptimizedImage,
|
||||
UsernamePipe,
|
||||
CorrespondentNamePipe,
|
||||
|
||||
+4
-5
@@ -19,12 +19,11 @@
|
||||
}
|
||||
|
||||
@if (document() && displayFields().includes(DisplayField.TAGS)) {
|
||||
@let visibleTagIDs = document().tags | collapseTags | async;
|
||||
<div class="tags d-flex flex-column text-end position-absolute me-1 fs-6" [class.tags-no-wrap]="visibleTagIDs?.length > 3">
|
||||
@for (tagID of getTagIDs(visibleTagIDs); track tagID) {
|
||||
<pngx-tag [tagID]="tagID" [split]="true" (click)="clickTag.emit(tagID);$event.stopPropagation()" (parentClick)="clickTag.emit($event)" [clickable]="true" linkTitle="Toggle tag filter" i18n-linkTitle></pngx-tag>
|
||||
<div class="tags d-flex flex-column text-end position-absolute me-1 fs-6" [class.tags-no-wrap]="document().tags.length > 3">
|
||||
@for (tagID of tagIDs; track tagID) {
|
||||
<pngx-tag [tagID]="tagID" (click)="clickTag.emit(tagID);$event.stopPropagation()" [clickable]="true" linkTitle="Toggle tag filter" i18n-linkTitle></pngx-tag>
|
||||
}
|
||||
@if (getMoreTags(visibleTagIDs); as moreTags) {
|
||||
@if (moreTags) {
|
||||
<div>
|
||||
<span class="badge text-dark">+ {{moreTags}}</span>
|
||||
</div>
|
||||
|
||||
+1
-2
@@ -103,8 +103,7 @@ a {
|
||||
line-height: 1;
|
||||
|
||||
&.tags-no-wrap {
|
||||
// split-pill parents clip to a stub instead (see TagComponent)
|
||||
::ng-deep .badge:not(.split-parent) {
|
||||
::ng-deep .badge {
|
||||
display: inline-block;
|
||||
max-width: 100%;
|
||||
white-space: nowrap;
|
||||
|
||||
+2
-33
@@ -4,9 +4,6 @@ import { provideHttpClientTesting } from '@angular/common/http/testing'
|
||||
import { ComponentFixture, TestBed } from '@angular/core/testing'
|
||||
import { By } from '@angular/platform-browser'
|
||||
import { RouterTestingModule } from '@angular/router/testing'
|
||||
import { of } from 'rxjs'
|
||||
import { PermissionsService } from 'src/app/services/permissions.service'
|
||||
import { TagService } from 'src/app/services/rest/tag.service'
|
||||
import { TagComponent } from '../../common/tag/tag.component'
|
||||
import { DocumentCardSmallComponent } from './document-card-small.component'
|
||||
|
||||
@@ -100,36 +97,8 @@ describe('DocumentCardSmallComponent', () => {
|
||||
).toHaveLength(6)
|
||||
})
|
||||
|
||||
it('should hide parent tags implied by a child and count pills for the hidden tag counter', () => {
|
||||
jest
|
||||
.spyOn(TestBed.inject(PermissionsService), 'currentUserCan')
|
||||
.mockReturnValue(true)
|
||||
jest.spyOn(TestBed.inject(TagService), 'listAll').mockReturnValue(
|
||||
of({
|
||||
count: 8,
|
||||
all: [1, 2, 3, 4, 5, 6, 7, 8],
|
||||
results: [
|
||||
{ id: 1, name: 'Parent' },
|
||||
{ id: 2, name: 'Child', parent: 1 },
|
||||
...[3, 4, 5, 6, 7, 8].map((id) => ({ id, name: `Tag ${id}` })),
|
||||
],
|
||||
})
|
||||
)
|
||||
fixture.componentRef.setInput('document', {
|
||||
...component.document(),
|
||||
tags: [1, 2, 3, 4, 5, 6, 7, 8],
|
||||
})
|
||||
fixture.detectChanges()
|
||||
|
||||
const tags = fixture.debugElement.queryAll(By.directive(TagComponent))
|
||||
expect(tags.map((t) => t.componentInstance.tagID())).toEqual([
|
||||
2, 3, 4, 5, 6,
|
||||
])
|
||||
expect(fixture.nativeElement.textContent).toContain('+ 2')
|
||||
})
|
||||
|
||||
it('should clear hidden tag counter when tag count falls below the limit', () => {
|
||||
expect(component.getMoreTags(component.document().tags)).toEqual(3)
|
||||
expect(component.moreTags).toEqual(3)
|
||||
|
||||
fixture.componentRef.setInput('document', {
|
||||
...component.document(),
|
||||
@@ -137,7 +106,7 @@ describe('DocumentCardSmallComponent', () => {
|
||||
})
|
||||
fixture.detectChanges()
|
||||
|
||||
expect(component.getMoreTags(component.document().tags)).toBeNull()
|
||||
expect(component.moreTags).toBeNull()
|
||||
expect(fixture.nativeElement.textContent).not.toContain('+ 3')
|
||||
})
|
||||
|
||||
|
||||
+14
-12
@@ -20,7 +20,6 @@ import {
|
||||
Document,
|
||||
} from 'src/app/data/document'
|
||||
import { SETTINGS_KEYS } from 'src/app/data/ui-settings'
|
||||
import { CollapseTagsPipe } from 'src/app/pipes/collapse-tags.pipe'
|
||||
import { CorrespondentNamePipe } from 'src/app/pipes/correspondent-name.pipe'
|
||||
import { CustomDatePipe } from 'src/app/pipes/custom-date.pipe'
|
||||
import { DocumentTitlePipe } from 'src/app/pipes/document-title.pipe'
|
||||
@@ -46,7 +45,6 @@ import { LoadingComponentWithPermissions } from '../../loading-component/loading
|
||||
TagComponent,
|
||||
CustomFieldDisplayComponent,
|
||||
AsyncPipe,
|
||||
CollapseTagsPipe,
|
||||
NgOptimizedImage,
|
||||
UsernamePipe,
|
||||
CorrespondentNamePipe,
|
||||
@@ -92,13 +90,12 @@ export class DocumentCardSmallComponent
|
||||
@Output()
|
||||
clickStoragePath = new EventEmitter<number>()
|
||||
|
||||
private get tagLimit(): number {
|
||||
return this.document()?.notes.length > 0 ? 6 : 7
|
||||
}
|
||||
|
||||
getMoreTags(tagIDs: number[]): number {
|
||||
const limit = this.tagLimit
|
||||
return tagIDs?.length > limit ? tagIDs.length - (limit - 1) : null
|
||||
get moreTags(): number {
|
||||
const document = this.document()
|
||||
const limit = document?.notes.length > 0 ? 6 : 7
|
||||
return document?.tags.length > limit
|
||||
? document.tags.length - (limit - 1)
|
||||
: null
|
||||
}
|
||||
|
||||
@ViewChild('popupPreview') popupPreview: PreviewPopupComponent
|
||||
@@ -119,9 +116,14 @@ export class DocumentCardSmallComponent
|
||||
return this.documentService.getDownloadUrl(this.document().id)
|
||||
}
|
||||
|
||||
getTagIDs(tagIDs: number[]): number[] {
|
||||
const limit = this.tagLimit
|
||||
return tagIDs?.length > limit ? tagIDs.slice(0, limit - 1) : tagIDs
|
||||
get tagIDs() {
|
||||
const document = this.document()
|
||||
const limit = document.notes.length > 0 ? 6 : 7
|
||||
if (document.tags.length > limit) {
|
||||
return document.tags.slice(0, limit - 1)
|
||||
} else {
|
||||
return document.tags
|
||||
}
|
||||
}
|
||||
|
||||
mouseLeaveCard() {
|
||||
|
||||
@@ -335,8 +335,8 @@
|
||||
<a routerLink="/documents/{{d.id}}" title="Edit document" i18n-title style="overflow-wrap: anywhere;">{{d.title | documentTitle}}</a>
|
||||
}
|
||||
@if (activeDisplayFields.includes(DisplayField.TAGS)) {
|
||||
@for (tagID of d.tags | collapseTags | async; track tagID) {
|
||||
<pngx-tag [tagID]="tagID" [split]="true" class="ms-1 fs-6" clickable="true" linkTitle="Filter by tag" i18n-linkTitle (click)="clickTag(tagID);$event.stopPropagation()" (parentClick)="clickTag($event)"></pngx-tag>
|
||||
@for (tagID of d.tags; track tagID) {
|
||||
<pngx-tag [tagID]="tagID" class="ms-1 fs-6" clickable="true" linkTitle="Filter by tag" i18n-linkTitle (click)="clickTag(tagID);$event.stopPropagation()"></pngx-tag>
|
||||
}
|
||||
}
|
||||
</td>
|
||||
|
||||
@@ -39,7 +39,6 @@ import {
|
||||
SortableDirective,
|
||||
SortEvent,
|
||||
} from 'src/app/directives/sortable.directive'
|
||||
import { CollapseTagsPipe } from 'src/app/pipes/collapse-tags.pipe'
|
||||
import { CorrespondentNamePipe } from 'src/app/pipes/correspondent-name.pipe'
|
||||
import { CustomDatePipe } from 'src/app/pipes/custom-date.pipe'
|
||||
import { DocumentTitlePipe } from 'src/app/pipes/document-title.pipe'
|
||||
@@ -97,7 +96,6 @@ import { SaveViewConfigDialogComponent } from './save-view-config-dialog/save-vi
|
||||
StoragePathNamePipe,
|
||||
BootstrapIconComponent,
|
||||
AsyncPipe,
|
||||
CollapseTagsPipe,
|
||||
FormsModule,
|
||||
ReactiveFormsModule,
|
||||
NgTemplateOutlet,
|
||||
|
||||
@@ -94,7 +94,6 @@ export const SETTINGS_KEYS = {
|
||||
DEFAULT_PERMS_VIEW_GROUPS: 'general-settings:permissions:default-view-groups',
|
||||
DEFAULT_PERMS_EDIT_USERS: 'general-settings:permissions:default-edit-users',
|
||||
DEFAULT_PERMS_EDIT_GROUPS: 'general-settings:permissions:default-edit-groups',
|
||||
TAGS_SHOW_HIERARCHY: 'general-settings:tags:show-hierarchy',
|
||||
DOCUMENT_EDITING_REMOVE_INBOX_TAGS:
|
||||
'general-settings:document-editing:remove-inbox-tags',
|
||||
DOCUMENT_EDITING_OVERLAY_THUMBNAIL:
|
||||
@@ -306,11 +305,6 @@ export const SETTINGS: UiSetting[] = [
|
||||
type: 'string',
|
||||
default: '',
|
||||
},
|
||||
{
|
||||
key: SETTINGS_KEYS.TAGS_SHOW_HIERARCHY,
|
||||
type: 'boolean',
|
||||
default: true,
|
||||
},
|
||||
{
|
||||
key: SETTINGS_KEYS.DOCUMENT_EDITING_REMOVE_INBOX_TAGS,
|
||||
type: 'boolean',
|
||||
|
||||
@@ -1,67 +0,0 @@
|
||||
import { provideHttpClient, withInterceptorsFromDi } from '@angular/common/http'
|
||||
import { provideHttpClientTesting } from '@angular/common/http/testing'
|
||||
import { TestBed } from '@angular/core/testing'
|
||||
import { firstValueFrom, of, throwError } from 'rxjs'
|
||||
import { Tag } from '../data/tag'
|
||||
import { PermissionsService } from '../services/permissions.service'
|
||||
import { TagService } from '../services/rest/tag.service'
|
||||
import { SettingsService } from '../services/settings.service'
|
||||
import { CollapseTagsPipe } from './collapse-tags.pipe'
|
||||
|
||||
const tags: Tag[] = [
|
||||
{ id: 1, name: 'Parent' },
|
||||
{ id: 2, name: 'Child', parent: 1 },
|
||||
{ id: 3, name: 'Other' },
|
||||
]
|
||||
|
||||
describe('CollapseTagsPipe', () => {
|
||||
let pipe: CollapseTagsPipe
|
||||
let tagService: TagService
|
||||
let settingsService: SettingsService
|
||||
let permissionsService: PermissionsService
|
||||
|
||||
beforeEach(() => {
|
||||
TestBed.configureTestingModule({
|
||||
providers: [
|
||||
CollapseTagsPipe,
|
||||
provideHttpClient(withInterceptorsFromDi()),
|
||||
provideHttpClientTesting(),
|
||||
],
|
||||
})
|
||||
pipe = TestBed.inject(CollapseTagsPipe)
|
||||
tagService = TestBed.inject(TagService)
|
||||
settingsService = TestBed.inject(SettingsService)
|
||||
permissionsService = TestBed.inject(PermissionsService)
|
||||
jest.spyOn(permissionsService, 'currentUserCan').mockReturnValue(true)
|
||||
jest.spyOn(settingsService, 'get').mockReturnValue(true)
|
||||
jest
|
||||
.spyOn(tagService, 'listAll')
|
||||
.mockReturnValue(of({ count: 3, all: [1, 2, 3], results: tags }))
|
||||
})
|
||||
|
||||
it('should drop parents implied by a selected child', async () => {
|
||||
expect(await firstValueFrom(pipe.transform([1, 2, 3]))).toEqual([2, 3])
|
||||
})
|
||||
|
||||
it('should pass ids through when hierarchy display is off or not permitted', async () => {
|
||||
jest.spyOn(settingsService, 'get').mockReturnValue(false)
|
||||
expect(await firstValueFrom(pipe.transform([1, 2]))).toEqual([1, 2])
|
||||
|
||||
jest.spyOn(settingsService, 'get').mockReturnValue(true)
|
||||
jest.spyOn(permissionsService, 'currentUserCan').mockReturnValue(false)
|
||||
expect(await firstValueFrom(pipe.transform([1, 2]))).toEqual([1, 2])
|
||||
expect(tagService.listAll).not.toHaveBeenCalled()
|
||||
})
|
||||
|
||||
it('should handle empty input', async () => {
|
||||
expect(await firstValueFrom(pipe.transform(null))).toEqual([])
|
||||
expect(await firstValueFrom(pipe.transform([]))).toEqual([])
|
||||
})
|
||||
|
||||
it('should fall back to the original ids if tags fail to load', async () => {
|
||||
jest
|
||||
.spyOn(tagService, 'listAll')
|
||||
.mockReturnValue(throwError(() => new Error('failed')))
|
||||
expect(await firstValueFrom(pipe.transform([1, 2]))).toEqual([1, 2])
|
||||
})
|
||||
})
|
||||
@@ -1,47 +0,0 @@
|
||||
import { inject, Pipe, PipeTransform } from '@angular/core'
|
||||
import { catchError, map, Observable, of } from 'rxjs'
|
||||
import { Tag } from '../data/tag'
|
||||
import { SETTINGS_KEYS } from '../data/ui-settings'
|
||||
import {
|
||||
PermissionAction,
|
||||
PermissionsService,
|
||||
PermissionType,
|
||||
} from '../services/permissions.service'
|
||||
import { TagService } from '../services/rest/tag.service'
|
||||
import { SettingsService } from '../services/settings.service'
|
||||
import { collapseImpliedAncestors } from '../utils/collapse-tags'
|
||||
|
||||
/**
|
||||
* Drops tag IDs whose descendant is also in the list for when the child's
|
||||
* Tag badge already shows its parent.
|
||||
*/
|
||||
@Pipe({
|
||||
name: 'collapseTags',
|
||||
})
|
||||
export class CollapseTagsPipe implements PipeTransform {
|
||||
private readonly permissionsService = inject(PermissionsService)
|
||||
private readonly tagService = inject(TagService)
|
||||
private readonly settingsService = inject(SettingsService)
|
||||
|
||||
transform(ids: number[]): Observable<number[]> {
|
||||
if (
|
||||
!ids?.length ||
|
||||
!this.settingsService.get(SETTINGS_KEYS.TAGS_SHOW_HIERARCHY) ||
|
||||
!this.permissionsService.currentUserCan(
|
||||
PermissionAction.View,
|
||||
PermissionType.Tag
|
||||
)
|
||||
) {
|
||||
return of(ids ?? [])
|
||||
}
|
||||
return this.tagService.listAll().pipe(
|
||||
map((tags) =>
|
||||
collapseImpliedAncestors(
|
||||
ids,
|
||||
new Map<number, Tag>(tags.results.map((t) => [t.id, t]))
|
||||
)
|
||||
),
|
||||
catchError(() => of(ids))
|
||||
)
|
||||
}
|
||||
}
|
||||
@@ -1,47 +0,0 @@
|
||||
import { Tag } from '../data/tag'
|
||||
import { collapseImpliedAncestors, getTagAncestors } from './collapse-tags'
|
||||
|
||||
const tags: Tag[] = [
|
||||
{ id: 1, name: 'Finance' },
|
||||
{ id: 2, name: 'Account', parent: 1 },
|
||||
{ id: 3, name: 'Mortgage', parent: 2 },
|
||||
{ id: 4, name: 'Taxes', parent: 1 },
|
||||
{ id: 5, name: 'Inbox' },
|
||||
]
|
||||
const tagsById = new Map(tags.map((t) => [t.id, t]))
|
||||
|
||||
describe('collapseImpliedAncestors', () => {
|
||||
it('drops ancestors that are implied by a descendant in the list', () => {
|
||||
expect(collapseImpliedAncestors([1, 2, 3, 4, 5], tagsById)).toEqual([
|
||||
3, 4, 5,
|
||||
])
|
||||
})
|
||||
|
||||
it('keeps a parent with none of its children present', () => {
|
||||
expect(collapseImpliedAncestors([1, 5], tagsById)).toEqual([1, 5])
|
||||
})
|
||||
|
||||
it('keeps unknown (private) ids and handles empty input', () => {
|
||||
expect(collapseImpliedAncestors([99, 2], tagsById)).toEqual([99, 2])
|
||||
expect(collapseImpliedAncestors([], tagsById)).toEqual([])
|
||||
expect(collapseImpliedAncestors(null, tagsById)).toEqual([])
|
||||
})
|
||||
})
|
||||
|
||||
describe('getTagAncestors', () => {
|
||||
it('returns ancestors root first', () => {
|
||||
expect(getTagAncestors(3, tagsById).map((t) => t.id)).toEqual([1, 2])
|
||||
expect(getTagAncestors(5, tagsById)).toEqual([])
|
||||
})
|
||||
|
||||
it('stops at a parent that is not visible or forms a cycle', () => {
|
||||
const hidden = new Map<number, Tag>([[6, { id: 6, name: 'x', parent: 99 }]])
|
||||
expect(getTagAncestors(6, hidden)).toEqual([])
|
||||
|
||||
const cyclic = new Map<number, Tag>([
|
||||
[7, { id: 7, name: 'a', parent: 8 }],
|
||||
[8, { id: 8, name: 'b', parent: 7 }],
|
||||
])
|
||||
expect(getTagAncestors(7, cyclic).map((t) => t.id)).toEqual([7, 8])
|
||||
})
|
||||
})
|
||||
@@ -1,43 +0,0 @@
|
||||
import { Tag } from '../data/tag'
|
||||
|
||||
/**
|
||||
* Collapses implied ancestor tags from a list of tag IDs such that if a tag's
|
||||
* ancestor is also present in the list, the ancestor is removed. For example
|
||||
* [Finance, Account, Mortgage] -> [Mortgage]
|
||||
*/
|
||||
export function collapseImpliedAncestors(
|
||||
ids: number[],
|
||||
tagsById: Map<number, Tag>
|
||||
): number[] {
|
||||
if (!ids?.length) return ids ?? []
|
||||
const present = new Set(ids)
|
||||
const implied = new Set<number>()
|
||||
for (const id of ids) {
|
||||
const seen = new Set<number>()
|
||||
let parentId = tagsById.get(id)?.parent
|
||||
while (parentId && !seen.has(parentId)) {
|
||||
seen.add(parentId)
|
||||
if (present.has(parentId)) implied.add(parentId)
|
||||
parentId = tagsById.get(parentId)?.parent
|
||||
}
|
||||
}
|
||||
return ids.filter((id) => !implied.has(id))
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns an array of ancestor tags for the given tag ID, starting from the
|
||||
* root and ending with the immediate parent.
|
||||
*/
|
||||
export function getTagAncestors(id: number, tagsById: Map<number, Tag>): Tag[] {
|
||||
const chain: Tag[] = []
|
||||
const seen = new Set<number>()
|
||||
let parentId = tagsById.get(id)?.parent
|
||||
while (parentId && !seen.has(parentId)) {
|
||||
seen.add(parentId)
|
||||
const parent = tagsById.get(parentId)
|
||||
if (!parent) break
|
||||
chain.unshift(parent)
|
||||
parentId = parent.parent
|
||||
}
|
||||
return chain
|
||||
}
|
||||
@@ -17,7 +17,7 @@
|
||||
<context context-type="linenumber">386,393</context>
|
||||
</context-group>
|
||||
<note priority="1" from="description">Currently selected slide number read by screen reader</note>
|
||||
<target state="needs-translation"> Slide <x id="INTERPOLATION" equiv-text="source?: NgbSli"/> of <x id="INTERPOLATION_1" equiv-text="s._cycleToSelec"/> </target>
|
||||
<target state="translated"> Slaids <x id="INTERPOLATION" equiv-text="source?: NgbSli"/> no <x id="INTERPOLATION_1" equiv-text="s._cycleToSelec"/> </target>
|
||||
</trans-unit>
|
||||
<trans-unit id="ngb.carousel.previous" datatype="html">
|
||||
<source>Previous</source>
|
||||
@@ -275,7 +275,7 @@
|
||||
<context context-type="sourcefile">src/app/app.component.ts</context>
|
||||
<context context-type="linenumber">78</context>
|
||||
</context-group>
|
||||
<target state="needs-translation">Document <x id="PH" equiv-text="status.filename"/> was added to Paperless-ngx.</target>
|
||||
<target state="translated">Dokuments <x id="PH" equiv-text="status.filename"/> tika pievienots Paperless-ngx.</target>
|
||||
</trans-unit>
|
||||
<trans-unit id="1931214133925051574" datatype="html">
|
||||
<source>Open document</source>
|
||||
@@ -427,7 +427,7 @@
|
||||
<context context-type="sourcefile">src/app/app.component.ts</context>
|
||||
<context context-type="linenumber">140</context>
|
||||
</context-group>
|
||||
<target state="needs-translation">The dashboard can be used to show saved views, such as an 'Inbox'. Views are found under Manage > Saved Views once you have created some.</target>
|
||||
<target state="translated">Infopanelī var attēlot saglabātos skatus, piemēram, “Iesūtne”. Kad būsiet izveidojis kādu skatu, tos varēsiet atrast sadaļā Pārvaldīt > Saglabātie skati.</target>
|
||||
</trans-unit>
|
||||
<trans-unit id="9075755296812854717" datatype="html">
|
||||
<source>Drag-and-drop documents here to start uploading or place them in the consume folder. You can also drag-and-drop documents anywhere on all other pages of the web app. Once you do, Paperless-ngx will start training its machine learning algorithms.</source>
|
||||
@@ -435,7 +435,7 @@
|
||||
<context context-type="sourcefile">src/app/app.component.ts</context>
|
||||
<context context-type="linenumber">147</context>
|
||||
</context-group>
|
||||
<target state="needs-translation">Drag-and-drop documents here to start uploading or place them in the consume folder. You can also drag-and-drop documents anywhere on all other pages of the web app. Once you do, Paperless-ngx will start training its machine learning algorithms.</target>
|
||||
<target state="translated">Velciet un nometiet dokumentus šeit, vai ievietojiet tos ielādes mapē, lai sāktu augšupielādi. Dokumentus var vilkt un nomest arī jebkurā citā lietotnes lapā. Tiklīdz to izdarīsiet, Paperless-ngx sāks apmācīt savus mašīnmācīšanās algoritmus.</target>
|
||||
</trans-unit>
|
||||
<trans-unit id="7495498057594070122" datatype="html">
|
||||
<source>The documents list shows all of your documents and allows for filtering as well as bulk-editing. There are three different view styles: list, small cards and large cards. A list of documents currently opened for editing is shown in the sidebar.</source>
|
||||
@@ -443,7 +443,7 @@
|
||||
<context context-type="sourcefile">src/app/app.component.ts</context>
|
||||
<context context-type="linenumber">152</context>
|
||||
</context-group>
|
||||
<target state="needs-translation">The documents list shows all of your documents and allows for filtering as well as bulk-editing. There are three different view styles: list, small cards and large cards. A list of documents currently opened for editing is shown in the sidebar.</target>
|
||||
<target state="translated">Dokumentu sarakstā ir redzami visi jūsu dokumenti, kur tos iespējams filtrēt un masveidā rediģēt. Ir pieejami trīs dažādi skata stili: saraksts, mazas kartītes un lielas kartītes. Sānu joslā ir redzami dokumenti, kas pašlaik atvērti rediģēšanai.</target>
|
||||
</trans-unit>
|
||||
<trans-unit id="1334220418719920556" datatype="html">
|
||||
<source>The filtering tools allow you to quickly find documents using various searches, dates, tags, etc.</source>
|
||||
@@ -451,7 +451,7 @@
|
||||
<context context-type="sourcefile">src/app/app.component.ts</context>
|
||||
<context context-type="linenumber">159</context>
|
||||
</context-group>
|
||||
<target state="needs-translation">The filtering tools allow you to quickly find documents using various searches, dates, tags, etc.</target>
|
||||
<target state="translated">Filtrēšanas rīki ļauj ātri atrast dokumentus, izmantojot dažādus meklējumus, datumus, birkas u. c.</target>
|
||||
</trans-unit>
|
||||
<trans-unit id="5427326625898532358" datatype="html">
|
||||
<source>Any combination of filters can be saved as a 'view' which can then be displayed on the dashboard and / or sidebar.</source>
|
||||
@@ -459,7 +459,7 @@
|
||||
<context context-type="sourcefile">src/app/app.component.ts</context>
|
||||
<context context-type="linenumber">165</context>
|
||||
</context-group>
|
||||
<target state="needs-translation">Any combination of filters can be saved as a 'view' which can then be displayed on the dashboard and / or sidebar.</target>
|
||||
<target state="translated">Jebkuru filtru kombināciju var saglabāta kā atsevišķu skatu, ko pēc tam attēlot infopanelī un/vai sānu joslā.</target>
|
||||
</trans-unit>
|
||||
<trans-unit id="5010312032259162639" datatype="html">
|
||||
<source>Attributes like tags, correspondents, document types, storage paths and custom fields can all be managed here. They can also be created from the document edit view.</source>
|
||||
@@ -467,7 +467,7 @@
|
||||
<context context-type="sourcefile">src/app/app.component.ts</context>
|
||||
<context context-type="linenumber">170</context>
|
||||
</context-group>
|
||||
<target state="needs-translation">Attributes like tags, correspondents, document types, storage paths and custom fields can all be managed here. They can also be created from the document edit view.</target>
|
||||
<target state="translated">Šeit var pārvaldīt tādus atribūtus kā birkas, korespondentus, dokumentu veidus, glabāšanas ceļus un pielāgotos laukus. Tos var izveidot arī dokumenta rediģēšanas skatā.</target>
|
||||
</trans-unit>
|
||||
<trans-unit id="7851939076947092983" datatype="html">
|
||||
<source>Manage e-mail accounts and rules for automatically importing documents.</source>
|
||||
@@ -479,7 +479,7 @@
|
||||
<context context-type="sourcefile">src/app/components/manage/mail/mail.component.html</context>
|
||||
<context context-type="linenumber">4,5</context>
|
||||
</context-group>
|
||||
<target state="needs-translation">Manage e-mail accounts and rules for automatically importing documents.</target>
|
||||
<target state="translated">Pārvaldīt e-pasta kontus un nosacījumus automātiskai dokumentu importēšanai.</target>
|
||||
</trans-unit>
|
||||
<trans-unit id="2258659358902319601" datatype="html">
|
||||
<source>Workflows give you more control over the document pipeline.</source>
|
||||
@@ -487,7 +487,7 @@
|
||||
<context context-type="sourcefile">src/app/app.component.ts</context>
|
||||
<context context-type="linenumber">186</context>
|
||||
</context-group>
|
||||
<target state="needs-translation">Workflows give you more control over the document pipeline.</target>
|
||||
<target state="translated">Darbplūsmas sniedz lielāku kontroli pār dokumentu apstrādes procesu.</target>
|
||||
</trans-unit>
|
||||
<trans-unit id="2685141468866020893" datatype="html">
|
||||
<source>Tasks helps you track background work, what needs attention, and what recently completed.</source>
|
||||
@@ -495,7 +495,7 @@
|
||||
<context context-type="sourcefile">src/app/app.component.ts</context>
|
||||
<context context-type="linenumber">194</context>
|
||||
</context-group>
|
||||
<target state="needs-translation">Tasks helps you track background work, what needs attention, and what recently completed.</target>
|
||||
<target state="translated">Uzdevumi palīdz sekot līdzi fonā notiekošajiem procesiem, to problēmām un izpildes statusam.</target>
|
||||
</trans-unit>
|
||||
<trans-unit id="2755033621682206902" datatype="html">
|
||||
<source>Check out the settings for various tweaks to the web app.</source>
|
||||
@@ -503,7 +503,7 @@
|
||||
<context context-type="sourcefile">src/app/app.component.ts</context>
|
||||
<context context-type="linenumber">202</context>
|
||||
</context-group>
|
||||
<target state="needs-translation">Check out the settings for various tweaks to the web app.</target>
|
||||
<target state="translated">Apskatiet iestatījumus dažādiem lietotnes pielāgojumiem.</target>
|
||||
</trans-unit>
|
||||
<trans-unit id="7172877665285340082" datatype="html">
|
||||
<source>Thank you! 🙏</source>
|
||||
@@ -2875,7 +2875,7 @@
|
||||
<context context-type="sourcefile">src/app/components/admin/tasks/tasks.component.ts</context>
|
||||
<context context-type="linenumber">94</context>
|
||||
</context-group>
|
||||
<target state="needs-translation">Check Workflows</target>
|
||||
<target state="translated">Apskatīt darbplūsmas</target>
|
||||
</trans-unit>
|
||||
<trans-unit id="2065831805515896240" datatype="html">
|
||||
<source>Bulk Update</source>
|
||||
@@ -4319,7 +4319,7 @@
|
||||
<context context-type="sourcefile">src/app/components/app-frame/global-search/global-search.component.html</context>
|
||||
<context context-type="linenumber">160,161</context>
|
||||
</context-group>
|
||||
<target state="needs-translation">Workflows</target>
|
||||
<target state="translated">Darbplūsmas</target>
|
||||
</trans-unit>
|
||||
<trans-unit id="83507137894716798" datatype="html">
|
||||
<source>Successfully updated object.</source>
|
||||
@@ -4799,7 +4799,7 @@
|
||||
<context context-type="sourcefile">src/app/components/common/confirm-dialog/run-workflow-confirm-dialog/run-workflow-confirm-dialog.component.html</context>
|
||||
<context context-type="linenumber">11,12</context>
|
||||
</context-group>
|
||||
<target state="needs-translation">Workflow</target>
|
||||
<target state="translated">Darbplūsma</target>
|
||||
</trans-unit>
|
||||
<trans-unit id="6185505570283812140" datatype="html">
|
||||
<source>Select a workflow</source>
|
||||
@@ -4807,7 +4807,7 @@
|
||||
<context context-type="sourcefile">src/app/components/common/confirm-dialog/run-workflow-confirm-dialog/run-workflow-confirm-dialog.component.html</context>
|
||||
<context context-type="linenumber">13,14</context>
|
||||
</context-group>
|
||||
<target state="needs-translation">Select a workflow</target>
|
||||
<target state="translated">Izvēlies darbplūsmu</target>
|
||||
</trans-unit>
|
||||
<trans-unit id="261810320774538615" datatype="html">
|
||||
<source>Run on this document regardless of trigger filters</source>
|
||||
@@ -4823,7 +4823,7 @@
|
||||
<context context-type="sourcefile">src/app/components/common/confirm-dialog/run-workflow-confirm-dialog/run-workflow-confirm-dialog.component.html</context>
|
||||
<context context-type="linenumber">23,24</context>
|
||||
</context-group>
|
||||
<target state="needs-translation">Ignore the workflow's trigger filters for this document.</target>
|
||||
<target state="translated">Ignorēt darbplūsmas palaišanas filtrus dokumentam</target>
|
||||
</trans-unit>
|
||||
<trans-unit id="4512110365422311821" datatype="html">
|
||||
<source>Run on all selected documents</source>
|
||||
@@ -4839,7 +4839,7 @@
|
||||
<context context-type="sourcefile">src/app/components/common/confirm-dialog/run-workflow-confirm-dialog/run-workflow-confirm-dialog.component.html</context>
|
||||
<context context-type="linenumber">26,27</context>
|
||||
</context-group>
|
||||
<target state="needs-translation">Ignore the workflow's trigger filters and run on every selected document.</target>
|
||||
<target state="translated">Ignorēt darbplūsmas palaišanas filtrus un izpildīt katram atlasītajam dokumentam.</target>
|
||||
</trans-unit>
|
||||
<trans-unit id="2509141182388535183" datatype="html">
|
||||
<source>View</source>
|
||||
@@ -6639,7 +6639,7 @@
|
||||
<context context-type="sourcefile">src/app/components/common/edit-dialog/workflow-edit-dialog/workflow-edit-dialog.component.html</context>
|
||||
<context context-type="linenumber">31,32</context>
|
||||
</context-group>
|
||||
<target state="needs-translation">Trigger Workflow On:</target>
|
||||
<target state="translated">Palaist darbplūsmu:</target>
|
||||
</trans-unit>
|
||||
<trans-unit id="3901427285052969410" datatype="html">
|
||||
<source>Add Trigger</source>
|
||||
@@ -6855,7 +6855,7 @@
|
||||
<context context-type="sourcefile">src/app/components/common/edit-dialog/workflow-edit-dialog/workflow-edit-dialog.component.html</context>
|
||||
<context context-type="linenumber">195,196</context>
|
||||
</context-group>
|
||||
<target state="needs-translation">No advanced workflow filters defined.</target>
|
||||
<target state="translated">Nav definēts neviens papildu darbplūsmas filtrs.</target>
|
||||
</trans-unit>
|
||||
<trans-unit id="6892734625735572404" datatype="html">
|
||||
<source> Complete the custom field query configuration. </source>
|
||||
@@ -6887,7 +6887,7 @@
|
||||
<context context-type="sourcefile">src/app/components/common/edit-dialog/workflow-edit-dialog/workflow-edit-dialog.component.html</context>
|
||||
<context context-type="linenumber">264</context>
|
||||
</context-group>
|
||||
<target state="needs-translation">Can include some placeholders, see <a target='_blank' href='https://docs.paperless-ngx.com/usage/#workflows'>documentation</a>.</target>
|
||||
<target state="translated">Var iekļaut dažus vietturus, skatīt<a target='_blank' href='https://docs.paperless-ngx.com/usage/#workflows'>dokumentāciju</a>.</target>
|
||||
</trans-unit>
|
||||
<trans-unit id="6528897010417701530" datatype="html">
|
||||
<source>Assign tags</source>
|
||||
@@ -7135,7 +7135,7 @@
|
||||
<context context-type="sourcefile">src/app/components/common/edit-dialog/workflow-edit-dialog/workflow-edit-dialog.component.html</context>
|
||||
<context context-type="linenumber">438</context>
|
||||
</context-group>
|
||||
<target state="needs-translation"> One password per line. The workflow will try them in order until one succeeds. </target>
|
||||
<target state="translated"> Pa vienai parolei katrā rindā. Darbplūsma tās mēģinās norādītajā secībā, līdz kāda no tām derēs. </target>
|
||||
</trans-unit>
|
||||
<trans-unit id="3853121441237751087" datatype="html">
|
||||
<source>Passwords</source>
|
||||
@@ -7159,7 +7159,7 @@
|
||||
<context context-type="sourcefile">src/app/components/common/edit-dialog/workflow-edit-dialog/workflow-edit-dialog.component.html</context>
|
||||
<context context-type="linenumber">455,456</context>
|
||||
</context-group>
|
||||
<target state="needs-translation">The document will be moved to the trash at the end of the workflow run.</target>
|
||||
<target state="translated">Dokuments tiks pārvietots uz atkritni pēc darbplūsmas izpildes.</target>
|
||||
</trans-unit>
|
||||
<trans-unit id="7532958562244845095" datatype="html">
|
||||
<source>The document will be sent to the configured remote OCR service. May incur costs.</source>
|
||||
@@ -7183,7 +7183,7 @@
|
||||
<context context-type="sourcefile">src/app/components/common/edit-dialog/workflow-edit-dialog/workflow-edit-dialog.component.html</context>
|
||||
<context context-type="linenumber">470,471</context>
|
||||
</context-group>
|
||||
<target state="needs-translation">This action runs in the background, so the suggestions may be applied after the other actions of this workflow have finished.</target>
|
||||
<target state="translated">Šī darbība notiek fonā, tāpēc ieteikumus var piemērot pēc tam, kad pārējās šīs darbplūsmas darbības ir pabeigtas.</target>
|
||||
</trans-unit>
|
||||
<trans-unit id="3473589590476379802" datatype="html">
|
||||
<source>Apply suggestions for</source>
|
||||
@@ -7503,7 +7503,7 @@
|
||||
<context context-type="sourcefile">src/app/components/common/edit-dialog/workflow-edit-dialog/workflow-edit-dialog.component.ts</context>
|
||||
<context context-type="linenumber">574</context>
|
||||
</context-group>
|
||||
<target state="needs-translation">Some workflow options could not be loaded.</target>
|
||||
<target state="translated">Neizdevās ielādēt dažas darbplūsmas opcijas.</target>
|
||||
</trans-unit>
|
||||
<trans-unit id="3138206142174978019" datatype="html">
|
||||
<source>Create new workflow</source>
|
||||
@@ -9703,7 +9703,7 @@
|
||||
<context context-type="sourcefile">src/app/utils/document-operation.ts</context>
|
||||
<context context-type="linenumber">12</context>
|
||||
</context-group>
|
||||
<target state="needs-translation">Run workflow</target>
|
||||
<target state="translated">Palaist darbplūsmu</target>
|
||||
</trans-unit>
|
||||
<trans-unit id="7049887240439736400" datatype="html">
|
||||
<source>Print</source>
|
||||
@@ -10331,7 +10331,7 @@
|
||||
<context context-type="sourcefile">src/app/components/document-detail/document-detail.component.ts</context>
|
||||
<context context-type="linenumber">1591</context>
|
||||
</context-group>
|
||||
<target state="needs-translation">Run a workflow on "<x id="PH" equiv-text="this.document().title"/>".</target>
|
||||
<target state="translated">Palaist darbplūsmu dokumentam "<x id="PH" equiv-text="this.document().title"/>".</target>
|
||||
</trans-unit>
|
||||
<trans-unit id="3759965007855499397" datatype="html">
|
||||
<source>Run</source>
|
||||
@@ -10351,7 +10351,7 @@
|
||||
<context context-type="sourcefile">src/app/components/document-detail/document-detail.component.ts</context>
|
||||
<context context-type="linenumber">1607</context>
|
||||
</context-group>
|
||||
<target state="needs-translation">Workflow queued.</target>
|
||||
<target state="translated">Darbplūsma pievienota izpildei.</target>
|
||||
</trans-unit>
|
||||
<trans-unit id="3321568156074471424" datatype="html">
|
||||
<source>Workflow completed.</source>
|
||||
@@ -10359,7 +10359,7 @@
|
||||
<context context-type="sourcefile">src/app/components/document-detail/document-detail.component.ts</context>
|
||||
<context context-type="linenumber">1609</context>
|
||||
</context-group>
|
||||
<target state="needs-translation">Workflow completed.</target>
|
||||
<target state="translated">Darbplūsma izpildīta.</target>
|
||||
</trans-unit>
|
||||
<trans-unit id="6030453331794586802" datatype="html">
|
||||
<source>Error downloading document</source>
|
||||
@@ -10831,7 +10831,7 @@
|
||||
<context context-type="sourcefile">src/app/components/document-list/bulk-editor/bulk-editor.component.ts</context>
|
||||
<context context-type="linenumber">316</context>
|
||||
</context-group>
|
||||
<target state="needs-translation">Run a workflow on <x id="PH" equiv-text="this.getSelectionSize()"/> selected document(s).</target>
|
||||
<target state="translated">Palaist darbplūsmu <x id="PH" equiv-text="this.getSelectionSize()"/> atlasītajiem dokumentiem.</target>
|
||||
</trans-unit>
|
||||
<trans-unit id="8161885405686762788" datatype="html">
|
||||
<source>Workflow will run on the selected documents in the background.</source>
|
||||
@@ -10839,7 +10839,7 @@
|
||||
<context context-type="sourcefile">src/app/components/document-list/bulk-editor/bulk-editor.component.ts</context>
|
||||
<context context-type="linenumber">333</context>
|
||||
</context-group>
|
||||
<target state="needs-translation">Workflow will run on the selected documents in the background.</target>
|
||||
<target state="translated">Darbplūsma fonā apstrādās atlasītos dokumentus.</target>
|
||||
</trans-unit>
|
||||
<trans-unit id="6198773644658556874" datatype="html">
|
||||
<source>Bulk operation '<x id="PH" equiv-text="label"/>' submitted for processing.</source>
|
||||
@@ -13283,7 +13283,7 @@
|
||||
<context context-type="sourcefile">src/app/components/manage/workflows/workflows.component.html</context>
|
||||
<context context-type="linenumber">4,5</context>
|
||||
</context-group>
|
||||
<target state="needs-translation">Use workflows to customize the behavior of Paperless-ngx when events 'trigger' a workflow.</target>
|
||||
<target state="translated">Izmanto darbplūsmas, lai pielāgotu Paperless-ngx rīcību, kad darbība tās palaiž.</target>
|
||||
</trans-unit>
|
||||
<trans-unit id="2437630016855517844" datatype="html">
|
||||
<source>Add Workflow</source>
|
||||
@@ -13291,7 +13291,7 @@
|
||||
<context context-type="sourcefile">src/app/components/manage/workflows/workflows.component.html</context>
|
||||
<context context-type="linenumber">9</context>
|
||||
</context-group>
|
||||
<target state="needs-translation">Add Workflow</target>
|
||||
<target state="translated">Pievienot darbplūsmu</target>
|
||||
</trans-unit>
|
||||
<trans-unit id="1624023882313260402" datatype="html">
|
||||
<source>No workflows defined.</source>
|
||||
@@ -13299,7 +13299,7 @@
|
||||
<context context-type="sourcefile">src/app/components/manage/workflows/workflows.component.html</context>
|
||||
<context context-type="linenumber">80,82</context>
|
||||
</context-group>
|
||||
<target state="needs-translation">No workflows defined.</target>
|
||||
<target state="translated">Nav definēta neviena darbplūsma.</target>
|
||||
</trans-unit>
|
||||
<trans-unit id="4200688335642457098" datatype="html">
|
||||
<source>Saved workflow "<x id="PH" equiv-text="newWorkflow.name"/>".</source>
|
||||
@@ -13307,7 +13307,7 @@
|
||||
<context context-type="sourcefile">src/app/components/manage/workflows/workflows.component.ts</context>
|
||||
<context context-type="linenumber">90</context>
|
||||
</context-group>
|
||||
<target state="needs-translation">Saved workflow "<x id="PH" equiv-text="newWorkflow.name"/>".</target>
|
||||
<target state="translated">Saglabāt darbplūsmu "<x id="PH" equiv-text="newWorkflow.name"/>".</target>
|
||||
</trans-unit>
|
||||
<trans-unit id="7593065565369163325" datatype="html">
|
||||
<source>Error saving workflow.</source>
|
||||
@@ -13315,7 +13315,7 @@
|
||||
<context context-type="sourcefile">src/app/components/manage/workflows/workflows.component.ts</context>
|
||||
<context context-type="linenumber">98</context>
|
||||
</context-group>
|
||||
<target state="needs-translation">Error saving workflow.</target>
|
||||
<target state="translated">Neizdevās saglabāt darbplūsmu.</target>
|
||||
</trans-unit>
|
||||
<trans-unit id="563460864902055482" datatype="html">
|
||||
<source>Confirm delete workflow</source>
|
||||
@@ -13323,7 +13323,7 @@
|
||||
<context context-type="sourcefile">src/app/components/manage/workflows/workflows.component.ts</context>
|
||||
<context context-type="linenumber">131</context>
|
||||
</context-group>
|
||||
<target state="needs-translation">Confirm delete workflow</target>
|
||||
<target state="translated">Apstiprināt darbplūsmas dzēšanu</target>
|
||||
</trans-unit>
|
||||
<trans-unit id="6874008462443189248" datatype="html">
|
||||
<source>This operation will permanently delete this workflow.</source>
|
||||
@@ -13331,7 +13331,7 @@
|
||||
<context context-type="sourcefile">src/app/components/manage/workflows/workflows.component.ts</context>
|
||||
<context context-type="linenumber">132</context>
|
||||
</context-group>
|
||||
<target state="needs-translation">This operation will permanently delete this workflow.</target>
|
||||
<target state="translated">Šī darbība neatgriezeniski izdzēsīs darbplūsmu.</target>
|
||||
</trans-unit>
|
||||
<trans-unit id="1284828901551483140" datatype="html">
|
||||
<source>Deleted workflow "<x id="PH" equiv-text="workflow.name"/>".</source>
|
||||
@@ -13339,7 +13339,7 @@
|
||||
<context context-type="sourcefile">src/app/components/manage/workflows/workflows.component.ts</context>
|
||||
<context context-type="linenumber">142</context>
|
||||
</context-group>
|
||||
<target state="needs-translation">Deleted workflow "<x id="PH" equiv-text="workflow.name"/>".</target>
|
||||
<target state="translated">Izdzēstā darbplūsma "<x id="PH" equiv-text="workflow.name"/>".</target>
|
||||
</trans-unit>
|
||||
<trans-unit id="1427555175623563103" datatype="html">
|
||||
<source>Error deleting workflow "<x id="PH" equiv-text="workflow.name"/>".</source>
|
||||
@@ -13347,7 +13347,7 @@
|
||||
<context context-type="sourcefile">src/app/components/manage/workflows/workflows.component.ts</context>
|
||||
<context context-type="linenumber">149</context>
|
||||
</context-group>
|
||||
<target state="needs-translation">Error deleting workflow "<x id="PH" equiv-text="workflow.name"/>".</target>
|
||||
<target state="translated">Neizdevās izdzēst darbplūsmu "<x id="PH" equiv-text="workflow.name"/>".</target>
|
||||
</trans-unit>
|
||||
<trans-unit id="3737192425004139518" datatype="html">
|
||||
<source>Enabled workflow "<x id="PH" equiv-text="workflow.name"/>"</source>
|
||||
@@ -13355,7 +13355,7 @@
|
||||
<context context-type="sourcefile">src/app/components/manage/workflows/workflows.component.ts</context>
|
||||
<context context-type="linenumber">162</context>
|
||||
</context-group>
|
||||
<target state="needs-translation">Enabled workflow "<x id="PH" equiv-text="workflow.name"/>"</target>
|
||||
<target state="translated">Iespējota darbplūsma "<x id="PH" equiv-text="workflow.name"/>"</target>
|
||||
</trans-unit>
|
||||
<trans-unit id="7404075898344576079" datatype="html">
|
||||
<source>Disabled workflow "<x id="PH" equiv-text="workflow.name"/>"</source>
|
||||
@@ -13363,7 +13363,7 @@
|
||||
<context context-type="sourcefile">src/app/components/manage/workflows/workflows.component.ts</context>
|
||||
<context context-type="linenumber">163</context>
|
||||
</context-group>
|
||||
<target state="needs-translation">Disabled workflow "<x id="PH" equiv-text="workflow.name"/>"</target>
|
||||
<target state="translated">Atspējota darbplūsma "<x id="PH" equiv-text="workflow.name"/>"</target>
|
||||
</trans-unit>
|
||||
<trans-unit id="6597823365851861961" datatype="html">
|
||||
<source>Error toggling workflow "<x id="PH" equiv-text="workflow.name"/>".</source>
|
||||
@@ -13371,7 +13371,7 @@
|
||||
<context context-type="sourcefile">src/app/components/manage/workflows/workflows.component.ts</context>
|
||||
<context context-type="linenumber">170</context>
|
||||
</context-group>
|
||||
<target state="needs-translation">Error toggling workflow "<x id="PH" equiv-text="workflow.name"/>".</target>
|
||||
<target state="translated">Neizdevās pārslēgt darbplūsmu "<x id="PH" equiv-text="workflow.name"/>".</target>
|
||||
</trans-unit>
|
||||
<trans-unit id="2649252321173430744" datatype="html">
|
||||
<source>Not Found</source>
|
||||
@@ -13836,7 +13836,7 @@
|
||||
<context context-type="sourcefile">src/app/data/paperless-config.ts</context>
|
||||
<context context-type="linenumber">233</context>
|
||||
</context-group>
|
||||
<target state="needs-translation">Which documents are sent to the remote engine. Use 'workflow_only' to keep remote OCR off unless a workflow enables it for a document.</target>
|
||||
<target state="translated">Kuri dokumenti tiek nosūtīti attālinātajam dzinējam. Izmantojiet “workflow_only”, lai attālinātā teksta atpazīšana (OCR) būtu izslēgta, ja vien kāda darbplūsma to neiespējo konkrētam dokumentam.</target>
|
||||
</trans-unit>
|
||||
<trans-unit id="7106327322456204362" datatype="html">
|
||||
<source>Application Logo</source>
|
||||
|
||||
+23
-7
@@ -5318,6 +5318,8 @@ class CustomFieldViewSet(PermissionsAwareDocumentCountMixin, ModelViewSet[Custom
|
||||
class SystemStatusView(PassUserMixin):
|
||||
permission_classes = (IsAuthenticated,)
|
||||
TASK_SUMMARY_DAYS = 30
|
||||
# Seconds to wait on the broker before reporting it as unreachable
|
||||
BROKER_SOCKET_TIMEOUT = 5
|
||||
|
||||
def get(self, request, format=None):
|
||||
if not has_system_status_permission(request.user):
|
||||
@@ -5363,7 +5365,11 @@ class SystemStatusView(PassUserMixin):
|
||||
if redis_url_parsed.hostname is not None:
|
||||
redis_constructed_url += f":{redis_url_parsed.port}"
|
||||
redis_error = None
|
||||
with Redis.from_url(url=redis_url) as client:
|
||||
with Redis.from_url(
|
||||
url=redis_url,
|
||||
socket_timeout=self.BROKER_SOCKET_TIMEOUT,
|
||||
socket_connect_timeout=self.BROKER_SOCKET_TIMEOUT,
|
||||
) as client:
|
||||
try:
|
||||
client.ping()
|
||||
redis_status = "OK"
|
||||
@@ -5378,12 +5384,22 @@ class SystemStatusView(PassUserMixin):
|
||||
celery_url = None
|
||||
try:
|
||||
celery_ping = None
|
||||
for ping_attempt in range(3):
|
||||
celery_ping = celery_app.control.inspect().ping()
|
||||
if celery_ping:
|
||||
break
|
||||
if ping_attempt < 2:
|
||||
sleep(0.25)
|
||||
# Use a dedicated connection with socket timeouts. Without them a
|
||||
# stalled broker blocks this request (and its DB connection) forever
|
||||
with celery_app.connection_for_read(
|
||||
transport_options={
|
||||
"socket_timeout": self.BROKER_SOCKET_TIMEOUT,
|
||||
"socket_connect_timeout": self.BROKER_SOCKET_TIMEOUT,
|
||||
},
|
||||
) as celery_connection:
|
||||
for ping_attempt in range(3):
|
||||
celery_ping = celery_app.control.inspect(
|
||||
connection=celery_connection,
|
||||
).ping()
|
||||
if celery_ping:
|
||||
break
|
||||
if ping_attempt < 2:
|
||||
sleep(0.25)
|
||||
|
||||
if not celery_ping:
|
||||
celery_active = "WARNING"
|
||||
|
||||
@@ -3,7 +3,7 @@ msgstr ""
|
||||
"Project-Id-Version: paperless-ngx\n"
|
||||
"Report-Msgid-Bugs-To: \n"
|
||||
"POT-Creation-Date: 2026-11-17 20:48+0000\n"
|
||||
"PO-Revision-Date: 2026-11-17 20:49\n"
|
||||
"PO-Revision-Date: 2026-11-21 12:15\n"
|
||||
"Last-Translator: \n"
|
||||
"Language-Team: Arabic\n"
|
||||
"Language: ar_SA\n"
|
||||
@@ -23,7 +23,7 @@ msgstr "المستندات"
|
||||
|
||||
#: documents/filters.py:349
|
||||
msgid "Expected a date or a relative date such as \"today\" or \"in 30 days\"."
|
||||
msgstr ""
|
||||
msgstr "كان متوقعا إدخال تاريخ أو تاريخ نسبي مثل «اليوم» أو «بعد 30 يوما»"
|
||||
|
||||
#: documents/filters.py:527
|
||||
msgid "Value must be valid JSON."
|
||||
@@ -39,7 +39,7 @@ msgstr "قائمة عبارة خاطئة."
|
||||
|
||||
#: documents/filters.py:579
|
||||
msgid "Invalid logical operator {op!r}"
|
||||
msgstr ""
|
||||
msgstr "عملية منطقية غير صالحة"
|
||||
|
||||
#: documents/filters.py:593
|
||||
msgid "Maximum number of query conditions exceeded."
|
||||
@@ -290,7 +290,7 @@ msgstr "أرشيف"
|
||||
|
||||
#: documents/models.py:629
|
||||
msgid "Bank"
|
||||
msgstr ""
|
||||
msgstr "بنك"
|
||||
|
||||
#: documents/models.py:630
|
||||
msgid "Basket"
|
||||
@@ -298,15 +298,15 @@ msgstr ""
|
||||
|
||||
#: documents/models.py:631
|
||||
msgid "Bell"
|
||||
msgstr ""
|
||||
msgstr "جرس"
|
||||
|
||||
#: documents/models.py:632
|
||||
msgid "Bookmark"
|
||||
msgstr ""
|
||||
msgstr "المفضلة"
|
||||
|
||||
#: documents/models.py:633
|
||||
msgid "Boxes"
|
||||
msgstr ""
|
||||
msgstr "الصناديق"
|
||||
|
||||
#: documents/models.py:634
|
||||
msgid "Briefcase"
|
||||
@@ -318,15 +318,15 @@ msgstr ""
|
||||
|
||||
#: documents/models.py:636
|
||||
msgid "Calculator"
|
||||
msgstr ""
|
||||
msgstr "الحاسبة"
|
||||
|
||||
#: documents/models.py:637
|
||||
msgid "Calendar"
|
||||
msgstr ""
|
||||
msgstr "التقويم"
|
||||
|
||||
#: documents/models.py:638
|
||||
msgid "Camera"
|
||||
msgstr ""
|
||||
msgstr "كاميرة"
|
||||
|
||||
#: documents/models.py:639
|
||||
msgid "Checklist"
|
||||
@@ -334,11 +334,11 @@ msgstr ""
|
||||
|
||||
#: documents/models.py:640
|
||||
msgid "Cash"
|
||||
msgstr ""
|
||||
msgstr "نقذي"
|
||||
|
||||
#: documents/models.py:641
|
||||
msgid "Chat"
|
||||
msgstr ""
|
||||
msgstr "الدردشة"
|
||||
|
||||
#: documents/models.py:642
|
||||
msgid "Check"
|
||||
@@ -350,7 +350,7 @@ msgstr ""
|
||||
|
||||
#: documents/models.py:644
|
||||
msgid "Clock"
|
||||
msgstr ""
|
||||
msgstr "الساعة"
|
||||
|
||||
#: documents/models.py:645
|
||||
msgid "Credit card"
|
||||
@@ -358,7 +358,7 @@ msgstr ""
|
||||
|
||||
#: documents/models.py:646
|
||||
msgid "Download"
|
||||
msgstr ""
|
||||
msgstr "تحميل"
|
||||
|
||||
#: documents/models.py:647
|
||||
msgid "Envelope"
|
||||
@@ -366,11 +366,11 @@ msgstr ""
|
||||
|
||||
#: documents/models.py:648
|
||||
msgid "Warning"
|
||||
msgstr ""
|
||||
msgstr "تحذير"
|
||||
|
||||
#: documents/models.py:649
|
||||
msgid "File"
|
||||
msgstr ""
|
||||
msgstr "ملف"
|
||||
|
||||
#: documents/models.py:650
|
||||
msgid "Checked file"
|
||||
|
||||
@@ -3,7 +3,7 @@ msgstr ""
|
||||
"Project-Id-Version: paperless-ngx\n"
|
||||
"Report-Msgid-Bugs-To: \n"
|
||||
"POT-Creation-Date: 2026-11-17 20:48+0000\n"
|
||||
"PO-Revision-Date: 2026-11-17 20:50\n"
|
||||
"PO-Revision-Date: 2026-11-20 12:17\n"
|
||||
"Last-Translator: \n"
|
||||
"Language-Team: Spanish\n"
|
||||
"Language: es_ES\n"
|
||||
@@ -802,7 +802,7 @@ msgstr "búsqueda simple por texto"
|
||||
|
||||
#: documents/models.py:808
|
||||
msgid "has duplicates"
|
||||
msgstr ""
|
||||
msgstr "tiene Duplicados"
|
||||
|
||||
#: documents/models.py:818
|
||||
msgid "rule type"
|
||||
@@ -874,7 +874,7 @@ msgstr "Verificar flujos de trabajo"
|
||||
|
||||
#: documents/models.py:869
|
||||
msgid "Bulk Update"
|
||||
msgstr ""
|
||||
msgstr "Actualización Masiva"
|
||||
|
||||
#: documents/models.py:870
|
||||
msgid "Reprocess Document"
|
||||
@@ -890,7 +890,7 @@ msgstr "Borrado masivo"
|
||||
|
||||
#: documents/models.py:873
|
||||
msgid "Apply AI Suggestions"
|
||||
msgstr ""
|
||||
msgstr "Aplicar sugerencias de IA"
|
||||
|
||||
#: documents/models.py:882 documents/models.py:1545
|
||||
msgid "Scheduled"
|
||||
@@ -902,7 +902,7 @@ msgstr "Interfaz de usuario web"
|
||||
|
||||
#: documents/models.py:884
|
||||
msgid "API Upload"
|
||||
msgstr ""
|
||||
msgstr "Subir API"
|
||||
|
||||
#: documents/models.py:885
|
||||
msgid "Folder Consume"
|
||||
@@ -910,7 +910,7 @@ msgstr ""
|
||||
|
||||
#: documents/models.py:886
|
||||
msgid "Email Consume"
|
||||
msgstr ""
|
||||
msgstr "Consume Email"
|
||||
|
||||
#: documents/models.py:887
|
||||
msgid "System"
|
||||
|
||||
@@ -3,7 +3,7 @@ msgstr ""
|
||||
"Project-Id-Version: paperless-ngx\n"
|
||||
"Report-Msgid-Bugs-To: \n"
|
||||
"POT-Creation-Date: 2026-11-17 20:48+0000\n"
|
||||
"PO-Revision-Date: 2026-11-17 20:49\n"
|
||||
"PO-Revision-Date: 2026-11-18 04:15\n"
|
||||
"Last-Translator: \n"
|
||||
"Language-Team: Italian\n"
|
||||
"Language: it_IT\n"
|
||||
@@ -1002,7 +1002,7 @@ msgstr ""
|
||||
|
||||
#: documents/models.py:1011
|
||||
msgid "Markdown"
|
||||
msgstr ""
|
||||
msgstr "Annotare"
|
||||
|
||||
#: documents/models.py:1016
|
||||
msgid "Note for the document"
|
||||
|
||||
@@ -3,7 +3,7 @@ msgstr ""
|
||||
"Project-Id-Version: paperless-ngx\n"
|
||||
"Report-Msgid-Bugs-To: \n"
|
||||
"POT-Creation-Date: 2026-11-17 20:48+0000\n"
|
||||
"PO-Revision-Date: 2026-11-17 20:49\n"
|
||||
"PO-Revision-Date: 2026-11-21 00:31\n"
|
||||
"Last-Translator: \n"
|
||||
"Language-Team: Latvian\n"
|
||||
"Language: lv_LV\n"
|
||||
|
||||
Reference in new issue
Block a user