mirror of
https://github.com/paperless-ngx/paperless-ngx.git
synced 2025-07-28 18:24:38 -05:00
Saved views, some refactoring
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
import { Directive, OnInit } from '@angular/core';
|
||||
import { NgbModal } from '@ng-bootstrap/ng-bootstrap';
|
||||
import { MatchingModel } from 'src/app/data/matching-model';
|
||||
import { MatchingModel, MATCHING_ALGORITHMS, MATCH_AUTO } from 'src/app/data/matching-model';
|
||||
import { ObjectWithId } from 'src/app/data/object-with-id';
|
||||
import { AbstractPaperlessService } from 'src/app/services/rest/abstract-paperless-service';
|
||||
import { DeleteDialogComponent } from '../../common/delete-dialog/delete-dialog.component';
|
||||
@@ -21,10 +21,10 @@ export abstract class GenericListComponent<T extends ObjectWithId> implements On
|
||||
public collectionSize = 0
|
||||
|
||||
getMatching(o: MatchingModel) {
|
||||
if (o.matching_algorithm == MatchingModel.MATCH_AUTO) {
|
||||
if (o.matching_algorithm == MATCH_AUTO) {
|
||||
return "Automatic"
|
||||
} else if (o.match && o.match.length > 0) {
|
||||
return `${o.match} (${MatchingModel.MATCHING_ALGORITHMS.find(a => a.id == o.matching_algorithm).name})`
|
||||
return `${o.match} (${MATCHING_ALGORITHMS.find(a => a.id == o.matching_algorithm).name})`
|
||||
} else {
|
||||
return "-"
|
||||
}
|
||||
|
@@ -2,5 +2,38 @@
|
||||
|
||||
</app-page-header>
|
||||
|
||||
<p>items per page, documents per view type</p>
|
||||
<!-- <p>items per page, documents per view type</p> -->
|
||||
<ul ngbNav #nav="ngbNav" class="nav-tabs">
|
||||
<li [ngbNavItem]="1">
|
||||
<a ngbNavLink>Document List Settings</a>
|
||||
<ng-template ngbNavContent>
|
||||
</ng-template>
|
||||
</li>
|
||||
<li [ngbNavItem]="2">
|
||||
<a ngbNavLink>Saved views</a>
|
||||
<ng-template ngbNavContent>
|
||||
|
||||
<table class="table table-striped">
|
||||
<thead>
|
||||
<tr>
|
||||
<th scope="col">Title</th>
|
||||
<th scope="col">Show in dashboard</th>
|
||||
<th scope="col">Show in sidebar</th>
|
||||
<th scope="col">Actions</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr *ngFor="let config of savedViewConfigService.getConfigs()">
|
||||
<td>{{ config.title }}</td>
|
||||
<td>{{ config.showInDashboard }}</td>
|
||||
<td>{{ config.showInSideBar }}</td>
|
||||
<td><button type="button" class="btn btn-sm btn-outline-danger" (click)="deleteViewConfig(config)">Delete</button></td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
</ng-template>
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
<div [ngbNavOutlet]="nav" class="mt-2"></div>
|
@@ -1,4 +1,6 @@
|
||||
import { Component, OnInit } from '@angular/core';
|
||||
import { SavedViewConfig } from 'src/app/data/saved-view-config';
|
||||
import { SavedViewConfigService } from 'src/app/services/saved-view-config.service';
|
||||
|
||||
@Component({
|
||||
selector: 'app-settings',
|
||||
@@ -7,9 +9,17 @@ import { Component, OnInit } from '@angular/core';
|
||||
})
|
||||
export class SettingsComponent implements OnInit {
|
||||
|
||||
constructor() { }
|
||||
constructor(
|
||||
private savedViewConfigService: SavedViewConfigService
|
||||
) { }
|
||||
|
||||
active
|
||||
|
||||
ngOnInit(): void {
|
||||
}
|
||||
|
||||
deleteViewConfig(config: SavedViewConfig) {
|
||||
this.savedViewConfigService.deleteConfig(config)
|
||||
}
|
||||
|
||||
}
|
||||
|
@@ -2,7 +2,7 @@ import { Component } from '@angular/core';
|
||||
import { FormControl, FormGroup } from '@angular/forms';
|
||||
import { NgbActiveModal } from '@ng-bootstrap/ng-bootstrap';
|
||||
import { EditDialogComponent } from 'src/app/components/common/edit-dialog/edit-dialog.component';
|
||||
import { PaperlessTag } from 'src/app/data/paperless-tag';
|
||||
import { TAG_COLOURS, PaperlessTag } from 'src/app/data/paperless-tag';
|
||||
import { TagService } from 'src/app/services/rest/tag.service';
|
||||
import { ToastService } from 'src/app/services/toast.service';
|
||||
|
||||
@@ -29,11 +29,11 @@ export class TagEditDialogComponent extends EditDialogComponent<PaperlessTag> {
|
||||
}
|
||||
|
||||
getColours() {
|
||||
return PaperlessTag.COLOURS
|
||||
return TAG_COLOURS
|
||||
}
|
||||
|
||||
getColor(id: number) {
|
||||
return PaperlessTag.COLOURS.find(c => c.id == id)
|
||||
return TAG_COLOURS.find(c => c.id == id)
|
||||
}
|
||||
|
||||
}
|
||||
|
@@ -1,6 +1,6 @@
|
||||
import { Component } from '@angular/core';
|
||||
import { NgbModal } from '@ng-bootstrap/ng-bootstrap';
|
||||
import { PaperlessTag } from 'src/app/data/paperless-tag';
|
||||
import { TAG_COLOURS, PaperlessTag } from 'src/app/data/paperless-tag';
|
||||
import { TagService } from 'src/app/services/rest/tag.service';
|
||||
import { CorrespondentEditDialogComponent } from '../correspondent-list/correspondent-edit-dialog/correspondent-edit-dialog.component';
|
||||
import { GenericListComponent } from '../generic-list/generic-list.component';
|
||||
@@ -18,7 +18,7 @@ export class TagListComponent extends GenericListComponent<PaperlessTag> {
|
||||
}
|
||||
|
||||
getColor(id) {
|
||||
return PaperlessTag.COLOURS.find(c => c.id == id)
|
||||
return TAG_COLOURS.find(c => c.id == id)
|
||||
}
|
||||
|
||||
getObjectName(object: PaperlessTag) {
|
||||
|
Reference in New Issue
Block a user