paperless-ngx/src-ui/src/app/components/manage/settings/settings.component.ts

33 lines
1.2 KiB
TypeScript
Raw Normal View History

2020-10-27 01:10:18 +01:00
import { Component, OnInit } from '@angular/core';
2020-11-04 19:28:08 +01:00
import { FormControl, FormGroup } from '@angular/forms';
import { PaperlessSavedView } from 'src/app/data/paperless-saved-view';
2020-11-04 19:28:08 +01:00
import { GENERAL_SETTINGS } from 'src/app/data/storage-keys';
import { DocumentListViewService } from 'src/app/services/document-list-view.service';
import { SavedViewService } from 'src/app/services/rest/saved-view.service';
2020-10-27 01:10:18 +01:00
@Component({
selector: 'app-settings',
templateUrl: './settings.component.html',
styleUrls: ['./settings.component.scss']
2020-10-27 01:10:18 +01:00
})
2020-12-14 20:59:18 +01:00
export class SettingsComponent {
2020-10-27 01:10:18 +01:00
2020-11-04 19:28:08 +01:00
settingsForm = new FormGroup({
'documentListItemPerPage': new FormControl(+localStorage.getItem(GENERAL_SETTINGS.DOCUMENT_LIST_SIZE) || GENERAL_SETTINGS.DOCUMENT_LIST_SIZE_DEFAULT)
})
2020-10-30 22:46:43 +01:00
constructor(
public savedViewService: SavedViewService,
2020-12-14 20:59:18 +01:00
private documentListViewService: DocumentListViewService
2020-10-30 22:46:43 +01:00
) { }
deleteSavedView(savedView: PaperlessSavedView) {
this.savedViewService.delete(savedView).subscribe(() => {})
2020-10-30 22:46:43 +01:00
}
2020-11-04 19:28:08 +01:00
saveSettings() {
localStorage.setItem(GENERAL_SETTINGS.DOCUMENT_LIST_SIZE, this.settingsForm.value.documentListItemPerPage)
this.documentListViewService.updatePageSize()
}
2020-10-27 01:10:18 +01:00
}