Confirm before deleting database columns
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
Garrett Mills 2020-11-10 08:03:42 -06:00
parent 4f777855a5
commit b5b36cf614
Signed by: garrettmills
GPG Key ID: D2BF5FBA8298F246

View File

@ -1,5 +1,5 @@
import {Component, Input, OnInit} from '@angular/core'; import {Component, Input, OnInit} from '@angular/core';
import {ModalController} from '@ionic/angular'; import {AlertController, ModalController} from '@ionic/angular';
import {uuid_v4} from '../../../../utility'; import {uuid_v4} from '../../../../utility';
@Component({ @Component({
@ -11,7 +11,8 @@ export class ColumnsComponent implements OnInit {
@Input() columnSets: Array<{headerName: string, field: string, Type: string, additionalData: any}> = []; @Input() columnSets: Array<{headerName: string, field: string, Type: string, additionalData: any}> = [];
constructor( constructor(
protected modals: ModalController protected modals: ModalController,
protected alerts: AlertController,
) { } ) { }
ngOnInit() {} ngOnInit() {}
@ -50,9 +51,21 @@ export class ColumnsComponent implements OnInit {
} }
onDeleteClick(i) { onDeleteClick(i) {
this.columnSets = this.columnSets.filter((x, index) => { this.alerts.create({
return index !== i; header: 'Delete column?',
}); message: 'Are you sure you want to delete this column? Its data will be lost.',
buttons: [
{ text: 'Keep It', role: 'cancel' },
{
text: 'Delete It',
handler: () => {
this.columnSets = this.columnSets.filter((x, index) => {
return index !== i;
});
},
}
],
}).then(alert => alert.present());
} }
onUpArrow(i) { onUpArrow(i) {