mirror of
				https://github.com/paperless-ngx/paperless-ngx.git
				synced 2025-11-03 03:16:10 -06:00 
			
		
		
		
	Merge pull request #726 from darmiel/feature/664-filter-by-asn
Implemented 'Filter by: ASN'
This commit is contained in:
		@@ -1,5 +1,6 @@
 | 
			
		||||
[](https://github.com/jonaswinkler/paperless-ng/actions)
 | 
			
		||||

 | 
			
		||||
[](https://crowdin.com/project/paperless-ng)
 | 
			
		||||
[](https://paperless-ng.readthedocs.io/en/latest/?badge=latest)
 | 
			
		||||
[](https://gitter.im/paperless-ng/community?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)
 | 
			
		||||
[](https://hub.docker.com/r/jonaswinkler/paperless-ng)
 | 
			
		||||
@@ -77,9 +78,9 @@ The documentation for Paperless-ng is available on [ReadTheDocs](https://paperle
 | 
			
		||||
 | 
			
		||||
# Translation
 | 
			
		||||
 | 
			
		||||
Paperless is currently available in English, German, Dutch, French, and Portuguese.
 | 
			
		||||
Paperless is currently available in English, German, Dutch, French, Portuguese, Italian, and Romanian.
 | 
			
		||||
 | 
			
		||||
There's an active translation project at transifex! If you want to help out by translating paperless into your language, please head over to https://github.com/jonaswinkler/paperless-ng/issues/212 for details.
 | 
			
		||||
There's an active translation project at crowdin! If you want to help out by translating paperless into your language, please head over to https://github.com/jonaswinkler/paperless-ng/issues/212 for details.
 | 
			
		||||
 | 
			
		||||
# Feature Requests
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -1,7 +1,5 @@
 | 
			
		||||
#!/bin/bash
 | 
			
		||||
 | 
			
		||||
set -e
 | 
			
		||||
 | 
			
		||||
ask() {
 | 
			
		||||
	while true ; do
 | 
			
		||||
		if [[ -z $3 ]] ; then
 | 
			
		||||
@@ -64,6 +62,19 @@ if [[ -z $(which docker-compose) ]] ; then
 | 
			
		||||
	exit 1
 | 
			
		||||
fi
 | 
			
		||||
 | 
			
		||||
# Check if user has permissions to run Docker by trying to get the status of Docker (docker status). 
 | 
			
		||||
# If this fails, the user probably does not have permissions for Docker.
 | 
			
		||||
docker stats --no-stream 2>/dev/null 1>&2
 | 
			
		||||
if [ $? -ne 0 ] ; then
 | 
			
		||||
	echo ""
 | 
			
		||||
	echo "WARN: It look like the current user does not have Docker permissions."
 | 
			
		||||
	echo "WARN: Use 'sudo usermod -aG docker $USER' to assign Docker permissions to the user."
 | 
			
		||||
	echo ""
 | 
			
		||||
	sleep 3
 | 
			
		||||
fi
 | 
			
		||||
 | 
			
		||||
set -e
 | 
			
		||||
 | 
			
		||||
echo ""
 | 
			
		||||
echo "############################################"
 | 
			
		||||
echo "###   Paperless-ng docker installation   ###"
 | 
			
		||||
 
 | 
			
		||||
@@ -1043,63 +1043,77 @@
 | 
			
		||||
        <source>Title</source>
 | 
			
		||||
        <context-group purpose="location">
 | 
			
		||||
          <context context-type="sourcefile">src/app/components/document-list/filter-editor/filter-editor.component.ts</context>
 | 
			
		||||
          <context context-type="linenumber">73</context>
 | 
			
		||||
          <context context-type="linenumber">77</context>
 | 
			
		||||
        </context-group>
 | 
			
		||||
      </trans-unit>
 | 
			
		||||
      <trans-unit id="3100631071441658964" datatype="html">
 | 
			
		||||
        <source>Title & content</source>
 | 
			
		||||
        <context-group purpose="location">
 | 
			
		||||
          <context context-type="sourcefile">src/app/components/document-list/filter-editor/filter-editor.component.ts</context>
 | 
			
		||||
          <context context-type="linenumber">74</context>
 | 
			
		||||
          <context context-type="linenumber">78</context>
 | 
			
		||||
        </context-group>
 | 
			
		||||
      </trans-unit>
 | 
			
		||||
      <trans-unit id="7517688192215738656" datatype="html">
 | 
			
		||||
        <source>ASN</source>
 | 
			
		||||
        <context-group purpose="location">
 | 
			
		||||
          <context context-type="sourcefile">src/app/components/document-list/filter-editor/filter-editor.component.ts</context>
 | 
			
		||||
          <context context-type="linenumber">79</context>
 | 
			
		||||
        </context-group>
 | 
			
		||||
      </trans-unit>
 | 
			
		||||
      <trans-unit id="5195932016807797291" datatype="html">
 | 
			
		||||
        <source>Correspondent: <x id="PH" equiv-text="this.correspondents.find(c => c.id == +rule.value)?.name"/></source>
 | 
			
		||||
        <context-group purpose="location">
 | 
			
		||||
          <context context-type="sourcefile">src/app/components/document-list/filter-editor/filter-editor.component.ts</context>
 | 
			
		||||
          <context context-type="linenumber">32</context>
 | 
			
		||||
          <context context-type="linenumber">33</context>
 | 
			
		||||
        </context-group>
 | 
			
		||||
      </trans-unit>
 | 
			
		||||
      <trans-unit id="8170755470576301659" datatype="html">
 | 
			
		||||
        <source>Without correspondent</source>
 | 
			
		||||
        <context-group purpose="location">
 | 
			
		||||
          <context context-type="sourcefile">src/app/components/document-list/filter-editor/filter-editor.component.ts</context>
 | 
			
		||||
          <context context-type="linenumber">34</context>
 | 
			
		||||
          <context context-type="linenumber">35</context>
 | 
			
		||||
        </context-group>
 | 
			
		||||
      </trans-unit>
 | 
			
		||||
      <trans-unit id="8705701325879965907" datatype="html">
 | 
			
		||||
        <source>Type: <x id="PH" equiv-text="this.documentTypes.find(dt => dt.id == +rule.value)?.name"/></source>
 | 
			
		||||
        <context-group purpose="location">
 | 
			
		||||
          <context context-type="sourcefile">src/app/components/document-list/filter-editor/filter-editor.component.ts</context>
 | 
			
		||||
          <context context-type="linenumber">39</context>
 | 
			
		||||
          <context context-type="linenumber">40</context>
 | 
			
		||||
        </context-group>
 | 
			
		||||
      </trans-unit>
 | 
			
		||||
      <trans-unit id="4362173610367509215" datatype="html">
 | 
			
		||||
        <source>Without document type</source>
 | 
			
		||||
        <context-group purpose="location">
 | 
			
		||||
          <context context-type="sourcefile">src/app/components/document-list/filter-editor/filter-editor.component.ts</context>
 | 
			
		||||
          <context context-type="linenumber">41</context>
 | 
			
		||||
          <context context-type="linenumber">42</context>
 | 
			
		||||
        </context-group>
 | 
			
		||||
      </trans-unit>
 | 
			
		||||
      <trans-unit id="8180755793012580465" datatype="html">
 | 
			
		||||
        <source>Tag: <x id="PH" equiv-text="this.tags.find(t => t.id == +rule.value)?.name"/></source>
 | 
			
		||||
        <context-group purpose="location">
 | 
			
		||||
          <context context-type="sourcefile">src/app/components/document-list/filter-editor/filter-editor.component.ts</context>
 | 
			
		||||
          <context context-type="linenumber">45</context>
 | 
			
		||||
          <context context-type="linenumber">46</context>
 | 
			
		||||
        </context-group>
 | 
			
		||||
      </trans-unit>
 | 
			
		||||
      <trans-unit id="6494566478302448576" datatype="html">
 | 
			
		||||
        <source>Without any tag</source>
 | 
			
		||||
        <context-group purpose="location">
 | 
			
		||||
          <context context-type="sourcefile">src/app/components/document-list/filter-editor/filter-editor.component.ts</context>
 | 
			
		||||
          <context context-type="linenumber">49</context>
 | 
			
		||||
          <context context-type="linenumber">50</context>
 | 
			
		||||
        </context-group>
 | 
			
		||||
      </trans-unit>
 | 
			
		||||
      <trans-unit id="6523384805359286307" datatype="html">
 | 
			
		||||
        <source>Title: <x id="PH" equiv-text="rule.value"/></source>
 | 
			
		||||
        <context-group purpose="location">
 | 
			
		||||
          <context context-type="sourcefile">src/app/components/document-list/filter-editor/filter-editor.component.ts</context>
 | 
			
		||||
          <context context-type="linenumber">53</context>
 | 
			
		||||
          <context context-type="linenumber">54</context>
 | 
			
		||||
        </context-group>
 | 
			
		||||
      </trans-unit>
 | 
			
		||||
      <trans-unit id="1872523635812236432" datatype="html">
 | 
			
		||||
        <source>ASN: <x id="PH" equiv-text="rule.value"/></source>
 | 
			
		||||
        <context-group purpose="location">
 | 
			
		||||
          <context context-type="sourcefile">src/app/components/document-list/filter-editor/filter-editor.component.ts</context>
 | 
			
		||||
          <context context-type="linenumber">57</context>
 | 
			
		||||
        </context-group>
 | 
			
		||||
      </trans-unit>
 | 
			
		||||
      <trans-unit id="02d184c288f567825a1fcbf83bcd3099a10853d5" datatype="html">
 | 
			
		||||
@@ -1826,13 +1840,6 @@
 | 
			
		||||
          <context context-type="linenumber">39</context>
 | 
			
		||||
        </context-group>
 | 
			
		||||
      </trans-unit>
 | 
			
		||||
      <trans-unit id="7517688192215738656" datatype="html">
 | 
			
		||||
        <source>ASN</source>
 | 
			
		||||
        <context-group purpose="location">
 | 
			
		||||
          <context context-type="sourcefile">src/app/services/rest/document.service.ts</context>
 | 
			
		||||
          <context context-type="linenumber">17</context>
 | 
			
		||||
        </context-group>
 | 
			
		||||
      </trans-unit>
 | 
			
		||||
      <trans-unit id="2691296884221415710" datatype="html">
 | 
			
		||||
        <source>Correspondent</source>
 | 
			
		||||
        <context-group purpose="location">
 | 
			
		||||
 
 | 
			
		||||
@@ -8,12 +8,13 @@ import { DocumentTypeService } from 'src/app/services/rest/document-type.service
 | 
			
		||||
import { TagService } from 'src/app/services/rest/tag.service';
 | 
			
		||||
import { CorrespondentService } from 'src/app/services/rest/correspondent.service';
 | 
			
		||||
import { FilterRule } from 'src/app/data/filter-rule';
 | 
			
		||||
import { FILTER_ADDED_AFTER, FILTER_ADDED_BEFORE, FILTER_CORRESPONDENT, FILTER_CREATED_AFTER, FILTER_CREATED_BEFORE, FILTER_DOCUMENT_TYPE, FILTER_HAS_ANY_TAG, FILTER_HAS_TAG, FILTER_TITLE, FILTER_TITLE_CONTENT } from 'src/app/data/filter-rule-type';
 | 
			
		||||
import { FILTER_ADDED_AFTER, FILTER_ADDED_BEFORE, FILTER_ASN, FILTER_CORRESPONDENT, FILTER_CREATED_AFTER, FILTER_CREATED_BEFORE, FILTER_DOCUMENT_TYPE, FILTER_HAS_ANY_TAG, FILTER_HAS_TAG, FILTER_TITLE, FILTER_TITLE_CONTENT } from 'src/app/data/filter-rule-type';
 | 
			
		||||
import { FilterableDropdownSelectionModel } from '../../common/filterable-dropdown/filterable-dropdown.component';
 | 
			
		||||
import { ToggleableItemState } from '../../common/filterable-dropdown/toggleable-dropdown-button/toggleable-dropdown-button.component';
 | 
			
		||||
 | 
			
		||||
const TEXT_FILTER_TARGET_TITLE = "title"
 | 
			
		||||
const TEXT_FILTER_TARGET_TITLE_CONTENT = "title-content"
 | 
			
		||||
const TEXT_FILTER_TARGET_ASN = "asn"
 | 
			
		||||
 | 
			
		||||
@Component({
 | 
			
		||||
  selector: 'app-filter-editor',
 | 
			
		||||
@@ -51,6 +52,9 @@ export class FilterEditorComponent implements OnInit, OnDestroy {
 | 
			
		||||
 | 
			
		||||
        case FILTER_TITLE:
 | 
			
		||||
          return $localize`Title: ${rule.value}`
 | 
			
		||||
 | 
			
		||||
        case FILTER_ASN:
 | 
			
		||||
          return $localize`ASN: ${rule.value}`
 | 
			
		||||
      }
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
@@ -71,7 +75,8 @@ export class FilterEditorComponent implements OnInit, OnDestroy {
 | 
			
		||||
 | 
			
		||||
  textFilterTargets = [
 | 
			
		||||
    {id: TEXT_FILTER_TARGET_TITLE, name: $localize`Title`},
 | 
			
		||||
    {id: TEXT_FILTER_TARGET_TITLE_CONTENT, name: $localize`Title & content`}
 | 
			
		||||
    {id: TEXT_FILTER_TARGET_TITLE_CONTENT, name: $localize`Title & content`},
 | 
			
		||||
    {id: TEXT_FILTER_TARGET_ASN, name: $localize`ASN`}
 | 
			
		||||
  ]
 | 
			
		||||
 | 
			
		||||
  textFilterTarget = TEXT_FILTER_TARGET_TITLE_CONTENT
 | 
			
		||||
@@ -111,6 +116,10 @@ export class FilterEditorComponent implements OnInit, OnDestroy {
 | 
			
		||||
          this._textFilter = rule.value
 | 
			
		||||
          this.textFilterTarget = TEXT_FILTER_TARGET_TITLE_CONTENT
 | 
			
		||||
          break
 | 
			
		||||
        case FILTER_ASN:
 | 
			
		||||
          this._textFilter = rule.value
 | 
			
		||||
          this.textFilterTarget = TEXT_FILTER_TARGET_ASN
 | 
			
		||||
          break
 | 
			
		||||
        case FILTER_CREATED_AFTER:
 | 
			
		||||
          this.dateCreatedAfter = rule.value
 | 
			
		||||
          break
 | 
			
		||||
@@ -147,6 +156,9 @@ export class FilterEditorComponent implements OnInit, OnDestroy {
 | 
			
		||||
    if (this._textFilter && this.textFilterTarget == TEXT_FILTER_TARGET_TITLE) {
 | 
			
		||||
      filterRules.push({rule_type: FILTER_TITLE, value: this._textFilter})
 | 
			
		||||
    }
 | 
			
		||||
    if (this._textFilter && this.textFilterTarget == TEXT_FILTER_TARGET_ASN) {
 | 
			
		||||
      filterRules.push({rule_type: FILTER_ASN, value: this._textFilter})
 | 
			
		||||
    }
 | 
			
		||||
    if (this.tagSelectionModel.isNoneSelected()) {
 | 
			
		||||
      filterRules.push({rule_type: FILTER_HAS_ANY_TAG, value: "false"})
 | 
			
		||||
    } else {
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user