mirror of
https://github.com/paperless-ngx/paperless-ngx.git
synced 2025-07-30 18:27:45 -05:00
added paperless ui
This commit is contained in:
@@ -0,0 +1,4 @@
|
||||
.match {
|
||||
color: black;
|
||||
background-color: orange;
|
||||
}
|
@@ -0,0 +1,3 @@
|
||||
... <span *ngFor="let fragment of highlights">
|
||||
<span *ngFor="let token of fragment" [ngClass]="token.term != null ? 'match term'+ token.term : ''">{{token.text}}</span> ...
|
||||
</span>
|
@@ -0,0 +1,25 @@
|
||||
import { ComponentFixture, TestBed } from '@angular/core/testing';
|
||||
|
||||
import { ResultHightlightComponent } from './result-hightlight.component';
|
||||
|
||||
describe('ResultHightlightComponent', () => {
|
||||
let component: ResultHightlightComponent;
|
||||
let fixture: ComponentFixture<ResultHightlightComponent>;
|
||||
|
||||
beforeEach(async () => {
|
||||
await TestBed.configureTestingModule({
|
||||
declarations: [ ResultHightlightComponent ]
|
||||
})
|
||||
.compileComponents();
|
||||
});
|
||||
|
||||
beforeEach(() => {
|
||||
fixture = TestBed.createComponent(ResultHightlightComponent);
|
||||
component = fixture.componentInstance;
|
||||
fixture.detectChanges();
|
||||
});
|
||||
|
||||
it('should create', () => {
|
||||
expect(component).toBeTruthy();
|
||||
});
|
||||
});
|
@@ -0,0 +1,19 @@
|
||||
import { Component, Input, OnInit } from '@angular/core';
|
||||
import { SearchResultHighlightedText } from 'src/app/services/rest/search.service';
|
||||
|
||||
@Component({
|
||||
selector: 'app-result-hightlight',
|
||||
templateUrl: './result-hightlight.component.html',
|
||||
styleUrls: ['./result-hightlight.component.css']
|
||||
})
|
||||
export class ResultHightlightComponent implements OnInit {
|
||||
|
||||
constructor() { }
|
||||
|
||||
@Input()
|
||||
highlights: SearchResultHighlightedText[][]
|
||||
|
||||
ngOnInit(): void {
|
||||
}
|
||||
|
||||
}
|
11
src-ui/src/app/components/search/search.component.css
Normal file
11
src-ui/src/app/components/search/search.component.css
Normal file
@@ -0,0 +1,11 @@
|
||||
.result-content {
|
||||
color: darkgray;
|
||||
}
|
||||
|
||||
.doc-img {
|
||||
object-fit: cover;
|
||||
object-position: top;
|
||||
height: 100%;
|
||||
position: absolute;
|
||||
|
||||
}
|
12
src-ui/src/app/components/search/search.component.html
Normal file
12
src-ui/src/app/components/search/search.component.html
Normal file
@@ -0,0 +1,12 @@
|
||||
<app-page-header title="Search results">
|
||||
</app-page-header>
|
||||
|
||||
<p>Search string: <i>{{query}}</i></p>
|
||||
|
||||
<app-document-card-large *ngFor="let result of results"
|
||||
[document]="result.document"
|
||||
[details]="result.highlights">
|
||||
|
||||
</app-document-card-large>
|
||||
|
||||
<p *ngIf="results.length == 0" class="mx-auto">No results</p>
|
25
src-ui/src/app/components/search/search.component.spec.ts
Normal file
25
src-ui/src/app/components/search/search.component.spec.ts
Normal file
@@ -0,0 +1,25 @@
|
||||
import { ComponentFixture, TestBed } from '@angular/core/testing';
|
||||
|
||||
import { SearchComponent } from './search.component';
|
||||
|
||||
describe('SearchComponent', () => {
|
||||
let component: SearchComponent;
|
||||
let fixture: ComponentFixture<SearchComponent>;
|
||||
|
||||
beforeEach(async () => {
|
||||
await TestBed.configureTestingModule({
|
||||
declarations: [ SearchComponent ]
|
||||
})
|
||||
.compileComponents();
|
||||
});
|
||||
|
||||
beforeEach(() => {
|
||||
fixture = TestBed.createComponent(SearchComponent);
|
||||
component = fixture.componentInstance;
|
||||
fixture.detectChanges();
|
||||
});
|
||||
|
||||
it('should create', () => {
|
||||
expect(component).toBeTruthy();
|
||||
});
|
||||
});
|
28
src-ui/src/app/components/search/search.component.ts
Normal file
28
src-ui/src/app/components/search/search.component.ts
Normal file
@@ -0,0 +1,28 @@
|
||||
import { Component, OnInit } from '@angular/core';
|
||||
import { ActivatedRoute } from '@angular/router';
|
||||
import { SearchResult, SearchService } from 'src/app/services/rest/search.service';
|
||||
|
||||
@Component({
|
||||
selector: 'app-search',
|
||||
templateUrl: './search.component.html',
|
||||
styleUrls: ['./search.component.css']
|
||||
})
|
||||
export class SearchComponent implements OnInit {
|
||||
|
||||
results: SearchResult[] = []
|
||||
|
||||
query: string = ""
|
||||
|
||||
constructor(private searchService: SearchService, private route: ActivatedRoute) { }
|
||||
|
||||
ngOnInit(): void {
|
||||
this.route.queryParamMap.subscribe(paramMap => {
|
||||
this.query = paramMap.get('query')
|
||||
this.searchService.search(this.query).subscribe(result => {
|
||||
this.results = result
|
||||
})
|
||||
})
|
||||
|
||||
}
|
||||
|
||||
}
|
Reference in New Issue
Block a user