mirror of
https://github.com/paperless-ngx/paperless-ngx.git
synced 2025-07-28 18:24:38 -05:00
Refactor
This commit is contained in:
@@ -4380,22 +4380,22 @@
|
||||
<context context-type="linenumber">121</context>
|
||||
</context-group>
|
||||
</trans-unit>
|
||||
<trans-unit id="7581051779822096189" datatype="html">
|
||||
<source>Set scheduled trigger delay and which field to use.</source>
|
||||
<trans-unit id="5337452276818111131" datatype="html">
|
||||
<source>Set scheduled trigger offset and which field to use.</source>
|
||||
<context-group purpose="location">
|
||||
<context context-type="sourcefile">src/app/components/common/edit-dialog/workflow-edit-dialog/workflow-edit-dialog.component.html</context>
|
||||
<context context-type="linenumber">123</context>
|
||||
</context-group>
|
||||
</trans-unit>
|
||||
<trans-unit id="1418101411356139094" datatype="html">
|
||||
<source>Delay</source>
|
||||
<trans-unit id="3676850495488145564" datatype="html">
|
||||
<source>Offset</source>
|
||||
<context-group purpose="location">
|
||||
<context context-type="sourcefile">src/app/components/common/edit-dialog/workflow-edit-dialog/workflow-edit-dialog.component.html</context>
|
||||
<context context-type="linenumber">126</context>
|
||||
</context-group>
|
||||
</trans-unit>
|
||||
<trans-unit id="2695696137978565586" datatype="html">
|
||||
<source>Delay time string such as '3months', '1y'.</source>
|
||||
<trans-unit id="1053165610360608412" datatype="html">
|
||||
<source>Offset in days. Use 0 for immediate.</source>
|
||||
<context-group purpose="location">
|
||||
<context context-type="sourcefile">src/app/components/common/edit-dialog/workflow-edit-dialog/workflow-edit-dialog.component.html</context>
|
||||
<context context-type="linenumber">126</context>
|
||||
@@ -4429,8 +4429,8 @@
|
||||
<context context-type="linenumber">134</context>
|
||||
</context-group>
|
||||
</trans-unit>
|
||||
<trans-unit id="2364111057675998268" datatype="html">
|
||||
<source>Custom field to use for delay.</source>
|
||||
<trans-unit id="1088170562604583291" datatype="html">
|
||||
<source>Custom field to use for date.</source>
|
||||
<context-group purpose="location">
|
||||
<context context-type="sourcefile">src/app/components/common/edit-dialog/workflow-edit-dialog/workflow-edit-dialog.component.html</context>
|
||||
<context context-type="linenumber">134</context>
|
||||
|
@@ -120,18 +120,18 @@
|
||||
<input type="hidden" formControlName="id" />
|
||||
<pngx-input-select i18n-title title="Trigger type" [horizontal]="true" [items]="triggerTypeOptions" formControlName="type"></pngx-input-select>
|
||||
@if (formGroup.get('type').value === WorkflowTriggerType.Scheduled) {
|
||||
<p class="small" i18n>Set scheduled trigger delay and which field to use.</p>
|
||||
<p class="small" i18n>Set scheduled trigger offset and which field to use.</p>
|
||||
<div class="row">
|
||||
<div class="col-4">
|
||||
<pngx-input-text i18n-title title="Delay" formControlName="schedule_delay" i18n-hint hint="Delay time string such as '3months', '1y'." [error]="error?.schedule_delay"></pngx-input-text>
|
||||
<pngx-input-number i18n-title title="Offset" formControlName="schedule_offset_days" i18n-hint hint="Offset in days. Use 0 for immediate." [error]="error?.schedule_offset_days"></pngx-input-number>
|
||||
<pngx-input-check i18n-title title="Repeat" formControlName="schedule_is_recurring" i18n-hint hint="Repeat the trigger after the delay." [error]="error?.schedule_is_recurring"></pngx-input-check>
|
||||
</div>
|
||||
<div class="col-4">
|
||||
<pngx-input-select i18n-title title="Relative to" formControlName="schedule_delay_field" [items]="scheduleDelayFieldOptions" [error]="error?.schedule_delay_field"></pngx-input-select>
|
||||
<pngx-input-select i18n-title title="Relative to" formControlName="schedule_date_field" [items]="scheduleDateFieldOptions" [error]="error?.schedule_date_field"></pngx-input-select>
|
||||
</div>
|
||||
@if (formGroup.get('schedule_delay_field').value === 'custom_field') {
|
||||
@if (formGroup.get('schedule_date_field').value === 'custom_field') {
|
||||
<div class="col-4">
|
||||
<pngx-input-select i18n-title title="Delay custom field" formControlName="schedule_delay_custom_field" [items]="dateCustomFields" i18n-hint hint="Custom field to use for delay." [error]="error?.schedule_delay_custom_field"></pngx-input-select>
|
||||
<pngx-input-select i18n-title title="Delay custom field" formControlName="schedule_date_custom_field" [items]="dateCustomFields" i18n-hint hint="Custom field to use for date." [error]="error?.schedule_date_custom_field"></pngx-input-select>
|
||||
</div>
|
||||
}
|
||||
</div>
|
||||
|
@@ -19,7 +19,7 @@ import { CustomFieldsService } from 'src/app/services/rest/custom-fields.service
|
||||
import { CustomField, CustomFieldDataType } from 'src/app/data/custom-field'
|
||||
import {
|
||||
DocumentSource,
|
||||
ScheduleDelayField,
|
||||
ScheduleDateField,
|
||||
WorkflowTrigger,
|
||||
WorkflowTriggerType,
|
||||
} from 'src/app/data/workflow-trigger'
|
||||
@@ -49,21 +49,21 @@ export const DOCUMENT_SOURCE_OPTIONS = [
|
||||
},
|
||||
]
|
||||
|
||||
export const SCHEDULE_DELAY_FIELD_OPTIONS = [
|
||||
export const SCHEDULE_DATE_FIELD_OPTIONS = [
|
||||
{
|
||||
id: ScheduleDelayField.Added,
|
||||
id: ScheduleDateField.Added,
|
||||
name: $localize`Added`,
|
||||
},
|
||||
{
|
||||
id: ScheduleDelayField.Created,
|
||||
id: ScheduleDateField.Created,
|
||||
name: $localize`Created`,
|
||||
},
|
||||
{
|
||||
id: ScheduleDelayField.Modified,
|
||||
id: ScheduleDateField.Modified,
|
||||
name: $localize`Modified`,
|
||||
},
|
||||
{
|
||||
id: ScheduleDelayField.CustomField,
|
||||
id: ScheduleDateField.CustomField,
|
||||
name: $localize`Custom Field`,
|
||||
},
|
||||
]
|
||||
@@ -338,11 +338,11 @@ export class WorkflowEditDialogComponent
|
||||
filter_has_document_type: new FormControl(
|
||||
trigger.filter_has_document_type
|
||||
),
|
||||
schedule_delay: new FormControl(trigger.schedule_delay),
|
||||
schedule_offset_days: new FormControl(trigger.schedule_offset_days),
|
||||
schedule_is_recurring: new FormControl(trigger.schedule_is_recurring),
|
||||
schedule_delay_field: new FormControl(trigger.schedule_delay_field),
|
||||
schedule_delay_custom_field: new FormControl(
|
||||
trigger.schedule_delay_custom_field
|
||||
schedule_date_field: new FormControl(trigger.schedule_date_field),
|
||||
schedule_date_custom_field: new FormControl(
|
||||
trigger.schedule_date_custom_field
|
||||
),
|
||||
}),
|
||||
{ emitEvent }
|
||||
@@ -418,8 +418,8 @@ export class WorkflowEditDialogComponent
|
||||
return WORKFLOW_TYPE_OPTIONS
|
||||
}
|
||||
|
||||
get scheduleDelayFieldOptions() {
|
||||
return SCHEDULE_DELAY_FIELD_OPTIONS
|
||||
get scheduleDateFieldOptions() {
|
||||
return SCHEDULE_DATE_FIELD_OPTIONS
|
||||
}
|
||||
|
||||
get dateCustomFields() {
|
||||
@@ -448,10 +448,10 @@ export class WorkflowEditDialogComponent
|
||||
matching_algorithm: MATCH_NONE,
|
||||
match: '',
|
||||
is_insensitive: true,
|
||||
schedule_delay: null,
|
||||
schedule_offset_days: null,
|
||||
schedule_is_recurring: false,
|
||||
schedule_delay_field: ScheduleDelayField.Added,
|
||||
schedule_delay_custom_field: null,
|
||||
schedule_date_field: ScheduleDateField.Added,
|
||||
schedule_date_custom_field: null,
|
||||
}
|
||||
this.object.triggers.push(trigger)
|
||||
this.createTriggerField(trigger)
|
||||
|
@@ -13,7 +13,7 @@ export enum WorkflowTriggerType {
|
||||
Scheduled = 4,
|
||||
}
|
||||
|
||||
export enum ScheduleDelayField {
|
||||
export enum ScheduleDateField {
|
||||
Added = 'added',
|
||||
Created = 'created',
|
||||
Modified = 'modified',
|
||||
@@ -43,11 +43,11 @@ export interface WorkflowTrigger extends ObjectWithId {
|
||||
|
||||
filter_has_document_type?: number // DocumentType.id
|
||||
|
||||
schedule_delay?: string
|
||||
schedule_offset_days?: number
|
||||
|
||||
schedule_is_recurring?: boolean
|
||||
|
||||
schedule_delay_field?: ScheduleDelayField
|
||||
schedule_date_field?: ScheduleDateField
|
||||
|
||||
schedule_delay_custom_field?: number // CustomField.id
|
||||
schedule_date_custom_field?: number // CustomField.id
|
||||
}
|
||||
|
Reference in New Issue
Block a user