import SlColorPicker from '@shoelace-style/shoelace/dist/components/color-picker/color-picker.component.js'; import SlDialog from '@shoelace-style/shoelace/dist/components/dialog/dialog.component.js'; import SlInput from '@shoelace-style/shoelace/dist/components/input/input.component.js'; import SlSelect from '@shoelace-style/shoelace/dist/components/select/select.component.js'; import { SlChangeEvent } from '@shoelace-style/shoelace'; import { names } from 'konva/types/Node'; import { html, TemplateResult } from 'lit'; import { NetworkComponent } from 'src'; import { Ipv4Address } from '../adressing/Ipv4Address'; import { Ipv6Address } from '../adressing/Ipv6Address'; import { MacAddress } from '../adressing/MacAddress'; import { Net } from '../components/logicalNodes/Net'; import { Router } from '../components/physicalNodes/Connector'; import { GraphNodeFactory } from '../event-handlers/component-manipulation'; import { biAlphabet, biDashSquare, biEthernet, biPCICardNetwork, biPlusSquare, biTrash, biWifi } from '../styles/icons'; import { EdgeController } from '../event-handlers/edge-controller'; import { styleMap } from 'lit/directives/style-map.js'; import { GraphEdge } from '../components/GraphEdge'; import { SubnettingController } from '../event-handlers/subnetting-controller'; import { AlertHelper } from '../utils/AlertHelper'; import { AddressingHelper } from '../utils/AdressingHelper'; import { Host } from 'src/components/physicalNodes/Host'; import { msg } from '@lit/localize'; export function contextMenuTemplate(this: NetworkComponent): TemplateResult { const type = this.selectedObject?.isNode() ? this.selectedObject.data('cssClass').includes('net-node') ? 'network' : 'node' : 'edge'; if (this.mode === 'simulate' && type === 'node') return nodeRoutingTableTemplate.bind(this)(); if (this.mode === 'simulate') return html`
`; return html` ${type === 'network' ? networkContextDialogTemplate.bind(this)() : ''} ${type === 'node' ? nodeContextDialogTemplate.bind(this)() : ''} ${type === 'edge' ? edgeContextDialogTemplate.bind(this)() : ''} `; } function nodeContextMenuTemplate(this: NetworkComponent): TemplateResult { return html`| Index | ${columns.includes('Name') ? html`${msg('Name')} | ` : ''} ${columns.includes('Connection Type') ? html`${msg('Connection Type')} | ` : ''} ${columns.includes('MAC') ? html`MAC | ` : ''} ${columns.includes('IPv4') ? html`IPv4 | ` : ''} ${columns.includes('IPv6') ? html`IPv6 | ` : ''}|
|---|---|---|---|---|---|---|
| ${index} | ${columns.includes('Name') ? html`
| `
: ''}
${columns.includes('Connection Type')
? html`
| `
: ''}
${columns.includes('MAC')
? html`
| `
: ''}
${columns.includes('IPv4')
? html`
| `
: ''}
${columns.includes('IPv6')
? html`
| `
: ''}
|
${msg('No port available.')}
`}