many changes to support server side saved views

This commit is contained in:
jonaswinkler
2020-12-14 19:26:36 +01:00
parent 13d934dc6e
commit b7126030d1
17 changed files with 131 additions and 117 deletions

View File

@@ -44,11 +44,11 @@
</tr>
</thead>
<tbody>
<tr *ngFor="let config of savedViewConfigService.getConfigs()">
<td>{{ config.title }}</td>
<td>{{ config.showInDashboard | yesno }}</td>
<td>{{ config.showInSideBar | yesno }}</td>
<td><button type="button" class="btn btn-sm btn-outline-danger" (click)="deleteViewConfig(config)">Delete</button></td>
<tr *ngFor="let view of savedViewService.allViews">
<td>{{ view.name }}</td>
<td>{{ view.show_on_dashboard | yesno }}</td>
<td>{{ view.show_in_sidebar | yesno }}</td>
<td><button type="button" class="btn btn-sm btn-outline-danger" (click)="deleteSavedView(view)">Delete</button></td>
</tr>
</tbody>
</table>

View File

@@ -1,10 +1,11 @@
import { Component, OnInit } from '@angular/core';
import { FormControl, FormGroup } from '@angular/forms';
import { Title } from '@angular/platform-browser';
import { SavedViewConfig } from 'src/app/data/saved-view-config';
import { map, tap } from 'rxjs/operators';
import { PaperlessSavedView } from 'src/app/data/paperless-saved-view';
import { GENERAL_SETTINGS } from 'src/app/data/storage-keys';
import { DocumentListViewService } from 'src/app/services/document-list-view.service';
import { SavedViewConfigService } from 'src/app/services/saved-view-config.service';
import { SavedViewService } from 'src/app/services/rest/saved-view.service';
import { environment } from 'src/environments/environment';
@Component({
@@ -19,7 +20,7 @@ export class SettingsComponent implements OnInit {
})
constructor(
private savedViewConfigService: SavedViewConfigService,
public savedViewService: SavedViewService,
private documentListViewService: DocumentListViewService,
private titleService: Title
) { }
@@ -28,8 +29,8 @@ export class SettingsComponent implements OnInit {
this.titleService.setTitle(`Settings - ${environment.appTitle}`)
}
deleteViewConfig(config: SavedViewConfig) {
this.savedViewConfigService.deleteConfig(config)
deleteSavedView(savedView: PaperlessSavedView) {
this.savedViewService.delete(savedView).subscribe(() => {})
}
saveSettings() {