Skip to content

A community-supported supercharged document management system: scan, index and archive all your documents

Merge branch 'dev' into feature/unsaved-changes

Michael Shamoon67b9977d57ff
diff --cc src-ui/package-lock.json
index cc43532d0,d17acc50e..f12d89bca
--- a/src-ui/package-lock.json
+++ b/src-ui/package-lock.json
@@@ -2070,49 -18869,136 +18869,141 @@@
"tslib": "^2.0.0"
}
},
+ "@ngneat/dirty-check-forms": {
+ "version": "1.0.1",
+ "resolved": "https://registry.npmjs.org/@ngneat/dirty-check-forms/-/dirty-check-forms-1.0.1.tgz",
+ "integrity": "sha512-3rgThvjpZIxLS3sANYvma4J4VLITeAsnHrWOe9dtEYauCI4Vl5wDLB2aPNJkKu6EQD/X0QLs96rZvFqe3A3paw=="
+ },
"@ngtools/webpack": {
- "version": "10.2.0",
- "resolved": "https://registry.npmjs.org/@ngtools/webpack/-/webpack-10.2.0.tgz",
- "integrity": "sha512-W4SSFNQhIiC8JRhIn3c4mb1+fsFKiHp+THVMAUNo+wRZEt/rgzsCdnqv0EmQJJojZhnilUIyB/wVYJu2+S/Bxg==",
+ "version": "11.2.14",
+ "resolved": "https://registry.npmjs.org/@ngtools/webpack/-/webpack-11.2.14.tgz",
+ "integrity": "sha512-6q57tEWtUJRsxfTKE19L20iXvNesfVy8hrVdyzVk64DZQh0lIl4/xZT4d5bJCWOuQQDaAeZK4YbEFcYJn7k1yw==",
+ "dev": true,
+ "requires": {
+ "@angular-devkit/core": "11.2.14",
+ "enhanced-resolve": "5.7.0",
+ "webpack-sources": "2.2.0"
+ }
+ },
+ "@nodelib/fs.scandir": {
+ "version": "2.1.5",
+ "resolved": "https://registry.npmjs.org/@nodelib/fs.scandir/-/fs.scandir-2.1.5.tgz",
+ "integrity": "sha512-vq24Bq3ym5HEQm2NKCr3yXDwjc7vTsEThRDnkp2DK9p1uqLR+DHurm/NOTo0KG7HYHU7eppKZj3MyqYuMBf62g==",
+ "dev": true,
+ "requires": {
+ "@nodelib/fs.stat": "2.0.5",
+ "run-parallel": "^1.1.9"
+ }
+ },
+ "@nodelib/fs.stat": {
+ "version": "2.0.5",
+ "resolved": "https://registry.npmjs.org/@nodelib/fs.stat/-/fs.stat-2.0.5.tgz",
+ "integrity": "sha512-RkhPPp2zrqDAQA/2jNhnztcPAlv64XdhIp7a7454A5ovI7Bukxgt7MX7udwAu3zg1DcpPU0rz3VV1SeaqvY4+A==",
+ "dev": true
+ },
+ "@nodelib/fs.walk": {
+ "version": "1.2.7",
+ "resolved": "https://registry.npmjs.org/@nodelib/fs.walk/-/fs.walk-1.2.7.tgz",
+ "integrity": "sha512-BTIhocbPBSrRmHxOAJFtR18oLhxTtAFDAvL8hY1S3iU8k+E60W/YFs4jrixGzQjMpF4qPXxIQHcjVD9dz1C2QA==",
+ "dev": true,
+ "requires": {
+ "@nodelib/fs.scandir": "2.1.5",
+ "fastq": "^1.6.0"
+ }
+ },
+ "@npmcli/ci-detect": {
+ "version": "1.3.0",
+ "resolved": "https://registry.npmjs.org/@npmcli/ci-detect/-/ci-detect-1.3.0.tgz",
+ "integrity": "sha512-oN3y7FAROHhrAt7Rr7PnTSwrHrZVRTS2ZbyxeQwSSYD0ifwM3YNgQqbaRmjcWoPyq77MjchusjJDspbzMmip1Q==",
+ "dev": true
+ },
+ "@npmcli/git": {
+ "version": "2.0.9",
+ "resolved": "https://registry.npmjs.org/@npmcli/git/-/git-2.0.9.tgz",
+ "integrity": "sha512-hTMbMryvOqGLwnmMBKs5usbPsJtyEsMsgXwJbmNrsEuQQh1LAIMDU77IoOrwkCg+NgQWl+ySlarJASwM3SutCA==",
"dev": true,
"requires": {
- "@angular-devkit/core": "10.2.0",
- "enhanced-resolve": "4.3.0",
- "webpack-sources": "1.4.3"
+ "@npmcli/promise-spawn": "^1.3.2",
+ "lru-cache": "^6.0.0",
+ "mkdirp": "^1.0.4",
+ "npm-pick-manifest": "^6.1.1",
+ "promise-inflight": "^1.0.1",
+ "promise-retry": "^2.0.1",
+ "semver": "^7.3.5",
+ "which": "^2.0.2"
},
"dependencies": {
- "@angular-devkit/core": {
- "version": "10.2.0",
- "resolved": "https://registry.npmjs.org/@angular-devkit/core/-/core-10.2.0.tgz",
- "integrity": "sha512-XAszFhSF3mZw1VjoOsYGbArr5NJLcStjOvcCGjBPl1UBM2AKpuCQXHxI9XJGYKL3B93Vp5G58d8qkHvamT53OA==",
+ "err-code": {
+ "version": "2.0.3",
+ "resolved": "https://registry.npmjs.org/err-code/-/err-code-2.0.3.tgz",
+ "integrity": "sha512-2bmlRpNKBxT/CRmPOlyISQpNj+qSeYvcym/uT0Jx2bMOlKLtSy1ZmLuVxSEKKyor/N5yhvp/ZiG1oE3DEYMSFA==",
+ "dev": true
+ },
+ "hosted-git-info": {
+ "version": "4.0.2",
+ "resolved": "https://registry.npmjs.org/hosted-git-info/-/hosted-git-info-4.0.2.tgz",
+ "integrity": "sha512-c9OGXbZ3guC/xOlCg1Ci/VgWlwsqDv1yMQL1CWqXDL0hDjXuNcq0zuR4xqPSuasI3kqFDhqSyTjREz5gzq0fXg==",
"dev": true,
"requires": {
- "ajv": "6.12.4",
- "fast-json-stable-stringify": "2.1.0",
- "magic-string": "0.25.7",
- "rxjs": "6.6.2",
- "source-map": "0.7.3"
+ "lru-cache": "^6.0.0"
}
},
- "rxjs": {
- "version": "6.6.2",
- "resolved": "https://registry.npmjs.org/rxjs/-/rxjs-6.6.2.tgz",
- "integrity": "sha512-BHdBMVoWC2sL26w//BCu3YzKT4s2jip/WhwsGEDmeKYBhKDZeYezVUnHatYB7L85v5xs0BAQmg6BEYJEKxBabg==",
+ "mkdirp": {
+ "version": "1.0.4",
+ "resolved": "https://registry.npmjs.org/mkdirp/-/mkdirp-1.0.4.tgz",
+ "integrity": "sha512-vVqVZQyf3WLx2Shd0qJ9xuvqgAyKPLAiqITEtqW0oIUjzo3PePDd6fW9iFz30ef7Ysp/oiWqbhszeGWW2T6Gzw==",
+ "dev": true
+ },
+ "npm-package-arg": {
+ "version": "8.1.4",
+ "resolved": "https://registry.npmjs.org/npm-package-arg/-/npm-package-arg-8.1.4.tgz",
+ "integrity": "sha512-xLokoCFqj/rPdr3LvcdDL6Kj6ipXGEDHD/QGpzwU6/pibYUOXmp5DBmg76yukFyx4ZDbrXNOTn+BPyd8TD4Jlw==",
"dev": true,
"requires": {
- "tslib": "^1.9.0"
+ "hosted-git-info": "^4.0.1",
+ "semver": "^7.3.4",
+ "validate-npm-package-name": "^3.0.0"
}
},
- "tslib": {
- "version": "1.14.1",
- "resolved": "https://registry.npmjs.org/tslib/-/tslib-1.14.1.tgz",
- "integrity": "sha512-Xni35NKzjgMrwevysHTCArtLDpPvye8zV/0E4EyYn43P7/7qvQwPh9BGkHewbMulVntbigmcT7rdX3BNo9wRJg==",
- "dev": true
+ "npm-pick-manifest": {
+ "version": "6.1.1",
+ "resolved": "https://registry.npmjs.org/npm-pick-manifest/-/npm-pick-manifest-6.1.1.tgz",
+ "integrity": "sha512-dBsdBtORT84S8V8UTad1WlUyKIY9iMsAmqxHbLdeEeBNMLQDlDWWra3wYUx9EBEIiG/YwAy0XyNHDd2goAsfuA==",
+ "dev": true,
+ "requires": {
+ "npm-install-checks": "^4.0.0",
+ "npm-normalize-package-bin": "^1.0.1",
+ "npm-package-arg": "^8.1.2",
+ "semver": "^7.3.4"
+ }
+ },
+ "promise-retry": {
+ "version": "2.0.1",
+ "resolved": "https://registry.npmjs.org/promise-retry/-/promise-retry-2.0.1.tgz",
+ "integrity": "sha512-y+WKFlBR8BGXnsNlIHFGPZmyDf3DFMoLhaflAnyZgV6rG6xu+JwesTo2Q9R6XwYmtmwAFCkAk3e35jEdoeh/3g==",
+ "dev": true,
+ "requires": {
+ "err-code": "^2.0.2",
+ "retry": "^0.12.0"
+ }
+ },
+ "semver": {
+ "version": "7.3.5",
+ "resolved": "https://registry.npmjs.org/semver/-/semver-7.3.5.tgz",
+ "integrity": "sha512-PoeGJYh8HK4BTO/a9Tf6ZG3veo/A7ZVsYrSA6J8ny9nb3B1VrpkuN+z9OE5wfE5p6H4LchYZsegiQgbJD94ZFQ==",
+ "dev": true,
+ "requires": {
+ "lru-cache": "^6.0.0"
+ }
+ },
+ "which": {
+ "version": "2.0.2",
+ "resolved": "https://registry.npmjs.org/which/-/which-2.0.2.tgz",
+ "integrity": "sha512-BLI3Tl1TW3Pvl70l3yq3Y64i+awpwXqsGBYWkkqMtnbXgrMD+yj7rhW0kuEDxzJaYXGjEW5ogapKNMEKNMjibA==",
+ "dev": true,
+ "requires": {
+ "isexe": "^2.0.0"
+ }
}
}
},
diff --cc src-ui/package.json
index c7965ff04,b85368559..2d7a0f666
--- a/src-ui/package.json
+++ b/src-ui/package.json
@@@ -11,23 -11,24 +11,25 @@@
},
"private": true,
"dependencies": {
- "@angular/animations": "~10.1.5",
- "@angular/common": "~10.1.5",
- "@angular/compiler": "~10.1.5",
- "@angular/core": "~10.1.5",
- "@angular/forms": "~10.1.5",
- "@angular/localize": "~10.1.5",
- "@angular/platform-browser": "~10.1.5",
- "@angular/platform-browser-dynamic": "~10.1.5",
- "@angular/router": "~10.1.5",
- "@ng-bootstrap/ng-bootstrap": "^8.0.0",
- "@ng-select/ng-select": "^5.0.9",
+ "@angular/animations": "~11.2.14",
+ "@angular/common": "~11.2.14",
+ "@angular/compiler": "~11.2.14",
+ "@angular/core": "~11.2.14",
+ "@angular/forms": "~11.2.14",
+ "@angular/localize": "~11.2.14",
+ "@angular/platform-browser": "~11.2.14",
+ "@angular/platform-browser-dynamic": "~11.2.14",
+ "@angular/router": "~11.2.14",
+ "@ng-bootstrap/ng-bootstrap": "^9.1.2",
+ "@ng-select/ng-select": "^7.0.0",
+ "@ngneat/dirty-check-forms": "^1.0.1",
"bootstrap": "^4.5.0",
- "ng-bootstrap": "^1.6.3",
+ "file-saver": "^2.0.5",
"ng2-pdf-viewer": "^6.3.2",
+ "ngx-bootstrap": "^6.2.0",
+ "ngx-color": "^6.2.0",
"ngx-cookie-service": "^10.1.1",
- "ngx-file-drop": "^10.0.0",
+ "ngx-file-drop": "^11.1.0",
"ngx-infinite-scroll": "^9.1.0",
"rxjs": "~6.6.0",
"tslib": "^2.0.0",
diff --cc src-ui/src/app/app-routing.module.ts
index f083b32a6,031a4bb0b..714528ed7
--- a/src-ui/src/app/app-routing.module.ts
+++ b/src-ui/src/app/app-routing.module.ts
@@@ -10,8 -10,7 +10,9 @@@ import { LogsComponent } from './compon
import { SettingsComponent } from './components/manage/settings/settings.component';
import { TagListComponent } from './components/manage/tag-list/tag-list.component';
import { NotFoundComponent } from './components/not-found/not-found.component';
+ import {DocumentAsnComponent} from "./components/document-asn/document-asn.component";
+import { SearchComponent } from './components/search/search.component';
+import { DirtyFormGuard } from './guards/dirty-form.guard';
const routes: Routes = [
{path: '', redirectTo: 'dashboard', pathMatch: 'full'},
@@@ -19,8 -18,9 +20,8 @@@
{path: 'dashboard', component: DashboardComponent },
{path: 'documents', component: DocumentListComponent },
{path: 'view/:id', component: DocumentListComponent },
- {path: 'search', component: SearchComponent },
{path: 'documents/:id', component: DocumentDetailComponent },
- {path: 'asn/:id', component: DocumentAsnComponent },
-
++ {path: 'asn/:id', component: DocumentAsnComponent },
{path: 'tags', component: TagListComponent },
{path: 'documenttypes', component: DocumentTypeListComponent },
{path: 'correspondents', component: CorrespondentListComponent },
diff --cc src-ui/src/app/components/app-frame/app-frame.component.ts
index d19fd660a,f8e76f0ae..65143c40c
--- a/src-ui/src/app/components/app-frame/app-frame.component.ts
+++ b/src-ui/src/app/components/app-frame/app-frame.component.ts
@@@ -24,8 -26,11 +26,9 @@@ export class AppFrameComponent implemen
private openDocumentsService: OpenDocumentsService,
private searchService: SearchService,
public savedViewService: SavedViewService,
+ private list: DocumentListViewService,
private meta: Meta
- ) {
-
- }
+ ) { }
versionString = `${environment.appTitle} ${environment.version}`
diff --cc src-ui/src/app/components/document-detail/document-detail.component.ts
index 4561a26f2,e711b3416..c5ccf3ec1
--- a/src-ui/src/app/components/document-detail/document-detail.component.ts
+++ b/src-ui/src/app/components/document-detail/document-detail.component.ts
@@@ -19,8 -19,8 +19,10 @@@ import { PDFDocumentProxy } from 'ng2-p
import { ToastService } from 'src/app/services/toast.service';
import { TextComponent } from '../common/input/text/text.component';
import { SettingsService, SETTINGS_KEYS } from 'src/app/services/settings.service';
+import { dirtyCheck, DirtyComponent } from '@ngneat/dirty-check-forms';
+import { Observable, Subscription, BehaviorSubject } from 'rxjs';
+ import { PaperlessDocumentSuggestions } from 'src/app/data/paperless-document-suggestions';
+ import { FILTER_FULLTEXT_MORELIKE } from 'src/app/data/filter-rule-type';
@Component({
selector: 'app-document-detail',
@@@ -63,10 -65,15 +67,19 @@@ export class DocumentDetailComponent im
previewCurrentPage: number = 1
previewNumPages: number = 1
+ store: BehaviorSubject<any>
+ storeSub: Subscription
+ isDirty$: Observable<boolean>
+
+ @ViewChild('nav') nav: NgbNav
+ @ViewChild('pdfPreview') set pdfPreview(element) {
+ // this gets called when compontent added or removed from DOM
+ if (element && element.nativeElement.offsetParent !== null) { // its visible
+
+ setTimeout(()=> this.nav?.select(1));
+ }
+ }
+
constructor(
private documentsService: DocumentService,
private route: ActivatedRoute,
@@@ -101,31 -108,15 +114,32 @@@
this.previewUrl = this.documentsService.getPreviewUrl(this.documentId)
this.downloadUrl = this.documentsService.getDownloadUrl(this.documentId)
this.downloadOriginalUrl = this.documentsService.getDownloadUrl(this.documentId, true)
+ this.suggestions = null
if (this.openDocumentService.getOpenDocument(this.documentId)) {
this.updateComponent(this.openDocumentService.getOpenDocument(this.documentId))
- } else {
- this.documentsService.get(this.documentId).subscribe(doc => {
+ }
+ this.documentsService.get(this.documentId).subscribe(doc => {
+ // Initialize dirtyCheck
+ this.store = new BehaviorSubject({
+ title: doc.title,
+ content: doc.content,
+ created: doc.created,
+ correspondent: doc.correspondent,
+ document_type: doc.document_type,
+ archive_serial_number: doc.archive_serial_number,
+ tags: doc.tags
+ })
+
+ this.isDirty$ = dirtyCheck(this.documentForm, this.store.asObservable())
+ this.isDirty$.subscribe(dirty => {
+ this.openDocumentService.setDirty(this.document.id, dirty)
+ })
+
+ if (!this.openDocumentService.getOpenDocument(this.documentId)) {
this.openDocumentService.openDocument(doc)
this.updateComponent(doc)
- }, error => {this.router.navigate(['404'])})
- }
+ }
+ }, error => {this.router.navigate(['404'])})
})
}
@@@ -203,30 -201,10 +226,30 @@@
})
}
+ maybeClose() {
+ this.isDirty$.subscribe(dirty => {
+ if (dirty) {
+ let modal = this.modalService.open(ConfirmDialogComponent, {backdrop: 'static'})
+ modal.componentInstance.title = $localize`Unsaved Changes`
+ modal.componentInstance.messageBold = $localize`You have unsaved changes.`
+ modal.componentInstance.message = $localize`Are you sure you want to leave?`
+ modal.componentInstance.btnClass = "btn-warning"
+ modal.componentInstance.btnCaption = $localize`Leave page`
+ modal.componentInstance.confirmClicked.subscribe(() => {
+ modal.componentInstance.buttonsEnabled = false
+ modal.close()
+ this.close()
+ })
+ } else {
+ this.close()
+ }
+ })
+ }
+
close() {
this.openDocumentService.closeDocument(this.document)
- if (this.documentListViewService.savedViewId) {
- this.router.navigate(['view', this.documentListViewService.savedViewId])
+ if (this.documentListViewService.activeSavedViewId) {
+ this.router.navigate(['view', this.documentListViewService.activeSavedViewId])
} else {
this.router.navigate(['documents'])
}
diff --cc src-ui/src/app/components/manage/settings/settings.component.html
index 367b4ea20,c2a32906e..93a12faf4
--- a/src-ui/src/app/components/manage/settings/settings.component.html
+++ b/src-ui/src/app/components/manage/settings/settings.component.html
@@@ -148,7 -168,7 +168,7 @@@
</li>
</ul>
- <div [ngbNavOutlet]="nav" class="border-left border-right border-bottom p-3 mb-3 shadow"></div>
+ <div [ngbNavOutlet]="nav" class="border-left border-right border-bottom p-3 mb-3 shadow-sm"></div>
- <button type="submit" class="btn btn-primary" i18n>Save</button>
+ <button type="submit" class="btn btn-primary" [disabled]="!(isDirty$ | async)" i18n>Save</button>
</form>
diff --cc src-ui/src/app/components/manage/settings/settings.component.ts
index 7b396f730,ab71b1028..91dcc9809
--- a/src-ui/src/app/components/manage/settings/settings.component.ts
+++ b/src-ui/src/app/components/manage/settings/settings.component.ts
@@@ -18,26 -16,27 +18,30 @@@ export class SettingsComponent implemen
savedViewGroup = new FormGroup({})
settingsForm = new FormGroup({
- 'bulkEditConfirmationDialogs': new FormControl(this.settings.get(SETTINGS_KEYS.BULK_EDIT_CONFIRMATION_DIALOGS)),
- 'bulkEditApplyOnClose': new FormControl(this.settings.get(SETTINGS_KEYS.BULK_EDIT_APPLY_ON_CLOSE)),
- 'documentListItemPerPage': new FormControl(this.settings.get(SETTINGS_KEYS.DOCUMENT_LIST_SIZE)),
- 'darkModeUseSystem': new FormControl(this.settings.get(SETTINGS_KEYS.DARK_MODE_USE_SYSTEM)),
- 'darkModeEnabled': new FormControl(this.settings.get(SETTINGS_KEYS.DARK_MODE_ENABLED)),
- 'darkModeInvertThumbs': new FormControl(this.settings.get(SETTINGS_KEYS.DARK_MODE_THUMB_INVERTED)),
- 'useNativePdfViewer': new FormControl(this.settings.get(SETTINGS_KEYS.USE_NATIVE_PDF_VIEWER)),
+ 'bulkEditConfirmationDialogs': new FormControl(null),
+ 'bulkEditApplyOnClose': new FormControl(null),
+ 'documentListItemPerPage': new FormControl(null),
+ 'darkModeUseSystem': new FormControl(null),
+ 'darkModeEnabled': new FormControl(null),
+ 'useNativePdfViewer': new FormControl(null),
'savedViews': this.savedViewGroup,
- 'displayLanguage': new FormControl(this.settings.getLanguage()),
- 'dateLocale': new FormControl(this.settings.get(SETTINGS_KEYS.DATE_LOCALE)),
- 'dateFormat': new FormControl(this.settings.get(SETTINGS_KEYS.DATE_FORMAT)),
- 'notificationsConsumerNewDocument': new FormControl(this.settings.get(SETTINGS_KEYS.NOTIFICATIONS_CONSUMER_NEW_DOCUMENT)),
- 'notificationsConsumerSuccess': new FormControl(this.settings.get(SETTINGS_KEYS.NOTIFICATIONS_CONSUMER_SUCCESS)),
- 'notificationsConsumerFailed': new FormControl(this.settings.get(SETTINGS_KEYS.NOTIFICATIONS_CONSUMER_FAILED)),
- 'notificationsConsumerSuppressOnDashboard': new FormControl(this.settings.get(SETTINGS_KEYS.NOTIFICATIONS_CONSUMER_SUPPRESS_ON_DASHBOARD)),
+ 'displayLanguage': new FormControl(null),
+ 'dateLocale': new FormControl(null),
+ 'dateFormat': new FormControl(null),
++ 'notificationsConsumerNewDocument': new FormControl(null),
++ 'notificationsConsumerSuccess': new FormControl(null),
++ 'notificationsConsumerFailed': new FormControl(null),
++ 'notificationsConsumerSuppressOnDashboard': new FormControl(null),
})
savedViews: PaperlessSavedView[]
+ store: BehaviorSubject<any>
+ storeSub: Subscription
+ isDirty$: Observable<boolean>
+
get computedDateLocale(): string {
- return this.settingsForm.value.dateLocale || this.settingsForm.value.displayLanguage
+ return this.settingsForm.value.dateLocale || this.settingsForm.value.displayLanguage || this.currentLocale
}
constructor(
@@@ -51,42 -50,14 +55,46 @@@
ngOnInit() {
this.savedViewService.listAll().subscribe(r => {
this.savedViews = r.results
+ let storeData = {
+ 'bulkEditConfirmationDialogs': this.settings.get(SETTINGS_KEYS.BULK_EDIT_CONFIRMATION_DIALOGS),
+ 'bulkEditApplyOnClose': this.settings.get(SETTINGS_KEYS.BULK_EDIT_APPLY_ON_CLOSE),
+ 'documentListItemPerPage': this.settings.get(SETTINGS_KEYS.DOCUMENT_LIST_SIZE),
+ 'darkModeUseSystem': this.settings.get(SETTINGS_KEYS.DARK_MODE_USE_SYSTEM),
+ 'darkModeEnabled': this.settings.get(SETTINGS_KEYS.DARK_MODE_ENABLED),
+ 'useNativePdfViewer': this.settings.get(SETTINGS_KEYS.USE_NATIVE_PDF_VIEWER),
+ 'savedViews': {},
+ 'displayLanguage': this.settings.getLanguage(),
+ 'dateLocale': this.settings.get(SETTINGS_KEYS.DATE_LOCALE),
+ 'dateFormat': this.settings.get(SETTINGS_KEYS.DATE_FORMAT),
++ 'notificationsConsumerNewDocument': this.settings.get(SETTINGS_KEYS.NOTIFICATIONS_CONSUMER_NEW_DOCUMENT),
++ 'notificationsConsumerSuccess': this.settings.get(SETTINGS_KEYS.NOTIFICATIONS_CONSUMER_SUCCESS),
++ 'notificationsConsumerFailed': this.settings.get(SETTINGS_KEYS.NOTIFICATIONS_CONSUMER_FAILED),
++ 'notificationsConsumerSuppressOnDashboard': this.settings.get(SETTINGS_KEYS.NOTIFICATIONS_CONSUMER_SUPPRESS_ON_DASHBOARD),
+ }
+
for (let view of this.savedViews) {
+ storeData.savedViews[view.id.toString()] = {
+ "id": view.id,
+ "name": view.name,
+ "show_on_dashboard": view.show_on_dashboard,
+ "show_in_sidebar": view.show_in_sidebar
+ }
this.savedViewGroup.addControl(view.id.toString(), new FormGroup({
- "id": new FormControl(view.id),
- "name": new FormControl(view.name),
- "show_on_dashboard": new FormControl(view.show_on_dashboard),
- "show_in_sidebar": new FormControl(view.show_in_sidebar)
+ "id": new FormControl(null),
+ "name": new FormControl(null),
+ "show_on_dashboard": new FormControl(null),
+ "show_in_sidebar": new FormControl(null)
}))
}
+
+ this.store = new BehaviorSubject(storeData)
+
+ this.storeSub = this.store.asObservable().subscribe(state => {
+ this.settingsForm.patchValue(state, { emitEvent: false })
+ })
+
+ // Initialize dirtyCheck
+ this.isDirty$ = dirtyCheck(this.settingsForm, this.store.asObservable())
})
}
@@@ -111,8 -79,11 +120,12 @@@
this.settings.set(SETTINGS_KEYS.USE_NATIVE_PDF_VIEWER, this.settingsForm.value.useNativePdfViewer)
this.settings.set(SETTINGS_KEYS.DATE_LOCALE, this.settingsForm.value.dateLocale)
this.settings.set(SETTINGS_KEYS.DATE_FORMAT, this.settingsForm.value.dateFormat)
+ this.settings.set(SETTINGS_KEYS.NOTIFICATIONS_CONSUMER_NEW_DOCUMENT, this.settingsForm.value.notificationsConsumerNewDocument)
+ this.settings.set(SETTINGS_KEYS.NOTIFICATIONS_CONSUMER_SUCCESS, this.settingsForm.value.notificationsConsumerSuccess)
+ this.settings.set(SETTINGS_KEYS.NOTIFICATIONS_CONSUMER_FAILED, this.settingsForm.value.notificationsConsumerFailed)
+ this.settings.set(SETTINGS_KEYS.NOTIFICATIONS_CONSUMER_SUPPRESS_ON_DASHBOARD, this.settingsForm.value.notificationsConsumerSuppressOnDashboard)
this.settings.setLanguage(this.settingsForm.value.displayLanguage)
+ this.store.next(this.settingsForm.value)
this.documentListViewService.updatePageSize()
this.settings.updateDarkModeSettings()
this.toastService.showInfo($localize`Settings saved successfully.`)