You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
44 lines
1.2 KiB
44 lines
1.2 KiB
import {Component, Input, OnInit} from '@angular/core';
|
|
import {PopoverController} from '@ionic/angular';
|
|
import {EditorPage} from '../../../pages/editor/editor.page';
|
|
import HostRecord from '../../../structures/HostRecord';
|
|
|
|
@Component({
|
|
selector: 'editor-host-options',
|
|
templateUrl: './host-options.component.html',
|
|
styleUrls: ['./host-options.component.scss'],
|
|
})
|
|
export class HostOptionsComponent implements OnInit {
|
|
@Input() editor: EditorPage;
|
|
@Input() index: number;
|
|
@Input() event: Event;
|
|
@Input() hostRecord: HostRecord;
|
|
|
|
public menuItems: Array<{name: string, icon: string, value: string, type?: string}> = [];
|
|
protected possibleMenuItems: Array<{name: string, icon: string, value: string, type?: string}> = [
|
|
{
|
|
name: 'Delete Node',
|
|
icon: 'trash',
|
|
value: 'delete_node',
|
|
},
|
|
];
|
|
|
|
constructor(
|
|
protected popover: PopoverController,
|
|
) { }
|
|
|
|
ngOnInit() {
|
|
for ( const item of this.possibleMenuItems ) {
|
|
if ( !item.type ) {
|
|
this.menuItems.push(item);
|
|
} else if ( item.type === this.hostRecord.type ) {
|
|
this.menuItems.push(item);
|
|
}
|
|
}
|
|
}
|
|
|
|
async onSelect(value) {
|
|
await this.popover.dismiss(value);
|
|
}
|
|
}
|