Add popup confirm before deleting node (#28)
All checks were successful
continuous-integration/drone/push Build is passing
All checks were successful
continuous-integration/drone/push Build is passing
This commit is contained in:
parent
0f90515252
commit
8190f1704b
@ -1,7 +1,7 @@
|
|||||||
import {Component, HostListener, Input, OnInit} from '@angular/core';
|
import {Component, HostListener, Input, OnInit} from '@angular/core';
|
||||||
import HostRecord from '../../structures/HostRecord';
|
import HostRecord from '../../structures/HostRecord';
|
||||||
import {ActivatedRoute, Router} from '@angular/router';
|
import {ActivatedRoute, Router} from '@angular/router';
|
||||||
import {LoadingController, PopoverController} from '@ionic/angular';
|
import {AlertController, LoadingController, PopoverController} from '@ionic/angular';
|
||||||
import {NodePickerComponent} from '../../components/editor/node-picker/node-picker.component';
|
import {NodePickerComponent} from '../../components/editor/node-picker/node-picker.component';
|
||||||
import {HostOptionsComponent} from '../../components/editor/host-options/host-options.component';
|
import {HostOptionsComponent} from '../../components/editor/host-options/host-options.component';
|
||||||
import {EditorService} from '../../service/editor.service';
|
import {EditorService} from '../../service/editor.service';
|
||||||
@ -21,6 +21,7 @@ export class EditorPage implements OnInit {
|
|||||||
protected router: Router,
|
protected router: Router,
|
||||||
protected loader: LoadingController,
|
protected loader: LoadingController,
|
||||||
protected popover: PopoverController,
|
protected popover: PopoverController,
|
||||||
|
protected alerts: AlertController,
|
||||||
public readonly editorService: EditorService,
|
public readonly editorService: EditorService,
|
||||||
) {
|
) {
|
||||||
this.route.params.subscribe(params => {
|
this.route.params.subscribe(params => {
|
||||||
@ -63,7 +64,23 @@ export class EditorPage implements OnInit {
|
|||||||
popover.onDidDismiss().then(result => {
|
popover.onDidDismiss().then(result => {
|
||||||
const { event: dismissEvent , value } = result.data;
|
const { event: dismissEvent , value } = result.data;
|
||||||
if ( value === 'delete_node' ) {
|
if ( value === 'delete_node' ) {
|
||||||
this.editorService.deleteNode(node.UUID);
|
this.alerts.create({
|
||||||
|
header: 'Delete node?',
|
||||||
|
message: 'Are you sure you want to delete this node? Its contents will be unrecoverable.',
|
||||||
|
buttons: [
|
||||||
|
{
|
||||||
|
text: 'Keep It',
|
||||||
|
role: 'cancel',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
text: 'Delete It',
|
||||||
|
role: 'ok',
|
||||||
|
handler: () => {
|
||||||
|
this.editorService.deleteNode(node.UUID);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
],
|
||||||
|
}).then(alert => alert.present());
|
||||||
} else if ( value === 'move_up' ) {
|
} else if ( value === 'move_up' ) {
|
||||||
this.editorService.moveNode(node, 'up');
|
this.editorService.moveNode(node, 'up');
|
||||||
} else if ( value === 'move_down' ) {
|
} else if ( value === 'move_down' ) {
|
||||||
|
Loading…
Reference in New Issue
Block a user