Saved views, some refactoring

This commit is contained in:
Jonas Winkler
2020-10-30 22:46:43 +01:00
parent a5c2ed1d76
commit c39d94b8cb
43 changed files with 461 additions and 232 deletions

View File

@@ -0,0 +1,17 @@
<form [formGroup]="saveViewConfigForm" class="needs-validation" novalidate (ngSubmit)="save()">
<div class="modal-header">
<h4 class="modal-title" id="modal-basic-title">Save current view</h4>
<button type="button" class="close" aria-label="Close" (click)="cancel()">
<span aria-hidden="true">&times;</span>
</button>
</div>
<div class="modal-body">
<app-input-text title="Title" formControlName="title"></app-input-text>
<app-input-check title="Show in side bar" formControlName="showInSideBar"></app-input-check>
<app-input-check title="Show in dashboard" formControlName="showInDashboard"></app-input-check>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-outline-dark" (click)="cancel()">Cancel</button>
<button type="submit" class="btn btn-primary">Save</button>
</div>
</form>

View File

@@ -0,0 +1,25 @@
import { ComponentFixture, TestBed } from '@angular/core/testing';
import { SaveViewConfigDialogComponent } from './save-view-config-dialog.component';
describe('SaveViewConfigDialogComponent', () => {
let component: SaveViewConfigDialogComponent;
let fixture: ComponentFixture<SaveViewConfigDialogComponent>;
beforeEach(async () => {
await TestBed.configureTestingModule({
declarations: [ SaveViewConfigDialogComponent ]
})
.compileComponents();
});
beforeEach(() => {
fixture = TestBed.createComponent(SaveViewConfigDialogComponent);
component = fixture.componentInstance;
fixture.detectChanges();
});
it('should create', () => {
expect(component).toBeTruthy();
});
});

View File

@@ -0,0 +1,33 @@
import { Component, EventEmitter, OnInit, Output } from '@angular/core';
import { FormControl, FormGroup } from '@angular/forms';
import { NgbActiveModal } from '@ng-bootstrap/ng-bootstrap';
@Component({
selector: 'app-save-view-config-dialog',
templateUrl: './save-view-config-dialog.component.html',
styleUrls: ['./save-view-config-dialog.component.css']
})
export class SaveViewConfigDialogComponent implements OnInit {
constructor(private modal: NgbActiveModal) { }
@Output()
public saveClicked = new EventEmitter()
saveViewConfigForm = new FormGroup({
title: new FormControl(''),
showInSideBar: new FormControl(false),
showInDashboard: new FormControl(false),
})
ngOnInit(): void {
}
save() {
this.saveClicked.emit(this.saveViewConfigForm.value)
}
cancel() {
this.modal.close()
}
}