mirror of
https://github.com/paperless-ngx/paperless-ngx.git
synced 2025-07-28 18:24:38 -05:00
@@ -1,25 +1,24 @@
|
||||
import { ComponentFixture, TestBed } from '@angular/core/testing';
|
||||
import { ComponentFixture, TestBed } from '@angular/core/testing'
|
||||
|
||||
import { DocumentAsnComponent } from './document-asn.component';
|
||||
import { DocumentAsnComponent } from './document-asn.component'
|
||||
|
||||
describe('DocumentASNComponentComponent', () => {
|
||||
let component: DocumentAsnComponent;
|
||||
let fixture: ComponentFixture<DocumentAsnComponent>;
|
||||
let component: DocumentAsnComponent
|
||||
let fixture: ComponentFixture<DocumentAsnComponent>
|
||||
|
||||
beforeEach(async () => {
|
||||
await TestBed.configureTestingModule({
|
||||
declarations: [ DocumentAsnComponent ]
|
||||
})
|
||||
.compileComponents();
|
||||
});
|
||||
declarations: [DocumentAsnComponent],
|
||||
}).compileComponents()
|
||||
})
|
||||
|
||||
beforeEach(() => {
|
||||
fixture = TestBed.createComponent(DocumentAsnComponent);
|
||||
component = fixture.componentInstance;
|
||||
fixture.detectChanges();
|
||||
});
|
||||
fixture = TestBed.createComponent(DocumentAsnComponent)
|
||||
component = fixture.componentInstance
|
||||
fixture.detectChanges()
|
||||
})
|
||||
|
||||
it('should create', () => {
|
||||
expect(component).toBeTruthy();
|
||||
});
|
||||
});
|
||||
expect(component).toBeTruthy()
|
||||
})
|
||||
})
|
||||
|
@@ -1,34 +1,33 @@
|
||||
import { Component, OnInit } from '@angular/core';
|
||||
import {DocumentService} from "../../services/rest/document.service";
|
||||
import {ActivatedRoute, Router} from "@angular/router";
|
||||
import {FILTER_ASN} from "../../data/filter-rule-type";
|
||||
import { Component, OnInit } from '@angular/core'
|
||||
import { DocumentService } from '../../services/rest/document.service'
|
||||
import { ActivatedRoute, Router } from '@angular/router'
|
||||
import { FILTER_ASN } from '../../data/filter-rule-type'
|
||||
|
||||
@Component({
|
||||
selector: 'app-document-asncomponent',
|
||||
templateUrl: './document-asn.component.html',
|
||||
styleUrls: ['./document-asn.component.scss']
|
||||
styleUrls: ['./document-asn.component.scss'],
|
||||
})
|
||||
export class DocumentAsnComponent implements OnInit {
|
||||
|
||||
asn: string
|
||||
constructor(
|
||||
private documentsService: DocumentService,
|
||||
private route: ActivatedRoute,
|
||||
private router: Router) { }
|
||||
|
||||
private router: Router
|
||||
) {}
|
||||
|
||||
ngOnInit(): void {
|
||||
|
||||
this.route.paramMap.subscribe(paramMap => {
|
||||
this.asn = paramMap.get('id');
|
||||
this.documentsService.listAllFilteredIds([{rule_type: FILTER_ASN, value: this.asn}]).subscribe(documentId => {
|
||||
if (documentId.length == 1) {
|
||||
this.router.navigate(['documents', documentId[0]])
|
||||
} else {
|
||||
this.router.navigate(['404'])
|
||||
}
|
||||
})
|
||||
this.route.paramMap.subscribe((paramMap) => {
|
||||
this.asn = paramMap.get('id')
|
||||
this.documentsService
|
||||
.listAllFilteredIds([{ rule_type: FILTER_ASN, value: this.asn }])
|
||||
.subscribe((documentId) => {
|
||||
if (documentId.length == 1) {
|
||||
this.router.navigate(['documents', documentId[0]])
|
||||
} else {
|
||||
this.router.navigate(['404'])
|
||||
}
|
||||
})
|
||||
})
|
||||
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user